hi, i m trying to track red circle from cam.
i find and draw circle but problem is detecting is not stable , if camera and object both are still detecting circles position continuously fluctuate . plz guide me how to detect perfectly.here is my code
cvtColor(imgOriginal, imgHSV, CV_BGR2HSV);
inRange(imgHSV, Scalar(lowerH1, lowerS1, lowerV1), Scalar(upperH1, upperS1, upperV1),imgThreshHigh);
inRange(imgHSV, Scalar(lowerH2, lowerS2, lowerV2), Scalar(upperH2, upperS2, upperV2), imgThreshLow);
add(imgThreshLow, imgThreshHigh, imgThresh);
GaussianBlur(imgThresh, imgThresh, Size(3, 3), 0);
Mat structuringElement = getStructuringElement(MORPH_RECT,Size(3, 3));
dilate(imgThresh, imgThresh, structuringElement);
erode(imgThresh, imgThresh, structuringElement);
// fill circles vector with all circles in processed image
HoughCircles(imgThresh,
v3fCircles,
CV_HOUGH_GRADIENT,
2,
imgThresh.rows / 4,
cannyThreshold*2,
cannyThreshold,
minR,
maxR);
↧