ビデオファイルから最後の10フレームを取得/登録/記憶する必要があります。これは、微表現を検出するためのより大きなプロジェクトの小さなバージョンです。したがって、最後の10フレーム(検出された)に対して「行」が表示されているか、または10行以上表示されていても検出されていないかどうかを確認する必要があります。私はまた、vision.VideoFileReader
とvision.OpticalFlow
で作業するように強制されています。これを行う方法?Matlabの最後の10の数字/フレームの範囲
file = 'MEXTest.mp4';
vid = vision.VideoFileReader(file,'ImageColorSpace','RGB','VideoOutputDataType','single');
optFlo = vision.OpticalFlow('OutputValue','Horizontal and vertical components in complex form','ReferenceFrameDelay',3);
shapeInsertOptFloColor = vision.ShapeInserter('Shape','Lines','BorderColor','Custom','CustomBorderColor',[255 255 0]);
numFrames = 0;
frameList = {};
hasLines = zeros(10, 1, 'logical');
figH = figure;
while ~isDone(vid)
colorFrame = step(vid);
colorFrameRes = imresize(colorFrame,0.3);
grayFrame = rgb2gray(colorFrameRes);
optFloVectors = step(optFlo, grayFrame);
lines = oflo(optFloVectors,20);
motionVectors = step(shapeInsertOptFloColor, colorFrameRes, lines);
imshow(motionVectors); title('Optical Flow on Frame');
notEmpty = ~isempty(lines);
if numel(notEmpty) ~= 1, notEmpty = 1; end
hasLines = [hasLines(2:end); notEmpty];
if numFrames >= 10
frameList = [frameList(2:end) colorFrame];
else
frameList = [frameList colorFrame];
end
numFrames = numFrames + 1;
if numFrames >= 10 && all(hasLines)
disp('Micro-Expression Detected')
else
disp('Not detected')
end
if ~ishghandle(figH)
close all
break
end
end
release(vid);
だから、あなたは何を求めているのですか?現在のポイントよりも前に読み込まれたビデオの最後の10フレームを覚えていますか? – rayryeng
'isempty(points)== false' - >'〜isempty(points) ' –
はい、申し訳ありませんが正しく表現していないのです。 – UZIERSKI