I\'m using OpenCV to iterate through an image and find the colour of each pixel, here\'s some of the code I\'m using:
IplImage* img = cvLoadImage(\"c:\\\\tes
Try this:
IplImage* img = cvLoadImage("c:\\test.png");
for (int i = 0; i < img->height; i++)
{
for (int j = 0; j < img->width; j += img->nChannels)
{
unsigned char red = img->imageData[i * img->widthStep + j + 2];
unsigned char green = img->imageData[i * img->widthStep + j + 1];
unsigned char blue = img->imageData[i * img->widthStep + j];
outputRGBValues(red, green, blue);
if (red == REDCOLOUR && green == GREENCOLOUR && blue == BLUECOLOUR)
{
count++;
}
}
}
cvReleaseImage(&img);