필터 지우기
필터 지우기

negative values of pixels in aimage

조회 수: 26 (최근 30일)
Gova ReDDy
Gova ReDDy 2012년 5월 25일
편집: Walter Roberson 2016년 10월 19일
hi..
Can a image contain negative value of pixels ?
what does negative value of pixels in a image mean?

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 25일
편집: Walter Roberson 2016년 3월 5일
Yes, as a generality, images can contain pixels with negative values.
If I recall correctly, if you look at the diagrams of color representation as perceived by the human eye, and you look at how they define RGB coordinates, then there are some colors that humans can perceive that would have to be modeled as negative coordinates. RGB and the other color spaces in common use in image file formats, are approximations of what we can really see, and since approximations are imperfect, some colors visible to humans (at least under perfect conditions) fall outside the models.
Ask yourself this: what color is infrared in RGB coordinates? It doesn't fit. But you might have taken an image with a camera that is sensitive to infrared as well as to visible optics, so you might want to deal in negative coordinates.
Pixel values are interpreted, part of a mathematical model, and need not represent real measurements in physics -- or might represent measurements whose zero point was originally determined before all oddities were known, leading to some negative readings.
Example: if you were taking astronomical pictures, it might make sense in some contexts to use stars' apparent magnitude as the pixel values. If one excludes the Sun and planets, that still leaves a small number of stars (about half a dozen at most) that would have negative values.
  댓글 수: 5
Aarach Sap
Aarach Sap 2016년 10월 19일
The image file formats that I know of that support negative values are DICOM (use dicomwrite() for that), and TIFF (you need to use the TIFF class and special settings to be able to store negative values.)
I have input image as Tiff image(RGB). I convert to YDbDr then I perform some operation on each channel and the results in one channel is negative. Now I want to convert Ydbdr into RGB. Then want to write the image on matlab and display in RGB space. But my result appears pink and I display on 'uint8'. how to deal with negative values in tiff? what is the setting?
Walter Roberson
Walter Roberson 2016년 10월 19일
편집: Walter Roberson 2016년 10월 19일
I had not heard of YDbDr before; it appears to be https://en.wikipedia.org/wiki/YDbDr. One routine that handles the conversion is https://github.com/petercorke/machinevision-toolbox-matlab/blob/master/colorspace.m
To store floating point values in TIFF see:
It appears that there is no good PhotometricInterpretation for uninterpreted data; MinIsBlack looks like it might be the common for this case, even though that is entirely misleading for the situation, and I can see the potential for problems with values that happen to be 0 perhaps interpreted as black. The underlying TIFF tag appears to be 1 = BlackIsZero which LibTiff seems to call PHOTOMETRIC_MINISBLACK so I am not at all sure that MinIsBlack is going to work for this. But I cannot see anything better at the moment. DNG has 34892 = LinearRaw and perhaps that would make the most sense.... though you would have a difficult time finding software that could interpret it. I thought for a moment that perhaps PHOTOMETRIC_SEPARATED ("usually CMYK") would be the approach but I see in other postings that separated requires that the data channels be percentage of inks, which is not appropriate here.
... but perhaps all of that is irrelevant if you are not trying to write out the YDrDb as a TIFF file. If you are just holding it in memory or are saving it as .mat or something like that, then you do not care how TIFF represents data that does not match one of its color specifications.
"Now I want to convert Ydbdr into RGB"
Try the routine from the PeterCorke toolbox. Or you could pull down https://www.mathworks.com/matlabcentral/fileexchange/28790-colorspace-transformations

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by