|
|
|
|
187
|
### Exercise 2 - Convert a colored image to an image with gray tones
|
187
|
### Exercise 2 - Convert a colored image to an image with gray tones
|
188
|
|
188
|
|
189
|
Image grayscale is an operation that is used to convert a colored image to an image with only tones of gray. To make this conversion the following formula is used in each pixel:
|
189
|
Image grayscale is an operation that is used to convert a colored image to an image with only tones of gray. To make this conversion the following formula is used in each pixel:
|
190
|
-
|
|
|
191
|
-`gray = (red * 11 + green * 16 + blue * 5)/32 ;`
|
|
|
192
|
-
|
|
|
193
|
-where `red`, `green` and `blue` are the values for the tones of the red, green and blue colors in the pixel of the original colored image, and `gray` will be the assigned color to the red, green, and blue colors in the pixel of the edited image. That is,
|
|
|
194
|
-
|
|
|
|
|
190
|
+ `gray = (red * 11 + green * 16 + blue * 5)/32 ;` where `red`, `green` and `blue` are the values for the tones of the red, green and blue colors in the pixel of the original colored image, and `gray` will be the assigned color to the red, green, and blue colors in the pixel of the edited image. That is,
|
195
|
`editedImage.setPixel( i, j, qRgb(gray, gray, gray) )`.
|
191
|
`editedImage.setPixel( i, j, qRgb(gray, gray, gray) )`.
|
196
|
|
192
|
|
197
|
#### Instructions:
|
193
|
#### Instructions:
|
|
|
|
|
240
|
|
236
|
|
241
|
##Deliverables
|
237
|
##Deliverables
|
242
|
|
238
|
|
243
|
-Use "Deliverables" in Moodle to upload the `filter.cpp` file that contains the `GreyScale` and `Threshold` functions. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
|
|
|
|
|
239
|
+Use "Deliverable" in Moodle to upload the `filter.cpp` file that contains the `GreyScale` and `Threshold` functions. Remember to use good programming techniques, include the names of the programmers involved, and to document your program.
|
244
|
|
240
|
|
245
|
---
|
241
|
---
|
246
|
|
242
|
|