View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

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



Daniel Lopes (view profile)


20 Jun 2007 (Updated )

Draws line segments on a image matrix.

| Watch this File

File Information

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.


This file inspired Line Phantoms For Back Projection Detectability Tests.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
14 Dec 2009 Sujeet

Sujeet (view profile)

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..

05 May 2009 B Treeby

Useful function, thank!

Comment only
05 May 2009 B Treeby

20 Aug 2008 Stephen blo

Does not draw conected lines.
Line Points are not all connected.

Warning: Divide by zero.
> In drawline at 148

04 Jun 2008 Shawn L

works great. Thanks for saving me some time!

20 Feb 2008 Ze Ji

useful for me, thanks

12 Jan 2008 ali ali

good work

23 Jul 2007 Olivier Salvado

it works...

Contact us