title: How to adjust image brightness in Android with OpenCV?
body: <p>I created an example image with brightness adjusted in Android. I used Bitmap to adjust the brightness but it takes a very long time to run. Instead, I want to set the image brightness in Android using OpenCV. </p>
  
  <p>This is my example code, but it only changes the colour of the image:</p>
  
  <pre><code>Bitmap bmp = BitmapFactory.decodeResource(getResources(),
              R.drawable.a001);
  int width = bmp.getWidth();
  int height = bmp.getHeight();
  Mat mRgba = new Mat(width, height, CvType.CV_8UC1);
  Utils.bitmapToMat(bmp, mRgba);
  Mat mRay = new Mat();
  Imgproc.cvtColor(mRgba, mRay, Imgproc.COLOR_BGRA2RGB, 4);
  Utils.matToBitmap(mRay, bmp);
  mImageview_01.setImageBitmap(bmp);
  </code></pre>
  
  <p><strong>[Update]</strong> 
  I try add code, but it error</p>
  
  <pre><code>Bitmap bmp = BitmapFactory.decodeResource(getResources(),
              R.drawable.a001);
  int width = bmp.getWidth();
  int height = bmp.getHeight();
  Mat mRgba = new Mat(width, height, CvType.CV_8UC1);
  Utils.bitmapToMat(bmp, mRgba);
  Mat mRay = new Mat();
  Imgproc.cvtColor(mRgba, mRay, Imgproc.COLOR_BGRA2RGB, 4);
  /*
  * Use Adaptive Thresholding on the grayscaled Mats crop -&gt; threshed Mat
  * src, Mat dst, double maxValue, int adaptiveMethod, int thresholdType,
  * int blockSize, double C
  */
  Imgproc.adaptiveThreshold(threshed, threshed, 255,
              Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY_INV, 15, 8);
  Utils.matToBitmap(mRay, bmp);
  mImageview_01.setImageBitmap(bmp);
  </code></pre>
  
  <p><strong>[Error]</strong></p>
  
  <pre><code>CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/thresh.cpp:796: error: (-215) src.type() == CV_8UC1 in function void cv::adaptiveThreshold(cv::InputArray, cv::OutputArray, double, int, int, int, double)
  </code></pre>
  
  <p>Pls view examples of what I'm trying to do <a href="http://shaikhhamadali.blogspot.com/2013/07/set-brightness-of-imageincreasedecrease.html" rel="nofollow">here</a>.</p>