Open main menu

CDOT Wiki β

Changes

Three-Star

844 bytes added, 09:19, 21 February 2018
Image Profiling
==== Image Profiling ====
Chosen to profile image profiling as shown here: http://www.dreamincode.net/forums/topic/76816-image-processing-tutorial/ , using the sample programs (main/image.h/image.cpp)
Slightly modified main.cpp to accomodate larger images.
Had to expand a PGM image (to about 83~MB size) to return any meaningful result (Using a regular sized PGM image of 11KB yielded absolutely no meaningful results to the human eye - all 0's on the flat profile/call graph)
0.00 1.82 0.00 1 0.00 336.67 Image::reflectImage(bool,Image&)
0.00 1.82 0.00 1 0.00 0.00 Image::inBounds(int, int)
 
 
Out of all the functions tested, reflectImage has the largest ms/call. Below is the code for reflectImage:
void Image::reflectImage(bool flag, Image& oldImage)
/*Reflects the Image based on users input*/
{
int rows = oldImage.N;
int cols = oldImage.M;
Image tempImage(oldImage);
if(flag == true) //horizontal reflection
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
tempImage.pixelVal[rows - (i + 1)][j] = oldImage.pixelVal[i][j];
}
}
else //vertical reflection
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
tempImage.pixelVal[i][cols - (j + 1)] = oldImage.pixelVal[i][j];
}
}
oldImage = tempImage;
}
==== LZW Data Compression Algorithm ====
122
edits