This repository contains my coursework for the Coursera course "Object-Oriented Data Structures in C++" by the University of Illinois. This project, MP1: Image Transform, involves creating a C++ class for handling pixel data in the HSL color space and using it to perform various image transformations.
The project is divided into two main parts:
- HSLAPixel Class: Implementation of a class to represent colored pixels in the HSL (Hue, Saturation, Luminance) color space.
- Image Transformations: Using the
HSLAPixelclass and a providedPNGclass to perform image transformations including grayscaling, illinifying, creating spotlights, and applying watermarks.
The following files and libraries were provided by the course creators to help structure and facilitate the project:
uiuc/PNG.handuiuc/PNG.cpp: A complete PNG class for handling image files.tests/*: Unit tests to validate the correctness of the implemented functions.Makefile: A makefile for compiling the project and the tests.main.cpp: The main driver program for running the image transformations.
The following files were edited or created by me to complete the coursework:
uiuc/HSLAPixel.handuiuc/HSLAPixel.cpp: Implementation of theHSLAPixelclass, representing pixels in the HSL color space.ImageTransform.handImageTransform.cpp: Implementation of the image transformation functions:grayscale: Converts an image to grayscale.illinify: Changes the hue of every pixel to Illini Orange or Illini Blue.spotlight: Creates a spotlight effect centered at a given point.watermark: Applies a watermark to an image based on a stencil image.
Converts an image to grayscale by setting the saturation of every pixel to 0.
Changes the hue of every pixel to either Illini Orange (hue = 11) or Illini Blue (hue = 216), depending on which is closer.
Creates a spotlight effect centered at (centerX, centerY), reducing luminance based on distance from the center.
Applies a watermark to an image, increasing the luminance of the base image's pixels where the stencil image's pixels have maximum luminance.
To compile the project, navigate to the directory containing the Makefile and run : make
To run the unit tests, use: make test ./test
To clean up the compiled files, use: make clean
I would like to acknowledge the University of Illinois and the course creators for providing the foundational code and structure for this project. The PNG class and the unit tests were provided as part of the course materials, enabling me to focus on implementing the specific transformations and the HSLAPixel class.