www.gusucode.com > vision 源码程序 matlab案例代码 > vision/FindIntersectionPointsBetweenALineAndImageBorderExample.m

    %% Find Intersection Points Between a Line and Image Border
% 
%%
% Load and display an image.
I = imread('rice.png');
figure; 
imshow(I); 
hold on;
%%
% Define a line with the equation, 2 * x + y - 300 = 0.
aLine = [2,1,-300];
%%
% Compute the intersection points of the line and the image border.
points = lineToBorderPoints(aLine,size(I))
line(points([1,3]),points([2,4]));