Matlab rgb2ntsc function implementation in opencv using c++ [2 Attachments]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Matlab rgb2ntsc function implementation in opencv using c++ [2 Attachments]

opencv-users mailing list
I am trying to implement Matlab function rgb2ntsc in opencv using c++.
 for(int i=0;i<rn;i++)
    {
      for(int j=0;j<cn;j++)
       {
         Vec3b intensity = image.at<Vec3b>(i,j);
         R= intensity.val[2];
         G= intensity.val[1];
         B= intensity.val[0];
         Y = 0.299*R+0.587*G+0.114*B;
         I = 0.596*R-0.274*G-0.322*B;
         Q = 0.211*R-0.523*G+0.312*B;
         Result.at<Vec3b>(i,j)[0]=(float)Y;
         Result.at<Vec3b>(i,j)[1]=(float)I;
         Result.at<Vec3b>(i,j)[2]=(float)Q;
      }
  }
        I done this for the implementation of rgb2ntsc.But my output image is not similar to the output of matlab function rgb2ntsc. Please find the output image of my implementation and Matlab.Can I do any additional operation?