Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to find a spot inside circle

Hi I am trying to process image1 so that I can find the spot as shown in image2

image1:

image description

image 2:

image description

the code that I am using mergers the spot with the outer circle... is there away to go around this?

int thresh1 = 5;
Mat pyr, timg, gray0(image.size(), CV_8U), gray;
vector< Vec4i > hierarchy;
pyrDown(image, pyr, Size(image.cols/2, image.rows/2));
pyrUp(pyr, timg, image.size());
Mat display_image = image.clone();
int ch[] = {0, 0};
    mixChannels(&timg, 1, &gray0, 1, ch, 1);
    Canny(gray0, gray, 0, thresh1, 5);
    //dilate(gray, gray, Mat(), Point(-1,-1));
    gray = gray0 >= (6)*255/11;
    //gray = gray0 >= (1)*255/11;
    //gray = gray0 >= (1)*255/11;
    //gray = gray0 >= (1)*255/11;
    imshow( "Hough Circle Transform Demo 2", gray );
    waitKey(0);

image description