daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Feb 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. `#include <opencv2/opencv.hpp>
  3.  
  4. using namespace cv;
  5. using namespace std;
  6.  
  7. int main(){
  8. Mat bgr=imread("image.png",1);
  9. namedWindow("image",CV_WINDOW_FREERATIO);
  10. imshow("image",bgr);
  11. waitKey(0);
  12.  
  13. Mat hsv;
  14. cvtColor(bgr,hsv,COLOR_BGR2HSV);
  15.  
  16.  
  17. Mat mask1;
  18. Mat mask2;
  19. inRange(hsv,Scalar(0,100,100), Scalar(1,255,255), mask1);
  20. inRange(hsv,Scalar(176,100,100), Scalar(179,255,255), mask2);
  21.  
  22. Mat mask =mask1 | mask2;
  23. namedWindow("Output",CV_WINDOW_FREERATIO);
  24. imshow("Output",mask);
  25. waitKey(0);
  26.  
  27. Scalar mean (InputArray bgr, InputArray mask);
  28. {
  29.  
  30. cout << "Mask= " << mean << endl;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top