Click here to Skip to main content
15,921,250 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
CvSeq* circles = cvHoughCircles( gray, cvCreateMemStorage(0), CV_HOUGH_GRADIENT, 2 , gray->height/6, 3 );
printf ("%d circles detected\n", circles->total);
int *px = new int[circles->total];
int *py = new int[circles->total];
if(circles->total > 0) {
int i = 0;
float * p = (float*)cvGetSeqElem( circles, i );
int i=0;
px[i]=cvRound(p[0]);
py[i]=cvRound(p[1]);
int radius = cvRound(p[2]);
int measurement[] = { px[i], py[i] };


In the similar way i want to draw a line instead of circle using opencv c++. Can anyone help please.
Posted
Updated 28-Jan-14 21:58pm
v2

1 solution

The coordinates of your circle are stored in px and py. So you can simply use these coordinates to draw a line with the line[^] function.

You should also consider using the new openCV API. You are working with the older C version of openCV. There exists a new C++ version for quite some time now which makes many tasks easier to implement, understand and also less error prone.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900