hello any one can solve the code of image inpainting based on convolution

1 view (last 30 days)
hello the code which is given below is which is not working with another image so any one can solve the problem the code is
%%Digital Images Inpainting using Modified Convolution Based Method
clc;
clear all;
close all;
%% Input Image I=imread('bunge0.png'); % I=imread('cool boy_00122_001.jpg'); I=rgb2gray(I); inpainted=I; I=double(I); mask=double(I==0); inpainted(find(mask==1))=255; inpainted=double(inpainted); [sx,sy]=size(I); k=inpainted; k1=k; it=0; %% mask for convolution w1=[.073235 .176765 .073235; .176765 0 .176765;.073235 .176765 .073235]; w2=[.125 .125 .125;.125 0 .125;.125 .125 .125];
%% convolving the image with mask for more than 100 iteration for lp=1:100 % it=it+1; %% uncomment the four lines for animation % imshow(uint8(inpainted)); % title(['Inpainted image after ' num2str(it) ' iterations']); % pause(1.0); % for i=3:sx-3 for j=3:sy-3 if(mask(i,j)==1) inpainted(i,j)=sum(sum((I(i-1:i+1,j-1:j+1)).*w1)); inpainted(i,j)=sum(sum((inpainted(i-1:i+1,j-1:j+1)).*w2)); end
end
end
end
%% figure; subplot(121); imshow(uint8(I)); title('ORIGINAL IMAGE'); subplot(122) imshow(uint8(inpainted)); title('IMAGE AFTER INPAINTING');

Answers (1)

Image Analyst
Image Analyst on 4 May 2014
Read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup then fix your code formatting, and attach bunge0.png. Then define "solve the code". What needs to be solved?
By the way, your algorithm is incredibly inefficient. Convolving 100 times with a Gaussian (or anything for that matter) is the same as convolving once with a single Gaussian 100 times as wide.

Community Treasure Hunt

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

Start Hunting!