Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Last active December 17, 2015 22:19
Show Gist options
  • Save cocodrips/5680874 to your computer and use it in GitHub Desktop.
Save cocodrips/5680874 to your computer and use it in GitHub Desktop.
【OpenCV for Android】ガンマ補正
public synchronized Mat gammaFilter(Mat inputPicture) {
Mat result = new Mat();
inputPicture.copyTo(result);
Mat lut = new Mat(1, 256, CvType.CV_8UC1);
lut.setTo(new Scalar(0));
double gamma = 3;
for (int i = 0; i < 256; i++)
{
lut.put(0, i, Math.pow((double)(1.0 * i/255), gm) * 255);
}
Core.LUT(inputPicture, lut, result);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment