Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using below code you can easily access image pixel from a Mat, from that R,G,B value you can check your condition and store the pixel value.

 or(int i = 0; i < img.rows; i++)
   {
  for(int j = 0; j < img.cols; j++)
   { 
    Vec3b bgr = foo.at<Vec3b>(i, j);

    // using BGR values check the condition and store the pixel value
   }
  }

Using below code you can easily access image pixel from a Mat, from that R,G,B value you can check your condition and store the pixel value.

 or(int i = 0; i < img.rows; i++)
   {
  for(int j = 0; j < img.cols; j++)
   { 
    Vec3b bgr = foo.at<Vec3b>(i, img.at<Vec3b>(i, j);

    // using BGR values check the condition and store the pixel value
   }
  }

Using below code you can easily access image pixel from a Mat, from that R,G,B value you can check your condition and store the pixel value.

 or(int for(int i = 0; i < img.rows; i++)
   {
  for(int j = 0; j < img.cols; j++)
   { 
    Vec3b bgr = img.at<Vec3b>(i, j);

    // using BGR values check the condition and store the pixel value
   }
  }