Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencv2/xphoto/white_balance.hpp>
- #include <opencv2/xphoto.hpp>
- #include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <opencv2/imgproc/imgproc.hpp>
- #include <iostream>
- using namespace cv;
- using namespace std;
- int main(int argc, char* argv[])
- {
- Mat img, img_out;
- img = imread(argv[1], CV_LOAD_IMAGE_COLOR);
- namedWindow( "Input", WINDOW_NORMAL );
- resizeWindow( "Input", 1280, 720);
- imshow( "Input", img );
- Ptr<xphoto::LearningBasedWB> wb;
- wb = xphoto::createLearningBasedWB("color_balance_model.yml");
- wb->setRangeMaxVal(255);
- wb->setSaturationThreshold(0.98);
- wb->setHistBinNum(64);
- wb->balanceWhite(img, img_out);
- namedWindow( "Output", WINDOW_NORMAL );// Create a window for display.
- resizeWindow( "Output", 1280, 720);
- imshow( "Output", img_out ); // Show our image inside it.
- waitKey(0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement