본문 바로가기

Enginius/Machine Learning

Image filtering + Hybrid image

Goal

Implement your own code for image filtering, my_imfilter() in MATLAB or C++ (You will get extra credit if you use C++). It must (1) support grayscale and color images (2) support arbitrary shaped filters, as long as both dimensions are odd (e.g. 7x9 filters but not 4x5 filters) (3) pad the input image with zeros or reflected image content and (4) return a filtered image which is the same resolution as the input image. Test your program on the provided images.

Forbidden MATAB functions which you cannot use in your final code: imfilter(), filter2(), conv2(), nlfilter(), colfilt().


1.1. Image filtering

simple image filtering using 'my_imfilter'

Result

Image filtering [../../images/bike/bicycle.bmp] LOADED. 

Evaluating filtering...finished. 2e+00 sec 


1.2. Hybrid image

Generate hybrid image

Result

Hybrid image [../../images/bike/bicycle.bmp] + [../../images/bike/motorcycle.bmp] ARE LOADED. 

Evaluating filtering...finished. 3e+00 sec 


1.3 Frequency analysis

For your favorite result, you should also illustrate the process through frequency analysis. Show the log magnitude of the Fourier transform of the two input images, the filtered images, and the hybrid image. In MATLAB, you can compute and display the 2D Fourier transform with: imagesc(log(abs(fftshift(fft2(gray_image)))))


2.1 Zero-crossing of LoG

Find edge by finding zero-crossing of LoG


Result 

2.2 Zero-crossing of LOBG

- And the zero-crossings of the LOBG (Laplacian of Bilateral Gaussian) - You can derive the LOBG equation and design the kernel similarly to LOG case ? Write a single algorithm that has two kernel options, LOG and LOGB. ? Test your algorithm on the test images by varying the parameters of each algorithm (Try 9x9 kernel size with Gaussian std = 1.4).


Result

2.3 Add error to image and compare LoG and LoBG

? Add Gaussian noise with std= 20 to the test images and repeat the test on them. ? Show and compare your results, and discuss on them. Give any ideas for improving the performance.

Result

Full code