generating CIELab Image
이전 댓글 표시
I have set of color patches given by CIELab values.
How can I create image (preferably TIFF file) using only this data?
Again, image should show just these patches.
Thank you.
답변 (4개)
Here is an example of how to write a tiff file containing 3 known Lab values. As a check, open the tiff file in Photoshop: the displayed image should have a stripe of cyan, orange, and green and the information tool will display Lab values at the cursor location which should be the same as what you used in Matlab. [If you are doing anything technical with these color values, you should feel uneasy that you don't need to specify the illuminant and observer: Matlab assumes they are D50/2 if I remember right.]
% Start with a matrix of zeros, and later substitute Lab values
nRow = 100;
nCol = 100;
Lab = zeros(nRow,nCol,3);
% Cyan stripe on top
iSlice = 1:33; % The rows of the image that we set to this Lab value
Lab(iSlice,:,1) = 63; % L
Lab(iSlice,:,2) = -90; % a
Lab(iSlice,:,3) = -15; % b
% Orange in middle
iSlice = 34:66;
Lab(iSlice,:,1) = 72; % L
Lab(iSlice,:,2) = 33; % a
Lab(iSlice,:,3) = 117; % b
% Green on bottom
iSlice = 67:100;
Lab(iSlice,:,1) = 81; % L
Lab(iSlice,:,2) = -59; % a
Lab(iSlice,:,3) = 84; % b
%%
lab_uint16=lab2uint16(Lab); % Convert to 16-bit
fileTif = 'test_Lab.tif'; % The tif file containing your Lab values
imwrite(lab_uint16,fileTif,'tif','ColorSpace','CIELab'); % 16-bit CIELAB
Walter Roberson
2012년 5월 15일
0 개 추천
This is possible if you specify the ColorSpace parameter to imwrite() for a TIFF file. There is more detail in the imwrite documentation in the TIFF portion.
You could probably also use the new TIFF class to handle it.
Image Analyst
2012년 5월 15일
0 개 추천
Do you mean you want to convert those lab patches into RGB patches and then stitch them all together to form a rectangular RGB image? If so, you can use makecform() to convert lab values into "book formula" rgb values and then use regular assignment to put those rgb values into a 3D true color rectangular image array variable. You can then save it to a standard image format with imwrite() if you want to save it to disk.
If that's what you want and can't figure it out, write back. Needless to say, posting any kind of image or diagram might help explain what you want to do.
댓글 수: 1
Walter Roberson
2012년 5월 15일
TIFF files support cielab colorspace directly.
No word on whether browsers can display them....
Opiuz
2012년 5월 16일
0 개 추천
댓글 수: 1
Walter Roberson
2012년 5월 16일
TIFF files with ColorSpace icelab do not have any colorspace conversion applied.
카테고리
도움말 센터 및 File Exchange에서 L*a*b* Color Space에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!