ssim experimentation

This commit is contained in:
Tyler 2019-12-25 02:39:30 -08:00
parent 1f8fbfc194
commit 1de5668367
3 changed files with 53 additions and 51 deletions

View File

@ -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'.

View File

@ -60,7 +60,7 @@ public:
}
}
variance /= (block_size * block_size - 1);
variance = pow(variance, .5);
//variance = pow(variance, .5);
return variance;
}

View File

@ -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;
}