How to make feature vector using optical Flow
2 次查看(过去 30 天)
显示 更早的评论
Hello.
I want to get a feature vector using the optical Flow Farneback function.
When I used this code, I got a "flow cell".
How can I make a feature vector using this?
Is it a reasonable feature vector? Which one is better as a feature vector?
I want to use this feature for classification.
% use only flow{i}.Vx
optical_vector{i} = [flow{i}.Vx];
% use all flow values
optical_vector{i} = [flow{i}.Vx, flow{i}.Vy, flow{i}.Orientation, flow{i}.Magnitude];
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/281890/image.png)
clear all
close all
%// read the video:
list = dir('*.avi')
% loop through the filenames in the list
opticFlow = opticalFlowFarneback
for k = 1:length(list)
reader = VideoReader(list(k).name);
vid = {};
while hasFrame(reader)
vid{end+1} = readFrame(reader);
end
for i=1:25
fIdx(i) = i; %// do it for frame 1 ~ 60
frameGray{i} = rgb2gray(vid{fIdx(i)});
flow{i} = estimateFlow(opticFlow,frameGray{i});
optical_vector{i} = [flow{i}.Vx];
end
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Optics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!