Error - Error using im2double

7 次查看(过去 30 天)
Sara Kadam
Sara Kadam 2023-4-25
I implemented the following code for non-overlapping patch and I'm getting this error. What does this mean?
Thank you.
*Code -*
YourImage = im2double('house.jpg');
[m,n] = size(YourImage);
Blocks = cell(m/16,n/16);
counti = 0;
for i = 1:16:m-15
counti = counti + 1;
countj = 0;
for j = 1:16:n-15
countj = countj + 1;
Blocks{counti,countj} = YourImage(i:i+15,j:j+15);
end
end
*Error Message -*
Error using im2double
Expected input number 1, Image, to be one of these types:
double, logical, uint8, uint16, int16, single
  1 个评论
Stephen23
Stephen23 2023-4-25
编辑:Stephen23 2023-4-25
"What does this mean?"
The IM2DOUBLE documentation states that its first input must be an "Input image, specified as a numeric scalar, vector, matrix, or multidimensional array." Instead of providing a numeric image, you have called IM2DOUBLE with some text.
I do not see anything in the IM2DOUBLE documentation to suggest that it accepts text as its first input.
If you are trying to import an image from a file try using an image importing function, e.g. IMREAD:

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2023-4-25
Your code does not use im2double. And you did not post the entire error message (all the red text). I know because the line number and actual line of code is not included in what you post, and they are in the actual error message. We can't see what you really did So...

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by