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'.

답변 (1개)

Image Analyst
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.
You can also use imadjust.
  댓글 수: 7
DGM
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.
Anas Saleh
Anas Saleh 2022년 5월 31일
Thank you all,
I will try to use these methods, and if I face any problems I will tell you.
Many thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by