Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

findContours: Assertion failed

Hi, I am using the latest OpenCV 3 Version with Visual Studio 2017. x64, Compiled using CMake and opencv_contrib.

My program crashes when I call findContours. I saw that some people have problemes with this function, but I wasn't able to fix my problem with theire solutions... Hopefully I did something wrong with my Includes etc...

C/C++ -> General-> Additional Include Directories: build\install\include

Linker -> General -> Additional Library Directories: build\install\x64\vc15\lib

Linker -> Input -> Additional Dependencies: everything from the directorie above

Exception:

include\xmemory0

template<class _alloc,="" class="" _ptr="typename" _wrap_alloc<_alloc="">::pointer> inline
    void _Destroy_range1(_Ptr _First, _Ptr _Last, _Wrap_alloc<_Alloc>& _Al, false_type)
    {   // destroy [_First, _Last), no special optimization
    for (; _First != _Last; ++_First)
        _Al.destroy(_Unfancy(_First)); //Exception thrown: read access violation.

    }

Call Stack

opencv_core320.dll!std::_Destroy_range1<std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > >,std::vector<unsigned char,std::allocator<unsigned="" char=""> > * __ptr64>(std::vector<unsigned char,std::allocator<unsigned="" char=""> > * _First, std::vector<unsigned char,std::allocator<unsigned="" char=""> > * _Last, std::_Wrap_alloc<std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > > > & _Al, std::integral_constant<bool,0> __formal) Line 1201  C++
[Inline Frame] opencv_core320.dll!std::_Destroy_range(std::vector<unsigned char,std::allocator<unsigned="" char=""> > *) Line 1218 C++
[Inline Frame] opencv_core320.dll!std::vector<std::vector<unsigned char,std::allocator<unsigned="" char=""> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > > >::_Destroy(std::vector<unsigned char,std::allocator<unsigned="" char=""> > *) Line 1885 C++
opencv_core320.dll!std::vector<std::vector<unsigned char,std::allocator<unsigned="" char=""> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > > >::_Resize<<lambda_b962d82acf8d40dd69d8706383060581> >(const unsigned __int64 _Newsize, std::vector<std::vector<unsigned char,std::allocator<unsigned="" char=""> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > > >::resize::__l2::<lambda_b962d82acf8d40dd69d8706383060581> _Udefault_or_fill) Line 1484 C++
[Inline Frame] opencv_core320.dll!std::vector<std::vector<unsigned char,std::allocator<unsigned="" char=""> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned="" char=""> > > >::resize(const unsigned __int64) Line 1496 C++
opencv_core320.dll!cv::_OutputArray::create(int d, const int * sizes, int mtype, int i, bool allowTransposed, int fixedDepthMask) Line 2421 C++
opencv_core320.dll!cv::_OutputArray::create(int _rows, int _cols, int mtype, int i, bool allowTransposed, int fixedDepthMask) Line 2322 C++
opencv_imgproc320.dll!cv::findContours(const cv::_InputOutputArray & _image, const cv::_OutputArray & _contours, const cv::_OutputArray & _hierarchy, int mode, int method, cv::Point_<int> offset) Line 1922 C++
Tracker.exe!getMainContour(cv::Mat mask) Line 33 C++

Thank you really much for your help! Greetings!