In MATLAB Write a class that implements a 2D line segement t

In MATLAB:

Write a class that implements a 2-D line segement;

the class has the following propoerties: End-point location in 2D space

Line Color

and methods: display the line in 2D space

rotate the line by an angle given as parameter

Demonstrate the functionality of your class by generating 20 random lines in a graphics window and rotate them

Solution

h = fspecial(type, parameters) accepts the filter specified by type plus additional modifying parameters particular to the type of filter chosen. If you omit these arguments, fspecial uses default values for the parameters.

The following list shows the syntax for each filter type. Where applicable, additional parameters are also shown.

h = fspecial(\'average\', hsize) returns an averaging filter h of size hsize. The argument hsize can be a vector specifying the number of rows and columns in h, or it can be a scalar, in which case h is a square matrix. The default value for hsize is [3 3].

h = fspecial(\'disk\', radius) returns a circular averaging filter (pillbox) within the square matrix of size 2*radius+1. The default radius is 5.

h = fspecial(\'gaussian\', hsize, sigma) returns a rotationally symmetric Gaussian lowpass filter of size hsize with standard deviation sigma (positive).hsize can be a vector specifying the number of rows and columns in h, or it can be a scalar, in which case h is a square matrix. The default value for hsize is [3 3]; the default value for sigma is 0.5. Not recommended. Use imgaussfilt or imgaussfilt3 instead.

h = fspecial(\'laplacian\', alpha) returns a 3-by-3 filter approximating the shape of the two-dimensional Laplacian operator. The parameter alpha controls the shape of the Laplacian and must be in the range 0.0 to 1.0. The default value for alpha is 0.2.

h = fspecial(\'log\', hsize, sigma) returns a rotationally symmetric Laplacian of Gaussian filter of size hsize with standard deviation sigma (positive).hsize can be a vector specifying the number of rows and columns in h, or it can be a scalar, in which case h is a square matrix. The default value for hsize is [5 5] and 0.5 for sigma.

h = fspecial(\'motion\', len, theta) returns a filter to approximate, once convolved with an image, the linear motion of a camera by len pixels, with an angle of theta degrees in a counterclockwise direction. The filter becomes a vector for horizontal and vertical motions. The default len is 9 and the default theta is 0, which corresponds to a horizontal motion of nine pixels.

To compute the filter coeffici

In MATLAB: Write a class that implements a 2-D line segement; the class has the following propoerties: End-point location in 2D space Line Color and methods: di

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site