Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How do I generate eight distinct shapes from a set of specified variables using MATLAB image processing?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Aim: To be able to generate eight distinct shapes from a set of specified variables using MATLAB image processing.
Your shape generator algorithm should be able to generate the following shapes:
1. Circle
(Input radius in pixels)
2. Square
(Input length of 1 side in pixels. Adjacent sides must be parallel to both borders of the image respectively)
3. Triangle
(Input length of base in pixels and both base angles in degrees. The base is associated with column span, which is parallel to the top border, and the apex of triangle must be located at a point above the base line)
4. Rectangle
(Input length of 2 adjacent sides in pixels. For display purposes the smaller value is associated with the row span and the larger values is associated with the column span. Adjacent sides must be parallel to both borders of the image respectively)
5. Pentagon
(Input length of 1 side in pixels. The base is associated with column span, which is parallel to the top border, and the apex of pentagon must be located at a point above the base line)
6. Hexagon
(Input length of 1 side in pixels. At least 2 sides must be parallel to the top and bottom borders of the image)
7. Ellipse
(Input length of semi-minor (rows) and semi-major (columns) axes in pixels. For display purposes the semi-minor axis is associated with the row span, and must be parallel to the left and right borders of the image, and the semi-major axis is associated with column span, and must be parallel to the top and bottom borders of the image)
8. Octagon
(Input length of 1 side in pixels. At least two sides must be parallel to the top and bottom borders of the image)
In addition to the input specifications described above, a colour must be attributed to every shape i.e. every shape must have an R, G and B value associated with it.
The final product/algorithm must output 2 separate images:
1. A binary (black and white) image with all the shapes in black and background in white. () a. Each shape must be located centrally within 8 square boxes of equal size (as shown below).
Circle Square Triangle Rectangle
Pentagon Hexagon Ellipse Octagon
The dimensions of all the square boxes must be equal. The inner length of one side of these boxes are calculated by firstly determining the shape with the largest width (column span) then adding 40 pixels to this width i.e. if the shape with the largest width is the ellipse then the inner length of the square (bounding) box around the ellipse will have a value of the pixel length of the major axis of the ellipse plus 40 pixels. N.B. The shape with the largest width is not necessarily the largest shape. For display purposes the width of the borders of these boxes must be 4 pixels i.e. there will be an inner length and outer length for the box such that the border width is equal to the outer length minus the inner length. As a numerical example, if the largest width of all the shapes is 173 pixels then each square box will have an inner length of 213 pixels and an outer length of 221 pixels; and the width of the entire image will be 884 pixels and the height will be 442 pixels. The border of these boxes must be black, since the background is white.
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!