Skip to content Skip to sidebar Skip to footer

Convert Merged RGB Image To Grayscale OPENCV ANDROID

I tried to split RGB image (http://www.kavim.com/uploads/signs/tn__51A2376.JPG) into seperate channels, threshold each channel and merge it back together resulting in something li

Solution 1:

The problem was that, I was trying to convert object set as inputFrame.rgba() to gray.

For this I had to create another mat set as inputFrame.gray() and then try to convert it.

Mat rgb = inputFrame.rgba();
Mat gray = inputFrame.gray();
Mat grayInnerWindow = gray.submat(top, top + height, left, left + width);
Mat rgbaInnerWindow = rgba.submat(top, top + height, left, left + width);
//SOME CODE
Imgproc.cvtColor(rgbaInnerWindow,grayInnerWindow, Imgproc.COLOR_BGR2GRAY);

This now works as it should!


Post a Comment for "Convert Merged RGB Image To Grayscale OPENCV ANDROID"