What happens when an image is first edited in Paint and then processed in Matlab?
2 次查看(过去 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
0 个评论
采纳的回答
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
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
2013-12-14
If im is your image, write
im=im(:,:,1)
1 个评论
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!