필터 지우기
필터 지우기

error using imfinfo()

조회 수: 2 (최근 30일)
Sajitha K.N.
Sajitha K.N. 2019년 10월 13일
댓글: Walter Roberson 2019년 10월 13일
When I using imfinfo() function for finding bit depth of an image it shows an error messege that my image is in uni8 type and image should be in char or string type.What can I do now? please help someone. Its very urgent.

답변 (1개)

Walter Roberson
Walter Roberson 2019년 10월 13일
Images in memory such as your compareimages do not have a "bitdepth", and cannot be queried with imfinfo()
Before you while loop, do
filenames = ds.Files;
Then change
info = imfinfo( compareimages);
to
thisfile = filenames{k};
info = imfinfo(thisfile);
  댓글 수: 3
Sajitha K.N.
Sajitha K.N. 2019년 10월 13일
I want to find bit depth of compareimages
Walter Roberson
Walter Roberson 2019년 10월 13일
Oh, here it is. You have
outputimage1 = im2uint8(filtered_3x3);
outputimage2 = im2uint8(filtered_3x3);
so no matter what the bit depth of the input image, your outputimage1 and outputimage2 are 8 bit. You then
compareimages = imabsdiff(outputimage2,outputimage1);
The result of imabsdiff() of two uint8 images is uint8 . Therefore the bit depth of compareimages is 8 no matter what the input files were.
It is possible that you will not need the full 8 bits to represent the result, but that is a different question. For example if you have an input image that consisted only of values 0 and 255, then each location could be encoded as a single bit for a bit depth of 1, but would still require a bit depth of 8 because of the way that the image is stored.

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

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by