Skip to content

CyAScott/ImageProcessor

Repository files navigation

Quick Example--------------------------------------------------------------------------------------

An example of how to use the command line tool is:

	ImageProcessor.exe -Input baboon.pgm -Output baboon.jpg

The example above will convert baboon.pgm to baboon.jpg. The '-Input' and '-Output' arguments are 
required for the program to run correctly.

Some Basics-----------------------------------------------------------------------------------------

The general format for arguments is:

	-Input <input file path> ... {pipe line arguments and parameters} ... -Output <output file path>

Where is the relative path to the input file, {pipe line arguments and parameters} is a series of 
arguments with parameters which tells the program what filters to apply to the image. The order of 
the {pipe line arguments and parameters} does matter. Some arguments require additional parameters 
proceeding the argument (i.e. -Input baboon.pgm) while others do not (i.e. -Help).

Pipe Line Arguments and Parameters (Filters)--------------------------------------------------------

You can apply as many filters on an image as you want. The order in which those filters are applied 
to the image depends on the order the argument plus its parameters was given to the program. For 
example:

This applies the median filter first, then the threshold filter:
	ImageProcessor.exe -Input baboon.pgm -Median -ThresholdFilter -Output baboon.jpg

This applies the threshold filter first, then the median filter:
	ImageProcessor.exe -Input baboon.pgm -Median -ThresholdFilter -Output baboon.jpg

Examples--------------------------------------------------------------------------------------------

Converts the image to gray scale:
	ImageProcessor.exe -Input baboon.pgm -Grayscale -Output baboon.jpg

Scales the image to twice the original size:
	ImageProcessor.exe -Input baboon.pgm -Scale 2.0 -Output baboon.jpg

Scales the image to half the original size:
	ImageProcessor.exe -Input baboon.pgm -Scale 0.5 -Output baboon.jpg

Makes a black and white image (no gray values) where the 'brightness' of the color is calculated to 
a value of 0 to 1 and the threshold value will mark the resulting pixel either black or white based 
on that number:
	ImageProcessor.exe -Input baboon.pgm -ThresholdFilter 0.5 -Output baboon.jpg

All Arguments---------------------------------------------------------------------------------------

Displaying help info:

	The general format for arguments is:

		-Input <input file path> ... {pipe line arguments} ... -Output <output file
		path>

	Pipe line arguments are arguments where the order does matter. Each pipe line
	argument applies an filter on the image and applies it in the order in which
	is was sent to the program. The format for an argument and paramters is:

		-{Argument} {Paramter 1} {Paramter 2} ... {Paramter N}

	The following arguments can be used:
		-Help: Optional

			Will list all possible command line arguments and their descriptions.


		-Input: Required

			The Input argument is used to tell the program where the read the input
			file.Multiple arguments of this type are not allowed. The argument requires
			exactly 1 paramter(s).

			Argument Parameter(s):
				Format: <string>
				Optional: false
				Description:
					The relative path to the file.


		-Output: Required

			The Output argument is used to tell the program where to write the output file.
			If the file already exists then it will be over written.Multiple arguments of
			this type are not allowed. The argument requires exactly 1 paramter(s).

			Argument Parameter(s):
				Format: <string>
				Optional: false
				Description:
					The relative path to the file.


		-Scale: Optional

			The Scale argument is used to scale an image.  The number parameter repsents
			percentage to increase or decrease the image by (1.0 = 100% or no scaling).
			This parameter is not optional.

			Argument Parameter(s):
				Format: <double>
				Optional: true
				Description:
					Must be a value greater than or equal to zero. Values below 1.0 will shrink the
					image and values above 1.0 will increase the image size. If the value is 1.0
					then the image will not be altered.


		-ThresholdFilter: Optional

			The ThresholdFilter argument is used to convert the image into a set of black
			or white pixels or color binarization. The 'brightness' of each pixel will be
			calculated into a value between 0 and 1 (where 0 is white and 1 is black).

			Argument Parameter(s):
				Format: threshold:<double>
				Optional: true
				Description:
					Must be a value greater than or equal to zero.

				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-Grayscale: Optional

			Converts the image into colors ranging between black and white (all gray
			colors).

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-Median: Optional

			Applies an uniform smoothing filter to an image using the median method.

			Argument Parameter(s):
				Format: x:<boolean>
				Optional: true
				Description:
					Applies the filter only in the left and right directions. The default value is
					false.

				Format: y:<boolean>
				Optional: true
				Description:
					Applies the filter only in the up and down directions. The default value is
					false.

				Format: window:<integer>
				Optional: true
				Description:
					When calculating the resulting pixel, a window surrounding the target pixel is
					used for the calculation. This value must be a positive odd integer. The
					default value is 3.

				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-GrayHistogram: Optional

			Generates a histogram image based on a gray scale render of the image.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-GrayHistogramEqualization: Optional

			Changes the contrast of a gray image based on the histogram.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-HistogramStretch: Optional

			Changes the contrast of an image based on a percentile in the histogram.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image

				Format: percentile:<double>
				Optional: true
				Description:
					Must be a value between 0 and 1. The default value is 0.05. This value will be
					used as the lower and upper percentile of the histogram.


		-HistogramEqualization: Optional

			Changes the contrast of an image based on the histogram.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image


		-HsiHistogramEqualization: Optional

			Changes the contrast of an image based on the histogram.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image

				Format: h:<boolean>
				Optional: true
				Description:
					Applies the filter only to the H channel. The color of the image will change if
					this filter option is used. The default value is false.

				Format: s:<boolean>
				Optional: true
				Description:
					Applies the filter only to the S channel. The default value is true.

				Format: i:<boolean>
				Optional: true
				Description:
					Applies the filter only to the I channel. The default value is true.


		-SobelEdgeDetection: Optional

			Edge detection using Sobel operator.

			Argument Parameter(s):
				Format: roi:<x>,<y>,<width>,<height>
				Optional: true
				Description:
					Applies the filter to a target section of the image. The default value is the
					whole image

				Format: window:<integer>
				Optional: true
				Description:
					When calculating the resulting pixel, a window surrounding the target pixel is
					used for the calculation. This value must be a positive odd integer (only 3
					and 5 are supported). The default value is 3.

				Format: threshold:<byte>
				Optional: true
				Description:
					Must be a value 0 and 255. Colors greater than or equal to the value will be
					set as white else black. If no threshold value is provided then the image will
					be grayscale.

				Format: direction:<integer>
				Optional: true
				Description:
					A direction measured in degrees. Only edges that match this angle will be used.
					If no direction value is provided then all angles will be used.

				Format: color:<enum>
				Optional: true
				Description:
					The color space to use. The default value is gray. Possible values are: hsi, 
					rgb gray.

				Format: colorChannel1:<boolean>
				Optional: true
				Description:
					If the color parameter is rgb or hsi then r or h channel will be used of edge
					detection. The default value is true.

				Format: colorChannel2:<boolean>
				Optional: true
				Description:
					If the color parameter is rgb or hsi then g or s channel will be used of edge
					detection. The default value is true.

				Format: colorChannel3:<boolean>
				Optional: true
				Description:
					If the color parameter is rgb or hsi then b or i channel will be used of edge
					detection. The default value is true.

About

Project for CAP4401.001S16

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published