How can I convert my 4-channel CMYK image data to gray scale for image processing?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a 4-channel image data which I want to convert to grayscale for image processing.
Akzeptierte Antwort
MathWorks Support Team
am 2 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!