Find brightest frame in video file
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bill White
el 9 de En. de 2024
Editada: Bill White
el 19 de En. de 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 comentarios
Respuesta aceptada
Image Analyst
el 9 de En. de 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 comentarios
Image Analyst
el 12 de En. de 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);
Más respuestas (1)
Ver también
Categorías
Más información sobre MATLAB Support Package for USB Webcams en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!