我正在使用一个简单的边缘检测程序包。
https://github.com/flutter-clutter/flutter-simple-edge-detection
使用过程镜像功能时出现此运行时错误。
E / cv::error()(25743):OpenCV(4.4.0)错误:OutOfMemoryError中的内存不足(未能分配396761445280字节),文件/ build / master_pack-android / opencv / modules / core / src / alloc。 cpp,第73行
E / libc++ abi(25743):终止于cv::Exception类型的未捕获异常:OpenCV(4.4.0)/build/master_pack-android/opencv/modules/core/src/alloc.cpp:73:错误: (-4:内存不足)无法在函数'OutOfMemoryError'中分配396761445280字节
F / libc(25743):致命信号6(SIGABRT),tid 26135(DartWorker)中的代码-6,pid 25743(_app_docscanner)
构建指纹:'Xiaomi / riva / riva:8.1.0 / OPM1.171019.026 / V11.0.2.0.OCKMIXM:user / release-keys'
修订:“0”
ABI:“arm64”
pid:25743,tid:26135,名称:DartWorker >>> com.dev.flutter_app_docscanner <<<
信号6(SIGABRT),代码-6(SI_TKILL),故障加法器--------
中止消息:'终止于cv::Exception类型的未捕获异常:OpenCV(4.4.0)/build/master_pack-android/opencv/modules/core/src/alloc.cpp:73:错误:(-4:内存不足)无法在函数'OutOfMemoryError'中分配396761445280字节
'
x0 0000000000000000 x1 0000000000006617 x2 0000000000000006 x3 0000000000000008
x4 fefefefefefeffee x5 fefefefefefeffee x6 fefefefefefeffee x7 7f7f7f7f7f7f7f7fff
x8 0000000000000083 x9 d8990fa8bbd15576 x10 0000000000000000 x11 0000000000000001
x12 ffffffffffffffff x13 000000005f9804cc x14 00135f14cf2c6400 x15 00009bbecf145629
x16 0000005d0d39dfa8 x17 00000073d84ee598 x18 00000073336dad84 x19 000000000000648f
x20 0000000000006617 x21 00000073298fdb68 x22 ffffff80ffffffc8 x23 00000073298fdc20
x24 00000073298fdb00 x25 00000073298fdb40 x26 0000007337858400 x27 000000732f33fb30
x28 0000000000000004 x29 00000073298fda70 x30 00000073d84a3df8
sp 00000073298fda30 pc 00000073d84a3e14 pstate 0000000060000000
回溯:
#00 pc 000000000001de14 /system/lib64/libc.so(中止+104)
#1 pc 000000000009ce88 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libc++_shared.so
#2 pc 000000000009d07c /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libc++_shared.so
#3 pc 00000000000aead0 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libc++_shared.so
#4 pc 00000000000ae3d8 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libc++_shared.so(__cxa_rethrow + 196)
#5 pc 0000000000305174 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libopencv_java4.so(cv::Mat::create(int,int const *,int)+1316)
#6 pc 0000000000327d98 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libopencv_java4.so
#7 pc 000000000001ce64 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==//lib/arm64/libnative_edge_detection.so(_ZNK2cv7MatExprcvNS_3MatEEv + 96)
#8 pc 000000000001c9fc /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libnative_edge_detection.so(ImageProcessor::crop_and_transform(cv::Mat,float,float,float,float,float,float, ,float)+512)
#9 pc 000000000001c788 /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libnative_edge_detection.so(ImageProcessor::process_image(cv::Mat,float,float,float,float,float,float,float,float ,float)+136)
#10 pc 000000000000ef6c /data/app/com.dev.flutter_app_docscanner-IsHbl2638h0fBP3Q2TWjlQ==/lib/arm64/libnative_edge_detection.so(process_image + 640)
#11 pc 00000000000065a4匿名:000000733b480000
与设备的连接断开。
最佳答案
内存不足很清楚,您使用的图像分辨率超出了设备可以处理的范围。
您需要缩放输入图像,以使其更小。此代码随附一个示例图像。尝试将图像缩小到与示例图像相同的大小。
关于android - 使用简单边缘检测 flutter 时出现运行时错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/64555521/