Find and plot peaks/maxima

386 views Asked by At

How can I plot the 'peak' (local maxima) in Matlab/Octave? My below code loads in an image, extracts the red channel and attempts to find and plot the local maxima but it fails with the error:

error: findpeaks: DATA must be a vector of at least 3 elements

Here is my simple code:

pkg load image;
pkg load signal;

i = imread('foo.jpg');

% Get red channel
red = i(:,:,1);

% Attempt to find and plot peaks
findpeaks(red);
% Error on the above line: error: findpeaks: DATA must be a vector of at least 3 elements
0

There are 0 answers