'How to convert RGBA_8888 formatted image to opencv mat in android?

I am working on a android project where I need to use openCV for detecting and drawing over objects from live camera feed. But I don't know how can i convert to openCV mat format from RGBA_8888 format which is my analyzer output image format.

Found questions about default camerax output format YUV_420_888 to mat conversions but nothing about RGBA8888.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source