I am using cv::EM to train the GMMs. Everything works fine except when I want to get the co-variance matrix I got a Debug Assertion Failed.
The code is:
cout << "Test the EM algorithm in Opencv" << endl;
cv::EM em(5);
em.train(training_set);
if (em.isTrained())
{
cout << "Finished trainging EM" << endl;
const cv::Mat &weights = em.get<cv::Mat>("weights");
const cv::Mat &Means = em.get<cv::Mat>("means");
const vector<cv::Mat> &Covs = em.get<vector<cv::Mat>>("covs");
}
system("pause");
and the error message is:
Debug Assertion Failed!
Program: D:\Kinect test\GMM\GMM\x64\Debug\GMM.exe File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c Line: 1424
Expression: _pFirstBlock == pHead
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
The complete call stack is:
ntdll.dll!NtWaitForSingleObject() Unknown
ntdll.dll!LdrpDrainWorkQueue() Unknown
ntdll.dll!LdrpLoadDllInternal() Unknown
ntdll.dll!LdrpLoadDll() Unknown
ntdll.dll!LdrLoadDll() Unknown
KernelBase.dll!LoadLibraryExW() Unknown
SogouPY.ime!00007ff89b27daf8() Unknown
SogouPY.ime!00007ff89b1186ce() Unknown
SogouPY.ime!00007ff89b11873a() Unknown
SogouPY.ime!00007ff89b1f7a02() Unknown
SogouPY.ime!00007ff89b1f7b68() Unknown
SogouPY.ime!00007ff89b2212e7() Unknown
SogouPY.ime!00007ff89b228965() Unknown
SogouPY.ime!00007ff89b2b6a85() Unknown
SogouPY.ime!00007ff89b227437() Unknown
SogouPY.ime!00007ff89b22759f() Unknown
SogouPY.ime!00007ff89b227638() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchClientMessage() Unknown
user32.dll!__fnINLPCREATESTRUCT() Unknown
ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
win32u.dll!NtUserCreateWindowEx() Unknown
user32.dll!VerNtUserCreateWindowEx() Unknown
user32.dll!CreateWindowInternal() Unknown
user32.dll!CreateWindowExW() Unknown
SogouTSF.ime!00007ff89b7fceae() Unknown
SogouTSF.ime!00007ff89b7e9dd5() Unknown
msctf.dll!CTip::Activate() Unknown
msctf.dll!CThreadInputMgr::_ActivateTip() Unknown
msctf.dll!CThreadInputMgr::ActivateInputProfile() Unknown
msctf.dll!CThreadInputMgr::OnActiveProfileChange(void) Unknown
msctf.dll!CThreadInputMgr::TimerProc(struct HWND__ *,unsigned int,unsigned __int64,unsigned long) Unknown
user32.dll!UserCallWinProc() Unknown
user32.dll!DispatchMessageWorker() Unknown
user32.dll!DialogBox2() Unknown
user32.dll!InternalDialogBox() Unknown
user32.dll!SoftModalMessageBox() Unknown
user32.dll!MessageBoxWorker() Unknown
user32.dll!MessageBoxTimeoutW() Unknown
user32.dll!MessageBoxW() Unknown
msvcr120d.dll!__crtMessageBoxW(const wchar_t * lpText=0x0000008d4ddc2260, const wchar_t * lpCaption=0x00007ff877265140, unsigned int uType=73746) Line 250 C
msvcr120d.dll!__crtMessageWindowW(int nRptType=2, void * returnAddress=0x00007ff8771f0829, const wchar_t * szFile=0x00007ff877288a80, const wchar_t * szLine=0x0000008d4ddc5350, const wchar_t * szModule=0x0000000000000000, const wchar_t * szUserMessage=0x0000008d4ddca350) Line 391 C++
msvcr120d.dll!_VCrtDbgReportW(int nRptType=2, void * returnAddress=0x00007ff8771f0829, const wchar_t * szFile=0x00007ff877288a80, int nLine=1424, const wchar_t * szModule=0x0000000000000000, const wchar_t * szFormat=0x00007ff877263a3c, char * arglist=0x0000008d4ddcc448) Line 672 C
msvcr120d.dll!_CrtDbgReportWV(int nRptType=2, void * returnAddress=0x00007ff8771f0829, const wchar_t * szFile=0x00007ff877288a80, int nLine=1424, const wchar_t * szModule=0x0000000000000000, const wchar_t * szFormat=0x00007ff877263a3c, char * arglist=0x0000008d4ddcc448) Line 263 C++
msvcr120d.dll!_CrtDbgReportW(int nRptType=2, const wchar_t * szFile=0x00007ff877288a80, int nLine=1424, const wchar_t * szModule=0x0000000000000000, const wchar_t * szFormat=0x00007ff877263a3c, ...) Line 279 C++
msvcr120d.dll!_free_dbg_nolock(void * pUserData=0x000001a3b4141ca0, int nBlockUse=1) Line 1424 C++
msvcr120d.dll!_free_dbg(void * pUserData=0x000001a3b4141ca0, int nBlockUse=1) Line 1265 C++
msvcr120d.dll!operator delete(void * pUserData=0x000001a3b4141ca0) Line 54 C++
opencv_core2413d.dll!00007ff8773146a2() Unknown
opencv_core2413d.dll!00007ff87731449c() Unknown
opencv_core2413d.dll!00007ff87730f20d() Unknown
opencv_core2413d.dll!00007ff87730ac61() Unknown
opencv_core2413d.dll!00007ff87730b16c() Unknown
opencv_core2413d.dll!00007ff87731756b ...
(more)