Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think you have predefined string for each pixel value, if am right you can solve this by accessing each pixel in the image using following piece code

for(int i=0; i<src->height; i++)      
{
  for(int j=0; j<src->width; j++)    
   {   

    CvScalar pix=cvGet2D(src,i,j); // pix.val[0]->Blue channel
                                   // pix.val[1]->Green channel
                                   // pix.val[2]->Red channel    
   } 
 }

By comparing each pixel value you can find the colours of corresponding pixel. I hope this is what your are looking for.

I think you have predefined string for each pixel value, if am I right you can solve this by accessing each pixel in the image using following piece code

for(int i=0; i<src->height; i++)      
{
  for(int j=0; j<src->width; j++)    
   {   

    CvScalar pix=cvGet2D(src,i,j); // pix.val[0]->Blue channel
                                   // pix.val[1]->Green channel
                                   // pix.val[2]->Red channel    
   } 
 }

By comparing each pixel value you can find the colours of corresponding pixel. I hope this is what your are looking for.