Skip to content

Instantly share code, notes, and snippets.

@heaversm
Created March 20, 2019 00:29
Show Gist options
  • Save heaversm/0ac7cebe60b9e48268741716b06f0511 to your computer and use it in GitHub Desktop.
Save heaversm/0ac7cebe60b9e48268741716b06f0511 to your computer and use it in GitHub Desktop.
Using OpenCV Contrib White Balancing on a Mat in C++
//install openCV contrib: https://cocoapods.org/pods/OpenCV2-contrib
/*
//in Podfile:
target 'MyProject' do
pod 'OpenCV2-contrib', '~> 3.2'
*/
//pod install
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/xphoto/white_balance.hpp>
namespace myProject {
void myFunction(){
cv::Mat gray;
cv::cvtColor(image, gray, CV_BGR2GRAY);
cv::Ptr<cv::xphoto::WhiteBalancer> wb = cv::xphoto::createSimpleWB();
wb->balanceWhite(gray, gray);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment