This project contains implementations of basic image processing operations using Dr. Cem’s simple C++ image library (image.h). Each file corresponds to an individual image operation we covered in class and is meant to help reinforce the concepts we practiced on paper — now in code.
Each .cpp file corresponds to a different image processing technique:
| Filename | Description |
|---|---|
nearestNeighbor.cpp |
Nearest neighbor interpolation |
bilinearInterpolation.cpp |
Bilinear interpolation |
brighten.cpp |
Brightening the image |
contrast.cpp |
Adjusting contrast |
gamma.cpp |
Gamma correction |
contrastStretching.cpp |
Contrast stretching |
inverse.cpp |
Image inversion |
histogramEqualization.cpp |
Histogram equalization |
convolution.cpp |
Convolution with a blur kernel |
image.h |
Dr. Cem's simple image library (from Moodle) |
Also included:
lena.png: Original imagelena_grayscale.png: Grayscale version for comparison (helps verify your results)
Each file is independent. To compile and run any of them, use the terminal commands below. Just replace the filename with the one you want.
Install the PNG development library:
-
Ubuntu/Debian:
sudo apt install libpng-dev
-
Fedora:
sudo dnf install libpng-devel
Then compile and run:
g++ -lpng yourfile.cpp -o yourprogram
./yourprogramYou’ll need to install a C++ compiler that supports PNG, such as MinGW or Visual Studio.
A video tutorial will be added soon to help with setup on Windows.
Each .cpp file:
- Loads
lena.pngorlena_grayscale.png. - Applies a specific image processing operation.
- Saves the result to a new output file (like
output_convolution.png, etc).
All implementations mirror the same math we did manually in class — now automated with C++.
- The grayscale version is great for comparing visual effects after applying operations.
- The code is commented to help you understand what's going on step-by-step.
- Feel free to tweak the code and try different images (just update the filename in the code).
I hope this helps, and feel free to clone or fork and experiment as much as you want!