Why does Matlab display different pixel values than other programs?

4 次查看(过去 30 天)
I have a labview program which opens an image and displays the values of a pixel at a coordinate. If I open the same image with imread and display the value of that same coordinate, it is different.
If I plot intensity along a straight line in both programs, the relative intensity to other pixels remains constant; i.e. the coordinate of the brightest/darkest pixel is the same in both programs.
Finally, if I open that same image in any image editor (paint.net, GIMP, etc.), the pixel values agree with the results I get from Labview.
This problem persists regardless of the image type (.jpg, .bmp, etc.), whether it is greyscale or RGB, etc. I can't figure out why Matlab's pixel values don't agree with any other program's results. The ratio of Matlab's result to the other result is totally nonlinear; there is no scaling factor. The effect appears to exacerbate itself with very bright pixels.
I am using Matlab 7, though Matlab 6 has the same problem too.

采纳的回答

Evan
Evan 2013-7-17
编辑:Evan 2013-7-17
Shot in the dark here, but could it have anything to do with those programs using 0 indexing while matlab uses 1 indexing? Paint.NET definitely displays image coordinates as ranging from [0,0] to [m-1,n-1].
  2 个评论
Shan
Shan 2013-7-18
Yup, (x,y) in other programs is equivalent to (x+1,y+1) in Matlab. This has been driving me insane; thanks a bunch!

请先登录,再进行评论。

更多回答(2 个)

Image Analyst
Image Analyst 2013-7-17
I don't observe that problem. Never have. The value it displays (through a variety of means) is the value I see in Photoshop, or wherever. Why don't you make up a step wedge of, say 16 gray steps and post it? Tell us what the step values are, what you observe in MATLAB, and other programs for the 16 steps.

Jan
Jan 2013-7-18
编辑:Jan 2013-7-18
If I open the same image with imread and display the value of that same coordinate, it is different.
This is too vague to be reconsidered. I guess, the reason is found in the Matlab code, so please show us the corresponding code and provide a test image. Perhaps an interpolation happens in between to downsample the image to the screen resolution. Or the image is read in indexed colors, while LabView creates the colormap image implicitly.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by