【发布时间】:2017-10-07 21:24:56
【问题描述】:
我想使用 open cv 库将自适应阈值应用于我的位图图像,但是一旦我使用以下代码,它会显示空白(全白)图像,请帮我解决它。
以下是代码:
Mat grayMat = imread(getImageUri(this, photo).getPath(), IMREAD_GRAYSCALE);
Mat resultMat = new Mat();
Imgproc.adaptiveThreshold(grayMat, resultMat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 3, 40);
Bitmap imgBitmap = Bitmap.createBitmap(resultMat.cols(), resultMat.rows(), Bitmap.Config.ARGB_8888);
【问题讨论】:
-
您是如何将
resultMat分配给imgBitmap的?在我看来,您只是实例化位图的大小和类型。 -
谢谢Rick M,我只是像这样创建了imgBitmap,如何将上面的位图传递给ImageView,请帮助
-
@RickM Utils.matToBitmap(resultMat, imgBitmap);我用了这个,但结果相同。
标签: android opencv opencv3.0 threshold adaptive-threshold