**4.1.2 Area**

The area of an object is defined as the space between a region, in other words, the sum of all pixels that form the object, which can be defined by equation (2):

$$\mathbf{A} = \begin{array}{c} \Sigma\_{\text{i}} \ \Sigma\_{\text{j}}\text{pixels (i, j)} \in \text{form} \end{array} \tag{2}$$

## **4.1.3 Centroid**

The centre of mass of an arbitrary shape is a pair of coordinates (Xc, Yc) in which all its mass is considered concentrated and on which all the resultant forces are acting on. In other words it is the point where a single support can balance the object. Mathematically, in the discrete domain, the centroid is defined as:

$$\mathbf{Xc} = \frac{1}{\mathbf{A}} \boldsymbol{\Sigma}\_{\mathbf{x}, \mathbf{y}} \mathbf{j} \quad \text{ Yc} = \frac{1}{\mathbf{A}} \boldsymbol{\Sigma}\_{\mathbf{x}, \mathbf{y}} \mathbf{i} \tag{3}$$

where A is obtained from eq. (2)

114 Advances in Object Recognition Systems

First found pixel

A nearer pixel to the boundary is any pixel surrounded mostly by black pixels in 8-

A farther pixel to the boundary is any pixel that is not surrounded by black pixels in 8-

The highest and lowest coordinates are the ones that create a rectangle (Boundary Box).

If the new coordinates are higher than the last higher coordinates, the new values are

If the new coordinates are lower than the last lower coordinates, the new values are

Steps 1 to 5 are repeated until the procedure returns to the initial point, or no other nearer

This technique will surround any irregular shape very fast, and will not process useless

The area of an object is defined as the space between a region, in other words, the sum of all

The centre of mass of an arbitrary shape is a pair of coordinates (Xc, Yc) in which all its mass is considered concentrated and on which all the resultant forces are acting on. In other

� � ∑ ∑� � pixels �i, j� ∈ form (2)

pixels that form the object, which can be defined by equation (2):

The search algorithm executes the following procedures once it has found a white pixel:

Searches for the nearer pixel to the boundary that has not been already located. Assigns the label of actual pixel to the nearer pixel to the boundary recently found.

Fig. 1. Perimeter calculation of a workpiece.

Paints the last pixel as a visited pixel.

assigned to the higher coordinates.

assigned to the lower coordinates.

pixel to the boundary is found.

pixels of the image.

**4.1.2 Area** 

**4.1.3 Centroid** 

connectivity.

connectivity.

The next definitions are useful to understand the algorithm:

#### **4.2 Generation of descriptive vector (BOF)**

The generation of the descriptive vector called The Boundary Object Function (BOF) is based on the Euclidean distance between the object's centroid and the contour. If we assume that P1(X1, Y1) are the centroid coordinates (XC , YC) and P2(X2, Y2) is a point on the perimeter, then this distance is determined by the following equation:

$$\text{d}\{\mathbf{P}\_1, \mathbf{P}\_2\} = \sqrt{(\mathbf{X}\_2 - \mathbf{X}\_1)^2 + (\mathbf{Y}\_2 - \mathbf{Y}\_1)^2} \tag{4}$$

The descriptive vector (BOF) in 2D contains the distance calculated in eq. (4) for the whole object's contour. The vector is composed by 180 elements where each element represents the distance data collected every two degrees. The vector is normalized by dividing all the vector elements by the element with maximum value. Figure 2 shows an example where the object is a triangle. In general, the starting point for the vector generation is crucial, so the following rules apply: the first step is to find the longest line passing through the centre of the piece, as shown in Figure 2(a), there are several lines. The longest line is taken and divided by two, taking the centre of the object as reference. Thus, the longest middle part of the line is taken as shown in Figure 2(b) and this is taken as starting point for the BOF vector descriptor generation as shown in Figure 2(c). The object's pattern representation is depicted in Figure 2(d).

Fig. 2. Example for the generation of the BOF vector.

#### **5. Object's form**

The use of shading is taught in art class as an important cue to convey 3D shape in a 2D image. Smooth objects, such as an apple, often present a highlight at points where a reception from the light source makes equal angles with reflection toward the viewer. At the same time, smooth object get increasingly darker as the surface normal becomes perpendicular to rays of illumination. Planar surfaces tend to have a homogeneous appearance in the image with intensity proportional to the angle between the normal to the

The Use of Contour, Shape and Form in an Integrated Neural Approach for Object Recognition 117

