How to count the frequency of flashing light in a video

14 views (last 30 days)
Hi, I have a video-file, rgb, format avi, dimension 62x62, rate 60fps. duration 1min. The event is a flashing red light otherwise dark.
The flashing frequency very from video to video. So I wonder if someone could suggest me how to count the frequency using image-processing or video-processing tool box.
Thank you in advance for your attention
  1 Comment
Luke Abellanosa
Luke Abellanosa on 4 Feb 2021
hello emerson were you able to get the exact value of the frequency??

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 30 Apr 2015
Cedric Wannaz posted this code to do just that about a year ago. You can probably adapt it to your application.
Luke Abellanosa
Luke Abellanosa on 4 Feb 2021
hello again can i ask if what are to be edited in this script depending on the properties of the video im still a beginner to this
vidObj = VideoReader( '1.avi' ) ;
nFrames = vidObj.NumberOfFrames ;
tFrame = (1:nFrames) / vidObj.FrameRate ;
ghostCom = zeros( nFrames, 1 ) ;
for fId = 1 : nFrames
grayImage = rgb2gray( read( vidObj, fId )) ;
ghostCom(fId) = sum( grayImage(:) ) ;
figure() ; clf ;
set( gcf, 'Color', 'White', 'Units', 'Normalized', ...
'OuterPosition', [0, 0.1, 1, 0.6] ) ;
plot( tFrame, ghostCom/max(ghostCom), 'b' ) ;
set( gca, 'YTick', [0, 1] ) ;
xlabel( 'Time [s]' ) ;
[r] =risetime(ghostCom);
FREQUENCY =numel(r)/60;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by