网上搜索的都是C++或者python的解决思路。
这里给个java的处理思路
1.Imgproc.putText中文乱码
Imgproc.putText(image, new String(("性别:" + gender + "年龄:" + age).getBytes("UTF-8")),
new Point(rects[i].x, rects[i].y), Imgproc.FONT_HERSHEY_PLAIN, 0.8, sc, 1, Imgproc.LINE_AA, false);
2.问题处理思路
1.MAT转IMAGE
2.IMAGE添加水印后转MAT
3.代码(转换来自网络)
/**
* Mat转换成BufferedImage
*
* @param matrix 要转换的Mat
* @param fileExtension 格式为 ".jpg", ".png", etc
* @return
*/
public static BufferedImage Mat2BufImg(Mat matrix, String fileExtension) {
// convert the matrix into a matrix of bytes appropriate for
// this file extension
MatOfByte mob = new MatOfByte();
Imgcodecs.imencode(fileExtension, matrix, mob);
// convert the "matrix of bytes" in