How can I convert my 4-channel CMYK image data to gray scale for image processing?

12 ビュー (過去 30 日間)
I have a 4-channel image data which I want to convert to grayscale for image processing.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 10 月 2 日
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 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by