function out = umple(copy, mask1);
% clear all
% clc
se=strel('disk',2);



inversa=abs(1-mask1);

rez = imdilate(~inversa, se);

inversa = ~rez;

 out = inversa;

figure,imagesc(out),colormap(gray(256)),axis image, pixval;

oo = out.*copy;

aux = oo;

[m,n] = size(copy);

for i=1:m
    
    linie = oo(i,:);
    
    mm=1/3*ones(1,3);
    linie=conv(linie,mm);
    
    if linie ==0
        break
    end
    
    l = find(linie == 0);
    poz =min(l);
    
    for j=poz:(poz+length(l))
        i
        j
        
        p=100; r=110;
        v = oo(i,j-p:-1:j-r);
        if prod(v)==0
            aux(i,j)=mean(v(v>0));
        else
            aux(i,j)=mean(v);  
        end
        
    end
        
end

out=aux;
figure,imagesc(aux),colormap(gray(256)),axis image, pixval;