image processing, (thresholding images to obtain image with the required gray values )
1 次查看(过去 30 天)
显示 更早的评论
Hello every one,
I know how to display gray images with specific limits, for an example, if I want to diplay an image (I) with values from 0-150; I only do the following:
imshow (I, [0 150]);
However, now I am trying to save this image at 'A' , but I don't know how can I do that?
I tried the following
A= I<150 ;
but the answer was binary (i.e., black and white, zeros and ones) !! and I want to save gray image as what was obtained from (imshow(I, [0 150])) command in variable 'A'.
0 个评论
回答(1 个)
Image Analyst
2022-5-30
Try this:
A150 = uint8(double(A) * 255 / 150);
imwrite(A150, 'A150.png');
This will scale A from 0 to 433.5 but then the uint8() function clips it to 255, so that what was 150 now shows up as 255.
7 个评论
DGM
2022-5-31
If you're trying to automatically normalize based on the image extrema, bear in mind that using imadjust() with the implicit input range syntax will be problematic unless your image is scaled correctly for its class.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!