Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Program error!! Why??

1 visualizzazione (ultimi 30 giorni)
Marqual Brown
Marqual Brown il 28 Set 2017
Chiuso: MATLAB Answer Bot il 20 Ago 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

Risposte (2)

Rik
Rik il 2 Nov 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 il 2 Nov 2017
In
bestframeidx = frameidx_history(maxbrigthnessidx);
you misspell 'maxbrigthnessidx'. The 't' and 'h' are interchanged.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by