1
이 코드는 옵티컬 플로의 모션 벡터를 생성하는 Computer Vision System Toolbox의 한 예입니다. 각 비디오 프레임에서 배열 [x, y]을이 벡터를 만드는 좌표 점과 함께 추출하는 것은 흥미로운 일입니다.비디오에서 벡터 x와 y를 생성하는 점을 추출하십시오.
videoReader=vision.VideoFileReader('videoname','ImageColorSpace','Intensity',...
'VideoOutputDataType','uint8');
converter = vision.ImageDataTypeConverter;
opticalFlow = vision.OpticalFlow('ReferenceFrameDelay', 1);
opticalFlow.OutputValue = 'Horizontal and vertical components in complex form';
shapeInserter = vision.ShapeInserter('Shape', 'Lines', 'BorderColor',...
'Custom','CustomBorderColor', 255);
VideoPlayer = vision.VideoPlayer('Name','Motion Vector');
videoInfo = info(videoReader);
videoPlayer = vision.VideoPlayer('Position',...
[100 100 videoInfo.VideoSize(1:2)+30]);
while ~isDone(videoReader)
frame = step(videoReader);
im = step(converter, frame);
of = step(opticalFlow, im);
lines = videooptflowlines(of, 20);
if ~isempty(lines)
out = step(shapeInserter, im, lines);
step(videoPlayer, out);
end
end
release(videoPlayer);
release(videoReader);
그래서 googled lines videooptflowlines = function (f, 20); 옵티컬 플로우 라인의 좌표 점을 생성합니다. 나는이 데이터가있는 배열을 반환하기를 기다리는 명령 창에 'lines'을 넣으려고했지만 분명히 예상 된 배열이 아니 었습니다. 이 행렬에 대해서?