diff --git a/examples/img_proc/ball_log_lh.cpp b/examples/img_proc/ball_log_lh.cpp index c0033935047b20cdd7904c4cccf4bf4a60864eda..2f1ee01f3ce8c1ad5138b5a5059c7009a8642e85 100644 --- a/examples/img_proc/ball_log_lh.cpp +++ b/examples/img_proc/ball_log_lh.cpp @@ -36,6 +36,7 @@ int main(int argc, char** argv) { json jobj = load_json(vm["conf"].as<string>()); BallLogLikelihood bll(jobj.at("ball_log_lh")); + Binarizer bin(jobj.at("binarizer")); string fname = vm["input"].as<string>(); Mat img = imread(fname, CV_LOAD_IMAGE_COLOR); @@ -51,19 +52,25 @@ int main(int argc, char** argv) { " milliseconds" << endl; Mat log_lh_norm; normalize(im_proc, log_lh_norm, 0, 1, NORM_MINMAX); - imshow("Color", log_lh_norm); + imshow("Log likelihood equalized", log_lh_norm); + waitKey(0); + + //Probabilities + Mat t1, t2; + t1 = -im_proc; + exp(t1, t1); + t2 = 1.0/(1.0 + t1); + imshow("Probabilities", t2); waitKey(0); - double p = 0.95; - double thresh = log(p/(1-p)); Mat bin_img; start_t = std::chrono::steady_clock::now(); - threshold(im_proc, bin_img, thresh, 1, THRESH_BINARY_INV); + bin_img = bin(im_proc); end_t = std::chrono::steady_clock::now(); std::cout << "Binarization took " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - start_t).count() << " milliseconds" << endl; - imshow("Color", bin_img); + imshow("Binarized", bin_img); waitKey(0); if (vm.count("output")) {