フィルターのクリア

how to convert 24 bit depth images into 8 bit depth and 16 bit depth images.

34 ビュー (過去 30 日間)
ajay kumar
ajay kumar 2013 年 12 月 5 日
コメント済み: Image Analyst 2020 年 2 月 4 日
i have 24 bit depth images. but i need them in 8 bit depth and 16 bit depth format. can any one sugest how to convert them.
how to convert 24 bit depth images into 8 bit depth and 16 bit depth images.

採用された回答

Image Analyst
Image Analyst 2013 年 12 月 5 日
Is your 24 bit depth image a color image? Probably because there is no 24 bit integer in MATLAB. There is a 32 bit signed integer and you may be using up only the lower 24 bits of that because your values only go from 0 to 16,777,215. If you have that situation then divide by 256 to get 16 bit integers or divde by (256*256) to get uint8 images. There are other ways , to convert an integer gray scale image , such as using mat2gray or simple scaling:
image8bit = uint8(255 * mat2gray(image24bit))
This scaled between the max and min of the image rather than using a fixed range like dividing by 256 will do. It just depends on what range you want your output in.
Or if you have a 24 bit color RGB image , you can use rgb2gray:
image8bit = rgb2gray(rgbImage);
or take out just one color channel
image8bit = rgbImage(:, :, 2); % Extract the green channel.
  2 件のコメント
Mohammad Ali Kawser
Mohammad Ali Kawser 2020 年 2 月 4 日
thanks! worked for me!
Image Analyst
Image Analyst 2020 年 2 月 4 日
You're welcome. The usual thing to do is click the link to "Accept this answer". Thanks in advance.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 12 月 5 日
Divide by 256 to get 16 bit images, and divide by 256 again to get 8 bit images.

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by