How to extend line until end of image
i think i found it

X= [x1, x2]
Y=[y1, y2]

c = [[1; 1]  X(:)]\Y(:);    
slope_m = c(2)
intercept_b = c(1)

aLine = [slope_m,-1,intercept_b];
points = lineToBorderPoints(aLine,size(negfillHoles))
line(points([1 ,3]),points([2 ,4]),'LineWidth',1.5,'Color','r');
 plot(x1,y1,'*','LineWidth',2,'Color','g');