Info

This question is closed. Reopen it to edit or answer.

How do I find peaks from a graph which I plotted from analyzing a video file?

1 view (last 30 days)
I have a video file which I am analyzing- I have split my video into frames, and then checked each frame for gray levels and plotted my results in a graph. I would like to find the peaks in this graph and eventually find distance between the peaks and frequency of the peaks.
The documentation says I need to do something similar to this :
load sunspot.dat
year=sunspot(:,1);
relNums=sunspot(:,2);
findpeaks(relNums,year);
xlabel('Year');
ylabel('Sunspot Number')
title('Find All Peaks');
How would I go about this? I realise I need to use findpeaks(), but I am not sure what to put in the brackets because I don't actually have a file full of data.

Answers (1)

Image Analyst
Image Analyst on 28 Jan 2015
You don't need a file. findpeaks() takes an array. Just do this
[peakGrayLevel, indexOfPeaks] = findpeaks(yourGrayLevelVector);

Community Treasure Hunt

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

Start Hunting!