MATLAB Answers

john john

Can someone help me with my image processing?

Asked by john john
on 23 Jan 2013

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

anybody home? hehe


ops sorry for that links sir..

2 Answers

Answer by Image Analyst
on 23 Jan 2013
 Accepted answer

There is no way to count eggs which are obscured. If you had a pile of eggs 10 deep then you simply don't know by seeing only the top layer and part of some underlayers. Your best bet is to avoid the situation in the first place by arranging the eggs in a single layer.

  1 Comment

Thank you so much Image Analyst, that is the best explanation i must write.. then no more problem =)

Answer by Jurgen
on 23 Jan 2013

I think your problem is similar to a recent post by Steve Eddins:

Maybe worth checking that out.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!