Joined
Last Online
Recent Posts
posted in bug、问题、建议 read more

Wrapped CvException [org.opencv.core.CvException: cv::Exception: OpenCV(4.5.5) /build/master_pack-android/opencv/modules/imgproc/src/templmatch.cpp:1164: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function 'matchTemplate'
] (/android_asset/modules/images.js#410)
Wrapped CvException [org.opencv.core.CvException: cv::Exception: OpenCV(4.5.5) /build/master_pack-android/opencv/modules/imgproc/src/templmatch.cpp:1164: error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function 'matchTemplate'
]
at /android_asset/modules/images.js:410:0
at /android_asset/modules/images.js:438:0

复现过程
const img = images.interval(images.read(this.p + "1.png"), 0xffffffff, 0);
images.save(img, this.p + "t.png");
const t = images.read(this.p + "t.png");
const r = images.findImageInRegion(t, img, 1, 1);
总结
只要经过处理的image 放入找图类API中,都会出现这个错误. 如果将图片 保存,再读取后,得到的image则不会出现问题.例如:
const img = images.interval(images.read(this.p + "1.png"), 0xffffffff, 0);
images.save(img, this.p + "t.png");
const t = images.read(this.p + "t.png");
const r = images.findImageInRegion(t, images.fromBytes(images.toBytes(img)), 1, 1);
这样处理后,就不会有任何问题;

posted in bug、问题、建议 read more

要用到自定义字体寻找图片的方法.只能是将一个像素一个像素进行二值化拼接后再寻找.这样效率太低了.