Open main menu

CDOT Wiki β

Changes

Savy Cat

2,301 bytes added, 04:42, 25 March 2018
Initial Code
rotate90(src, dst);
rotate90(dst, src);
 
}</nowiki>
 
;Rotate.cpp
 
<nowiki>
// Evan Marinzel - DPS915 Project
// Rotate.cpp
 
#include "Rotate.h"
 
int main(int argc, char** argv) {
 
// Allocate memory for 3 CImg structures, initializing colour values from speficied files.
cimg_library::CImg<PX_TYPE> img_tiny("C:\\School\\DPS915\\Project\\CImg-Rotate\\Debug\\Tiny-Shay.jpg");
cimg_library::CImg<PX_TYPE> img_med("C:\\School\\DPS915\\Project\\CImg-Rotate\\Debug\\Medium-Shay.jpg");
cimg_library::CImg<PX_TYPE> img_large("C:\\School\\DPS915\\Project\\CImg-Rotate\\Debug\\Large-Shay.jpg");
 
// Allocate memory for rotated versions of above, initializing colour values to 0.
cimg_library::CImg<PX_TYPE> img_tiny90(img_tiny.height(), img_tiny.width(), 1, 3, 0);
cimg_library::CImg<PX_TYPE> img_med90(img_med.height(), img_med.width(), 1, 3, 0);
cimg_library::CImg<PX_TYPE> img_large90(img_large.height(), img_large.width(), 1, 3, 0);
 
// Un-comment to print pixel values to console and display image for 4 rotations
/*
display(img_tiny);
rotate90(img_tiny, img_tiny90);
display(img_tiny90);
rotate90(img_tiny90, img_tiny);
display(img_tiny);
rotate90(img_tiny, img_tiny90);
display(img_tiny90);
rotate90(img_tiny90, img_tiny);
display(img_tiny);
*/
 
// Display image statistics and rotate 12 times each.
imgStats("Tiny Shay", img_tiny);
std::cout << "Rotating 4x..." << std::endl;
rotate90x4(img_tiny, img_tiny90);
std::cout << "Rotating 8x..." << std::endl;
rotate90x4(img_tiny, img_tiny90);
std::cout << "Rotating 12x..." << std::endl;
rotate90x4(img_tiny, img_tiny90);
std::cout << "Shay is dizzy!" << std::endl << std::endl;
 
imgStats("Medium Shay", img_med);
 
std::cout << "Rotating 4x..." << std::endl;
rotate90x4(img_med, img_med90);
std::cout << "Rotating 8x..." << std::endl;
rotate90x4(img_med, img_med90);
std::cout << "Rotating 12x..." << std::endl;
rotate90x4(img_med, img_med90);
std::cout << "Shay is dizzy!" << std::endl << std::endl;
 
imgStats("Large Shay", img_large);
 
std::cout << "Rotating 4x..." << std::endl;
rotate90x4(img_large, img_large90);
std::cout << "Rotating 8x..." << std::endl;
rotate90x4(img_large, img_large90);
std::cout << "Rotating 12x..." << std::endl;
rotate90x4(img_large, img_large90);
std::cout << "Shay is dizzy!" << std::endl << std::endl;
 
return 0;
}</nowiki>
93
edits