MATLAB Answers


error using imfinfo()

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.

  0 件のコメント

サインイン to comment.

1 件の回答

Walter Roberson
Answer by Walter Roberson
on 13 Oct 2019

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);
thisfile = filenames{k};
info = imfinfo(thisfile);

  3 件のコメント

Sajitha K.N. on 13 Oct 2019
ds.Files here am I want to put ds.compareimages?
Sajitha K.N. on 13 Oct 2019
I want to find bit depth of compareimages
Walter Roberson
on 13 Oct 2019
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.

サインイン to comment.

Translated by