Difference between revisions of "GPU610/TeamKCM"

From CDOT Wiki
Jump to: navigation, search
(Analysis)
(Analysis)
Line 73: Line 73:
 
}
 
}
 
</pre>
 
</pre>
 
 
 
 
{{Box-round|title=Title|Text goes here}}
 
  
 
====Taeyang's Findings====
 
====Taeyang's Findings====

Revision as of 20:06, 3 October 2014


GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary

Team KCM

Team Members

  1. Byunghi Kim, Some responsibility
  2. Taeyang Chung, Some responsibility
  3. SeungYeon Moon, Some responsibility

Email All

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 matrix matrix 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
Original.png
Enhanced.png

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 was used.


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

Test run 500KB total.png

Total Time takes is 12 seconds


Test run 500KB.png


Test run with an image size of 2MB

Test run 2MB total.png

Total Time takes is 14 seconds


Test run 2MB.png


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;


Assignment 2

Assignment 3