I find a way to do this. I will post my answer to anyone interested.
Given the image "I.png" (attached) I fitted a linear model to find the central line and move the intercept to move the central line to the right and to the left. The pixel value of a given pixel represent the number of pixels this pixel is far from the center.
% Fit a linear model using pixel coordinates to find the center line
[y,x] = find(I) ;
p = polyfit(x,y,1);
xi = linspace(min(x),max(x),max(x)) ;
yi = polyval(p,xi) ;
frameLength=100;
Izeros=zeros(size(I));
% Left side
for i= 1:frameLength
aux_p=p;
aux_p(1,2)=p(1,2)+i; % Change the intercept
yi = polyval(aux_p,xi);
centralLinePixValue=i+1;
for k = 1 : length(xi)
row = round(yi(k));
col = round(xi(k));
if row>size(I,1)||col>size(I,2)
row=size(I,1);
col=size(I,2);
end
Izeros(row, col) = centralLinePixValue;
end
end
% Right side
frameLength=70;
for i= 1:70
aux_p=p;
aux_p(1,2)=p(1,2)-i; % Change the intercept
yi = polyval(aux_p,xi);
centralLinePixValue=i+1;
for k = 1 : length(xi)
row = abs(round(yi(k)));
col = abs(round(xi(k)));
if row==0||col==0
row=1;
col=1;
end
if row>size(I,1)||col>size(I,2)
row=size(I,1);
col=size(I,2);
end
Izeros(row, col) = centralLinePixValue;
end
end
Izeros=Izeros.*I;
figure, imshow(Izeros,[])