If the normals satisfy the recovered reflectance equation of the image, then these normals

The first step is to calculate the surface normals which are calculated using the gradient of

Since the normals are perpendicular to the tangents, the tangents can be found by the cross product, which is parallel to (-p, -q, 1) T. Then we can write for the normal expression:

Smoothing, in few words can be described as avoiding abrupt changes between normal and adjacent. The Sigmoidal Smoothness Constraint makes the restriction of smoothness or regularization, forcing the error of brightness to satisfy the matrix rotation θ, deterring

With the normal smoothed, then the next step is to rotate these normals so that they lie in

∂x

∂I ∂y� �

�p� � q� � 1 ��p� �q�� (7)

(6)

�I � �p q�� � �∂I

1

Where [p q] are used to obtain the gradient and are known as Sobel operators.

� �

Assuming that z component of the normal to the surface is positive.

sudden changes in direction of the normal through the surface.

must fall on their respective reflectance cones.

the image (I), as shown in equation (6).

**5.3 Smoothness and rotation** 

the reflectance cone as shown in Figure 4.

Fig. 4. Normals rotation within the reflectance cone.

**5.1 Image's gradient** 

**5.2 Normals** 

plane and the rays of illumination. In other words, the Shape From Shading algorithm (SFS) is the process of obtaining three-dimensional surface shape from reflection of light from a greyscale image. It consists primarily of obtaining the orientation of the surface due to local variations in brightness that is reflected by the object, and the intensities of the greyscale image is taken as a topographic surface.

In the 70's, Horn formulated the problem of Shape From Shading finding the solution of the equation of brightness or reflectance trying to find a single solution (Horn, 1970). Today, the issue of Shape from Shading is known as an ill-posed problem, as mentioned by Brooks, causing ambiguity between what has a concave and convex surface, which is due to changes in lighting parameters (Brooks, 1983). To solve the problem, it is important to study how the image is formed, as mentioned by Zhang (Zang, et al., 1999). A simple model of the formation of an image is the Lambertian model, where the grey value in the pixels of the image depends on the direction of light and surface normal. So, if we assume a Lambertian reflection, we know that the direction of light and brightness can be described as a function of the object surface and the direction of light, and then the problem becomes a little simpler.

The algorithm consists in finding the gradient of the surface to determine the normals. The gradient is perpendicular to the normals and appears in the reflectance cone whose centre is given by the direction of light. A smoothing operation is performed so that the normal direction of the local regions is not very uneven. When this is performed, some normals still lie outside of the normal cone reflectance, so that it is necessary to rotate them to place these normals within the cone. This is an iterative process to finally obtain the kind of local surface curvature.

The procedure is as follows, first the light reflectance E in (i, j), is calculated using the expression:

$$\mathbf{E} \text{ (i,j)} = \mathbf{n}\_{\mathbf{i},\mathbf{j}}^{\mathbf{k}} \cdot \mathbf{s} \tag{5}$$

where: S is the unit vector for the light direction, and the term n�,� � is the normal estimation in the Kth iteration. The reflectance equation of the image is defined by a cone of possible normal directions to the surface as shown in Figure 3 where the reflectance cone has an angle of cos-1(E(i,j)).

Fig. 3. Possible normal directions to the surface over the reflectance cone.

If the normals satisfy the recovered reflectance equation of the image, then these normals must fall on their respective reflectance cones.

#### **5.1 Image's gradient**

116 Advances in Object Recognition Systems

plane and the rays of illumination. In other words, the Shape From Shading algorithm (SFS) is the process of obtaining three-dimensional surface shape from reflection of light from a greyscale image. It consists primarily of obtaining the orientation of the surface due to local variations in brightness that is reflected by the object, and the intensities of the greyscale

In the 70's, Horn formulated the problem of Shape From Shading finding the solution of the equation of brightness or reflectance trying to find a single solution (Horn, 1970). Today, the issue of Shape from Shading is known as an ill-posed problem, as mentioned by Brooks, causing ambiguity between what has a concave and convex surface, which is due to changes in lighting parameters (Brooks, 1983). To solve the problem, it is important to study how the image is formed, as mentioned by Zhang (Zang, et al., 1999). A simple model of the formation of an image is the Lambertian model, where the grey value in the pixels of the image depends on the direction of light and surface normal. So, if we assume a Lambertian reflection, we know that the direction of light and brightness can be described as a function of the object

