Race Condition Image Batch Assignment

From CSE231 Wiki
Revision as of 07:07, 24 January 2023 by Cosgroved (talk | contribs) (→‎Value)
Jump to navigation Jump to search

Background

Pixels

The word pixel stands for Picture Element. A pixel is a small part of a picture. Pixels are the little dots that make up computer screens. When you see a low-resolution picture that is grainy, the grains you’re seeing are the pixels.

Color Models

There are many different representations of Color. These representations are called color models.

Subtractive Color Models

Some color models are subtractive. These models are useful for printing. They are subtractive because they model the subtraction of light as each color absorbs light (before what remains to bounce off into your eyes). The most common of these models is CMYK which represents Cyan, Magenta, Yellow, blacK. If you have ever changed the ink in a color printer, you have encountered CMYK cartridges. Truth be told, you don’t need the black. Essentially all of the visible spectrum of light would be absorbed printing layers of cyan, magenta, and yellow. A lot of black tends to be printed, so it is more cost effective to add to add black into the model.

CMYK subtractive color mixing

Additive Color Models

Component_video_RCA

Some color models are additive. These models are useful for display devices. They are additive because they model the addition of light which is thrown at your eyes.

RGB

RGB_color_solid_cube

The most common of these models is RGB which repesents Red, Green, Blue. If you have ever plugged an old device into a TV with a component video cable, that is what the separate cables are carrying: analog signal for red, green, and blue.

RGB_illumination

HSV

We will use the HSV color model which represents Hue, Saturation, Value.

HSV_color_solid_cone_chroma_gray

This model benefits from often being easier for humans to think about and will enable us to create some compelling image filters with minimal effort. Evidence for it being easier for humans to think about can be found in most defaults for color pickers, including the one which can be found by searching on Google for color picker.

Play around with the color picker for a while and watch the hue, saturation, and value change as you interact with it. Try to isolate the saturation by dragging left to right in the rectangle component of the color picker. Isolate changes to the value by dragging up and down. Control the hue with the slider below.

Hue

Hue is cyclical. Red is usually at 0.0 and the hue changes as you go around the ring… returning back to red at 1.0.

Saturation

Full saturation is a completely “vivid” form of the color. No saturation is “dull” gray.

Value

This component is somewhat uninspiringly named: “value”. It is often called brightness, but that can be somewhat confusing since one might expect full brightness to always equate to white, which it does not.

Motivation

Race conditions can lead to difficult bugs to find and fix. We gain experience finding them and fixing them.


Code To Investigate

HsvColor

HsvImage

SequentialImageFilter

DesaturateAllPixelFilter

DesaturateNonSkinTonePixelFilter

Code To Debug

ImageBatch

class: ImageBatch.java Debugging icon.png
methods: applyToAll
package: racecondition.image.exercise
source folder: student/src/main/java

method: HsvImage[] applyToAll(HsvImage[] images, ImageFilter imageFilter, PixelFilter pixelFilter) Parallel.svg (parallel implementation required)

Client

Testing Your Solution

Correctness

class: _ImageBatchTestSuite.java Junit.png
package: racecondition.image.exercise
source folder: testing/src/test/java

Pledge, Acknowledgments, Citations

file: race-condition-image-batch-pledge-acknowledgments-citations.txt

More info about the Honor Pledge