How to implement a funtion to 'Count an amount of one type of lego piece in the Image'?

20 vues (au cours des 30 derniers jours)
Sorry if it's a lot to ask but is there an easy way to implement a function that takes in the image of cluster of lego pieces and returns the count of a particular type of Lego piece? i.e. given the lego piece type shown in the first image--------->
how to implement a function that return the amount of the same type of lego pieces existed in the image below.
Thank you very much in advance!!
Baz

Réponse acceptée

Image Analyst
Image Analyst le 19 Jan 2015
First you have to do color segmentation to get separate, individual blocks. See my File Exchange for demos: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Then try using imfindcircles() to count the circles in each colored brick. Here is a demo: http://www.mathworks.com/matlabcentral/fileexchange/34365-circle-finder
  7 commentaires
Image Analyst
Image Analyst le 13 Jan 2019
Well of course you can ask regionprops() for the BoundingBox, but I think you may want the Feret Diameters.
Shruti Jha
Shruti Jha le 8 Déc 2020
Adding on to this thread, I have a similar problem. I am able to isolate blue coloured legos, however when I perform edge detection and filling, I get something like this (the last image).
Now, I'm not sure how to fill all the others and separate out the rectangular ones. Can somebody please help?
Much appreciated!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by