필터 지우기
필터 지우기

Saving a true color image

조회 수: 7 (최근 30일)
Michael
Michael 2014년 7월 14일
댓글: Image Analyst 2014년 7월 14일
I created a true color image using values for RGB:
R = 1;
G = 0.3301;
B = 0.9;
truecolor_image = cat(3, R, G, B);
filt_image = image(truecolor_image);
Now when I try to have Matlab save this image:
imwrite(filt_image, 'Filter Color.png');
All I get is a blank white pixel. Even after re-sizing to a 300 by 300 pixel image, the figure is still white and blank. How do I save this color image?

채택된 답변

Matz Johansson Bergström
Matz Johansson Bergström 2014년 7월 14일
편집: Matz Johansson Bergström 2014년 7월 14일
When you are calling image it returns a handle, which is a float value that you can use to modify the image in the plot window after you display it. For instance
handl = image(truecolor_image)
set(handl, 'cdata', 200)
What you are doing is writing this handle, which is a float, to a file. You want to write the actual matrix to the file. So, it is sufficient to write:
imwrite(truecolor_image, 'Filter Color.png');
  댓글 수: 2
Michael
Michael 2014년 7월 14일
Nice that worked well. Now would I be able to put text on top of the truecolor_image and then still save it in the same manner as well?
Image Analyst
Image Analyst 2014년 7월 14일
No. Not unless you used the textInserter method of the Computer Vision System Toolbox. Otherwise, use export_fig.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by