Skip to content

Instantly share code, notes, and snippets.

@hargup
Created December 5, 2013 11:53
Show Gist options
  • Save hargup/7804103 to your computer and use it in GitHub Desktop.
Save hargup/7804103 to your computer and use it in GitHub Desktop.
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char ** argv)
{
Mat img, res;
img = imread(argv[1], 0);
threshold(img, res, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
imwrite("img_bin.png",res);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment