# Solved Matlab Task: Section 3 – Mars-242: Choosing a landing site

Section 3 – Mars-242: Choosing a landing site
All code for section 3 should be entered into the ﬁle *A2part3.m*. Make sure to include appropriate scaling and informative axis labels.
The Mars-242 crew must now identify a suitable site for their landing module. The surface-based rover has transmitted images of some areas it has scouted to the spaceship for human inspection. After all your eﬀorts to enable communication between the rover and the Spaceship (in section 1: Mars Rover), you now discover that, the transmission channel between the rover and the spaceship has introduced both periodic and bandlimited random noise to the signal stream. As you can see from the example image shown in Fig. 4 the noise has rendered the image useless for identifying any surface features.
Your task is to de-noise the images and recommend an appropriate landing site.
Figure 4: A corrupted image from the Mars exploration rover.
Images in MATLAB are stored as 2D matrices. Each element in the matrix represents a pixel of the image. The numeric value at each matrix index describes the colour intensity of each pixel. Matrix elements for grayscale images are ﬂoating point numbers between 0 and 1; which correspond to the colours black (zero intensity) and white (maximum intensity) respectively. You will be working with grayscale images in this assignment.
Even though the images are represented by 2D matrices, they are received as a 1D data stream. The ﬁrst received pixel is placed at the top left corner of the image. Subsequent pixels are used to ﬁll the image column-wise (top to bottom) from left to right (shown below). The size of the images being received are 480×640 pixels.
The received signals are provided in the rows of the matrix *sig.* There are 4 images received, and hence 4 signals, with the ﬁrst stored in the ﬁrst row of the matrix.
*NOTE:* For sections 3.1-3.10 only use the ﬁrst received image
3.1 View the noisy image – Display the ﬁrst image using the *imshow* function. You will need to ﬁrst convert the signal into a 2D matrix using *reshape*, ie. *imshow(reshape(sig(1,:), 480, 640)). *
3.2 Reference vectors – Image data is received from the rover at 1000 pixels/sec. Consider each pixel a single sample. Construct a time vector for the input signal (i.e. a single image) and store this in *t*. Create an appropriate frequency vector and store in *k*.
3.3 Visualise the received signal – Plot the ﬁrst received signal *(sig(1,:))* in both the time and frequency domains. Scale the time domain plot to show the ﬁrst 3 seconds of the signal. Designate the frequency domain data with capitals i.e *SIG*. Data in *SIG* should correspond with time domain data in *sig* i.e. row-wise. Identify (graphically) both the periodic and bandlimited random noise in both frequency domain plots. Ensure you state the approximate period of the periodic noise and the bandwidth of the bandlimited noise. (Rescale the plots if necessary).
The periodic noise in the image can be removed if it is accurately estimated. Engineers at mission control have identiﬁed a set of possible values for the period of the corrupting noise. These values are stored in the vector *candidateT*. Averaging the shape of the waveform for all periods will emphasise the noise component, smoothing away the underlying image into an oﬀset value. The function *estimateNoise.p* has been provided to you to perform this. It will return a vector one period long representing your periodic noise.
3.4 Estimate the periodic noise – Determine the period of the noise from the given options and store your selected value as *T*. The units for *T *should be seconds. Use *estimateNoise* to estimate the noise proﬁle and store the result in the variable *sigNoise*. The syntax for its usage is
*output = estimateNoise(inputSignal,periodInSamples)*
Plot and compare a periodic version *sigNoise* to the received signal *(sig(1,:))*, showing only the ﬁrst 3 seconds. You can use *repmat* to repeat a vector many times. If the overall shape of the signals do not closely match, you may have an incorrect estimate of the period.
3.5 Model the periodic noise – Model the noise signal by computing the Fourier coeﬃcients of *sigNoise*. You can choose to perform this using either the trigonometric or complex exponential Fourier series. Start by computing the DC (a0) and the ﬁrst 6 harmonics (an,bn for 1 ≤ n ≤ 6 or Cn for −6 ≤ n ≤ 6). Remember to account for sampling rate. List these coeﬃcients and explain your process for computing them.
3.6 Bias – Mission control has determined that the mean of the periodic noise signal is 0. Any DC component present in *sigNoise* is due to the underlying image. Make any changes necessary to your coeﬃcients to take this information into account. List the new coeﬃcients and explain the reasoning behind any modiﬁcations you have made.

3.7 Generate the approximation – Using these Fourier Series coeﬃcients, generate the approximation of the noise component to correspond with the received signal (ie. all 307,200 samples) and store it *in sigNoise_fs*.
3.8 Compare the approximation – Compare the ﬁrst T samples of *sigNoise_fs* to *sigNoise*. Does the number of coeﬃcients used result in a good representation of *sigNoise*?
3.9 De-noise – de-noise the image. Store the result in the ﬁrst row of an image matrix *im1*. Display the image and its spectrum in MATLAB. Include the recovered image and spectrum. Comment on how the spectrum has changed compared with the spectrum of the received image. Also comment on the quality of the de-noised image. Has a suﬃcient amount of noise been removed to identify details of the image? If not, experiment with using more Fourier coeﬃcients to improve the image quality. Justify the number of coeﬃcients you decide on using for removing the noise.
3.10 Remove the bandlimited random noise – Remove the bandlimited random noise. Decide whether to do this in the time or frequency domain, but the ﬁnal outcome must be in the time domain. Store the ﬁltered signal in the ﬁrst row of *im2*.
3.11 Choose a site – Mission control has determined the periodic noise proﬁle is consistent across all received data. Using sigNoise fs, repeat the de-noising process from 3.9 for the remaining 3 images and store in the corresponding rows of im1. View the spectrum and remove the bandlimited random noise using the same method used in 3.10. Store the results in corresponding rows of im2. Display the images contained in im2 in a single ﬁgure in MATLAB. Of the 4 landing sites photographed, which is an appropriate site to send our lander? Justify your choice.
3.12 Resolution – Navigational numbers were marked onto each image at the time they were photographed. What are these numbers? List these in your report. Also include the ﬁltered images in your report, at a scale that allows the navigational numbers to be read.

Tags: