Advertisement
Guest User

xphoto_Test

a guest
Jan 2nd, 2018
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <opencv2/xphoto/white_balance.hpp>
  2. #include <opencv2/xphoto.hpp>
  3. #include <opencv2/core/core.hpp>
  4. #include <opencv2/highgui/highgui.hpp>
  5. #include <opencv2/imgproc/imgproc.hpp>
  6. #include <iostream>
  7.  
  8. using namespace cv;
  9. using namespace std;
  10.  
  11. int main(int argc, char* argv[])
  12. {
  13. Mat img, img_out;
  14. img = imread(argv[1], CV_LOAD_IMAGE_COLOR);
  15.  
  16. namedWindow( "Input", WINDOW_NORMAL );
  17. resizeWindow( "Input", 1280, 720);
  18. imshow( "Input", img );
  19. Ptr<xphoto::LearningBasedWB> wb;
  20. wb = xphoto::createLearningBasedWB("color_balance_model.yml");
  21. wb->setRangeMaxVal(255);
  22. wb->setSaturationThreshold(0.98);
  23. wb->setHistBinNum(64);
  24. wb->balanceWhite(img, img_out);
  25.  
  26. namedWindow( "Output", WINDOW_NORMAL );// Create a window for display.
  27. resizeWindow( "Output", 1280, 720);
  28. imshow( "Output", img_out ); // Show our image inside it.
  29.  
  30. waitKey(0);
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement