java opencv字节转mat,互转
文章目录前言字节转matmat转字节前言opencv中字节与mat互转,直接上代码字节转mat//以上省略//dataImg为要转换的图片字节数组 byte[]MatOfByte matIntOfByte = new MatOfByte(dataImg);Mat imgTemMat = Imgcodecs.imdecode(matIntOfByte, Imgcodecs.IMREAD_UNCHAN
·
前言
opencv中字节与mat互转,直接上代码
字节转mat
//以上省略
//dataImg为要转换的图片字节数组 byte[]
MatOfByte matIntOfByte = new MatOfByte(dataImg);
Mat imgTemMat = Imgcodecs.imdecode(matIntOfByte, Imgcodecs.IMREAD_UNCHANGED);
mat转字节
//mat为你要转换的原始mat
MatOfByte matOfByte = new MatOfByte();
Imgcodecs.imencode(".jpg",mat,matOfByte);
byte[] bytes = matOfByte.toArray();
更多推荐
所有评论(0)