0
尋找最小的像素值,我試着寫一些MATLAB代碼,這樣給單色的視頻,它需要產生這樣的圖像,該圖像的每個像素等於最低值表示像素髮生在視頻。作爲一個例子,像素(200,300)將等於視頻過程中像素(200,300)的最小值。我寫了一些代碼來做到這一點,但效率非常低。以提高我的代碼任何評論都將appriciatedMATLAB:從視頻
hologramVideo = VideoReader('test.mp4')
mkdir('images')
frames = int16(hologramVideo.Duration * hologramVideo.FrameRate)
imageValues = cell(frames, 1);
ii = 1;
while hasFrame(hologramVideo)
imageValues{ii} = im2uint8(rgb2gray(readFrame(hologramVideo)));
ii = ii + 1;
end
newImage = zeros(512)
currentMin = 255
currentVal = 0
x = 1;
y = 1;
for x = 1:512
for y = 1:512
currentMin = 0;
for i = 1:frames
currentImg = imageValues(i,1,1);
currentVal = currentImg{1,1}(x,y)
if currentVal < currentMin;
currentMin = currentVal;
end
end
newImage(x,y) = currentMin;
end
end