You are on page 1of 7

Chapter 3

Software:

This chapter describes the software portion of project all the algorithms which are used in this project
are explained in this chapter. The code of each algorithm is present in appendixes.

Image is taken using Openmv M4 cam and stored in 32x32 16-bit array. To increase the SNR multiple
images can be taken and summed to array. To compensate the difference in amplifier gain in each row
the image is calibrated by taking values from column 32. 2 x 31 array is produced after running the edge
detection algorithm with contains the edge pixel coordinates.

The pitch and roll values can be calculated from a straight line which is produced by using the edge
points from edge coordinates.

The figure 3.1 explains the running of project.

Figure 3.1

Edge detection[*]

An edge is set of connected pixels that lie on the boundary between two regions. An ideal edge is when
transition from one region to the other is a step in the grey-level profile from one pixel to the other as
shown in the figure 3.2. For the majority of edges in practice the transition will occur over a set of pixels
having a ‘ramp like’ gray-level profile. The edge will be sharper when the length of the slope is shorter
and a thicker or blurred edge will occur when the slop is longer[*].
Figure 3.2 difference between real and ideal edge

Edge detection algorithms:

lot of edge detection algorithms exist in nature which include:

 Roberts
 Canny
 Prewitt
 Sobel
 Marr-hildreth
 Zero-crossing

Each method has its own merits and demerits. These methods are explained in [*],[*] and [*] . The
algorithm which we will follow in our design is very similar to other algorithms used in ([*],[*]). The
process of edge detection is described with the help of flow diagram shown in figure 3.3.
Figure 3.3

Figure 3.4: pixel mapping


Line Fitting

Two techniques were considered for finding the line corresponding to detected edges.

 Hough transforms
 Least square method

General condition for straight line

y = mx + c

Hough Transform

“Any point (x,y) produce an infinite number of lines that pass through it and satisfy the straight line
equation.”

Because of defects in either the picture information or the detected edges, there might miss focuses or
pixels on the ideal curve and in addition spatial deviations between the perfect line/circle/oval and the
boisterous edge points as they are acquired from the edge locator. Therefore, it is regularly non-minor
to group the removed edge highlights to a fitting arrangement of lines. The reason for the Hough change
is to address this issue by making it conceivable to perform groupings of edge focuses into protest
hopefuls by playing out an express voting system over an arrangement of parameterized picture objects.

Detecting a line is the simplest way of Hough transform

Least square method

It’s less complex and less time consuming as compared to the Hough transform. The Least Square
Method relies upon the data point Ax and the first fit b, so the difference between the information point
and the first fit.

Error = Ax-b

Figure 3.4: Regression analysis

The flow diagram, for line filling algorithm is shown in figure 3.5.
Figure 3.5

Pitch and roll calculation[*]

The pitch and roll can be calculated from the position of line relative to the image’s boresight. The pitch
and roll is illustrated in figure 3.6.
Figure 3.6

The roll angle is the angle between the boresight vertical and a line perpendicular to the straight line
through the origin. The pitch of the straight line is perpendicular distance from the straight line to the
origin.

These values can be calculated using following equations

The follow diagram of algorithm is show below in figure 3.7.


Figure 3.7

You might also like