Path: news.mathworks.com!not-for-mail
From: "john john" <myjonas13@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: I need help with my images processing ..
Date: Wed, 23 Jan 2013 11:17:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <kdogrk$f4$1@newscl01ah.mathworks.com>
Reply-To: "john john" <myjonas13@gmail.com>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1358939828 484 172.30.248.38 (23 Jan 2013 11:17:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jan 2013 11:17:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2707697
Xref: news.mathworks.com comp.soft-sys.matlab:787182

Hi guys I'm currently doing egg counter, if eggs are just close to each other and  no top on other eggs my code can count how many eggs just like this photo.
<<http://i648.photobucket.com/albums/uu201/myjonas13/29_zps61ba495f.jpg>>

and now my problem if some of the eggs is at the top my code can't recognize how many eggs are there just like this photo.
<<http://i648.photobucket.com/albums/uu201/myjonas13/soclose1_zps0ae323e7.jpg>>
<<http://i648.photobucket.com/albums/uu201/myjonas13/soclose2_zps2c041938.jpg>>

anyone can help or suggest me a better algorithm to do it? thanks in advance guys =) this is the code i used

  B = im2bw(imfilter(img2, fspecial('gaussian', sigma*3, sigma), 'replicate'), thres);
  Bl = bwlabel(B);
  Neggs = max(Bl(:))