lineToBorderPoints
Intersection points of lines in image and image border
Description
Examples
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))
points = 1×4
149.7500 0.5000 21.7500 256.5000
line(points([1,3]),points([2,4]));
Input Arguments
lines
— Line matrix
M-by-3 matrix (default)
Line matrix, specified as an M-by-3 matrix, where each row must be in the format, [A,B,C]. This matrix corresponds to the definition of the line:
A * x + B * y + C = 0. |
lines
must be double
or
single
.
imageSize
— Image size
integer (default) | row vector
Image size, specified as a row vector in the format returned by the size
function.
Output Arguments
points
— Intersection points
M-by-4 matrix
Intersection points, returned as an M-by-4 matrix. The function
returns the matrix in the format of [x1,
y1,
x2,
y2]. In this matrix,
[x1
y1] and
[x2
y2] are the two intersection points. When a
line in the image and the image border do not intersect, the function returns
[-1,-1,-1,-1
].
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2011a
See Also
size
| line
| epipolarLine
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)