Find brightest frame in video file
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bill White
am 9 Jan. 2024
Bearbeitet: Bill White
am 19 Jan. 2024
I need to import a video file (which contains 1000s or 10,000s of frames) and find the brightest frame; and isolate and save that frame.
The image can br happily converted to greyscale if that makes things easier.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 9 Jan. 2024
See my attached demo that runs through a video getting the mean R, G, and B, and gray scale brightness. Once you've run though the video you can look at the vector of brightnesses to determine which frame was the brightest and then copy that particular frame somewhere, like to disk with imwrite.
8 Kommentare
Image Analyst
am 12 Jan. 2024
Try this:
hFig = figure;
hFig.Name = 'Brightest Frame';
hFig.WindowState = 'maximized';
% Show brightest frame in the middle.
subplot(1, 3, 2);
thisFrame = read(videoObject, max_brightness_image_frame);
% IMPORTANT NOTE: convert to gray level if needed - if that's how you decided upong the brightest frame..
meanOfThisFrame = mean(thisFrame);
imshow(thisFrame);
impixelinfo; % Let user mouse around and see (x, y, RGB)
axis('on', 'image');
caption = sprintf('The brightest frame is #%d and the mean is %.3f', max_brightness_image_frame, meanOfThisFrame);
title(caption);
% Show frame before the brightest frame on the left.
subplot(1, 3, 1);
thisFrame = read(videoObject, max_brightness_image_frame - 1);
% IMPORTANT NOTE: convert to gray level if needed - if that's how you decided upong the brightest frame..
meanOfThisFrame = mean(thisFrame);
imshow(thisFrame);
impixelinfo; % Let user mouse around and see (x, y, RGB)
axis('on', 'image');
caption = sprintf('The frame before is #%d and the mean is %.3f', max_brightness_image_frame - 1, meanOfThisFrame);
title(caption);
% Show frame after the brightest frame on the right.
subplot(1, 3, 3);
thisFrame = read(videoObject, max_brightness_image_frame + 1);
% IMPORTANT NOTE: convert to gray level if needed - if that's how you decided upong the brightest frame..
meanOfThisFrame = mean(thisFrame);
imshow(thisFrame);
impixelinfo; % Let user mouse around and see (x, y, RGB)
axis('on', 'image');
caption = sprintf('The frame after is #%d and the mean is %.3f', max_brightness_image_frame + 1, meanOfThisFrame);
title(caption);
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for USB Webcams finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!