Pixel intencity difference in opencv and Matlab [closed]

asked 2015-09-08 05:09:11 -0500

Tess gravatar image

updated 2015-09-08 05:12:09 -0500

I am trying to implement various Matlab functions rgb2lab in opencv. I got output images(in opencv) similar to Matlab. But their pixel values are different. For example output pixels values of 2x2 pixel image:

  1. Opencv pixel values : [255, 255, 255, 255, 255, 255; 255, 255, 255, 255, 255, 255]
  2. Matlab pixel values : e(:,:,1) = 51.0815 51.0815 51.0815 51.0815 e(:,:,2) = 33.3777 33.3777 33.3777 33.3777 e(:,:,3) = 10.6660 10.6660 10.6660 10.6660 Please help me to resolve my problem. How it happen?
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2015-09-08 07:07:14.119403



You should seriously stop implementing things for a while and start to understand what you're doing and what you should expect as outcome. From the last questions asked by you I see you have little understanding of the different types of data (float, uchar/uint8), the problems that can be caused by working/converting between them if handled incorrectly (underflow, overflow, truncation) and other important things such as normalization. Also, Matlab and OpenCV work in different ways when showing images, and you should search and understand such differences before trying to compare results.

LorenaGdL gravatar imageLorenaGdL ( 2015-09-08 05:48:31 -0500 )edit

And you should start using the documentation's search option before implementing everything over again. The wheel has already been invented, right here. This can be closed down.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-09-08 07:07:04 -0500 )edit