- The implementation of linear spatial filters requires moving a mask centered at each pixel of the image, computing sum of products of mask coefficients and corresponding pixels.
- Implement an algorithm for low-pass filtering a grayscale image by moving a kk averaging filter of the form ones((k,k))/(k2).
- As the filter is moved from one spatial location to the next one, the filter window shares many common pixels in adjacent neighborhoods. Exploit this observation and implement a more efficient version of averaging filter.
- To appreciate the benefits of doing so, generate a plot of k vs run-time for various sized images. The plot diagram should contain a line plot for each image size you pick. Use different marker types to distinguish the default implementation and improved implementation. Just to give you a rough idea, look at https: //imgur.com/a/0HtYlTE.
- Utilize the observation similar to above to implement an efficient version of a kk median filter. Generate a plot figure similar to previous question.
- Using the denoising concepts discussed in the class, try to remove noise from
Noisy.jpg
- Edge Detection
- Read about Canny Edge detector. Apply the Canny edge detector (use inbuilt Canny function for this task) to bell.jpg.
- Tweak the values of the arguments (minVal and maxVal), and report the values that give the best results for each image. (Hint: Try to detect as many edges in the bell as possible, while avoiding edges in the background.).
- Consider Roberts, Prewitt, Sobel and Laplacian filters discussed in the class. Implement and apply these filters on png and make observations upon comparing their outputs. Compare these with the output of Canny edge detector on the same image.
Figure 1: Prewitt, Roberts and Sobel filters
Figure 2: Two forms of the laplacian filter
- What will the 55 variants of Sobel and Prewitt filters look like? Apply these larger filters on png and make observations upon comparing their outputs with the corresponding smaller filters.
- Add noise to the input image above using Gaussian sampling. Study the effect of applying the above filters(from 2nd part) on noise-affected inputs.
- Bilateral Filtering
- Implement Bilateral Filtering and apply it on jpg
- In low light imaging, images tend to be noisy and lose sharp edges. However, with flash, there is an unpleasant direct-lighting effect. Here, a cross bilateral filter can be used with the range and spatial filters acting on two different images.
- By combining a flash photograph cake-flash.jpg and a no-flash photograph jpg, render a new photograph cake-out.jpg that has both the warm lighting of the no-flash picture and the crisp details of the flash image.
Figure 3: flash, no-flash and output images
Note: This question has to be done on RGB images. For applying filters on RGB images you can do the same filtering operation used on grayscale image for each channel (i.e., R,G,B) separately, one by one.
Reference link https://people.csail.mit.edu/sparis/bf_course/course_notes. pdf
- In order to achieve a basic cartoon effect, all you need is essentially a bilateral filter and some edge detection. The bilateral filter will reduce the color palette, necessary for the cartoon look, and edge detection will allow production of bold silhouettes. To get cartoonized effects following steps are needed
- Apply the bilateral filtering to the color image. Keep this filtered image aside for the last step.
- Now, take a copy of original color image, convert it to gray scale.
- Apply blurring on this gray scale image to reduce noise. (Try different variants of blurring and see the performance)
- Now, create an edge mask from this blurred, gray scale image. An edge mask can be obtained using adaptive thresholding.
- Combine the bilateral filtered image from step 1 with edge mask(by taking bitwise AND of both at each pixel location).
Figure 4: Sample cartoon image
Now try to do these for images of your choice. Feel free to experiment with different filters and even methods to generate even better cartoons.
Note: This question has to be done on RGB images only. But you can work on each channel separately, and then combine them for final image.
- Fourier Transform
- Implement 2D DFT.
- Implement 1D Fast Fourier Transform (Recursive Formulation). Use it to implement 2D FFT and display the result on suitable images of your choice. Compare the run times of your version of DFT and FFT on different sized inputs and plot them.
- Now, implement 2D Inverse FFT in a similar fashion.
- Calculate the Fourier transform of the Fourier transform of any image. You would observe that the image you get is similar to the original image. How is it different from the original image? How can you fix this in the frequency domain so that we would get the original image back instead?
- Pick two images f,h of same dimension (256 256). Compute their respective Fourier transforms F, H.
- Compute IFT(F.H) and f * h. Check whether IFT(F.H) corresponds to the center portion of f * h. Compute the average of squared difference between pixel values in IFT(F.H) and the central 256 256 portion of f * h (F.H denotes point-wise multiplication of F and H and f * h denotes convolution with padding).
- What changes do you observe when you zero pad the original images to dimension (511 511) and now calculate IFT(F.H) and report the new error. Choose any 6464 image. Now, add 64 columns and rows of zeros to the right and bottom side
of the original image. Repeat this process two more times each time doubling the image size and padding the pixels on the right and bottom by zeroes. You will therefore have 4 images first one 64 64 with no zero padding and then 128 128, 256 256 and 512 512 after padding. Find the Fourier transform of all these images. Display the results and explain and justify the relationship between the four outputs you get.
- Denoise the given image noisy-lena.png and explain your process.
Reviews
There are no reviews yet.