android-笔记-OpenCV 相关函数
Mat
1. Mat
Mat original = Imgcodecs.imread("input.jpg"); // 加载原始图像
Mat cloned = original.clone(); // 对克隆副本进行操作(原始图像不受影响)
original.release(); // 释放内存
cloned.release();
知识点 注意点
同张图片 bitmap的宽高 与 mat的宽高 行列数量相等 bitmap.getWidth() = matsrc.width(); bitmap.getHeight()= matsrc.height();
Bitmap bitmap = mSurfaceView.readPicture(img_org); //读图片 Mat matsrc = new Mat(); Log.e(TAG, "run: "+ bitmap.getWidth() + " " + bitmap.getHeight()); Utils.bitmapToMat(bitmap,matsrc); Log.e(TAG, "run: "+ matsrc.width() + " " + matsrc.height()); Log.e(TAG, "run: "+ matsrc.cols() + " " + matsrc.rows());
