diff --git a/dandere2x_cpp/src/Driver.h b/dandere2x_cpp/src/Driver.h index ce13f14..620481e 100644 --- a/dandere2x_cpp/src/Driver.h +++ b/dandere2x_cpp/src/Driver.h @@ -146,8 +146,8 @@ void driver_difference(string workspace, int resume_count, int frame_count, // For Debugging. Create a folder called 'debug_frames' in workspace when testing this - // Enabling this will allow you to see what Dandere2x_Cpp is seeing when it finishes processing a frame. -// DebugImage before = DebugImage::create_debug_from_image(*image_2); -// before.save(workspace + "debug_frames" + separator() + "before_" + to_string(x) + ".png"); + DebugImage before = DebugImage::create_debug_from_image(*image_2); + before.save(workspace + "debug_frames" + separator() + "before_" + to_string(x) + ".png"); // For the next iteration, we simply let frame 'x' become frame 'x+1'. diff --git a/dandere2x_cpp/src/Image/SSIM/SsimStatsFunctions.h b/dandere2x_cpp/src/Image/SSIM/SsimStatsFunctions.h index e29d889..f596fa9 100644 --- a/dandere2x_cpp/src/Image/SSIM/SsimStatsFunctions.h +++ b/dandere2x_cpp/src/Image/SSIM/SsimStatsFunctions.h @@ -60,7 +60,7 @@ public: } } variance /= (block_size * block_size - 1); - variance = pow(variance, .5); + //variance = pow(variance, .5); return variance; } diff --git a/dandere2x_cpp/src/main.cpp b/dandere2x_cpp/src/main.cpp index 35469df..8d2c871 100644 --- a/dandere2x_cpp/src/main.cpp +++ b/dandere2x_cpp/src/main.cpp @@ -17,63 +17,65 @@ void benchmark(){ #include "BlockMatch/ExhaustiveSearch.h" #include "Image/SSIM/SSIM.h" +#include "Image/SSIM/SsimStatsFunctions.h" - Image im1 = Image("C:\\Users\\windwoz\\Pictures\\test_images\\test_image.png"); - Image im2 = Image("C:\\Users\\windwoz\\Pictures\\test_images\\reallybad.png"); + Image im1 = Image("C:\\Users\\windwoz\\Desktop\\release\\workspace\\default\\negative_dir\\203.png"); + Image im2 = Image("C:\\Users\\windwoz\\Desktop\\release\\workspace\\default\\negative_dir\\compressed.jpg"); - Image im3 = Image(im1); + double covariance = StatFunctions::covariance(im1, im2, 0, 0, 0,0, 100, 'g'); + double var = StatFunctions::variance_block(im1, 0, 0, 100, 'g'); + double mean = StatFunctions::mean_block(im1, 0, 0, 100, 'g'); + std::cout << "variance: " << var << std::endl; + std::cout << "covariance: " << covariance << std::endl; + std::cout << "mean: " << mean << std::endl; - - double ssim = SSIM::ssim(im1, im2, 0,0,0,0,30); - double ssim_copy = SSIM::ssim(im3, im2, 0,0,0,0,30); - - std::cout << "ssim: " << ssim << std::endl; - std::cout << "ssim copy : " << ssim_copy << std::endl; + double ssim_r = SSIM::ssim(im1, im2, 0, 0, 0, 0, 100); + std::cout << "ssim_r: " << ssim_r << std::endl; } int main(int argc, char **argv) { -// benchmark(); + benchmark(); +//// +// bool debug = true; //debug flag // - bool debug = true; //debug flag - - //Initialize the variables needed for Dandere2x's driver. If debug = True, then we use these variables. - - string workspace = "C:\\Users\\windwoz\\Documents\\sublime_merge\\dandere2x\\src\\workspace\\30_no_fade\\"; - int frame_count = 240; - int block_size = 20; - int step_size = 8; - string run_type = "n";// 'n' or 'r' - int resume_frame = 55; - string extension_type = ".jpg"; - - cout << "Hello Dandere!!" << endl; - - //load arguments - if (!debug) { - workspace = argv[1]; - frame_count = atoi(argv[2]); - block_size = atoi(argv[3]); - step_size = atoi(argv[4]); - run_type = argv[5]; - resume_frame = atoi(argv[6]); - extension_type = argv[7]; - } - - cout << "Settings" << endl; - cout << "workspace: " << workspace << endl; - cout << "frame_count: " << frame_count << endl; - cout << "block_size: " << block_size << endl; - cout << "step_size: " << step_size << endl; - cout << "run_type: " << run_type << endl; - cout << "ResumeFrame (if valid): " << resume_frame << endl; - cout << "extension_type: " << extension_type << endl; - - if (run_type == "n") - driver_difference(workspace, 1, frame_count, block_size, step_size, extension_type); - else if (run_type == "r") - driver_difference(workspace, resume_frame, frame_count, block_size, step_size, extension_type); +// //Initialize the variables needed for Dandere2x's driver. If debug = True, then we use these variables. +// +// string workspace = "C:\\Users\\windwoz\\Desktop\\release\\workspace\\default\\"; +// int frame_count = 240; +// int block_size = 60; +// int step_size = 8; +// string run_type = "r";// 'n' or 'r' +// int resume_frame = 200; +// string extension_type = ".jpg"; +// +// cout << "Hello Dandere!!" << endl; +// +// //load arguments +// if (!debug) { +// workspace = argv[1]; +// frame_count = atoi(argv[2]); +// block_size = atoi(argv[3]); +// step_size = atoi(argv[4]); +// run_type = argv[5]; +// resume_frame = atoi(argv[6]); +// extension_type = argv[7]; +// } +// +// cout << "Settings" << endl; +// cout << "workspace: " << workspace << endl; +// cout << "frame_count: " << frame_count << endl; +// cout << "block_size: " << block_size << endl; +// cout << "step_size: " << step_size << endl; +// cout << "run_type: " << run_type << endl; +// cout << "ResumeFrame (if valid): " << resume_frame << endl; +// cout << "extension_type: " << extension_type << endl; +// +// if (run_type == "n") +// driver_difference(workspace, 1, frame_count, block_size, step_size, extension_type); +// else if (run_type == "r") +// driver_difference(workspace, resume_frame, frame_count, block_size, step_size, extension_type); return 0; }