How to write image
显示 更早的评论
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
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
2017-10-19
回答(2 个)
KSSV
2017-10-17
1 个投票
7 个评论
Ajay kumar
2017-10-17
KSSV
2017-10-17
does imshow show you a image?
Ajay kumar
2017-10-17
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
2017-10-17
Ajay kumar
2017-10-17
编辑:Ajay kumar
2017-10-17
Ajay kumar
2017-10-17
Guillaume
2017-10-19
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');
类别
在 帮助中心 和 File Exchange 中查找有关 Images 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
