How to make feature vector using optical Flow

2 views (last 30 days)
Kong
Kong on 4 Apr 2020
Edited: Kong on 6 Apr 2020
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];
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

Answers (0)

Community Treasure Hunt

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

Start Hunting!