image processing, (thresholding images to obtain image with the required gray values )
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 30 May 2022
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 Comments
DGM
on 31 May 2022
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.
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!