私がやろうとしているのは、しきい値処理された画像を取得し、その上で findContours を実行してから、回転補正された画像に描画することです。回転補正された画像としきい値処理された画像は期待どおりに機能するため、これがクラッシュする理由を理解するのに少し苦労しています。閾値化された画像は、バイナリ閾値が適用された回転補正画像のグレー バージョンです。
public void findImageContours(Mat passedThreshInt, Mat passedRotatedInit)
{
/* Get Thresholded input image */
Mat initThresh = passedThreshInt.clone();
/* Get image to draw Contours on */
Mat initRotated = passedRotatedInit.clone();
/* Get contours from threshold image */
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Imgproc.findContours(initThresh, contours, mHierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
/* Draw Contours */
Scalar CONTOUR_COLOR = new Scalar(255,0,0,255);
Log.e(TAG, "Contours count: " + contours.size());
Imgproc.drawContours(initRotated, contours, -1, CONTOUR_COLOR);
/* Save Output */
contouredInit = initRotated.clone(); //ContouredInit is Global
Utils.matToBitmap(contouredInit, contouredBitmapInit); // contouredBitmapInit is Global
}
エラー:
OpenCV Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/java/generator/src/cpp/utils.cpp, line 97
nMatToBitmap catched cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/java/generator/src/cpp/utils.cpp:97: error: (-215) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)
その後、JDI ディスパッチ エラーが発生しました。