How can I convert my 4-channel CMYK image data to gray scale for image processing?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a 4-channel image data which I want to convert to grayscale for image processing.
Respuesta aceptada
MathWorks Support Team
el 2 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!