Skip to content

Instantly share code, notes, and snippets.

@nishanthbhat07
Created July 14, 2021 18:57
Show Gist options
  • Save nishanthbhat07/8910cfebd9f5d7ca3c817803f57ee3a3 to your computer and use it in GitHub Desktop.
Save nishanthbhat07/8910cfebd9f5d7ca3c817803f57ee3a3 to your computer and use it in GitHub Desktop.
Contrast

Given an image, this function adds contrast to the image automatically.

Mat contrast(Mat image){
  Mat1b gray= imread(image, IMREAD_GRAYSCALE);
  Mat1b result;
  adaptiveThreshold(gray, result, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 15, 40);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment