imadjust doesn't return the same image
2 次查看(过去 30 天)
显示 更早的评论
Sum = imadjust(Sum,[],[],1.);
This should return Sum with no changes, right? The figure is almost all white.
imshow(uint8(Sum))
figure(4)
Sum = imadjust(Sum,[],[],1.);
imshow(Sum)
0 个评论
回答(2 个)
Walter Roberson
2016-10-30
If you had read in a uint8 image, and had used double() with it, then your Sum array would be class double with values in the range 0 to 255. imshow(uint8(Sum)) would "undo" the double() , diplaying the image in its uint8 form. But the imadjust() on the double() version of it would leave the data completely unchanged including still being double(). And you did not use uint8() on your second imshow(), so it would be trying to imshow data that is way out of range for images of class double.
For example,
Sum = double(imread('cameraman.tif'));
subplot(1,2,1)
imshow(uint8(Sum));
subplot(1,2,2)
imshow(Sum)
Image Analyst
2016-10-30
Use [] to fix it. Sum is a double image and any values over 1 will display as white unless you use [] to scale min to max to the range 0-255.
imshow(Sum, []);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!