Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Last active December 23, 2015 06:19
Show Gist options
  • Save cocodrips/6592834 to your computer and use it in GitHub Desktop.
Save cocodrips/6592834 to your computer and use it in GitHub Desktop.
チャンネルごとのガンマ補正 / OpenCV for Android
private double[] GAMMA_LEVEL_RGB = new double[3];
//こんなかんじの宣言しといて、適当に補正したい値を入れる
public synchronized Mat channelsGamma(Mat inputPicture) {
Mat channel = new Mat();
ArrayList<Mat> channels = new ArrayList<Mat>();
inputPicture.copyTo(channel);
Core.split(channel, channels);
for (int i = 0; i < 3; i++) {
channels.get(i), GAMMA_LEVEL_RGB[i]);
Mat result = gammaFilter(channels.get(i), GAMMA_LEVEL_RGB[i]);
//gammaFilterは自作関数
result.copyTo(channels.get(i));
}
Core.merge(channels, channel);
return channel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment