Introduction

Currently, there are a variety of image processing features available across multiple programming languages. Many of them require a lot of lines of code or are hard to use due to the technical jargon that is associated with digital signal processing; which also makes the documentation difficult to understand. Our focus in this project is to develop a language that is straightforward for users that are not necessarily knowledgeable of image processing or digital signal processing in general. We expect that the learning curve for our proposed programming language is far from steep so that users can swiftly modify images as they want to. Users can do this by importing an image and applying a variety of operations to an image such as scaling, sharpening, and feature extraction via our programming language. Our proposed language will be implemented using PLY, the python scanner/parser tool that will allow us to create the straightforward syntax of SIP. The python libraries of Scipy and Numpy will be used since they will allow us to manipulate the vectors/matrices associated with the images while also having some toolboxes for image/signal processing. Finally, matplotlib will be used to render the images and display the effects that the user executed.

Video Tutorial

VIDEO TUTORIAL

Steps to Use our Language

Steps of how to use our programming language:

  1. Download SIP from our GitHub repository with the following link: https://sammy5430.github.io/SIP-Simple-Image-Processing-Language/
  2. Make sure to have Python 3 (3.6.5) installed in your computer, pip (python package manager) comes included when downloading python.
  3. Install the following python libraries/packages using pip: PLY 3.11, Scipy 1.0.1, Numpy 1.14.3, Matplotlib 2.2.2, and Scikit-image 0.13.1.
  4. Run the sip.py file on your favourite IDE or terminal/command prompt
  5. Start using SIP Language

SIP Grammar

grammar

Reference Manual

Types

2D Images

3D Images

Variables

All variables will only be images represented as arrays of numbers representing pixels and can only be initialized by assigning an image or assigning it to a command reading an image file.

variable

Functions

read(“FILENAME”)

Example:

read

grayscale()

Example:

grayscale grayscale

sepia()

Example:

sepia sepia

red()

Example:

red red

green()

Example:

green green

blue()

Example:

blue blue

invert()

Example:

invert invert

show()

Example:

show show

blur(LEVEL)

Example:

blur blur

rotate(DIRECTION)

Example:

rotate rotate

edges(LEVEL)

Example:

edges edges

sharpen(LEVEL)

Example:

sharpen sharpen

save(“FILENAME”)

Example:

save

resize(height, width)

Example:

resize

crop(height, width)

Example:

crop crop

spiral(strength, radius)

Example:

spiral spiral

Language Development

Translator Architecture

Translator Architecture

Interfaces Between Modules

Software Development Environment

The following Programs were used in the development process of SIP Language:

Test Methodology

The modules within SIP Lang where tested using Blackbox Testing, where testers provide the inputs and observe the outputs. If the output was incorrect with respect to their corresponding input, then further testing was done until it gives a valid output.

Programs to Test Translator

Some Examples of the Programs to Test the Lexer:

The objective of the programs to test the lexer was to see if the lexer applied correctly the regular expression and identified the token related to that regular expression.

Program 1 Program 1

Program 2 Program 2

Some Examples of the Programs to the Test Parser:

The goals of these programs was to test the parser was to see if the parser could find a grammar rule that applied to the tokens that the lexer identified.

Program 3 Program 3

Program 4 Program 4

Some Examples of the Programs to Test the Complete SIP Language Translator:

The purpose of the programs to test the SIP translator was to see if our translator could identify which syntax that the user inputs is correct and that the corresponding piece of Intermediate code in SIP Language API executed successfully.

Program 5 Program 5

Program 6 Program 6

Conclusion

The completed language implementation provides some of the more common image processing methods with a simpler syntax, appropriate error handling, and parameters that are easier to understand. Methods which previously required complex user input have been implemented on SIP to work with levels (‘low’, ‘medium’, and ‘high’). Furthermore, the rotate method which normally requires the user to implement the number of degrees to rotate and the origin point for the rotation, has been simplified to work with 90-degree rotations with the origin set to the center of the image. After comparing code snippets between other implementations of these methods and the implementations done in this project, we can see a reduction in line of codes, which was one of the project’s goals. In addition, we can perceive the simplicity of the parameters used in SIP, when comparing it with other implementations. Overall, this language provides higher most image processing methods with better accessibility, since users can understand it even with little or no previous knowledge of image processing languages.