Object Shape Detection - Part 12: Shape Detection (Quadrangle/Hexagon/Pentagon)
by Yifei Zhou
4.3.2 Quadrangle
Compared with triangle, the detection of quadrangle might be more complicated. The reason is due to the diversity of categories of quadrangle. For polygons, with the increasing number of sides, the features and properties will be more complicated respectively. In my project, as for quadrangles, I mainly focus on the detection of parallelogram and trapezoid. As a matter of fact, I could classify a polygon with their concavity and convexity. For the general quadrangle, just check whether the total number of edges is 4.
First of all, the table 4.4.3 gives some general definitions and related terms about quadrangle.
Parallel postulate: (alternate interior angle theorem) (Transversal n.d.): In 2D-dimentional space, if two sides are cut out by the third side as example shown in figure 4.3.8, sides AB and CD are cut out by E, and it will generate two angles, 1 and 2 which are called alternate interior angles. In case that 1 and 2 are equivalent in value, thus, AB and CD are parallel. | |
Parallelogram: In 2D-dimentional space, a parallelogram mainly refers to a quadrangle with two pairs of parallel sides, and the length of opposite slides are equivalent (Byer et al. 2010). The picture 4.3.7 shows the structure of parallelogram. Basic definition: AB//DC and AD//BC. | |
The condition of Parallelogram: For example, as shown in figure 4.3.7, if AB = DC and AB // DC, ABCD would be a parallelogram. | |
The condition of Rectangle: For a parallelogram, there existing an angle with 90 degree (cf. Figure 4.3.24). | |
The condition of Rhombus: For a parallelogram, there existing a pair of adjacent sides are equivlant in length (cf. Figure 4.3.9) . | |
The condition of Square: The combination of Rectangle and Rhombus (cf. Figure 4.3.25). | |
Trapezoid: As for a quadrangle, there is only one opposite sides are parallel, and this quadrange is called as trapzoid (Gardiner and Bradley 2005) (cf. Figure 4.3.12). | |
Table 4.3.3 |
The figure 4.3.10 shows the process of the detection of parallelogram. In this example, for the sides AB and CD, two vectors v1 and v2 are created respectively. It might be easier to prove their lengths are equivalent. The tricky thing is how to prove the two pairs of opposite sides are parallel in terms of their positions. As I mentioned in section 4.3.1, vector acts an important role again that this not only avoid the complicated calculation but also get the effective solution for the problem. In this case, the cosine value of the angle between two vectors just need to be calculated, and then, I use acos function to restore the responding angle. If the angle less than 10 degree, this quadrangle could be treated as parallelogram approximately.
Figure 4.3.11: The result of detection of parallelogram |
In degree, more features can be added to filter the different types of shape, such as Rectangle, rhombus and square.
For the rectangle (cf. Figure 4.3.24), I just need to add a constrain condition that there is one angle which is equivalent to 90 degree. Similarly, for the rhombus (cf. Figure 4.3.9), I only need to add a constrain condition that there are two adjacent sides are equivalent in length. When it comes to square (cf. Figure 4.3.25), it could be treated as the junction of rectangle and rhombus. In other words, square is rhombus combining with the features of rectangle and vice versa.
The figure 4.3.12: Result of detection of rectangle and square. |
The picture 4.3.13 shows the detection process of Trapoid.
The figure 4.3.14 shows the result of detection of trapzoid from camrea capture.
Figure 4.3.14: The result of detection of Trapezoid |