This document provides a comprehensive overview of the image filtration program, including explanations of the implemented filters and usage instructions.
The program requires no specific installation process. You can compile the source code (image_filtration.c) using a C compiler like GCC and then execute the generated binary.
- Compile the code:
gcc b23cs1032.c -o b23cs1032
- Run the program:
./b23cs1032
The program will prompt you for the following information:
- Image Format: Choose the format of your image (1 for PGM, 2 for BMP).
- Filter Selection: Select the desired filter by entering the corresponding number:
- Grayscale
- Blur
- Sharpen
- Sobel Edge Detection
- Reflect (mirror image horizontally)
- Negative
The program will process the image with the chosen filter and create a new file with the original filename appended with "_new" and the corresponding format extension (".pgm" or ".bmp").
Currently, some filters may not work as expected on all the images due to the different bit makeup of each image. The filters have been designed with a certain bit makeup in mind, and images that do not match this makeup may not be processed correctly. I will be working on making the filters more robust to handle a wider range of images. Other than 24 bit BMP type format file other formats are not supported currently as their data makeup is very complex.
-
Read and Write Images: The project can read and write images in 24 bit BMP formats. The
getImageData
function reads an image from a file and stores pixel data in anImage
object. ThewriteImage
function writes an image from anImage
object to a file. -
Image Filtration: The project includes a function to apply a filter to an image and save the filtered image as a new file. The
filter
function applies a filter to anImage
object, and the filtered image is saved with a_new
suffix added to the original file name. -
Grayscale Filter: The project includes a grayscale filter that can convert a color image to grayscale.
-
Blur Filter: The project includes a blur filter that can blur an image.
-
Sharp Filter: The project includes a sharp filter that can sharpen an image.
-
Sobel Edge Detection Filter: The project includes a Sobel edge detection filter that can detect edges in an image.
-
Reflector Filter: The project includes a reflector filter that can reflect an image.
-
Negative Filter: The project includes a negative filter that can make the colors complementary an image.
-
Github Repositories: eg- Github
-
Books: eg- Link to Book
-
Websites: eg- Site
-
Blogs: eg- Blog
-
Other References: eg- Reference