Code covered by the BSD License  

Highlights from
drawline

4.28571

4.3 | 7 ratings Rate this file 30 Downloads (last 30 days) File Size: 3.05 KB File ID: #15374

drawline

by Daniel Lopes

 

20 Jun 2007 (Updated 06 Nov 2007)

Draws line segments on a image matrix.

| Watch this File

File Information
Description

DRAWLINE Returns the geometric space (matrix indices) occupied by a line segment in a MxN matrix. Each line segment is defined by two endpoints.

IND = DRAWLINE(P1, P2, IMAGE_SIZE) returns the matrix indices of the line segment with endpoints p1 and p2. If both points are out of the image boundary no line is drawn and an error will appear. If only one of the endpoints is out of the image boundary a line is still drawn.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
23 Jul 2007 Olivier Salvado

it works...

12 Jan 2008 ali ali

good work

20 Feb 2008 Ze Ji

useful for me, thanks

04 Jun 2008 Shawn L

works great. Thanks for saving me some time!

20 Aug 2008 Stephen blo

Does not draw conected lines.
Line Points are not all connected.
 
Warning: Divide by zero.
> In drawline at 148

05 May 2009 B Treeby  
05 May 2009 B Treeby

Useful function, thank!

14 Dec 2009 Sujeet

is there anyway I could draw a thick white line using this command? since, the line is too thin, I was not able to detect it using houghs transform.. pls help. thanks in advance..

Please login to add a comment or rating.
Updates
06 Nov 2007

Daniel Drucker spotted a bug.

"Line 62 should read:
for line_number = 1:size(p1,1)
Otherwise, it fails when there is only one point in p1 and p2."

It has now been corrected!

Tag Activity for this File
Tag Applied By Date/Time
annotation Daniel Lopes 22 Oct 2008 09:16:41
customization Daniel Lopes 22 Oct 2008 09:16:41
line Daniel Lopes 22 Oct 2008 09:16:41
label Daniel Lopes 22 Oct 2008 09:16:41
image Daniel Lopes 22 Oct 2008 09:16:41
draw Daniel Lopes 22 Oct 2008 09:16:41
annotation Wenjia 22 May 2009 10:51:21

Contact us at files@mathworks.com