Skip to content

gradyl16/PPM.Processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn


PPM Image Processor

A tool to perform various transformations on images in the .ppm format.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact

About The Project

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.

Background

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.

(back to top)

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

Refer to the official documentation to install .NET 7.0 SDK.

Installation

Clone the repo:

git clone https://github.com/gradyl16/PPM.Processor.git

(back to top)

Usage

To run your local instance of the project, do the following (starting from the repo's root directory):

cd src/PPM.Processor.App
dotnet run

Once 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.

PPM Reader

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.

Example Images

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:

(back to top)

Roadmap

  • Grayscale
  • Threshold
  • Horizontal flip
  • Edge detection
  • 90 degree clockwise rotation

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Dylen Greenenwald - dgree21@uic.edu

Project Link: https://github.com/gradyl16/PPM.Processor

(back to top)

About

A command line tool to perform various transformations on images in the .ppm format.

Resources

Stars

Watchers

Forks