5
edits
Changes
N/A
,→Assignment 1
The code uses standard libraries to handle images in the PGM format. It is a fairly straight forward program that intakes a number of images as command-line arguments, with the first being the image to edit, and provides the user some options to process the image, outputting the result to one of the provided image paths. The one thing I noticed the program lacks is a method for converting images to PGM, considering the program requires it. Therefore, for my testing of the program, I took a JPEG image and converted it to PGM using an online method found here: [https://www.files-conversion.com/image/pgm Dan's Tools - Convert Files]. Providing just the one image as a command-line argument only yielded 4 options that include getting/setting the values of pixels and getting other information. Looking through the code I knew there was more to it, but the method to process an image using the program required 2 arguments: first is the original image, second is the output image. With these provided, the program allows the user to rotate, invert/ reflect, enlarge, shrink, crop, translate, and negate.
The code is found on the site, near the end of the article. To run it, I made a Makefile. The code downloaded and borrowed from the site are stored as text files, so I renamed them as .cpp and .h files within the Linux environment. Here are the files for ease of access: [[File:main.cpp.txt]] | [[File:image.h.txt]] | [[File:image.cpp.txt]]Also, here is the Makefile:
#Makefile for A1 - Image Processing
0.00 0.61 0.00 1 0.00 0.00 _GLOBAL__sub_I__ZN5ImageC2Ev
0.00 0.61 0.00 1 0.00 0.00 Image::Image(Image const&)
A second run of the program, with me enlarging the image, rotating, translating, and negating the image resulted in a time of:
real 1m0.968s
user 0m0.295s
sys 0m0.297s
And a Flat profile of:
% cumulative self self total
time seconds seconds calls ms/call ms/call name
33.37 0.14 0.14 6 23.36 23.36 Image::operator=(Image const&)
26.22 0.25 0.11 5 22.02 22.02 Image::Image(int, int, int)
14.30 0.31 0.06 writeImage(char*, Image&)
14.30 0.37 0.06 Image::rotateImage(int, Image&)
7.15 0.40 0.03 Image::enlargeImage(int, Image&)
2.38 0.41 0.01 Image::reflectImage(bool, Image&)
2.38 0.42 0.01 Image::translateImage(int, Image&)
0.00 0.42 0.00 6 0.00 0.00 Image::~Image()
0.00 0.42 0.00 1 0.00 0.00 _GLOBAL__sub_I__ZN5ImageC2Ev
0.00 0.42 0.00 1 0.00 0.00 Image::Image(Image const&)
'''Conclusion:'''
=== Assignment 2 ===
=== Assignment 3 ===