Structured Basic Geometry Shapes Engineering Essay

What is a form? Mathematician and statistician Kendall D.G. defined form as all the geometrical information that remains when graduated table, location and rotary motion effects are filtered out from an object. [ 1 ] Basic forms can be described by basic geometry forms which are structured, frequently symmetrical forms such as squares, circles, trigons, rectangles, Pentagons, hexagons, stars and ellipses.

Why is form of import? Very basic forms, such as circle, are what humankind first scrawled on cave walls. That is the first measure of originative look. Depending on epoch, civilization and personal position, circles may stand for get downing, gesture, life etc. Learning shapes is a necessary measure in kindergartner ‘s instruction. Learning forms helps kids to place objects every bit good as letters. For case, B, vitamin D, o etc. , are letters made up of circle. Pulling forms is the first measure in larning how to pull. Almost everything can be represented with simple form such as streets and edifices in a map or the operation for a flow chart. In short, foundations are of import.

In the field of computing machine vision, form acknowledgment is a chief and of import undertaking in acknowledging and placing forms so that computing machines can treat this information accurately.

Therefore, some algorithms were developed to obtain the objects ‘ belongingss such as country, margin and other parametric quantities. Presents, the computing machine is able to acknowledge the form with astonishing truth through series of algorithms and computations performed on the information. Assorted countries such as mark designation, industrial portion designation etc. has been found with form acknowledgment. For illustration, today ‘s automatons are designed to ‘think ‘ and can make about anything a human can make. The capablenesss of form acknowledgment are critical to these maps. Human maps of vision and knowledge demand to be basically simulated which could perplex the plans.

Basic form classifier fundamentally classifies forms like squares, circles, trigons, rectangles, Pentagons, hexagons, stars and ellipses. It is besides able to number the figure of same forms and place the coloring material of the forms.

Problem Statement

Acknowledge the difference between forms and larning the name of the different forms is two different things but it is an of import measure in kindergartner ‘s instruction. The names of forms need to be learned by kids so that they can be identified verbally and in authorship and how they are used.


The chief purpose of this undertaking is to develop an algorithm that is able to acknowledge basic forms such as squares, circles, trigons, rectangles, Pentagons, hexagons, stars and ellipses. In add-on, the algorithm is besides able to number the figure of same forms. It is besides able to place the coloring material of the forms.

Technical Aims

The plans must be able to acknowledge, categorise and number the figure of forms in the image. It besides must be able to categorise the coloring material of the forms identified.


This undertaking is tested with some images that contain assorted forms and colorss.

Chapter 2: Literature Reappraisal

2.1 Block Matching

Block fiting method uses the comparing of a templet to an image for correlativity. One possible correlativity map is defined in equation below.

The scene image can be correlated straight with a templet formed by a gray degree case of an object but the lucifer will be sensitive to fluctuations in illuming. This duplicate sensitiveness can be avoided by organizing templets from silhouetted cases of objects and correlating these with binary threshold images although in practise this lone transfers the illuming fluctuation job to the thresholding phase. A more principled method to better the hardiness of block fiting to illuming fluctuation is to correlate border enhanced object templets with border enhanced scene images. Block matching has no built-in invariability features. To recognize objects of different graduated tables and orientations a different templet is required for each case, whilst the job of positional variableness is avoided by the virtuousness that the correlativity map is applied across the whole image. Robustness to little degrees of random noise is another correlativity map characteristic. It provides some tolerance when fiting with noisy scene images.

2.2 Shape Skeleton

The skeleton of a binary form is obtained by repeatedly thinning until it becomes a unit pel breadth web. Figure below shows a sample form.

Figure1: Shape skeleton

