inpainting_nans by John D'Errico ERROR MESSAGE

조회 수: 1 (최근 30일)
Paulo
Paulo 2011년 7월 20일
편집: DGM 2022년 11월 6일
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?

채택된 답변

Titus Edelhofer
Titus Edelhofer 2011년 7월 20일
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
Paulo
Paulo 2011년 7월 21일
thank you very much to the both of you
DGM
DGM 2022년 11월 6일
편집: DGM 2022년 11월 6일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by