Adjusting CData to match CLim for grayscale Image
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a grayscale image in a figure displayed through imshow. I adjust the axes CLim limits [a b] to improve it's contrast to desired levels. How can I adjust the image matrix (CData) to match the image displayed by my CLim limits? I've tried imadjust function i.e. Image2=imadjust(Image1,[a b],[]) , but the resultant Image2 contrast doesn't look like the one displayed by CLim limits [a b].
댓글 수: 0
채택된 답변
Walter Roberson
2016년 4월 21일
t = double(max(min(Image1, b),a));
adjusted_image = (t - a) / (b - a);
now adjusted_image is in the range 0 (corresponding to a) to 1 (corresponding to b). Remember to caxis([0 1])
추가 답변 (1개)
Image Analyst
2016년 4월 21일
What are you trying to do? If you want to stretch contrast, you can pass in the values you want for black and white into imshow(). Or else call caxis(). I don't understand why you would ask what you asked.
댓글 수: 4
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!