Just value your mind

Circle recognition using openCV

The picture below demonstrats openCV recognition progress of object detection. In this step, we now can locate the circle shapes in the captured image and output the number of the circles found.

circlerecg

Source code : circleDetect.cpp if you need more instructions please leave your comments.





QR code for this post, SCAN ME
QR:  Circle recognition using openCV

Posts may be of your interests

105 Comments On “ Circle recognition using openCV”

  1. Deb Burhans says:

    Hi,

    I’m getting started with OpenCV and wondered if you’ve posted your code anywhere? Thanks.

  2. Andol says:

    thanks for your concerning. i’ve updated the circle recognition code above.

  3. Jose says:

    Thanks for sharing the code! It’s exactly the example I was looking for

    I’m learning OpenCV to use it in robotics

  4. ZeroGravity says:

    Really thanks to you people…
    its really helpful to we newbies :).. THanks again

  5. ninhnv says:

    Thanks for sharing the code
    I’m learning OpenCV to use it in robotics

  6. Gatemaze says:

    Hi Andol,

    would you mind please emailing me the code of your example… I am getting started with openCV too and I also need to detect some colored balls on a plain background. Email: gatemaze@gmail.com

    Many thanks,
    GM

  7. Gatemaze says:

    Ooops, sorry discard previous msg… just show that there is a link to the source code…

  8. NK says:

    can u please send me the code to detect circles in an image using OpenCV.. I need to detect a yellow ball in a image.
    My email address:brkapadia2003@yahoo.com

  9. Alex says:

    Thanks for sharing the code

  10. tim says:

    Could you please send me the code to detect circles in an image using OpenCV.
    tecc.card@gmail.com

  11. Fightmaster says:

    Hey Andol,
    i have to detect balls (they are all the same size) on a picture. I used cvSub and cvHoughCircles, and find all balls on the picture. But openCV doesn’t find them centered… so I’d like to test your code and see if it works better.
    So please could you send me your code?
    fightmaster[at]mkh-clan.de

    Thank you!

  12. ramy maher says:

    thanks ya man

  13. huang says:

    There are good example for opencv.

  14. Dennis Burton says:

    I wonder where your codes are, because i am going to use it as a refernce. If its OK to you, may I have it?

  15. rahul jain says:

    can u please send me the code to detect circles in an image using OpenCV.. I need to detect a Orange ball in a image.
    My email address:frndsndrahul@gmail.com

  16. John says:

    Thank you very much man, I will test your code (if it is the one I found in your link). One question here. I used to use Camshift to find green object(a green ball in another colored background), but it seems that my webcam doesnt do well find that. Do you think you algorithm will be better finding it? I will leave you feedback when I tested your program.

    Thank you again

    • Andol says:

      Well John, thought this may help, using hsv color segmentation to detect objects: http://www.andol.info/hci/1116.htm

      • Guyang Zhang says:

        Hi Andol,
        Thanks a loooot for your reply.
        I tested the code but :
        int px[0], py[0];
        gives me a problem. I use VS 2005 to compile it and it and the errors are :
        cvtest.cpp(61) : error C2466: cannot allocate an array of constant size 0
        .\cvtest.cpp(61) : error C2133: ‘px’ : unknown size
        .\cvtest.cpp(61) : error C2466: cannot allocate an array of constant size 0
        .\cvtest.cpp(61) : error C2133: ‘py’ : unknown size

        • Guilherme says:

          I have the same problem…. can it related to library? I´m using the library below:
          #include “stdafx.h”
          #include “cv.h”
          #include “highgui.h”

          error:
          .\RecconheceCirculo.cpp(31) : error C2466: cannot allocate an array of constant size 0
          .\RecconheceCirculo.cpp(31) : error C2133: ‘px’ : unknown size
          .\RecconheceCirculo.cpp(31) : error C2466: cannot allocate an array of constant size 0
          .\RecconheceCirculo.cpp(31) : error C2133: ‘py’ : unknown size
          .\RecconheceCirculo.cpp(91) : error C2065: ‘cout’ : undeclared identifier
          .\RecconheceCirculo.cpp(111) : error C2065: ‘cout’ : undeclared identifier
          .\RecconheceCirculo.cpp(113) : error C2065: ‘cout’ : undeclared identifier

        • Guilherme says:

          i´m using VS 2008

    • Andol says:

      ;) Seems that is but a problem of c++ which concerns the definition of arrays in VS 2005. Due to the size of ‘px”py’ is unknown, ‘px”py’ redifination may be required, check it again, and feel free to change the codes as you want to.

      • Nard says:

        I tested the code but :
        int px[0], py[0];
        gives me a problem. I use VS 2005 to compile it and it and the errors are :
        cvtest.cpp(61) : error C2466: cannot allocate an array of constant size 0
        .\cvtest.cpp(61) : error C2133: ‘px’ : unknown size
        .\cvtest.cpp(61) : error C2466: cannot allocate an array of constant size 0
        .\cvtest.cpp(61) : error C2133: ‘py’ : unknown size

        I am using VS2008 to execute this program>>
        could you tell me how to redefine px and py, so they could be no problems for the program?

  17. dan says:

    It’s a good reference for me.

  18. Tien says:

    Hi ,
    that’s interesting project , thank you.
    I just started in OpenCV . I need to get the coordinate of a polygon on image , could you advise which function in OpenCV I should use ?

  19. acido says:

    dear andol, my opencv refuses to run, was wondering if you could help?

    im running unbuntu 10.4

    so far:

    Downloaded source code for open cv+dependcys

    Used cmake to create a new build folder

    now im stuck ;/

    everysingle guide on the internet seems not to work, im new to linux yesterday so im not to sure on how to configure it to work.

    many thanks

    Acido

  20. Jason says:

    Dear Andol

    Could you please send me your code? I want to learn it, thanks a lot.

    Email: chiefdesigner@live.ca

Leave a comment

You can use these XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyrights 2006-2014 © Andol Li | Theme Tree2, re-designed by Andol Li| Powered by WordPress
WWW.ANDOL.INFO- 76 queries in 0.417 seconds. Go to TOP