From: "john john" <>
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$>
Reply-To: "john john" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1358939828 484 (23 Jan 2013 11:17:08 GMT)
NNTP-Posting-Date: Wed, 23 Jan 2013 11:17:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2707697
Xref: 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.

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.

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(:))