I want to adjust the brightness of frame in opencv camera which is called mRgba. After I split the channel of lab. I hope to adjust the L channel but I don't know how to change the value in the L channel.
Mat lab_image = new Mat();
//mRgba is the frame which shows in the camera
Imgproc.cvtColor(mRgba, lab_image, Imgproc.COLOR_mRGBA2RGBA);
Imgproc.cvtColor(lab_image, lab_image, Imgproc.COLOR_RGBA2RGB);
Imgproc.cvtColor(lab_image, lab_image, Imgproc.COLOR_RGB2Lab);
// Extract the L channel
List<Mat> lab_list = new ArrayList(3);
Core.split(lab_image,lab_list);
//lab_list.get(0).copyTo(mRgba);
Mat result_image = new Mat();
Core.merge(lab_list,result_image);
Imgproc.cvtColor(result_image, mRgba, Imgproc.COLOR_Lab2RGB);
Imgproc.cvtColor(mRgba, mRgba, Imgproc.COLOR_RGB2RGBA);
Imgproc.cvtColor(mRgba, mRgba, Imgproc.COLOR_RGBA2mRGBA);
I try to use setTo() to set the color but it change the whole color.
lab_list.get(0).setTo(new Scalar(255,255,255,0.1));
I want to add value to increase the whole brightness.I hope the final result can become the following photo. Please give me some help. Thank You.
Let us say you want to increase your L channel by 50.
You can do it like this:
And then merge the channels like you do already.