122
edits
Changes
→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 1~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)
Rotated and negated the image.
>g++ -g -O2 -pg -omain main.cpp
>main baboonsizetwo
>gprof -p -b main>main.flt
The results of the flat profile:
Out of all the functions tested, reflectImage has rotateImage takes up the largest ms/callamount of time. Below is the code for reflectImagerotateImage:
{
int r0, c0; int r1, c1; int rows, cols; rows = oldImage.N; int cols = oldImage.M; Image tempImage(rows, cols, oldImage.Q); if float rads = (flag theta * 3.14159265)/180.0; r0 = rows / 2; c0 =cols / 2; for(int r = true0; r < rows; r++) //horizontal reflection
{
for(int i c = 0; i c < rowscols; ic++)
{
}
}
{
for(int i j = 0; i j < rowscols; ij++)
{
}
}
oldImage = tempImage;}