To thoroughly investigate image processing algorithms, such as in Section 6, a simulation program was written in MATLAB to create low-resolution images of the horizon. These images accurately represent the location and shape of the horizon while maintaining the ability to simulate different noise levels. The profile of the simulated horizon has two settings in order to simulate the expected high contrast horizon edge in space (see Figure 3.5), or the low contrast edge during ground testing setup (see Figure 3.7). This simulation does not take lens distortion into account as it is only intended to evaluate feature extraction techniques. The steps taken to create the simulated horizon are shown in Figure 3.17.
Start Determine disc parameters
Find edge pixel on image edge Determine edge pixel intensity Reached other image edge? Find neighbouring edge pixel No Fill remaining Earth pixels
Edge smoothing Add noise
End Yes Yes No Ground test simulation?
Figure 3.17: Flowchart depicting steps used to create simulated horizon
The simulated image is created by first calculating an expression for the expected Earth disc shape (Section 3.6.1). The intersection between this shape and the edge of the image plane is then determined (Section 3.6.2), and on this location the first edge pixel’s intensity is calculated (Section 3.6.3). This pixel’s neighbouring edge pixel is then found by following the line created by the Earth disc, after which the neighbouring pixel’s intensity is calculated. This process is repeated dynamically until the opposing image plane limit is reached. The created low resolution image is then blurred to smooth the edge (Section 3.6.4) when simulating a ground test environment, and lastly noise is added (Section 3.6.5).
3.6.1 Determining Disc Parameters
As stated in Section 3.1, the Earth is assumed to be a perfect sphere and therefore the visible Earth disc will always be circular in shape. The visible Earth disc, at an elevation φ and rotation θ, is described by:
(x − x0)2+ (y − y0)2= rp2 (3.16)
3.6.2 Intersection Determination between Rectangle and Disc
When determining the Earth disc’s intersection with the image plane limits (or individual pixel borders), the problem is simplified by determining the intersection between a circle and a rectangle. This is done by attempting to find the circle’s intersection on each of the rectangle’s four sides. With each of the rectangle’s sides, the x or y value is known thus eliminating an unknown from Eq 3.16.
Assuming the rectangle’s top side is described by a line y = yr, the intersection (xi, yi) between the disc and
this line is determined by solving the quadratic equation as shown in Eq. 3.17.
xi = ±
q
r2
p− (yr− y0)2+ x0 (3.17)
The same is done for the rectangle’s ride side, for example. Assuming this side is described by x = xr, the
intersection (xi, yi) is determined by solving Eq. 3.18
yi= ±
q
r2
p− (xr− x0)2+ y0 (3.18)
However, Eq. 3.17 and 3.18 will result in two possible solutions. Therefore, the assumption is made that only one intersection will occur within the rectangle’s range as the disc is significantly larger than the rectangle.
3.6.3 Determining Edge Pixel Intensity
Determining the edge pixel intensity P was achieved by determining the ratio between the pixel area covered by the disc and the total pixel area, as shown in Eq. 3.19.
P = Adisc
Apixel
(3.19)
The area covered by the disc (Adisc) is calculated by approximating the disc’s intersection with a straight
line. This is done by first determining the disc’s intersections with the pixel by utilising the method described in Section 3.6.2, and then creating a straight line between the two intersections, as depicted in Figure 3.18.
This straight line approximation is sufficient, as the disc is significantly larger than the pixel meaning that
the intersecting line resembles a straight line. The area covered by the disc (Adisc) is then calculated using
conventional area formulas for rectangles and trapezoids. This results in each pixel in the simulated image will having an intensity between 0 and 1.
3.6.4 Edge Smoothing
Figure 3.19a shows the high contrast edge which sufficiently simulates the expected space conditions. Figure 3.7 in Section 3.3.2, shows that ground test conditions created a lower contrast edge, and therefore the simulated edge needs to be modified to fit this behaviour. The edges shown in Figure 3.19 are of an Earth disc at a zero rotation and elevation depicting the high contrast and low contrast image. It is also clear that the disc only covers half of the middle pixel which is expected as there is an uneven number of pixel rows.
(a) High contrast space conditions (b) Blurred low contrast ground conditions
Figure 3.19: Examples of high and low contrast simulated edges
Lowering the contrast of the edge is achieved by blurring the simulated image, which lowers the contrast of the edge as shown in Figure 3.19b. A normalised 5x5 Gaussian Blur kernel is used, which is derived using Eq. 3.20 with a unit standard deviation (σ = 1). This smooths and extends the simulated edge to more accurately fit the expected image during ground testing conditions.
G(x, y) = 1
2πσ2e
−(x2+y2)/2σ2
(3.20)
3.6.5 Adding Noise
Gaussian noise is added to the images relative to the SNR specified. Gaussian noise is chosen as it accurately simulates the noise on the pixels, as seen in Section 3.3.2. The added noise is created with a zero mean and a standard deviation (σ) relative to the SNR (in dB), as shown in Eq. 3.21.
This results in a simulated image as shown in Figure 3.20, where a zero rotation and elevation is assumed and an SNR of 30 dB.
(a) Unmodified high contrast edge (b) Blurred low contrast edge (x = 0.5)
Figure 3.20: Example of simulated image of Earth disc section with added noise during ground test conditions