inpainting_nans by John D'Errico ERROR MESSAGE

1 visualización (últimos 30 días)
Paulo
Paulo el 20 de Jul. de 2011
Editada: DGM el 6 de Nov. de 2022
I used the inpainting_nans that is available here http://mathworks.com/matlabcentral/fileexchange/4551
I used an image file with a black background picture and a white spot on the middle of it. A = imread('F:\image.bmp');
and i used the inpainting_nans code to see what will be its effect B = inpaint_nans3(A);
But I encountered this error:
?? Error using ==> mtimes Sparse integer array arithmetic operations are not supported.
Error in ==> inpaint_nans3 at 159 rhs=-fda(:,known_list)*A(known_list);
What does this mean?

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 20 de Jul. de 2011
Hi, you will probably have to convert the image from integer values to doubles. Try
Ad = double(A);
and run inpaint_nans with Ad ...
Titus
  3 comentarios
Paulo
Paulo el 21 de Jul. de 2011
thank you very much to the both of you
DGM
DGM el 6 de Nov. de 2022
Editada: DGM el 6 de Nov. de 2022
I should add that if your image is integer-class (e.g. uint8), then it has no NaNs. Casting to 'double' will eliminate the error, but unless you do something to add NaN pixels to the image, there will be nothing for inpaint_nans to fill.
A = imread('cameraman.tif'); % uint8
A = im2double(A); % double, correctly-scaled for its class
% there's nothing to do here
op1 = inpaint_nans(A);
imshow(op1) % the image is unchanged
The above example accomplishes nothing, since there's nothing to inpaint. You'll have to create a mask from something and use that to apply NaNs to the image regions that need to be estimated.
% a logical mask
mk = imread('cmantifmk.png')>128;
% use NaNs to embed the mask in the image
A(mk) = NaN;
% there's actually something to do now
op2 = inpaint_nans(A);
imshow(op2)
... not that that's a good mask to demonstrate inpainting with, but it at least shows that inpainting is happening.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Import, Export, and Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by