to Mat
Converts a BufferedImage to Mat, the BufferedImage type to CvType mapping is listed as below:
BufferedImage.TYPE_BYTE_GRAY ->CvType.CV_8UC1
BufferedImage.TYPE_3BYTE_BGR ->CvType.CV_8UC3
BufferedImage.TYPE_4BYTE_ABGR ->CvType.CV_8UC4
Other types are not supported