Welcome to My Homepage

Hui Li (U49612800)

Original Image
Original image without any operation.
BGR to Grayscale
Convert the face from BGR to Grayscale format using the function : cvtColor(image, gray_image, CV_BGR2GRAY)
Threshold Binary
If the pixel src(x,y) is larger than 125, then the new pixel is set to 255. Other wise, set to 0. The function used : threshold(gray,thresholdbinary, 125, 255, 0).
Threshold Binary Inverted
If the pixel src(x,y) is larger than 125, then the new pixel is set to 0. Other wise, set to 255. The function used : threshold(gray,thresholdbinary, 125, 255, 1).
Truncate
The maximum value for a pixel is 100. If the original value is higher than 100, then truncate. The function used : threshold(gray, truncate, 100, 0, 2).
Threshold to Zero
If the pixel src(x,y) is lower than 125, then set the pixel value to zero. The function used : threshold(gray, tozero, 125, 0, 3).
Threshold to Zero Inverted
If the pixel src(x,y) is higher than 100, then set the pixel value to zero. The function used : threshold(gray, tozeroinverted, 100, 0, 4).
Remapping
For every pixel, change the pixel to a (x, number of rows - y). To do this, we need two mapping matrices maxp_x and map_y. Then, use the code to remap (for location (i, j)): map_x.at(j, i) = i; map_y.at(j, i) = image.rows - j.