Effacer les filtres
Effacer les filtres

How to make feature vector using optical Flow

2 vues (au cours des 30 derniers jours)
Kong
Kong le 4 Avr 2020
Modifié(e) : Kong le 6 Avr 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

Réponses (0)

Catégories

En savoir plus sur Optics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by