Bonjour,

Je cherche à réaliser un inpainting sur une image. J'ai un masque. J'y applique le code suivant mais cela ne marche pas...

Je vous poste le code car j'aimerais bien un peu d'aide!
ps: mes gradients et ma divergence sont justes (je les ai testé) donc je les remets pas

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function ImInpaint = LinearImpaint( Im, Im_Mask )
%LINEARIMPAINT Summary of this function goes here
%   Detailed explanation goes here
[m n]=size(Im);
Im=double(Im);
 
dt=0.2;
T=8;
 
u=Im;
 
for t=0:dt:T
    p_x=gradx(u);
    p_y=grady(u);
    LapLinear=div(p_x, p_y);
    u=u+dt*LapLinear;
    u(Im_Mask==1)=Im(Im_Mask==1);
end
 
ImInpaint = u;
end
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clear all;
close all;
 
Im_Damaged = imread('parrot_original.png');
[m n] = size(Im_Damaged);
Im_Damaged = double(Im_Damaged);
 
imshow(uint8(Im_Damaged));
title('Damaged Image');
 
Im_Mask = imread('parrot_mask.png');
figure, imshow(Im_Mask);
title('Mask Image');
 
for i=1:3
    Im = double(Im_Damaged(:,:,i));    
    ImInpaint = LinearImpaint(Im,Im_Mask);
    Im_ColorInpainted(:,:,i)=ImInpaint;
end
 
figure, imshow(uint8(Im_ColorInpainted));
title('Linear Inpaintaing Image');
Merci d'avance!