**7. Ellipse reconstruction algorithm using artificial image**

To test the algorithm with various image types, the authors have created a two dimension (2-D) image as given in Figure (22) using Adobe Photoshop with its axis of symmetry of a half-length A=0 (to model it as a disc) and degenerate axes of a half-length, B=48. The objective is to determine the position of the centre of the disc reconstructed from the reconstruction algorithm and to compare it with the known centre position determined by the Bounding Ellipse Algorithm. The ellipse created has a position of q = (168.5469, 140.0172).The image generated is 494x494 pixels. The image plane ellipse determined by the Bounding Ellipse algorithm is described as:

**a** = 133.998 pixels **b** = 48.934 pixels Xc = 168.5469 pixels Yc = 140.0172pixels omegha degrees, ω = -0.0017 degrees

514 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

Previously, there were quite a number of craters detection algorithms using Hough Transform especially using circular features detection as proposed by E.Johnson, A.Huertas, A.Werner and F.Montgomery in their paper [7]. As emphasized above, a camera will capture an ellipse if the image is taken from a certain angle and certain distance relative to the moon's surface. An ellipse will have five dimensions that have to be considered in the Hough algorithm when detecting shapes. An ellipse is more complicated to be detected than a circle because a circle just has 3 dimensions to be considered. It will certainly have a complex codes hence will take a longer time to construct. That is the reason why the authors have created an uncomplicated and robust algorithm in detecting hazards mainly craters on

To test the algorithm with various image types, the authors have created a two dimension (2-D) image as given in Figure (22) using Adobe Photoshop with its axis of symmetry of a half-length A=0 (to model it as a disc) and degenerate axes of a half-length, B=48. The objective is to determine the position of the centre of the disc reconstructed from the reconstruction algorithm and to compare it with the known centre position determined by the Bounding Ellipse Algorithm. The ellipse created has a position of q = (168.5469, 140.0172).The image generated is 494x494 pixels. The image plane ellipse determined by the

**Figure 21.** Edge Detection using 'canny' detector

the moon's surface for easy implementation.

Bounding Ellipse algorithm is described as:

**7. Ellipse reconstruction algorithm using artificial image** 

**Figure 22.** Artificial Image in 2-D created using Adobe Photoshop

To centralize the coordinate system and scale the image, it requires a translation of half of the image dimensions. The reconstruction algorithm is then used to determine the position and orientation of the modelled disc after taking into account the camera's parameter as below:

*Xc* = (Xcimage – 247)/494 *Yc* = (Ycimage – 247)/494 *a* (semi major axis) = **a**image/494 *b* (semi minor axis) = **b**image/494

The ellipses generated in Figure (23) above will undergo the same process as the authors performed on the real image (optical) previously using the same method of detection. For the reconstruction results, the authors will be judging two planes namely plane y and plane z to determine the position of the disc reconstructed. This is because, as being set in the algorithm, the centre coordinate of the 2-D plane is at [Zc,Yc]. Thus, the results of the position of the disc will be analyzed in two dimensions only namely Zc and Yc. This reconstructed position will be compared with the centroid's position calculated by the bounding ellipse algorithm. At the end of the experiment, the results from the reconstructed algorithm are satisfactory and similar to the results from the bounding ellipse algorithm. The positional error evaluated for both two solutions are shown in the table below. The one which has a low error will be taken as a true position. As can be seen in the results below, the positional errors are quite high from both solutions that are 8.8722 and 8.8715. Therefore, the authors take the solution 2 as a disc reconstructed position.

**Figure 23.** Artificial image of ellipse processed using minimum bounding ellipse with Khachiyan Algorithm

The positional errors are evaluated as shown in Table (3) below. Unlike before, the causes of the errors in the disc position are something similar to what were discussed in the previous 4.1.2.4 section. The positional error can be in any circumstances such as pixellation, the bounding ellipse algorithm error, MATLAB rounding figures as described before, uncertainties from the hardware and the like. These are the reasons why the authors tend to have quite a high number of errors on the position determination part. Besides, when the authors have the ellipse that is too eccentric, both the outputs of the reconstruction algorithm will become complex.

The ellipse bounding algorithm also has an error in bounding the targeted patch. As can be seen in the Figure (26) above, the targeted ellipse is not totally bounded by the red lines and this will affect the output of the image plane ellipse parameter such as semi major axis and semi minor axis. Hence, these parameters will also affect the output of the reconstruction algorithm and will cause errors in the disc's position. In practice, the way to overcome this problem is by reducing the eccentricity of the image plane ellipse or by increasing the eccentricity of the spheroid to be reconstructed. The results of this disc reconstruction algorithm are shown in the table below:


**Table 1.** Reconstruction algorithm results for disc position tested in artificial image

As for the orientation part, the authors will take the positive one which has to be (1.0000, 0.0038, 0.0016) similar to those in the real optical image. As discussed before, the orientations for the crater will only be seen if they are orientated upwards (positive values) rather than downwards (negative values). Therefore, after taking into account the above condition, the authors can eliminate the negative orientation. Further, the evaluation of error in the orientation part is similar to the one with the real image as discussed in previous section.
