GPU610/TeamKCM
GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary
Contents
- 1 Team KCM
Team KCM
Team Members
- Byunghi Kim, Some responsibility
- Taeyang Chung, Some responsibility
- SeungYeon Moon, Some responsibility
Progress
Assignment 1
Byungho's Findings
Introduction
To enhance image quality, most of S/W use convolution algorithm with sharpen kernel. The convolution algorithm is based on pixel window and kernel multiplication and the kernel which consists of 3 x 3 matrix or 5 x 5 matrix. Therefore, as we learned at the GPU610 class, I can speed up the program using CUDA library
Original Image | Enhanced Image |
---|---|
These two images show the result of the S/W. Left picture is the original image and right picture is obtained by the S/W. 3x3 matrix sharpen kernel is used.
Convolution
IP11 | IP12 | IP13 | IP14 | IP15 | IP16 |
IP21 | IP22 | IP23 | IP24 | IP25 | IP26 |
IP31 | IP32 | IP33 | IP34 | IP35 | IP36 |
IP41 | IP42 | IP43 | IP44 | IP45 | IP46 |
K0 | K1 | K2 |
K4 | K5 | k6 |
k7 | k8 | k9 |
The output pixel OP33 is IP22 x K0 + IP23 x K1 + IP24 x K2 + IP32 x K4 + IP33 x K5 + IP34 x K6 + IP42 x K7 + IP43 x K8 + IP44 x K9
Analysis
The profile shows that filter function occupies the most of processing time.
% cumulative self self total time seconds seconds calls ns/call ns/call name 93.59 1.46 1.46 filter(image_t*, double*, int, double, double) 6.41 1.56 0.10 5038848 19.85 19.85 put_pixel_unsafe(image_t*, unsigned int, unsigned int, unsigned char, unsigned char, unsigned char) 0.00 1.56 0.00 2 0.00 0.00 alloc_img(unsigned int, unsigned int) 0.00 1.56 0.00 1 0.00 0.00 _GLOBAL__sub_I__Z7get_ppmP8_IO_FILE 0.00 1.56 0.00 1 0.00 0.00 get_ppm(_IO_FILE*)
In the filter function, 3 x 3 mask walk through all RGB pixels and calculate convolution of them.
image filter(image im, double *K, int Ks, double divisor, double offset) { image oi; unsigned int ix, iy, l; int kx, ky; double cp[3]; oi = alloc_img(im->width, im->height); if ( oi != NULL ) { for(ix=0; ix < im->width; ix++) { for(iy=0; iy < im->height; iy++) { cp[0] = cp[1] = cp[2] = 0.0; for(kx=-Ks; kx <= Ks; kx++) { for(ky=-Ks; ky <= Ks; ky++) { for(l=0; l<3; l++) cp[l] += (K[(kx+Ks) + (ky+Ks)*(2*Ks+1)]/divisor) * ((double)GET_PIXEL_CHECK(im, ix+kx, iy+ky, l)) + offset; } } for(l=0; l<3; l++) cp[l] = (cp[l]>255.0) ? 255.0 : ((cp[l]<0.0) ? 0.0 : cp[l]) ; put_pixel_unsafe(oi, ix, iy, (color_component)cp[1], (color_component)cp[2], (color_component)cp[0]); } } return oi; } return NULL; }
Taeyang's Findings
......
SeungYeon's Findings
There are many types of image processing or operations can be done. Some of examples are rotating,re-sizing,blurring, etc... For Assignment 1, I decided to work with one of the operation that can be done with an image in c++, which deals with brightness and contrast of an image. I was able to find a open source code from "openCV" website it stands for Open Source Computer Vision, is open source libraries developed by Intel for image and video processing. The libraries can be installed in any platform, and i was able to install it in my windows platform, and all test runs all done using visual studio 2013, Test file is compiled and profiled using performance wizard vs13. Following website openCV.org is an official documentation website of openCV libraries, with code examples for many image and video type operations
The open source code for the program requires 3 user inputs which are path to an image and alpha,beta values which will be multiplied and added to each pixels' in the image. To make sure test run is accurate, i had to change some code in the program and hard code in the values for alpha and beta.
Here is two test runs using same image but in different file size
Test run with an image size of 500KB
Total Time takes is 12 seconds
Test run with an image size of 2MB
Total Time takes is 14 seconds
SeungYeons' observation for As_1
Changing contrast and brightness of an image in the function is implemented with a scale * matrix operation. M_A(x,y) = ALPHA * M_B(x,y) + BETA;