Code Monkey home page Code Monkey logo

2024_plc's Introduction

50.051 Programming Language Concepts (PLC) Project

Image Processor in C

An image processor written in C, allowing users to manipulate images using various filters and tools in a single edit session. Transformations applied are immediately displayed in a GUI.

Several constraints were fulfiled as part of the requirements of the 50.051 Programming Language Concepts course - namely, the implementation of a parser for any inputs and a Finite State Machine (FSM) to manage the overall program.

Setup Instructions

Download Dependencies

NOTE: Due to time constraints, the program is guaranteed to compile on Windows 64-bit systems but full testing on Linux distributions was not finished. Installations for Linux are included for completeness.

This application depends on 2 external programs - 1) GTK for the preview image display and 2) Image Magick to handle conversions on the fly from PNG to PPM and vice versa.

1. GTK

Windows (MSYS64) - Recommended

Please download MSYS2 here if not already installed.

Add bin path of path/to/msys64/mingw/bin to system env variables path.

Open MSYS2 terminal and run the following commands:

pacman -S mingw-w64-x86_64-gtk3
pacman -S mingw-w64-x86_64-toolchain base-devel

Windows (Cygwin)

Please download CYGWIN here if not already installed.

Add bin path of path/to/cygwin64/bin to system env variables path.

Run the setup-x86_64.exe application and install the following packages:

libgtk3-devel
libgtk3_0

Linux

Assuming the distribution is Debian/Ubuntu, run:

apt-get install libgtk-3-0
apt-get install libgtk-3-dev

2. Image Magick

Windows

Install Image Magick here
Using the Win64 dynamic at 8 bits-per-pixel component version

Linux

Use the same link as above.
Please install the appropriate rpm version for your Linux distribution and follow the official setup instructions on the website.

Building from Source

Once the dependencies are installed, you can build the source files using the following command*:

make -f .\Makefile_MSYS64

There should now be an executable in the /bin folder alongside its required dlls. Run the program using:

./bin/image_processor.exe

*Note: A CYGWIN-specific Makefile is also provided but we recommend using the MSYS64 development environment.

If you encounter any issues (gcc or pkgconfig not found), you may change each Makefile's CC, GTKINCLUDE, GTKLIBS to specify the correct path to those tools:

CC := path/to/bin/gcc.exe
GTKINCLUDE := $$(PKG_CONFIG_PATH=/path/to/lib/pkgconfig/ pkg-config --cflags gtk+-3.0)
GTKLIBS := $$(PKG_CONFIG_PATH=/path/to/lib/pkgconfig/ pkg-config --libs gtk+-3.0)

Usage

A sample of PNG images can be found in /media. Note there is a corrupt PNG included (truncated) to demonstrate error cases during an upload which should re-prompt the user to input a valid file.

You will be prompted with a list of commands at every step of the program. To proceed with committing or undoing a change, close the preview window pop-up to re-enable the terminal session.

Features

Rotation: Rotates the image. Users can specify the angle of rotation in positive and negative multiples of 90 degrees.

Scaling: Acts as a “zoom” and will scale image to make it bigger. Users can specify the scale factor and corner that they want to zoom into - Top-left, Top-right, Bottom-left and Bottom-right.

Cropping: Crops the image based on given on required dimensions and start point. Users can specify the start coordinates (x,y) and new image dimensions (width, height).

Colour Mapping: Separates out colour channels like a "colour filter". Users can specify the colour filter (R,G,B).

Grey Mapping: Converts image to a greyscale. No additional user inputs required.

Edge Detection: Produce a bitmap - black as the background and the edges of objects defined in gray/white. No additional user inputs required.

2024_plc's People

Contributors

mavene avatar nithyarv avatar ravenix12 avatar michelleordelia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.