sim =reshape(sim,row,col,3);
gim =reshape(gim,row,col);
figure,
subplot(2,2,2),imshow(gim,[]),title('titl');
subplot(2,2,3),imshow(sim,[]),title('titl');

댓글 수: 2

Guillaume
Guillaume 2017년 10월 17일
This snippet of code does not write any image to a file. It displays some images on screen.
From the conversation below, it's not clear if the question is about displaying images or saving them into a file. So, please clarify. A good question has words that clearly explain the problem, not just a title and a few lines of code.
In any case, for us to be able to help we need to know how the image is created (or loaded from file). What format it has (grayscale, rgb, indexed), what class (uint8, double, ...) and what range of intensities (0-1, 0-255, ...)
Ajay kumar
Ajay kumar 2017년 10월 19일
From this code I wanted to save into file .
From the script
gim =reshape(gim,row,col);
displays M*N double with intensity 0-255 Can you help in imwrite to gim

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

답변 (2개)

KSSV
KSSV 2017년 10월 17일

1 개 추천

댓글 수: 7

Ajay kumar
Ajay kumar 2017년 10월 17일
subplot(2,2,2),imshow(gim,[]),title('titl'); imwrite(gim,'g.png');
The image is blank white.
KSSV
KSSV 2017년 10월 17일
does imshow show you a image?
Ajay kumar
Ajay kumar 2017년 10월 17일
imshow(gim,[]),
displays the image perfectly. While writing the image it stored in the location but, the image is blank white.
KSSV
KSSV 2017년 10월 17일
black and white?? it is because you have to provide colormap to have it in color. Read the documentation dude.
Ajay kumar
Ajay kumar 2017년 10월 17일
I meant the saved image is 512*512 image with all pixel values 255= White image
For psedocolor images I got the image what i need. For grayscale image the saved image is complete White.
Ajay kumar
Ajay kumar 2017년 10월 17일
편집: Ajay kumar 2017년 10월 17일
This is the image what i got
Ajay kumar
Ajay kumar 2017년 10월 17일
Sorry the image is complete white so its not visual

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

Guillaume
Guillaume 2017년 10월 19일

0 개 추천

images of class double in matlab are assumed to have intensity range 0-1, with 0 == black, 1 == white.You get a white image because anything above 1 is the same as 1 == white. If your image is in the range 0-255 then its class should be uint8. So:
imwrite(uint8(gim), 'somename.png');

댓글 수: 1

Ajay kumar
Ajay kumar 2017년 10월 20일
Great day, Thanks for your valuable comments.
I have tried as you commented here. Still the image is white.

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

카테고리

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

질문:

2017년 10월 17일

댓글:

2017년 10월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by