【发布时间】:2014-09-02 15:51:54
【问题描述】:
我正在尝试将 Mat 矩形从 onCameraFrame 转换为位图,然后将位图发送到 ocr 函数,因为我需要使 ocr 根据矩形在 ROI 上实时工作。我尝试了以下几行:
Mat mgray= inputFrame.gray();
Mat grayInnerWindow = mgray.submat(100, 100 +500, 150, 200 + 50);
Imgproc.cvtColor(mIntermediateMat, rgbaInnerWindow, Imgproc.COLOR_GRAY2BGRA, 4);
rgbaInnerWindow.release();
Size sizeGray = grayInnerWindow.size();
int rowss = (int) sizeGray.height;
int colss = (int) sizeGray.width;
Mat tmp = new Mat(colss, rowss, CvType.CV_8UC4);
Imgproc.cvtColor(rgbaInnerWindow, tmp, Imgproc.COLOR_RGBA2BGRA, 4);
Bitmap bmp = Bitmap.createBitmap(tmp.cols(), tmp.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(tmp, bmp);
ImageView Img = (ImageView)findViewById(R.id.image_manipulations_activity_surface_view);
Img.setImageBitmap(bmp);
但是当我运行它时它终止了。
【问题讨论】:
-
终止为什么?!这里需要Logcat ...
标签: android opencv ocr tesseract