Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Just in case someone need's that, i add the code

            Mat  partROI;
            cvtColor(partROI, partROI, CV_BGR2GRAY);
            int count_white = 0;
            int count_black = 0;
            threshold( partROI, partROI, 200, 255, THRESH_BINARY );
            count_white = countNonZero(partyROI);
            count_black = partyROI.cols * partyROI.rows - count_white;
            cout << "white pixels = " << count_white << endl;
            cout << "black pixels = " << count_black << endl;
            cout << endl;
            imshow("Image", partROI);