The thought behind the skeleton attack to object acknowledgment is that most of the information about a peculiar form is limited within its topology. Object acknowledgment can be achieved utilizing form skeletons by pull outing form topologies from an image and happening a lucifer between this and any of the set of preparation set topologies. Thining schemes by and large work on the rule of depriving off consecutive beds of form boundary points on the status that the remotion of a point does non alter the connection of the form. When all acceptable points have been removed the form skeleton is left. Topological webs possess all of the invariant belongingss required of a general vision system although for most applications a strictly topological description is excessively equivocal and some structural restraints have to be added. These structural restraints may good compromise the invariability belongingss of the description. Thining algorithms are reasonably robust to random noise although in its presence may bring forth short goad, but these can be removed from the skeleton. By nature, thinning algorithms are sensitive to occlusion ( to a thinning algorithm an occluded form looks like a different form with different topology ) and in general acknowledgment strategies based on skeletons can non get by with occluded strategies.

2.3 Geometric Shape Forms

An arbitrary form, either in the signifier of a silhouette or a boundary, there are a few types of simple geometric methods which can be used to make a representation for that form. Examples of such methods include width, height, margin and country. The form form is constructed by concatenating a fixed figure of these steps to from a characteristic vector. Object acknowledgment can be achieved by comparing preparation set characteristic vectors with characteristic vectors extracted from a scene. The form under analysis must be located before any measurings can be taken. This removes any translational variableness but requires a suited cleavage strategy. Other invariability belongingss depend upon the types of measurings used to build the characteristic vector, for illustration margin and country measurings are invariant to rotary motion, ratios of breadths or lengths are invariant to scale. Generally, a appropriately descriptive characteristic vector which is constructed from a figure of different steps will non possess any invariability as a whole and scene variableness must be dealt with by standardization and form alliance techniques. Unfortunately, the demand for dependable standardization and alliance significantly weakens the method ‘s hardiness to resound and occlusion.

Chapter 3: Method

3.1 Overview

Shape acknowledgment requires a form description method. The aim of the description is to unambiguously separate the form.

The method used in this undertaking is a combination of acquiring the form belongingss and the furthest distance from the centroid of the object to its margin. Figure below shows an overall procedure of this undertaking.

3.2 Image Acquisition

In order to execute image processing, an image is required. Images are acquired by utilizing the map “ imread ” whose sentence structure is imread ( ‘filename ‘ ) . “ imshow ” is the bid to expose the image read whose sentence structure is imshow ( ‘filename ‘ ) and command “ figure ” , by itself, creates a new figure window to expose the following image read. Basically, “ figure ” is used to demo two different images in two different figure Windowss. E.g.

Img1 = imread ( ‘C: UsersBTDesktoppicasicshape.jpg ‘ ) ;

% reads the image and stored the informations in variable “ Img1 ”

Img2 = imread ( ‘C: UsersBTDesktoppic estimg5.jpg ‘ ) ;

% reads the image and stored the informations in variable “ Img2 ”

figure ; imshow ( Img1 ) ; % shows image in Figure1

figure ; imshow ( Img2 ) ; % shows image in Figure2

Figure: 1st image is shown in Figure 1 Figure: 2nd image is shown in Figure 2

3.3 Image Conversion

Binary images, besides known as black and white image, take merely two values, either 0 or 1, where 0 represents the background and 1 represents the object. Object belongingss can be easy extracted from a binary image such as centroid, country, margin, etc. “ im2bw ” produces binary images from grayscale images whose sentence structure is BW = im2bw ( grayImg, LEVEL ) . It converts grayscale image to binary by thresholding. With mention to LEVEL, the end product binary image BW will hold values of 1 ( white ) for all pels in the input image with luminosity greater than LEVEL and 0 ( black ) for all other pels. Note that the LEVEL is in the scope 0 to 1. E.g.

RGBimg = imread ( ‘basicshape.jpg ‘ ) ;

grayImg = rgb2gray ( RGBimg ) ;

BW = im2bw ( grayImg, 0.5 ) ;

figure ; imshow ( BW ) ;

figure ; imshow ( RGBimg ) ;

figure ; imshow ( grayImg ) ;

Figure: RGBimg Figure: grayImg Figure: Biological warfare

