# How to extend hough lines over the image space

I need to extend lines over the image space. I used Hough transform to finde vanishing lines, but i need to get lines longer and see where is vanishing points. How can i do it? Please help. This is my code:

clear; clc;

%rotI = imrotate(I,33,'crop');
bw_I = rgb2gray(I);
BW = edge(bw_I,'canny');

figure, imshow(BW); %pause;

BW=edge(BW,'canny',(graythresh(I)*(0.3)),'horizontal');

figure, imshow(BW); %pause;

[H,T,R] = hough(BW);
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
P  = houghpeaks(H,15,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2)); y = R(P(:,1));
plot(x,y,'s','color','white');
% Find lines and plot them
lines = houghlines(BW,T,R,P,'FillGap',200,'MinLength',200);
figure, imshow(I), hold on

for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot( xy(:,1) ,  xy(:,2),  'LineWidth',2,'Color','green');

% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
end


Fit a line through the end points using standard line model $ax+by+c=0$. Then draw them on the image from -10000, 10000. The points remaining on the image will give you what you are asking for.