Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!x1g2000prh.googlegroups.com!not-for-mail
From: Skeptic <skeptic@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Detecting spots on a butterfly
Date: Fri, 3 Apr 2009 07:29:57 -0700 (PDT)
Organization: http://groups.google.com
Lines: 28
Message-ID: <3bfc5910-32d9-46ca-b5d0-f258a75bf21b@x1g2000prh.googlegroups.com>
References: <gr4gga$d84$1@fred.mathworks.com> <gr4vgb$5sn$1@fred.mathworks.com> 
	<gr50g5$9fr$1@fred.mathworks.com>
NNTP-Posting-Host: 192.44.136.113
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1238768997 21604 127.0.0.1 (3 Apr 2009 14:29:57 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 3 Apr 2009 14:29:57 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: x1g2000prh.googlegroups.com; posting-host=192.44.136.113; 
	posting-account=TxM8yQoAAABZ2Lix6OESPX-ujX6je15D
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	GTB5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 bdci2px (NetCache NetApp/6.0.7)
Bytes: 2587
Xref: news.mathworks.com comp.soft-sys.matlab:530063




Husam Aldahiyat wrote:
> "Husam Aldahiyat" <numandina@gmail.com> wrote in message <gr4vgb$5sn$1@fred.mathworks.com>...
> > Here is my progress so far:
> >
> > >> I=imread('2009_03_15_3434.JPG');
> > >> I=rgb2gray(I);
> > >> bw = im2bw(I,.3);
> > >> bw = bwareaopen(bw,30);
> > >> imshow(bw)
> >
> > I want to use regionprops() like in one of the demos and decide which objects are more round, which will be the spots. But how can I split my pic into objects???
>
> I solved the problem finally. The problem was I needed to do bw=~bw :)
--------------------------------------------------------------
Good.  To decide on roundness (circularity) just use the compactness
measure from regionprops or just look at the perimeter^2 to area
ratio.  Thresholding the red or green channel will get you the brown
spots on yellow background pretty easily (better than using im2bw
which will include the blue channel which you probably don't want).
To get the orange spots on orange background - well that's pretty
tough.  Might try hough transform or edge filters or ask Dave
Robinson's opinion or ask over in sci.image.processing.  If you get
something, you can post the code and see if I can improve on it's
performance.
Good luck,
ImageAnalyst