Note that there are some explanatory texts on larger screens.

plurals
  1. POHoughCircles OpenCV
    primarykey
    data
    text
    <p>I am writing code for detecting a blue color round object with HSV color space in OpenCV, the program can also move the mouse pointer with the help of object. I was implementing the HoughCircles function in my code but it was not executing. This is the code:</p> <pre><code> #include "cv.h" #include "highgui.h" #include &lt;iostream&gt; #include &lt;windows.h&gt; using namespace cv; using namespace std; int main() { VideoCapture cap(0); if(!cap.isOpened()) return -1; Mat vd,copy,imgScribble; namedWindow("Video",1); namedWindow("Capture",1); int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); int ww = cap.get(CV_CAP_PROP_FRAME_WIDTH); int wh = cap.get(CV_CAP_PROP_FRAME_HEIGHT); double adjw = width/ww; double adjh = height/wh; int h = 640 * adjh; int w = 320 * adjw; for(;;) { cap&gt;&gt;vd; GaussianBlur( vd, vd, Size(9, 9), 2, 2 ); cvtColor(vd,copy,CV_RGB2HSV); Mat thresh; inRange(copy,Scalar(0,200,0),Scalar(13,255, 255),thresh); flip(thresh,thresh,1); Moments mom = moments(thresh); double moment10 = mom.m10; double moment01 = mom.m01; double area = mom.m00; static int posX = 0; static int posY = 0; int lastX = posX; int lastY = posY; posX = moment10/area; posY = moment01/area; h = posX * 2.134375; w = posY * 2.4; vector&lt;Vec3f&gt; circles; HoughCircles(vd,circles,CV_HOUGH_GRADIENT,2,vd.rows/4,100,100,0,0); if(area &gt;= 1000) { SetCursorPos(h,w); } cout&lt;&lt;height&lt;&lt;"x"&lt;&lt;width&lt;&lt;endl; cout&lt;&lt;h&lt;&lt;"xx"&lt;&lt;w&lt;&lt;endl; imshow("Capture",vd); imshow("Video",thresh); if(waitKey(30) &gt;= 0) break; } cap.release(); return 0; } </code></pre> <p>Please find me the solution for HoughCircles? Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload