Assignment #1
Please turn in the pdf (when needed) and html version of a MATLAB live script that contains your code, output and text answers (when needed). See https://www.mathworks.com/help/matlab/ live-scripts-and-functions.html.
Keep your code neat. Name it hwk1_yourname.pdf.
(1) Differentiating between image display options in MATLAB. (5 points)
Copyright By PowCoder代写 加微信 powcoder
(a) (2 points) Use information from MATLAB help to figure out how to read in the img_001.ppm
image that was distributed with this assignment. You cannot use MATLAB functions down- loaded from the net. (use a built in MATLAB function). After reading in the image, display the dimension of the 3D array. Print what are the smallest and largest intensity values and how many pixels are there in the image? Normally, each pixel can have multiple color channels. In this case each pixel should contain R,G,B information in the color channel.
(b) (1 points) Display the first 5 row values of the first column in the first slice of the 3D array you read into MATLAB in part (a). Divide these values by 3 and display the output. Repeat for different variable precision/data type and comment if you see differences.
(c) (2 points) Use MATLAB help to learn about the differences between image and imagesc. Using the double precision version of the image from part (a), make 2 separate figures, where each one displays the green color channel of the image using image and imagesc. Display the images in grayscale. Briefly comment if they look different?
(2) Window/level the image. (15 points)
Use dicomread to read in one or more images from the series series-1 provided with this
assignment. Read https://www.stepwards.com/?page_id=21646 which reviews the clinical value of window-level/contrast stretching that we covered in class. Choose any subset of 3-4 images in this series and check the properties of its histogram. You will implement a window-level procedure which performs a linear transformation of intensities that fall inside the range [lower,upper], out of the full range of pixel intensities in the image. For the intensities below lower you can set to 0, and for the intensities above upper you can set to 1. Choose appropriate precision type. The range [lower, upper] is provided by you. You are encouraged to choose different intensity ranges, one at a time, and study the effect of your transformation on the visual interpretability of the contrast changes for specific regions in the image. In a few sentences, discuss your findings.
(3) Filtering an image. (10 points)
We want to implement a procedure to mean filter the image from problem (1) using the double precision version of the green channel. For this problem you will use a for loop and the mean function, but may not use any other filtering-specific MATLAB functions. (10 points)
(a) (5 points) For now, we¡¯ll ignore the edges of the image and simply put 0s for the edges and fill in the rest. For each pixel construct a 3 ¡Á 3 neighborhood around it. The center of this neighborhood is the target in the new matrix (where your value will go) and the value is the mean of the 9 values in the neighborhood. Filter the image and print out the values for the 100 pixels in the first 10 columns and rows. Also make a 1 ¡Á 3 panel plot where the left panel is the original image the middle panel is the filtered image and the right panel is the original minus the filtered. Label the images, accordingly. Consider using imagesc and colormap(gray) to show the original minus the filtered images to make difference more interpretable.
(b) (5 points) Repeat what you did in the previous problem, but use a 9 ¡Á 9 neighborhood. Make sure you use exactly the right number of 0s along the edges. Hint: It may not be a 1 layer of zeros.
(4) Changing the resolution of an image. (10 points)
(a) (5 points) You will again use the 605 ¡Á 700 green channel of the retina image for this problem and the goal is to change the resolution by resizing the image to be 121 ¡Á 140 (reducing by a factor of 5). Display the dimensions of the resized image and also display the original and resized image in a 1 ¡Á 2 panel plot, labeling the plots accordingly. You may not use any special MATLAB functions for this problem (it is fine to use the mean function).
(b) (5 points) Changing back the resolution of an image. We will use the 121 ¡Á 140 reduced sized retina image for this problem and the goal is to change the resolution back to 605 ¡Á 700. Notice that the problem is ill-posed and no unique solution exists. Describe and implement a procedure to accomplish this goal. Discuss your findings. Feel free to ¡°fill in¡± the higher resolution image based on pixel intensities of the lower resolution image. You may also use the mean filter and/or provide more creative solutions.
(4) Readings. (Bonus: 1 point)
Please read the article at the following link https://www.nature.com/articles/d41586-018-07182-7.
mean([5,6,2,1,1,2,3,4,2])
mean([6,2,7,1,2,7,4,2,7])])
Original Image Filtered Image
mean([5, 6, 2, 1, 1, 2, 3, 4, 2])
mean([4,2,5, 1,2,1,2,3,8])
mean([7,2,9, 7,4,8,7,8,9])
mean([7,8,8, 4,3,5,9,7,6])
Original Image Resized Image
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com