Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Program error!! Why??

1 visualización (últimos 30 días)
Marqual Brown
Marqual Brown el 28 de Sept. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
//Code below
obj = VideoReader('C:\Users\Robotics\Pictures\Saved Pictures\Lightfile\Prelight.MOV');
frameidx = 0;
groupidx = 0;
frames_per_group = 5;
frame_history = [];
frameidx_history = [];
groupidx_history = [];
while hasFrame(obj)
frameidx = frameidx + 1;
groupidx = groupidx + 1;
b = readFrame(obj);
frame_history = cat(4, frame_history, b);
frameidx_history(end+1) = frameidx;
if size(frame_history, 4) == frames_per_group
maxbrightness = -inf;
maxbrightnessidx = -inf;
for K = 1 : frames_per_group;
grayframe = rgb2gray(frame_history(:,:,:,K));
thisbrightness = sum(grayframe(:));
if thisbrightness > maxbrightness
maxbrightness = thisbrightness;
maxbrightnessidx = K;
end
end
bestframe = frame_history(:,:,:,maxbri ghtnessidx);
bestframeidx = frameidx_history(maxbrigthnessidx);
filename = sprintf('frame%04d.jpg', bestframeidx);
imwrite(bestframe, filename);
frame_history = [];
frameidx_history = [];
end
end
when I run it, it says that its a problem with the maxbrightnessidx. Can someone help? Please

Respuestas (2)

Rik
Rik el 2 de Nov. de 2017
Without the file, the only thing I see, is that you have an extra space in your line:
bestframe = frame_history(:,:,:,maxbri ghtnessidx);

Roger Stafford
Roger Stafford el 2 de Nov. de 2017
In
bestframeidx = frameidx_history(maxbrigthnessidx);
you misspell 'maxbrigthnessidx'. The 't' and 'h' are interchanged.

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by