|
Problem Description:
In this assignment you will develop operations for compositing and blue screening. The goal of this project is
to learn how opacity/transparency is used to create aestetic results. These are the operations you can use
for combining layers in Photoshop.
The requirements are listed below.
You can still base your code from a your earlier code.
Project Requirements:
- Compositing two images with alpha maps: Implement Over operation (called normal in Photoshop),
Multiplication,Substraction and Max/Min.
- Develop a Blue/Green Screening tailored for a specific image. In this case, the goal is to construct
an alpha map that can provide an acceptable blue-screening result for a given image.
For the required parts of the project, implement your operations only using the basic programming operations such as while or
for loops and basic mathematical operations such as
addition, subtraction, multiplication, division and power. In other words,
no high level operation provided by some programming languages is allowed.
Project Submission:
Please write the program in either Processing or Java or C
or C++. For C and C++ use OpenGL and GLUTgraphics routines for the display.
Upload your program and all essential files to webassign as a "as small as possible" zip directory.
In your program, include comments about the program and your name.
Also make sure to provide information that and instructions on how to run it.
Note: For more information about
compositing see the description of
Blue Screening project from 2011. You can use it as a guide:
Code to convert RGB colors to HSV colors (taken from Foley,
Van Dam, Feiner and Hughes, pg. 592)
/*
Input RGB color primary values: r, g, and b on scale 0
- 255
Output HSV colors: h on scale 0-360, s and v on scale 0-1
*/
#define maximum(x, y, z) ((x) > (y)? ((x) > (z)? (x) : (z))
: ((y) > (z)? (y) : (z)))
#define minimum(x, y, z) ((x) < (y)? ((x) < (z)? (x) : (z)) : ((y) < (z)?
(y) : (z)))
void RGBtoHSV(int r, int g, int b, double &h, double &s,
double &v){
double red, green, blue;
double max, min, delta;
red = r / 255.0; green = g / 255.0; blue = b / 255.0; /*
r, g, b to 0 - 1 scale */
max = maximum(red, green, blue);
min = minimum(red, green, blue);
v = max; /* value
is maximum of r, g, b */
if(max == 0){ /* saturation and hue 0
if value is 0 */
s = 0;
h = 0;
}
else{
s = (max - min) / max; /*
saturation is color purity on scale 0 - 1 */
delta = max - min;
if(delta == 0) /*
hue doesn't matter if saturation is 0 */
h = 0;
else{
if(red == max) /*
otherwise, determine hue on scale 0 - 360 */
h = (green - blue) / delta;
else if(green == max)
h = 2.0 + (blue - red) / delta;
else /* (blue == max) */
h = 4.0 + (red - green) / delta;
h = h * 60.0;
if(h < 0)
h = h + 360.0;
}
}
}
|