Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Find Peaks in a Histogram
Date: Sun, 23 Dec 2007 18:10:26 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <fkm8ai$gut$1@fred.mathworks.com>
References: <fkm3et$dv8$1@mouse.otenet.gr>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1198433426 17373 172.30.248.35 (23 Dec 2007 18:10:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 23 Dec 2007 18:10:26 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:443414


"anonymous" <arisl@otenet.gr> wrote in message <fkm3et$dv8
$1@mouse.otenet.gr>...
> I am trying to find the peaks of a Histogram's gray scale picture, using 
> matlab. A peak is the value in Histogram that is bigger than it's closer 2 
> values left and right. Any ideas? 
--------
  If h is a row vector of your (histogram) values, (with at least two values) do this:

 hl = [h(2:end),h(end-1)];
 hr = [h(2),h(1:end-1)];
 p =  (h > hl) && (h > hr);

Roger Stafford