필터 지우기
필터 지우기

What happens when an image is first edited in Paint and then processed in Matlab?

조회 수: 1 (최근 30일)
When I open an existing image (TIF) with Paint and do some corrections and save it, and open it with MATLAB, it gives me the error of exceeding dimension! Why? What happens in Paint? I checked it and see it turns a 2D image into 3D! why and how? How can I correct it? If I need to do some modifications in Paint before going to Matlab, what should I do to keep the dimensions?
Thanks so much. Steven

채택된 답변

Walter Roberson
Walter Roberson 2013년 12월 14일
If the corrections were done in color, it would need to change it to RGB, which involves a 3D array.
If the corrections are in grayscale, it is possible that Paint is choosing to write the file in RGB anyhow. It has been a long long time since I used Paint, so I do not know if there is some option you could use for grayscale output.
If Paint is changing it to an RGB image, then you can apply rgb2gray() to it to change it back to grayscale.
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 12월 14일
If it shows up as N x M x 4 then it is saved as CMYK. In some of the other file formats one might guess it would be RGBA, but TIFF RGBA need special reading procedures and the x 4 is specifically documented for CMYK for TIFF files.
To do the conversion to RGB see the following (and just don't do the grayscale conversion): http://www.mathworks.com/matlabcentral/answers/96767-how-can-i-convert-my-4-channel-cmyk-image-data-to-gray-scale-for-image-processing

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 14일
If im is your image, write
im=im(:,:,1)
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 12월 14일
If the file stored CMYK and the image is grayscale, you could try extracting im(:,:,4) . I am seeing discussions indicating that there may be some shifts if that is done.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by