The algorithm consists in finding the gradient of the surface to determine the normals. The gradient is perpendicular to the normals and appears in the reflectance cone whose centre is given by the direction of light. A smoothing operation is performed so that the normal direction of the local regions is not very uneven. When this is performed, some normals still lie outside of the normal cone reflectance, so that it is necessary to rotate them to place these normals within the cone. This is an iterative process to finally obtain the kind of local

The procedure is as follows, first the light reflectance E in (i, j), is calculated using the

� ∙ s (5)

� is the normal estimation in

E �i, j� � n�,�

the Kth iteration. The reflectance equation of the image is defined by a cone of possible normal directions to the surface as shown in Figure 3 where the reflectance cone has an

where: S is the unit vector for the light direction, and the term n�,�

Fig. 3. Possible normal directions to the surface over the reflectance cone.

surface and the direction of light, and then the problem becomes a little simpler.

image is taken as a topographic surface.

surface curvature.

angle of cos-1(E(i,j)).

expression:

The first step is to calculate the surface normals which are calculated using the gradient of the image (I), as shown in equation (6).

$$\mathbf{V}\mathbf{I} = \begin{bmatrix} \mathbf{p} \ \mathbf{q} \end{bmatrix}^{\mathrm{T}} = \begin{bmatrix} \frac{\partial \mathbf{I}}{\partial \mathbf{x}} \ \frac{\partial \mathbf{I}}{\partial \mathbf{y}} \end{bmatrix}^{\mathrm{T}} \tag{6}$$

Where [p q] are used to obtain the gradient and are known as Sobel operators.

#### **5.2 Normals**

Since the normals are perpendicular to the tangents, the tangents can be found by the cross product, which is parallel to (-p, -q, 1) T. Then we can write for the normal expression:

$$\mathbf{n} = \frac{1}{\sqrt{\mathbf{p}^2 + \mathbf{q}^2 + 1}} \left( -\mathbf{p}, -\mathbf{q} \right)^T \tag{7}$$

Assuming that z component of the normal to the surface is positive.

#### **5.3 Smoothness and rotation**

Smoothing, in few words can be described as avoiding abrupt changes between normal and adjacent. The Sigmoidal Smoothness Constraint makes the restriction of smoothness or regularization, forcing the error of brightness to satisfy the matrix rotation θ, deterring sudden changes in direction of the normal through the surface.

With the normal smoothed, then the next step is to rotate these normals so that they lie in the reflectance cone as shown in Figure 4.

Fig. 4. Normals rotation within the reflectance cone.

The Use of Contour, Shape and Form in an Integrated Neural Approach for Object Recognition 119

With binocular vision, the vision system is able to interact in a three-dimensional world coping with volume and distance within the environment. Due to the separation between both cameras, two images are obtained with small differences between them; such differences are called disparity and form a so-called disparity map. The epipolar geometry describes the geometric relationships of images formed in two or more cameras focused on a

The most important elements for this geometric system as illustrated in figure 7 are: the epipolar plane, consisting of the pole (P) and two optical centres (O and O') from two chambers. The epipoles (e and e') are the virtual image of the optical centres (O and O'). The baseline, that join the two optical centres and epipolar lines (l and l'), formed by the intersection of the epipolar plane with both images (ILEFT and IRIGHT) connects the

Epipolar line is crucial in stereoscopic vision, because one of the most difficult parts in stereoscopic analysis is to establish the correspondence between two images, mating stereo,

The epipolar constraint allows you to narrow the search for stereoscopic, correspondence of

IRIGHT

*p'*

*l'*

*e'*

One way to further simplify the calculations associated with stereoscopic algorithms is the use of rectified images; that is, to replace the images by their equivalent projections on a common plane parallel to the baseline. It projects the image, choosing a suitable system of coordinates, the rectified epipolar lines are parallel to the baseline and they are converted to

O O'

In the case of rectified images, given two points p and p', located on the same line of exploration the left image and right image, with coordinates (u, v) and (u', v'), the disparity

deciding which point in the right image corresponds to which on the left.

two-dimensional (whole image) to a search in a dimension on the epipolar line.

P

**6. Histogram of disparity map (depth)** 

epipoles with the image of the observed points (p, p').

*p*

*l*

 *e*

Fig. 7. Elements of epipolar geometry.

ILEFT

single-line exploration.

point or pole.

Where n��� � are the smoothed normals, n��� �� are the normals after the smoothness and before the rotation, and n��� ��� are the normals after a rotation of θ degrees. The smoothness and rotation of the normals involve several iterations represented by the letter k.
