Every time I use imread to get an image it corrupts the input. Here's a link to a before and after picture. The after is what I'm seeing in matlab. Is this my doing or does matlab have a bug somewhere?
Code used:
I = imread('pout.gif');
imwrite (I, 'output.gif');
pretty straight forward. The pictures look like this: Photobucket

댓글 수: 1

Image Analyst
Image Analyst 2011년 9월 29일
It looks like you're displaying just a bit plane, or perhaps an indexed image without the associated colormap. But the "pout" image supplied by the Mathworks is not a GIF image - it's a TIFF image. So that brings up the question "Where did you get the GIF version of pout?" Also, post all your actual code, including the calls to imshow() or whatever.
Bottom line is, I'd say with 99.99% confidence that it's your doing and not a bug, based on thousands of prior observations of this kind of posting.

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

답변 (1개)

DGM
DGM 2022년 11월 9일
편집: DGM 2022년 11월 9일

0 개 추천

All GIF files are indexed-color images. If you're not reading the colormap, the array you're looking at is the index array. It's not a viewable image.
[Aind map] = imread('canoe.tif'); % this is also an indexed image
imshow(Aind,map) % using an indexed image requires both the index array and the map
If you don't read the map, this is what you will get. It's just a bunch of indices into a color table. There's no reason to expect that the indices are ordered in a way that naturally produces a clear image.
imshow(Aind) % if you don't have the map, you don't have the image.
Similarly, if you write an indexed image to a GIF without specifying the appropriate colormap, a default gray colormap will be substituted, which will likely destroy the image.
imwrite(Aind,'completegarbage.gif') % don't do this if the input is indexed
There are further complications specifically with multiframe GIF files, but that's a story for another time.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2011년 9월 29일

편집:

DGM
2022년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by