Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 600

The program to count number of white and black pixels in a binary image is not working.Here I paste the code i used.Please help me with a solution.

$
0
0
int count_white=0; int count_black=0; for (int y = 0; y < image.rows; y++) { for (int x = 0; x < image.cols; x++) { if (image.at(y, x) == cv::Vec3b(255, 255, 255)) { count_white++; } else if (image.at(y, x) == cv::Vec3b(0, 0, 0)) { count_black++; } } }

Viewing all articles
Browse latest Browse all 600

Trending Articles