フィルターのクリア

video processing for motion detection

3 ビュー (過去 30 日間)
Saffana Siddiqua
Saffana Siddiqua 2019 年 12 月 8 日
コメント済み: Saffana Siddiqua 2020 年 1 月 28 日
can i track the motion of a motor from a video? i tried histogram plotting but exporting data is hard
  12 件のコメント
Saffana Siddiqua
Saffana Siddiqua 2019 年 12 月 8 日
yes, concatenated. separation of plots is not necessery.
Saffana Siddiqua
Saffana Siddiqua 2019 年 12 月 10 日
help me out please :(

サインインしてコメントする。

採用された回答

Turlough Hughes
Turlough Hughes 2019 年 12 月 8 日
編集済み: Turlough Hughes 2019 年 12 月 11 日
So the method I suggested was to look at a single pixel, though you could also look at a few, or the entire image histogram, up to you. Here I track the R component of the mid pixel of each frame and then find local maxima which are greater than a nominal threshold value.
framerate=29.53; % I don't see how to get this from the video object directly.
threshold=0.15;
v=vision.VideoFileReader('vid.mp4');
c=0;
while ~isDone(v)
c=c+1;
f=step(v);
data(c)=f(360,720,1); % for green just replace the with, data(c)=f(360,720,2);
end
figure(), plot(data)
idx1=find(data(2:end-1) > data(1:end-2) & data(2:end-1) > data(3:end))+1; % find local maxima, 'data2'
data2=data(idx1);
hold on, plot(idx1,data2,'or'); % shows local maxima in plot
idx2=find(data2>threshold); % local maxima satisfying threshold
peakFrame=idx1(idx2);
hold on, plot(peakFrame,data2(idx2),'.k','MarkerSize',15) % shows peaks that pass threshold.
numFrames=peakFrame(end)-peakFrame(1) % number of frames from first to last flash.
revs=length(data2(idx2))-1; % Corresponding number of revolutions.
duration=numFrames/framerate; % numFrames/FramesPerSecond = duration in seconds
rpm=revs/(duration/60)
EDIT: as per comments below.
  11 件のコメント
Turlough Hughes
Turlough Hughes 2019 年 12 月 11 日
i cant find any function to determine the framerate with vision.videofilereader.
Neither can I. I took the framerate from looking at file details. Surely there's a way to get it with code but I can't see how. I see you've opened another question on this though.
what if i want to know the intensity of green or blue light in the center pixel
See comments in my edit to my original answer, also have a look at the following documentation.
the thing is i will get the duration by multiplying the framerate with number of frames
you get duration from NumberOfFrames/framerate: . I originally had framerate/NumberOfFrames but had fixed that before my last comment.
Saffana Siddiqua
Saffana Siddiqua 2020 年 1 月 28 日
hey,
so i could extract the framerate using videoReader.
now, the number of frames is showing 446, wheres the number of frames of the whole video is 265. shouldnt the number be less? cause i am only taking the frames with the flashes, no?

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by