フィルターのクリア

image() display image and adjust contrast automatically

5 ビュー (過去 30 日間)
Sun
Sun 2012 年 4 月 15 日
Hi, I have a 16-bit gray image which has a intensity value between [0 5000].I want to use image to display the image matrix and automatically display the image. However, I don't find and image handle properties about this.I know imshow() can do this easily, but I have to use image() now.
Thanks, Sun Tao

採用された回答

Image Analyst
Image Analyst 2012 年 4 月 15 日
I played around a bit with image with 16 bit images and various colormaps and couldn't get it to work (to display the complete range properly). The only way I could do it was to convert it to an 8 bit image.
% Create sample 16 bit image.
rows = 600;
columns = 800;
ramp = linspace(1, 5000, columns);
grayImage = uint16(repmat(ramp, [rows, 1]));
% imshow(grayImage, []); % This works.
% image(grayImage); % This doesn't seem to work no matter what colormap I used.
% Convert to normalized uint8 image.
g=uint8(255*mat2gray(grayImage));
image(g); % Now it works.
% Apply gray scale color map.
colormap(gray(256));
colorbar;
  2 件のコメント
Sun
Sun 2012 年 4 月 16 日
Hi,
Thanks for the reply! This works and now it can display. Althouth I may still use 16-bit because this will not lose information. But at this moment it's good enough.
Sun Tao
Image Analyst
Image Analyst 2012 年 4 月 16 日
Go ahead and use 16 bits everywhere you do math on it. I just converted to 8 bit for display only so no information is lost because you have only an 8 bit display (24 bit RGB) - you don't have a 16 bit per channel color display so even if you passed a 16 bit image to some display routine, it would have to convert to 8 bits internally *anyway* when it displayed it since the display can't handle 16 bits. Make sense?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by