Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <opencv2/imgproc/imgproc.hpp>
  2. #include <opencv2/highgui/highgui.hpp>
  3.  
  4. using namespace cv;
  5.  
  6. int main ( int argc, char **argv )
  7. {
  8. Mat im_gray = imread("img3.jpg",CV_LOAD_IMAGE_GRAYSCALE);
  9.  
  10. Mat im_rgb = imread("img3.jpg");
  11. cvtColor(im_rgb,im_gray,CV_RGB2GRAY);
  12.  
  13. Mat img_bw = im_gray > 115;
  14.  
  15. imwrite("img_bw3.jpg", img_bw);
  16.  
  17. return 0;
  18. }
  19.  
  20. cvThreshold(scr, dst, 128, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
  21.  
  22. cv::threshold(im_gray, img_bw, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement