Azzera filtri
Azzera filtri

Error - Error using im2double

7 visualizzazioni (ultimi 30 giorni)
Sara Kadam
Sara Kadam il 25 Apr 2023
Modificato: Walter Roberson il 25 Apr 2023
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 Commento
Stephen23
Stephen23 il 25 Apr 2023
Modificato: Stephen23 il 25 Apr 2023
"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:

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 25 Apr 2023
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...

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by