Skip to content

Instantly share code, notes, and snippets.

@codeOfRobin
Created May 22, 2015 13:24
Show Gist options
  • Save codeOfRobin/b2ee523fda6f97abed98 to your computer and use it in GitHub Desktop.
Save codeOfRobin/b2ee523fda6f97abed98 to your computer and use it in GitHub Desktop.
int threshold_value = 0;
int const max_BINARY_value = 2147483647;
cv::Mat src_gray=[self cvMatFromUIImage:img.image];
cv::Mat dst;
dst=src_gray;
cv::cvtColor(src_gray, dst, cv::COLOR_RGB2GRAY);
cv::Mat canny_output;
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::RNG rng(12345);
cv::threshold( dst, dst, threshold_value, max_BINARY_value,cv::THRESH_OTSU );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment