Why does Matlab display different pixel values than other programs?

2 views (last 30 days)
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.

Accepted Answer

Evan
Evan on 17 Jul 2013
Edited: Evan on 17 Jul 2013
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 Comments
Shan
Shan on 18 Jul 2013
Yup, (x,y) in other programs is equivalent to (x+1,y+1) in Matlab. This has been driving me insane; thanks a bunch!

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 17 Jul 2013
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 on 18 Jul 2013
Edited: Jan on 18 Jul 2013
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.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!