A tool to perform various transformations on images in the .ppm format.
Report Bug
·
Request Feature
Table of Contents
This project offers a few ways to transform images. Below are some clarifications on the less obvious operations:
-
Threshold
- Thresholding increases image separation --- dark values become darker and light values become lighter. Given a threshold value in the range 0 < threshold < color depth, any RGB value > threshold is set to the color depth (e.g. 255), while any RGB value <= threshold is set to 0.
-
Edge detection
- Edge detection is an algorithm used in computer vision to help distinguish different objects in a picture or to distinguish an object in the foreground of the picture from the background. Edge Detection replaces each pixel in the original image with a black pixel, (0, 0, 0), if the original pixel contains an "edge" in the original image. If the original pixel does not contain an edge, the pixel is replaced with a white pixel (255, 255, 255).
The transformations are done in a provably correct way due to the usage of functional programming. This project was built with F# and the .NET framework, created by Microsoft.
This project was developed as part of the curriculum for Programming Language Design & Implementation during the fall 2023 semester.
The .ppm image format is a human-readable format which has the following basic format:
[MAGIC NUMBER]
[INTEGER WIDTH] [INTEGER HEIGHT]
[MAX COLOR DEPTH (0<=max<=65536)]
[R G B] [R G B]...
[R G B]
...
Note that this syntax may not be the most accurate depiction. For more detailed information, visit the documentation.
To get a local copy up and running follow these steps.
Refer to the official documentation to install .NET 7.0 SDK.
Clone the repo:
git clone https://github.com/gradyl16/PPM.Processor.gitTo run your local instance of the project, do the following (starting from the repo's root directory):
cd src/PPM.Processor.App
dotnet runOnce the program has started, specify the path to the file that you wish to transform. Note that there are sample files located in src/PPM.Processor.App/sample. For example:
Image filename> sample/cake.ppm
You will then be prompted for an integer to select the transformation you wish to perform. Some operations may ask for additional input. For example:
Operation?
1 => grayscale
2 => threshold
3 => flip horizontal
4 => edge detect
5 => right-rotate 90
> 4
Edge threshold value (0 < value < 255)? 100
Running edge detection...
Writing 'output/cake-edge.ppm'...
Done
Observe that each execution of the program completes exactly one transformation on one image. To complete additional transformations, rerun the program with dotnet run.
Note that this project is shipped with a .ppm interpreter. If you do not wish to convert your images to a more common format for viewing, you can spin up a local server with ppmReader.html to view the file.
Below are some before and after images created from files located in the src/PPM.Processor.App/sample directory.
Transformation on cake.ppm with edge detect threshold = 100:
Transformation on blocks.ppm with grayscale:
- Grayscale
- Threshold
- Horizontal flip
- Edge detection
- 90 degree clockwise rotation
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Dylen Greenenwald - dgree21@uic.edu
Project Link: https://github.com/gradyl16/PPM.Processor



