spatial transformation of image

3 ビュー (過去 30 日間)
Allen Ray
Allen Ray 2016 年 9 月 17 日
編集済み: Image Analyst 2016 年 9 月 18 日
Hi guys, I am beginner to MATLAB.
How to convert one normal image(either gray or rgb) to 1 bit, 2 bit, 3 bit, 4 bit and 8 bit through spatial transformation?
Thanks.

回答 (1 件)

Image Analyst
Image Analyst 2016 年 9 月 17 日
You can't do that. You can transform the image spatially with function like imwarp(), imtranslate(), etc. but they won't change the bit depth.
See attached bit plane demo.
  8 件のコメント
Allen Ray
Allen Ray 2016 年 9 月 18 日
After I tried to follow your code, why the picture became darker and darker(from image7bit to image2bit)?
Image Analyst
Image Analyst 2016 年 9 月 18 日
編集済み: Image Analyst 2016 年 9 月 18 日
In your picture, you're changing the spatial resolution of the image, not the intensity resolution which is the bit depth.
Of course if the intensities are only 2 bits, the intensities can be 0, 1, 2, or 3, so of course that's going to be darker than an image with 8 bits where the values can go as high as 255.
To reduce the spatial resolution of the image, you can use imresize, with the 'nearest' option, both to shrink it and to magnify it.
grayImage = imread('cameraman.tif');
subplot(3,1,1);
imshow(grayImage);
axis on;
smallImage = imresize(grayImage, 1/16, 'nearest');
subplot(3,1,2);
imshow(smallImage);
axis on;
bigImage = imresize(smallImage, 16, 'nearest');
subplot(3,1,3);
imshow(bigImage);
axis on;

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

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by