How can I convert my 4-channel CMYK image data to gray scale for image processing?
26 views (last 30 days)
Show older comments
I have a 4-channel image data which I want to convert to grayscale for image processing.
Accepted Answer
MathWorks Support Team
on 2 Oct 2009
There are no built-in MATLAB functions for converting 4-channel CMYK data directly to grayscale. But it can be done in two steps:
Step 1:
Read the original image and convert the data from the CMYK colorspace to the RGB colorspace, using the MAKECFORM and APPLYCFORM functions. This requires an appropriate ICC color profile, such as the "USSheetfedCoated.icc" color profile from the Adobe Systems, Inc. (www.adobe.com).
Using this profile, the conversion can be executed as follows:
I_cmyk = imread('foo.tif');
inprof = iccread('USSheetfedCoated.icc');
outprof = iccread('sRGB.icm');
C = makecform('icc',inprof,outprof);
I_rgb = applycform(I_cmyk,C);
where "foo.tif" is the TIF-file to be converted.
STEP 2:
Use the RGB2GRAY function to convert the resulting RGB image to grayscale:
I_gray = rgb2gray(I_rgb);
0 Comments
More Answers (0)
Categories
Find more on Modify Image Colors 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!