Does imtool work on an image of type double?

조회 수: 1 (최근 30일)
sparsh garg
sparsh garg 2021년 8월 27일
편집: DGM 2021년 8월 27일
So I have an image and I have converted it to double so that I can do some mathematical operations on it like taking the log of pixels etc
My question is after I compute the log,the result is a double matrix,
now I can view this as imshow(I,[]) but if I was to send that output to say imtool the result doesn't show
Similarly when I send the same output to other functions like edge detection(subpixel) the result is NULL
Any help will be appreciated.

답변 (1개)

DGM
DGM 2021년 8월 27일
편집: DGM 2021년 8월 27일
How did you convert the image to double? If you did something like
A = imread('mypicture.jpg');
A = double(A);
then the image will be just be cast without being normalized. You'd want to use im2double() which does both.
Otherwise, if you did some operations on the image which pushed all the values outside the range [0 1], then you'll have to normalize it.
The image processing tools expect images to be scaled appropriately according to their class. For uint8, that'd be [0 255]. For floating point classes, it's [0 1]. If you have a [0 255] image cast as double and try to view it with imshow(), almost all the pixels will be rendered as white. When you use
imshow(A,[])
it handles the data ranging internally.
Long story short, yes it handles double images. Just make sure your images are scaled according to their class (normalized in this case).
  댓글 수: 2
sparsh garg
sparsh garg 2021년 8월 27일
actually im2double was my first choice,but my lead told me not to use the method,and do no normalization as that is bad.So I am stuck
DGM
DGM 2021년 8월 27일
편집: DGM 2021년 8월 27일
Any particular reason why? If you have (e.g. 0-255) scaled data in floating point, you could re-cast it back to uint8 so that imtool(), imshow(), imwrite() can handle it. ... but if you need to convert back to floating point afterwards (and back to integer for writing), then I can't imagine that such a horrible workflow is less destructive than normalization.
Depending on what you need from imtool(), you may just be able to use impixelinfo() or imcrop().

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

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by