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!