Why does Matlab display different pixel values than other programs?

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Evan
Evan il 17 Lug 2013
Modificato: Evan il 17 Lug 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 Commenti
Shan
Shan il 18 Lug 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!

Accedi per commentare.

Più risposte (2)

Image Analyst
Image Analyst il 17 Lug 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 il 18 Lug 2013
Modificato: Jan il 18 Lug 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.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by