Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:28:44+00:00 2026-06-06T09:28:44+00:00

I have found some code which recognize circles in particular image and I was

  • 0

I have found some code which recognize circles in particular image and I was able to convert 90% of that code it in to javacv. But unfortunately I couldn’t able to convert following lines in to javacv. So please can some one help me to convert this lines into javacv ?

CvSeq circles = cvHoughCircles(gry, mem, CV_HOUGH_GRADIENT, 1, 40.0, 100, 100,0,0);
cvCvtColor(canny, rgbcanny, CV_GRAY2BGR);

for (int i = 0; i < circles->total; i++)
{
 // round the floats to an int
 float* p = (float*)cvGetSeqElem(circles, i);
 cv::Point center(cvRound(p[0]), cvRound(p[1]));
 int radius = cvRound(p[2]);

 // draw the circle center
 cvCircle(img, center, 3, CV_RGB(0,255,0), -1, 8, 0 );

 // draw the circle outline
 cvCircle(img, center, radius+1, CV_RGB(0,0,255), 2, 8, 0 );

 printf("x: %d y: %d r: %d\n",center.x,center.y, radius);
} 

I just need to know how to convert 5 code lines which inside the for loop. Please be kind enough to share your experience. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:28:45+00:00Added an answer on June 6, 2026 at 9:28 am

    Well, I’m not going to convert that code for you (I don’t know JavaCV) but here’s some useful links for you:

    • Hints for Converting OpenCV C/C++ code to JavaCV – this is the very first thing you should read.
    • JavaCV source code – in this archive there’s file samples/HoughLines.java. It’s very similar to HoughCircles.java wich was deleted from repo.
    • JavaCV examples – this archive contains file OpenCV2_Cookbook/src/opencv2_cookbook/chapter07/ex4HoughCircles.scala. And here’s some part of code from this file:

    // Draw lines on the canny contour image
    val colorDst = cvCreateImage(cvGetSize(src), src.depth(), 3)
    cvCvtColor(src, colorDst, CV_GRAY2BGR)
    for (i <- 0 until circles.total) {
        val point = new CvPoint3D32f(cvGetSeqElem(circles, i))
        val center = cvPointFrom32f(new CvPoint2D32f(point.x, point.y))
        val radius = math.round(point.z)
        cvCircle(colorDst, center, radius, CV_RGB(255, 0, 0), 1, CV_AA, 0)
        print(point)
    }
    show(colorDst, "Hough Circles")
    

    This is exactly what you’re looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked around and found some code which so called chooses an image
I have found some code snippet in the internet. But it is missing some
//UPDATE// I found some code to do paging which I have modified to work
I have some code which I found online and it's working great. It lists
I found some code in a project which looks like that : int main(int
I have found some code on measuring execution time here http://www.dreamincode.net/forums/index.php?showtopic=24685 However, it does
I am now trying to understand some code and I have found a pattern,
i have found some ways but they are actually reading frames and applying transition
Have done some research and found some stuff that may be helpful. I would
I have found that I often have to implement some sort of a scheduler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.