Therefore, RGB images must foremost be converted to grayscale images and so converted to binary image for object belongingss extraction.

3.4 Filtering

Noise normally exists in most images. Therefore, filtrating is a must. “ bwareaopen ” is one of it. It removes noises ( unwanted objects ) that have fewer than desired pels from a binary image. In a binary image, fundamentally a BW image, object has the value of 1 ( white ) and 0 ( black ) as the background. Below shows an illustration on how to take noise utilizing “ bwareaopen ” .

oriImg = imread ( ‘noisybasicshape.jpg ‘ ) ; % get image

grey = rgb2gray ( oriImg ) ; % convert RGB img to grayscale

biological warfare = im2bw ( gray,0.5 ) ; % convert img to BW with 0.5 luminosity degree

nbw = ~bw ; % invert 0 to 1 as object must has the value of 1

clearbw = bwareaopen ( nbw,50 ) ; % take object that has pixel less than 50

figure ; imshow ( oriImg ) ; % original RGB image with noise

figure ; imshow ( biological warfare ) ; % black and white image

figure ; imshow ( nbw ) ; % upside-down BW ( object must hold the value of 1 )

figure ; imshow ( clearbw ) ; % noise has been removed

Figure: oriImg Figure: bw Figure: nbw Figure: clearbw

3.5 Colour Cleavage

The aim of cleavage is to simplify the representation of an object into something easier to analyse. One of the of import factors for color cleavage is taking a proper coloring material theoretical account.

3.5.1 RGB coloring material infinite

All colorss can be made from combination of ruddy, green and bluish ( RGB ) which are the three primary linear colorss and normally shown diagrammatically as an RGB coloring material regular hexahedron in Fig below. For illustration, by adding ruddy and green together, the coloring material yellow will appears.

Degree centigrades: UsersBTDesktop
gb-cube2.jpg C: UsersBTDesktop200px-AdditiveColor.svg.jpg

3.5.2 HSV coloring material infinite

HSV ( chromaticity, impregnation, value ) colour infinite was designed based on the manner worlds perceive and interpret coloring material. The chromaticity represents coloring materials, while the impregnation the sum of color nowadays and value represent the elation in the brightness of the colorss. For illustration, “ a deep, bright purple ” would hold a high strength ( bright ) , a chromaticity of “ violet ” and a high value of impregnation ( deep ) . It is easy to visualize this coloring material, but if it is defined in footings of its RGB constituents, R=110, G=20, B=245, most people would hold no thought how this coloring material appears. HSV color infinite can be visualized as a cone shown in Fig. In the Hue circle, RGB are separated by 120 grades: ruddy = 0 grade, green = 120 grades and bluish = 240 grades. The perpendicular axis represents Value: whiteness ( v=1 ) and inkiness ( v=0 ) . Distance from the perpendicular axis to Hue circle represents Impregnation: sum of color nowadays ( s=0~1 ) .

Degree centigrades: UsersBTDesktopIC45291.jpg

Therefore, HSV coloring material infinite is chosen for this undertaking because of its easy-to-understand function between colorss as mentioned above. RGB image is converted to HSV image by utilizing MATLAB map, rgb2hsv, whose sentence structure is hsv_img = rgb2hsv ( rgb_img ) . Colour categorization depends on the H, S and V value. Table below shows how colorss are being classified.

Hue value

Coloring material

Hue value

14 & gt ;


& gt ; 225

15 & lt ;


& lt ; 31

32 & lt ;


& lt ; 51

52 & lt ;


& lt ; 96

97 & lt ;


& lt ; 141

142 & lt ;


& lt ; 171

172 & lt ;


& lt ; 194

195 & lt ;


& lt ; 224

Coloring material

“ Value ” value


& lt ; 20

Coloring material

Saturation Value


& lt ; 20

3.6 Determination of Shape Properties

