Skip to content
Snippets Groups Projects
Commit b760252f authored by Sebastian Gomez-Gonzalez's avatar Sebastian Gomez-Gonzalez
Browse files

Updating the ball log likelihood example

parent 4947e464
No related branches found
No related tags found
No related merge requests found
......@@ -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")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment