Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think for these you need to scan through each pixel in the image and compare it. You can access pixel value using the below code

for(int i=0; i<img1->height; i++)      //img1->height=img21->height
{
  for(int j=0; j<img1->width; j++)     //img1->width=img2->width
   {
     CvScalar ele1;
     CvScalar ele2;

     ele1=cvGet2D(img1,i,j);
     ele2=cvGet2D(img2,i,j);

     if(ele1.val[0]==ele2.val[0]) //Blue channel
        // do some operation

     if(ele1.val[1]==ele2.val[1]) //Green channel
        // do some operation

     if(ele1.val[2]==ele2.val[2]) //Red channel
        // do some operation

   }
 }

Hope these helpful.