Thursday, April 27, 2017

CSE 163 Project 1 (part 1)


This is the first of three blog posts detailing the features of our first programming assignment for CSE 163: Advanced Computer Graphics. The assignment is an image editor (a mini-Photoshop of sorts) with various image transformation features, which will be explained in detail over three blog posts (the reason of separation being because we want to prevent blog posts from being unnecessarily long).
For part 2 of the project documentation, click here.
For part 3 of the project documentation, click here.
The project executable (Windows) can be downloaded here.

The team members for this homework project are: Hoang Tran and Nikhilesh Sankaranarayanan.

Section 3.2: Basic transformations

1. Brighten

Usage: image -brightness factor <input >output

This command changes an image's brightness. Values between 0.0 and 1.0 darken the image (with 0.0 blackening it and 1.0 leaving it unchanged), while values larger than 1.0 increase the brightness. The resulting image's brightness is linearly interpolated with a pure black image.
The following shows various brightness levels of an image found on Pinterest:
0.0
0.4
0.8
1.0
1.5
2.3

















2. Contrast

Usage: image -contrast factor <input >output

This command changes the contrast of an image. This function is similar to brighten, however the linear interpolation is done with a constant gray image instead of a black image. The gray image is obtained by averaging the luminance of every pixel in the original input image.
A special case occurs when the contrast factor is negative. The colors of the original image will then become inverted.
The following shows various contrast levels of an image found on Yelp:
-1.2
-0.5
0.0
0.3
0.7
1.0
1.4
2.2
















3. Saturation

Usage: image -saturation factor <input >output

This command changes the saturation of an image. The function is identical in behavior to contrast, however the gray image used is the grayscale version of the input image, rather than a constant gray image.
The following shows various saturation levels of an image found on the Times of India:
-1.5
-0.6
0.0
0.5
1.0
1.6
2.4
















4. Gamma correction

Usage: image -gamma factor <input >output

This command applies a gamma correction to the image based on the factor supplied. A value smaller than 1 causes an image to darken, a value of 1 leaves the image unchanged, and a value greater than 1 causes the image to brighten.
The following shows various gamma correction levels of an image found on Pinterest:
0.1
0.6
1.0
1.8











5. Crop

Usage: image -crop x y w h <input >output

This command crops an image, starting at coordinates (x, y), and produces a smaller image of size w x h. If the crop region extends past the borders of the original image (for example, if I wanted to crop a 90 x 90 image starting at (50, 50) in a 100 x 100 image), then it will only crop out the valid region, and print out the appropriate error message (such as image width or height not large enough).
The following shows various croppings of an image found on Thrillist:
Original image

100 x 100 image cropped at (50, 50)

 
100 x 150 image cropped at (40, 100)

120 x 200 image cropped at (200, 30)
100 x 100 image cropped at (360, 260).
Size clamped to 90 x 40 due to image dimensions

No comments:

Post a Comment