How to count the frequency of flashing light in a video

7 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
Emerson

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.
  5 Comments
Star Strider
Star Strider on 1 Dec 2020
Luke Abellanosa —
I just now looked through the Supplements, and (as you already discovered) neither the code nor the algorithm is published. You’d likely have to write to the authors, however I doubt they’d currently be forthcoming with the information.
Note that in the Acknowledgements section:
  • Competing interests: A U.S. provisional patent application has been filed by Duke University on 12 June 2020. The authors of the current manuscript are identical to the inventors on the patent application. The patent information is as follows: Title: “Optical Method to Test Efficacy of Face Masks”; inventors: M.C.F., E.P.F., D.G., W.S.W., I.H., and E.W.; application number: 63/038331.
Since they’re applying for a U.S. patent (and likely foreign patents) on this technique, that information will not be available until the patent is granted (typically about four years after the application is filed).
In the interim, see if anything in the Image Processing Toolbox — Examples documentation section has anything you can use to build on. (I have done some medical image processing, however it is not an area of my expertise, so I likely cannot help you with it.)
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(:) ) ;
end
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!