Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to detect weather the circle is green or black...

I have currently made an image that consists of black and green dots..... I made a print of it and then clicked it with my camera..... After that i made a program to scan this image in opencv. Here is the image:- image description

This is the code
        image = imread("ImageTryse.jpg", 1); // Read the image
    cv::resize(image, image, Size(800, 800), 0, 0, cv::INTER_CUBIC);
    Mat image_gray = IncreaseContrast(image);
    cvtColor(image_gray, image_gray, CV_BGR2GRAY);
    vector<vec3f> circles1;
    HoughCircles(image_gray, circles1, CV_HOUGH_GRADIENT, 2, 10, 100, 22, 10, 17);

I am able to scan circles with this code and run a loop through each of them.... But now i want to know weather the circle is green or black.... I don't know how i can do that.... I tried converting it to hsv but it was showing different colors on the side having light..... Please help me to solve this problem....