I am trying to implement rgb2ntsc colorspace conversion 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.299R+0.587G+0.114B; I = 0.596R-0.274G-0.322B; Q = 0.211R-0.523G+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 have done this for the implementation of rgb2ntsc. But my output image is not similar to the output of Matlab's rgb2ntsc function. Here are my input image, output image and matlab output image. Can I do any additional operation?