I am trying to write a function that change the gamma of input image.
The code that I wrote is as follow:
if(inputImage.channels() >= 3)
{
Mat hsv;
cvtColor(inputImage,hsv,CV_BGR2HSV_FULL);
vector<Mat> channels;
split(hsv,channels);
Mat tmp1=(channels[2]/255);
Mat tmp;
pow(tmp1,1.5,tmp);
channels[2]=255 *tmp;
Mat result;
merge(channels,hsv);
cvtColor(hsv,result,CV_HSV2BGR_FULL);
return result;
}
But I am getting run timeerror on line pwo(...): The error is:
OpenCV Error: Assertion failed (depth == CV_32F || depth == CV_64F) in unknown function, file C:\slave\builds\WinInstallerMegaPack\src\opencv\modules\core\src\mathfuncs.cpp, line 1931
If I change 1.5 to 2 in pow, There is no error. How can I raise each element of a matrix in openCV to a non integer value?
Is there any better way to change the gamma of an image in OpenCV?