inpainting_nans by John D'Errico ERROR MESSAGE
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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?
0 Commenti
Risposta accettata
  Titus Edelhofer
    
 il 20 Lug 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 Commenti
  DGM
      
      
 il 6 Nov 2022
				
      Modificato: DGM
      
      
 il 6 Nov 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.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Logical in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!