Every form has its ain belongingss. Through these belongingss, form categorization can be done. “ regionprops ” measures a set of belongingss for object in a black and white image, BW. Shape measurings that are utile in form categorization are ‘BoundingBox ‘ , ‘Extent ‘ , ‘MajorAxisLength ‘ , ‘MinorAxisLength ‘ and ‘Eccentricity ‘ .

‘BoundingBox ‘ is the smallest rectangle incorporating the object. Figures below show illustration of ‘BoundingBox ‘ for circle, trigon and rectangle. The ruddy line is the BoundingBox.

‘Extent ‘ specifies the ratio of the object ‘s country divided by the country of the BoundingBox. As shown above, the extent of an ideal rectangle is peers to 1 because the country of the rectangle and the country of the BoundingBox are the same.

‘MajorAxisLength ‘ is the longest diameter of an oval while ‘MinorAxisLength ‘ is the shortest diameter of an oval.

‘Eccentricity ‘ is the ratio of the distance between the focal point of the oval and its major axis length. An oval whose eccentricity is 0 is really an ideal circle, while an oval whose eccentricity is 1 is a line section.

In short, an ideal square has extent of 1, has the same major axis length and minor axis length. As for ideal rectangles, they have extent of 1, different major axis length and minor axis length. An ideal circle has eccentricity of 0.

3.6.1 Distance between centroid and margin

This method gets all the distance from centroid to margin. For illustration, there will be 10 distance calculated if the margin = 10 pels. The expression used is

Distance = , where ( X1, Y1 ) is the co-ordinate for centroid and ( X2, Y2 ) is the co-ordinate for one of the margin ‘s pel. From Fig, the line in ruddy is one of the distance between centroid ( xanthous point ) and margin of the object. Circles in green are the four furthest distances calculated. A graph of distance versus margin is plotted after obtaining the distances. The extremums in the graph plotted shows the furthest distance between centroid and margin. By numbering the figure of extremums, we can clear up that the object has 4 borders. Therefore, the object form can be classified as square or rectangle.

Degree centigrades: UsersBTDesktopsqDis.jpgC: UsersBTDesktop4sqDesc.jpg

3.7 Shape Classification

Shapes are being classified after obtaining the form belongingss and the distance between centroid and margin of the shape/object. For illustration, the form that has the belongings of extent greater than 0.95, the ratio of minor axis length divided by major axis length is greater than 0.95 and has 4 extremums will be classified as square.

3.8 Shapes and Colours Count

A counter is written in the plan where it counts the figure of forms and coloring material identified. Whenever a form or coloring material is identified, the value of the counter will increase by 1. For illustration, when a blue square is identified, blueCnt = blueCnt+1, sqCnt = sqCnt+1, where blueCnt and sqCnt initial value is 0.

3.9 GUI ( Graphical User Interface )

The consequence of forms and colorss counted will be shown in the GUI.

Chapter 4: Consequence AND Discussion

4.1 Overview

Shapes and colorss of the objects identified are labelled and shown in GUI.

4.2 Consequence

First, chink on the “ Read Image ” button to get an image for form categorization. Figure below shows the location of the button in GUI.

Degree centigrades: UsersBTDesktop

Following, choose available image and snap “ Open ” . Example shown below.

Degree centigrades: UsersBTDesktop

The image chosen is displayed on the GUI. Next, chink on the “ Identify Shape ” button to treat the image selected.

Degree centigrades: UsersBTDesktop

The processed image and counts will be displayed on the GUI.

Degree centigrades: UsersBTDesktop

4.3 Discussion

Chapter 5: Decision

Chapter 6: Future Work

Chapter 7: Mentions

Kendall, D.G. ( 1984 ) . “ Shape Manifolds, Procrustean Metrics, and Complex Projective Spaces ” . Bulletin of the London Mathematical Society 16 ( 2 ) : Pg 81-121.

Rafael C. Gonzalez, Richard E. Woods, 2007, Digital Image Processing, 3rd Edition, Prentice Hall

Appendix A: Beginning Code

Appendix B: Gantt Chart