Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!t2g2000yqm.googlegroups.com!not-for-mail
From: Brendan <brendandetracey@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to attack a local minima problem?
Date: Sat, 22 Nov 2008 09:50:59 -0800 (PST)
Organization: http://groups.google.com
Lines: 45
Message-ID: <eeb4c7b0-a2a2-4867-9423-f781e9e4c7bf@t2g2000yqm.googlegroups.com>
References: <gg9coq$b2l$1@fred.mathworks.com>
NNTP-Posting-Host: 142.68.150.119
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1227376260 8973 127.0.0.1 (22 Nov 2008 17:51:00 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 22 Nov 2008 17:51:00 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: t2g2000yqm.googlegroups.com; posting-host=142.68.150.119; 
	posting-account=B-TRNQoAAACbFTAQWrEB2ZKtNl2Jbw6S
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; 
	.NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:502509


On Nov 22, 12:42=A0pm, "Sven" <sven.holco...@gmail.deleteme.com> wrote:
> Hi all,
>
> I have a problem that I can boil down to an image such as:http://tinypic.=
com/view.php?pic=3Dwirhxt&s=3D4
>
> Here you see 9 fairly regularly spaced minima, with a little bit of smear=
ing from one to the next. I'm trying to write something to automatically lo=
cate each of these minima. I have the image processing toolbox at my dispos=
al.
>
> I have attacked this problem a few different ways, but none to my satisfa=
ction just yet.
>
> If I use imregionalmin, I get a scattering of local minima, but no simple=
 way to return only these 9 minima that I'm looking for. If I simply choose=
 the 9 minima regions having the lowest average pixel value, I almost alway=
s get multiple hits returned in just some of the minima you see in the imag=
e.
>
> Conceptually, I would like to 'hang' a chain of links/joints down my imag=
e. Each joint is attracted to pixels with lower values (ie, will merge towa=
rds minima), and each link is essentially a spring of some length (about th=
e average distance between the minima I'm searching for).
>
> Am I overthinking this? Can anyone help point me towards an algorithm I c=
ould adopt for the problem? Can anyone help me just *name* my problem so th=
at I know what i should be searching for?
>
> Thanks very much,
> Sven.

The start of a simple-headed way is gray level threshold, something
like:
[I,map] =3D imread('wirhxt.gif');
Ig=3D rgb2gray(ind2rgb(I,map));
Iw=3Dwiener2(Ig,[5 5]);
bw =3D im2bw(1-Iw,0.69);
figure
imshow(I,map)
figure
imshow(bw)

You could then get the  ROI using bwlabel, and calculate their centres
of mass.