Starting from:
$30

$24

Assignment 1 Solution

Write a Matlab function (m-file) that performs downsampling of the original image using a variable rate N. You will use two input image files (provided):



‘Xray.tif’
‘arteriogram.tif’



Your code and write-up will show results for N=2 and N=5 on both input images.




Downsampling is performed by uniform sampling at a spatial period of N (for both rows and columns), as shown in the diagram on the left.




The inputs of your function will be the original image and the down-sampling rate, while the output will be the downsampled image. You also need to display the input and output side by side.




This exercise is an opportunity to become familiar with matrix indexing in Matlab, as opposed to using for loops, which are computationally intensive and thus inefficient. For instance, consider the matrix A




The expression 1:k creates a vector of integer values from 1 to k, so we can select a submatrix T2 of A by using indexing with a single colon.










Using the colon operator twice allows you to access elements of A spaced at a uniform distance. The general syntax of this indexing is start_location: space : end_location

Write a Matlab function ((m-file) that lowers the bit resolution of the original input image by powers of 2 (B=3, 4, 5). The modification of the bit resolution is shown in the diagram below. You will use the ‘Xray.tif’ image provided. Your code will display the input and output image side by side, or in different figures.



As in Part 1, we need to avoid the use of for loops. The division by 2^B will result in a non- integer number, so a rounding operation needs to be performed afterwards. This is implemented in Matlab by round( ).




To display images with low dynamic range you may use the imshow command with a specific syntax, where the display range is specified.






























































































To submit: one zip file, containing two m-files (one for each part) and a pdf file containing a brief discussion of your results. Your discussion should focus on how the quality of the image is affected by varying the spatial resolution (part 1), and the intensity resolution (part 2).

More products