|
|
|
|
39
|
|
39
|
|
40
|
---
|
40
|
---
|
41
|
|
41
|
|
42
|
-## Green-screen technology
|
|
|
|
|
42
|
+## Green-screen Technology
|
43
|
|
43
|
|
44
|
In this laboratory experience, the student will be exposed to the basics of the green screen technology used in newscasting, motion pictures, video games, and others. Green screen compositing, or more generally known as chroma key compositing, is a technique for combining two still images or video frames[1]. Chroma key compositing, or chroma keying, is a special effects / post-production technique for compositing (layering) two images or video streams together based on color hues (range)[2]. Chroma keying can be done with backgrounds of any color that are uniform and distinct, but green and blue backgrounds are more commonly used because they differ most distinctly in hue from most human skin colors.
|
44
|
In this laboratory experience, the student will be exposed to the basics of the green screen technology used in newscasting, motion pictures, video games, and others. Green screen compositing, or more generally known as chroma key compositing, is a technique for combining two still images or video frames[1]. Chroma key compositing, or chroma keying, is a special effects / post-production technique for compositing (layering) two images or video streams together based on color hues (range)[2]. Chroma keying can be done with backgrounds of any color that are uniform and distinct, but green and blue backgrounds are more commonly used because they differ most distinctly in hue from most human skin colors.
|
45
|
|
45
|
|
|
|
|
|
106
|
* `qRgb(int red, int green, int blue)` // returns the `QRgb` pixel composed of the red, green and blue values received.
|
106
|
* `qRgb(int red, int green, int blue)` // returns the `QRgb` pixel composed of the red, green and blue values received.
|
107
|
|
107
|
|
108
|
|
108
|
|
109
|
-####Examples:
|
|
|
|
|
109
|
+####Examples
|
110
|
|
110
|
|
111
|
1. `QRgb myRgb = qRgb(0xff, 0x00, 0xff);`: Assigns the value `0xff00ff` to `myRgb` which represents the color ![figure4.png](images/figure4.png)
|
111
|
1. `QRgb myRgb = qRgb(0xff, 0x00, 0xff);`: Assigns the value `0xff00ff` to `myRgb` which represents the color ![figure4.png](images/figure4.png)
|
112
|
|
112
|
|
|
|
|
|
155
|
|
155
|
|
156
|
|
156
|
|
157
|
|
157
|
|
158
|
-### Measuring similarity of pixel colors
|
|
|
|
|
158
|
+### Measuring Similarity of Pixel Colors
|
159
|
|
159
|
|
160
|
Look at Figure 4, although the background in *image A* looks uniform, it really includes pixels of diverse (although similar) colors.
|
160
|
Look at Figure 4, although the background in *image A* looks uniform, it really includes pixels of diverse (although similar) colors.
|
161
|
|
161
|
|
|
|
|
|
197
|
---
|
197
|
---
|
198
|
|
198
|
|
199
|
|
199
|
|
200
|
-##Laboratory Session
|
|
|
|
|
200
|
+##Laboratory Session:
|
201
|
|
201
|
|
202
|
In this laboratory experience, starting with an image with an object of interest over a solid color background and an image to use as a background, you will define and implement a function that creates a third merged image where the image with the object of interest will have its background color removed and will appear over the image chosen to be the background.
|
202
|
In this laboratory experience, starting with an image with an object of interest over a solid color background and an image to use as a background, you will define and implement a function that creates a third merged image where the image with the object of interest will have its background color removed and will appear over the image chosen to be the background.
|
203
|
|
203
|
|
|
|
|
|
211
|
* (x, y): contains the coordinate of the pixel whose color will be used as solid background. The default value is (0,0).
|
211
|
* (x, y): contains the coordinate of the pixel whose color will be used as solid background. The default value is (0,0).
|
212
|
* (offset_x, offset_y): the coordinate of the merged image where the upper-left corner of the objectImage should be inserted. The default value is (0,0).
|
212
|
* (offset_x, offset_y): the coordinate of the merged image where the upper-left corner of the objectImage should be inserted. The default value is (0,0).
|
213
|
|
213
|
|
214
|
-### Exercise 1: Create a composite image
|
|
|
|
|
214
|
+### Exercise 1 - Create a Composite Image
|
215
|
|
215
|
|
216
|
####Instructions
|
216
|
####Instructions
|
217
|
|
217
|
|
|
|
|
|
244
|
|
244
|
|
245
|
Test your implementation by loading object and background images and verifying the merged image.
|
245
|
Test your implementation by loading object and background images and verifying the merged image.
|
246
|
|
246
|
|
247
|
-## Exercise 2: Creating a composite image using a ghost filter
|
|
|
|
|
247
|
+## Exercise 2 - Creating a Composite Image using a Ghost Filter
|
248
|
|
248
|
|
249
|
In this exercise you will modify Exercise 1 to apply a ghost filter to each of the pixels that will be composed over the background image (if the `ghost` variable is true). The filter creates a ghost like effect on the objects composed over the background image, as in Figure 6.
|
249
|
In this exercise you will modify Exercise 1 to apply a ghost filter to each of the pixels that will be composed over the background image (if the `ghost` variable is true). The filter creates a ghost like effect on the objects composed over the background image, as in Figure 6.
|
250
|
|
250
|
|
|
|
|
|
266
|
|
266
|
|
267
|
where $$N_R$$, $$N_G$$, and $$N_B$$ are the red, green and blue components of the new ghost pixel. $$S_R$$, $$S_G$$, and $$S_B$$ are the components of the object image. $$B_R$$, $$B_G$$, $$B_B$$ are the components of the background image.
|
267
|
where $$N_R$$, $$N_G$$, and $$N_B$$ are the red, green and blue components of the new ghost pixel. $$S_R$$, $$S_G$$, and $$S_B$$ are the components of the object image. $$B_R$$, $$B_G$$, $$B_B$$ are the components of the background image.
|
268
|
|
268
|
|
269
|
-## Exercise 3: Create a composite image placing the object in a specified position
|
|
|
|
|
269
|
+## Exercise 3 - Create a Composite Image placing the Object in a Specified Position
|
270
|
|
270
|
|
271
|
The widget that displays the background has been programmed to register the position where the user clicks. In this exercise you will program the `MergeImages` function so that the position that user clicks in the background image is used as the *top left* corner where the *object* image will be displayed in the merged image. The following figures illustrates the effect. Note the *Selected Coord* values under the images.
|
271
|
The widget that displays the background has been programmed to register the position where the user clicks. In this exercise you will program the `MergeImages` function so that the position that user clicks in the background image is used as the *top left* corner where the *object* image will be displayed in the merged image. The following figures illustrates the effect. Note the *Selected Coord* values under the images.
|
272
|
|
272
|
|
|
|
|
|
321
|
### Deliverables
|
321
|
### Deliverables
|
322
|
|
322
|
|
323
|
|
323
|
|
324
|
-Use "Deliverable" in Moodle to upload the `filter.cpp` file that contains the `MergeImages` function. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
|
|
|
|
|
324
|
+Use "Deliverable" in Moodle to upload the `filter.cpp` file that contains the `MergeImages` function. Remember to use good programming techniques, include the names of the programmers involved, and document your program.
|
325
|
|
325
|
|
326
|
---
|
326
|
---
|
327
|
|
327
|
|