opencv-rust
                                
                                
                                
                                    opencv-rust copied to clipboard
                            
                            
                            
                        TrackerKCF seems to be crash with Mat
I'm trying calling TrackerKCF.Init or TrackerKCF.update with reference of Mat. Tobe in the safe side, I always clone Mat before passing into the method, but sometime I received segmentation faul:
  frame #0: 0x000000019153c744 libsystem_kernel.dylib__pthread_kill + 8
frame #1: 0x0000000191573c28 libsystem_pthread.dylibpthread_kill + 288 frame #2: 0x0000000191481ae8 libsystem_c.dylibabort + 180
frame #3: 0x00000001913a2e28 libsystem_malloc.dylibmalloc_vreport + 908 frame #4: 0x00000001913b95d4 libsystem_malloc.dylibmalloc_zone_error + 104
frame #5: 0x00000001913b9ca8 libsystem_malloc.dylibmedium_free_list_remove_ptr_no_clear.cold.2 + 68 frame #6: 0x000000019139e5d8 libsystem_malloc.dylibmedium_free_list_remove_ptr_no_clear + 828
frame #7: 0x000000019139d210 libsystem_malloc.dylibfree_medium + 1148 frame #8: 0x0000000103a92ccc libopencv_core.408.dylibcv::StdMatAllocator::deallocate(cv::UMatData*) const + 56
frame #9: 0x0000000103a8fc60 libopencv_core.408.dylibcv::Mat::release() + 52 frame #10: 0x0000000103a8f264 libopencv_core.408.dylibcv::Mat::create(int, int const*, int) + 332
frame #11: 0x0000000103ac1e70 libopencv_core.408.dylibcv::_OutputArray::create(int, int const*, int, int, bool, cv::_OutputArray::DepthMask) const + 388 frame #12: 0x0000000103acd7b4 libopencv_core.408.dylibcv::merge(cv::Mat const*, unsigned long, cv::_OutputArray const&) + 228
frame #13: 0x00000001023a5098 libopencv_tracking.408.dylibcv::tracking::impl::TrackerKCFImpl::init(cv::_InputArray const&, cv::Rect_<int> const&) + 492 frame #14: 0x00000001006f7394 hades-rscv_Tracker_init_const__InputArrayR_const_RectR(instance=0x0000000110ae3418, image=0x000000010f488ae0, boundingBox=0x0000000171894730, ocvrs_return=0x0000000171894560) at video.cpp:1137:14
frame #15: 0x000000010011923c hades-rsopencv::opencv::hub::video::TrackerTrait::init::hcb0fbccef88fed56(self=0x000000012fe152a8, image=0x0000000171894688, bounding_box=(x = 509, y = 21, width = 57, height = 77)) at video.rs:2925:13  
Is it a bug ?
Thanks
It might be, will you be able share the minimum example that crashes?
it's hard to reproduce the case, sometime it happens, But I always call Mat::clone() before calling 2 above method to be in the safe side. It's really weird that it seems cv::Mat was double delete :( do we need any tracker that be tested in many case ?
Seems to be the bug of TrackerKCF, tried other trackers and it worked