Not all is uncloudly!
I was trying to write some "pseudo-realtime" recognition on android.
The idea was to create several threads(number_of_processor_cores - 2, as supposed) and then to give for each some captured frame from camera's preview stream, While they are working, just look on preview sources and check the final of processing in some thread. When this occured, give to the free thread new task with new frame and so on.
All was written and works fine.... in one minute!! Then application was closed without any stacktrace. And the strange thing: (number of threads * interval of working) seems to be constant!
Looks like a bomb whaiting fot total number of pushes. :-( When emulating "nativerecognize" call with sleep(300)- no problems, the code works infinetly. I tried to modify my code- now I terminate thread after each recognition, then recreate it- the result ith the same. Ohh, fogot to write! The "Camera" class was useed in this series of attempts.
Then I tried to do the same with "Camera2" class. It is very strange,but the time to crash was the same as with "Camera".
Using "Android monitor"(no logs were generated!) I saw, this info:
..........................................................................
12-23 20:17:09.412 182-387/? I/cmr_grab: L 485, cmr_grab_buff_cfg: 2 1 0x4000
12-23 20:17:09.412 182-387/? D/cmr_grab: L 506, cmr_grab_buff_cfg: buf 0: Y 0x20bfe000
12-23 20:17:09.412 182-387/? D/cmr_preview: L 7103, prev_set_zsl_buffer: out cnt 4 width 720 height 480 addr_y 0x20bfe000, addr_u 0x20c52600
12-23 20:17:09.412 182-405/? I/cmr_preview: L 1378, cmr_preview_set_zsl_buffer: out
12-23 20:17:09.412 182-405/? I/SprdOEMCamera: L 734, camera_set_zsl_buffer: done 0
12-23 20:17:09.412 182-405/? D/SprdCamera3EOMIf: L 4799, PushZslbuff: X
12-23 20:17:09.412 182-405/? D/SprdCamera3HAL_Mem: L 261, map: IOMMU MAP iova mem_info->fd = 61, mem_info->addr_phy = 0x20c7e000, mem_info->size = 0x80000
12-23 20:17:09.412 182-405/? D/SprdCamera3Stream: L 130, buffDoneQ: Fnumber 1487, handle 0xb587ae44, SType 1
12-23 20:17:09.412 182-405/? D/SprdCamera3EOMIf: L 4727, PushPreviewbuff: addr_phy = 0x20c7e000, addr_vir = 0xa9b34000, ret = 0
12-23 20:17:09.412 182-387/? I/cmr_grab: L 485, cmr_grab_buff_cfg: 1 1 0x1000
12-23 20:17:09.412 182-387/? D/cmr_grab: L 506, cmr_grab_buff_cfg: buf 0: Y 0x20c7e000
12-23 20:17:09.412 182-387/? D/cmr_preview: L 6821, prev_set_preview_buffer: done cnt 4 addr_y 0x20c7e000
12-23 20:17:09.422 1287-1287/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-23 20:17:09.422 1287-1287/? I/DEBUG: Native Crash TIME: 8708633
12-23 20:17:09.422 1287-1287/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-23 20:17:09.422 1287-1287/? I/DEBUG: Build fingerprint: 'SPRD/s106a/scx35_sp7731gea_hd:5.1/LMY47D/lh22403121723:user/release-keys'
12-23 20:17:09.422 1287-1287/? I/DEBUG: Revision: '0'
12-23 20:17:09.422 1287-1287/? I/DEBUG: ABI: 'arm'
12-23 20:17:09.422 1287-1287/? I/DEBUG: pid: 32744, tid: 453, name: Thread-519 >>> ru.privatetest.realcamapp <<<
12-23 20:17:09.422 1287-1287/? I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-23 20:17:09.442 1287-1287/? I/DEBUG: r0 00000000 r1 000001c5 r2 00000006 r3 00000000
12-23 20:17:09.442 1287-1287/? I/DEBUG: r4 a27ffdb8 r5 00000006 r6 00000000 r7 0000010c
12-23 20:17:09.442 1287-1287/? I/DEBUG: r8 00000002 r9 a2ca4a70 sl b4b8a870 fp 0000000a
12-23 20:17:09.452 1287-1287/? I/DEBUG: ip 000001c5 sp a27fd238 lr b6e2f715 pc b6e526f0 cpsr 600d0010
12-23 20:17:09.452 1287-1287/? I/DEBUG: backtrace:
12-23 20:17:09.452 1287-1287/? I/DEBUG: #00 pc 0003a6f0 /system/lib/libc.so (tgkill+12)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #01 pc 00017711 /system/lib/libc.so (pthread_kill+52)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #02 pc 00018327 /system/lib/libc.so (raise+10)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #03 pc 00014bd1 /system/lib/libc.so (__libc_android_abort+36)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #04 pc 00012f58 /system/lib/libc.so (abort+4)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #05 pc 000e12f7 /data/app/ru.privatetest.realcamapp-1/lib/arm/libtess.so (ERRCODE::error(char const*, TessErrorLogCode, char const*, ...) const+170)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #06 pc 001623db /data/app/ru.privatetest.realcamapp-1/lib/arm/libtess.so (tesseract::Textord::TextordPage(tesseract::PageSegMode, FCOORD const&, int, int, Pix*, Pix*, Pix*, bool, BLOBNBOX_LIST*, BLOCK_LIST*, TO_BLOCK_LIST*)+254)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #07 pc 000a81e7 /data/app/ru.privatetest.realcamapp-1/lib/arm/libtess.so (tesseract::Tesseract::SegmentPage(STRING const*, BLOCK_LIST*, tesseract::Tesseract*, OSResults*)+730)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #08 pc 00088f89 /data/app/ru.privatetest.realcamapp-1/lib/arm/libtess.so (tesseract::TessBaseAPI::FindLines()+524)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #09 pc 000890e9 /data/app/ru.privatetest.realcamapp-1/lib/arm/libtess.so (tesseract::TessBaseAPI::Recognize(ETEXT_DESC*)+32)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #10 pc 000f13f9 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::TesseractOcr::recognize_line(int, alpr::PipelineData*)+564)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #11 pc 000f2607 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::OCR::performOCR(alpr::PipelineData*)+134)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #12 pc 000c3a89 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::AlprImpl::analyzeSingleCountry(cv::Mat, cv::Mat, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >)+1596)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #13 pc 000c24a5 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::AlprImpl::recognizeFullDetails(cv::Mat, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >)+1148)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #14 pc 000c6069 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::AlprImpl::recognize(cv::Mat, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >)+68)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #15 pc 000c57e3 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::AlprImpl::recognize(cv::Mat)+114)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #16 pc 000c54d9 /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::AlprImpl::recognize(std::vector<char, std::allocator<char> >)+112)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #17 pc 000bea0b /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalpr.so (alpr::Alpr::recognize(std::vector<char, std::allocator<char> >)+58)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #18 pc 0000bd1f /data/app/ru.privatetest.realcamapp-1/lib/arm/libopenalprjni.so (Java_com_openalpr_Alpr23_native_1recognize___3B+158)
12-23 20:17:09.452 1287-1287/? I/DEBUG: #19 pc 00001cd3 /data/data/ru.privatetest.realcamapp/cache/slice-slice_4-classes.dex
12-23 20:17:09.512 182-385/? I/cmr_oem: L 567, camera_grab_evt_cb: evt 0x10000, handle 0xb596a000
12-23 20:17:09.512 182-385/? I/cmr_oem: L 275, camera_get_snp_req: 0
12-23 20:17:09.512 182-385/? I/cmr_grab: L 790, cmr_grab_path_capability: video prev 0 scale 0 capture_no_trim 0 capture_pause 1
.........................
Can You explain what to do?
I'm have small experience in C++ and "below zero" in tesseract :-(
P.S. OpenCv2.4 causes the same behavior as 3.1.
The armeabi-v7a targeted projectThis is the link for Android studio 2.2.3 project, Armeabi-v7a jni-libs are in it, other can be found in my previous post.
4 and more cores in CPU supposed.