Be the first to rate this file! 7 Downloads (last 30 days) File Size: 1.73 KB File ID: #25370
image thumbnail

Draw an angled line, with a slope relative to a reference point.

by Elad

 

20 Sep 2009 (Updated 02 Oct 2009)

Draw a line at an angle in degrees which goes through a reference point inputted as an argument.

| Watch this File

File Information
Description

function [yline xline] = drawslope(I, alpha, refpoint)
%
% function to draw a line at a desired angle <alpha>,
% which goes through a reference point <refpoint>
% function inputs:
% <I>: Image for which the drawing is desired.
% Range:3Dim, grayscale, or logical
% <alpha>: Angle in degrees, where 0 is complete
% horizontal
% Range: -Inf - +Inf (cyclic after +
% (-) 180 degrees of course)
% <refpoint> : Reference interception point with the slope
% Range: A varaible of size 2x1, where
% refpoint(1) is horizontal and (2) is vertical
% function outputs:
% <yline> : Y axis coordinates of both line ends
% <xline>: X axis coordinates of both line ends
%
% outputs should be used with plot
% function as following:
% plot(yline,xline,...plot specifiers)
%
% Example usage:
% Image = imread('someImage');
% image_centroid = [100 240];
% [yline xline] = drawslope(Image, -60, image_centroid);
% imshow(Image);
% hold on;
% plot(yline, xline, 'blue','LineWidth',2);
%
%
% Written by Elad Boneh, 15.8.2009
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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.
Please login to add a comment or rating.
Updates
02 Oct 2009

Description.

Tag Activity for this File
Tag Applied By Date/Time
draw Elad 21 Sep 2009 11:52:33
plot Elad 21 Sep 2009 11:52:33
line Elad 21 Sep 2009 11:52:33
angle Elad 21 Sep 2009 11:52:33
slope Elad 21 Sep 2009 11:52:33
reference point Elad 21 Sep 2009 11:52:33
image Elad 21 Sep 2009 11:52:33
straight Elad 21 Sep 2009 11:52:33

Contact us at files@mathworks.com