Last active
December 17, 2015 22:19
-
-
Save cocodrips/5680874 to your computer and use it in GitHub Desktop.
【OpenCV for Android】ガンマ補正
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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