Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Implementation of rgb2xyz in opencv using c++

$
0
0
I am trying to implement matlab rgb2xyz function in opencv using c++. I used cvtColor function for implementation. But my output image is not similar to Matlab output image.Should I use any other function or operations on image ?Here is my input image ,matlab output image and my output image.![input image](/upfiles/1441393500608184.jpg)![Matlab output image](/upfiles/14413935907671541.jpg)![My output image](/upfiles/14413936171664629.jpg) Hai... I got 1 more code for the implementation of rgb2xyz.But it gave me black output image. Here is the code. for(int i=0;i(i,j); R= intensity.val[2]; G= intensity.val[1]; B= intensity.val[0]; r = R/255.f; //R 0..1 g = G/255.f; //G 0..1 b = B/255.f; //B 0..1 if (r <= 0.04045) r = r/12; else r = (float)pow((r+0.055)/1.055,2.4); if (g <= 0.04045) g = g/12; else g = (float)pow((g+0.055)/1.055,2.4); if (b <= 0.04045) b = b/12; else b = (float)pow((b+0.055)/1.055,2.4); X = 0.436052025f*r + 0.385081593f*g + 0.143087414f *b; Y = 0.222491598f*r + 0.71688606f *g + 0.060621486f *b; Z = 0.013929122f*r + 0.097097002f*g + 0.71418547f *b; Result.at(i,j)[0]=(float)X; Result.at(i,j)[1]=(float)Y; Result.at(i,j)[2]=(float)Z; } }

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>