##Image_Processing_Laboratory_IITKGP(DIP) Laboratory Spring 2016.
This repository contains all DIP Lab Assignments. The Experiment are written in C++ without using OpenCV library except for reading of image and GUI (trackbar/slider) Code written using Visual Studio 2010.
##Directories included
/Assignment1
/Assignment2
/Assignment3
/Assignment4
/Assignment5
Each directory includes the experiment problem statement(.pdf),README(.txt), TestImages, source code(.cpp) and report(.pdf).
##The list of experiments:
-
BMP File Format
Write C/C++ modular functions to read, diagonally flip, and then write BMP image files. All functions must support at least 24-bit RGB, and 8-bit grayscale image formats.- ReadBMP:
- Input: Filename of input image.
- Output: BMP header structure, Image pixel array loaded onto memory.
- Input: Filename of input image.
- ConvertFlipGrayscale:
- Input: Image pixel array.
- Output: Grayscale-converted and diagonally flipped (transposed) pixel array.
- Input: Filename of output (grayscale) image, BMP header structure, Image pixel array.
- Input: Image pixel array.
- WriteBMP:
- Output: BMP file written on disk.
Use the above functions to read a 256 × 256 24-bit RGB colored Lena image, and write it as an 8-bit grayscale onto a different file on the disk.
- Output: BMP file written on disk.
- ReadBMP:
-
Histogram Equalization and Matching
Write C++/Image-J modular functions to- Perform histogram equalization on the 512 × 512 grayscale lena_gray_dark.jpg image. Perform the same on other low-contrast, dark, normal (gray/colored) images.
- Perform histogram matching of the same images with respect to a standard image (e.g. lena.jpg).
Display the histograms of the original image and the enhanced images and document the observations.
- Perform histogram equalization on the 512 × 512 grayscale lena_gray_dark.jpg image. Perform the same on other low-contrast, dark, normal (gray/colored) images.
-
Spatial Filtering
Write C/C++ modular functions/subroutines to design spatial filters - mean, median, gradient, Laplacian, Sobel kernels (horizontal, vertical, diagonal) on a stack of grayscale images (say, 15 images per stack)
Use OpenCV (or) ImageJ for image reading, writing and GUI development only. Use the OpenCV tracker (slider) functionality to show outputs for varying sizes of neighborhoods. You may have different sliders to select (i) Image (ii) Filter (iii) Neighborhood size- Input: Path to the stack of images. Input stack should contain the (provided) noisy images, and may also contain the normal test images, e.g. jetplane.jpg, lake.jpg.
- Output: Filtered stack of images should be shown beside input stack in the same pane of GUI with a slider to vary filter/kernel size/change image.
- Input: Path to the stack of images. Input stack should contain the (provided) noisy images, and may also contain the normal test images, e.g. jetplane.jpg, lake.jpg.
-
Frequency Filtering
Write C++/Image-J modular functions to perform the following operations on the 512 × 512 grayscale test images, e.g. jetplane.jpg, lake.jpg.- FFT2 (takes input image filename as the argument; gives 2D FFT coefficients as output)
- IFFT2 (takes 2D FFT coefficients as input argument; gives the back-projected/ reconstructed
image as output)
- Perform Ideal, Gaussian, and Butterworth low-pass and high-pass filtering, taking cut-off
frequency, F, and image filename as input arguments) respectively with
- Ideal_LPF
- Ideal_HPF
- Gaussian_LPF
- Gaussian_HPF
- Butterworth_LPF
- Butterworth_HPF
Display the (shifted) magnitude spectrums of the input, the filter and the filtered output. You may make use of the tracker/slider function to choose images, filter types and cut-off frequencies.
- Ideal_LPF
- FFT2 (takes input image filename as the argument; gives 2D FFT coefficients as output)
-
Morphological Operations
Write C++/Image-J modular functions to perform the following operations on the given test image, ricegrains_mono.bmp. All functions must support binary images.
Make separate functions for erosion, dilation, opening, and closing of binary images.- ErodeBinary, DilateBinary
- Input: Binary image, structuring element
- Output: Eroded/dilated image
- Input: Binary image, structuring element
- OpenBinary, CloseBinary
- Input: Binary image, structuring element
- Output: Opened/closed image
- Input: Binary image, structuring element
- ErodeBinary, DilateBinary
##References
- BMP file format wikipedia
- Histogram Equalization wikipedia
- Morphological Operations: Prof. P. K. Biswas, Lecture 33 - 36, Video Lecture Series (NPTEL) on Digital Image Processing
- R. C. Gonzalez and R. Woods, Digital Image Processing, Reading, MA: Addison-Wesley, 1992.
##Setup
- Download the directory
- Create a project Win32 Console Application in Visual studio.
- Copy the folder files to the project.
- Include the ".cpp" file as the source file.
- Include necessary OpenCV libraries [https://www.youtube.com/watch?v=LNlnjBLPJd8]
- Run the ".cpp" code