Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get the GMM co-variance matrix?

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.

I am using opencv2.4.13 and visual studio 2015. I had read lots of documents, but none of them helps. Please help me with that. Thank you!

How to get the GMM co-variance matrix?

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() Unknown

GMM.exe!cv::Algorithm::get<std::vector<cv::mat,std::allocator<cv::mat> > >(const char * _name=0x00007ff7a2338bd4) Line 4095 C++

GMM.exe!main() Line 100 C++

GMM.exe!invoke_main() Line 65 C++

GMM.exe!__scrt_common_main_seh() Line 253 C++

GMM.exe!__scrt_common_main() Line 296 C++

GMM.exe!mainCRTStartup() Line 17 C++

kernel32.dll!BaseThreadInitThunk() Unknown

ntdll.dll!RtlUserThreadStart() Unknown

I am using opencv2.4.13 and visual studio 2015. I had read lots of documents, but none of them helps. Please help me with that. Thank you!

click to hide/show revision 3
No.3 Revision

updated 2017-01-13 01:46:27 -0600

berak gravatar image

How to get the GMM co-variance matrix?

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;

endl; cv::EM em(5);

em.train(training_set);

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");

}

system("pause");

and the error message is:

Debug Assertion Failed!

Failed! Program: D:\Kinect test\GMM\GMM\x64\Debug\GMM.exe File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c Line: 1424

1424 Expression: _pFirstBlock == pHead

pHead For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.

asserts. The complete call stack is:

is: ntdll.dll!NtWaitForSingleObject() Unknown

Unknown ntdll.dll!LdrpDrainWorkQueue() Unknown

Unknown ntdll.dll!LdrpLoadDllInternal() Unknown

Unknown ntdll.dll!LdrpLoadDll() Unknown

Unknown ntdll.dll!LdrLoadDll() Unknown

Unknown KernelBase.dll!LoadLibraryExW() Unknown

Unknown SogouPY.ime!00007ff89b27daf8() Unknown

Unknown SogouPY.ime!00007ff89b1186ce() Unknown

Unknown SogouPY.ime!00007ff89b11873a() Unknown

Unknown SogouPY.ime!00007ff89b1f7a02() Unknown

Unknown SogouPY.ime!00007ff89b1f7b68() Unknown

Unknown SogouPY.ime!00007ff89b2212e7() Unknown

Unknown SogouPY.ime!00007ff89b228965() Unknown

Unknown SogouPY.ime!00007ff89b2b6a85() Unknown

Unknown SogouPY.ime!00007ff89b227437() Unknown

Unknown SogouPY.ime!00007ff89b22759f() Unknown

Unknown SogouPY.ime!00007ff89b227638() Unknown

Unknown user32.dll!UserCallWinProcCheckWow() Unknown

Unknown user32.dll!DispatchClientMessage() Unknown

Unknown user32.dll!__fnINLPCREATESTRUCT() Unknown

Unknown ntdll.dll!KiUserCallbackDispatcherContinue() Unknown

Unknown win32u.dll!NtUserCreateWindowEx() Unknown

Unknown user32.dll!VerNtUserCreateWindowEx() Unknown

Unknown user32.dll!CreateWindowInternal() Unknown

Unknown user32.dll!CreateWindowExW() Unknown

Unknown SogouTSF.ime!00007ff89b7fceae() Unknown

Unknown SogouTSF.ime!00007ff89b7e9dd5() Unknown

Unknown msctf.dll!CTip::Activate() Unknown

Unknown msctf.dll!CThreadInputMgr::_ActivateTip() Unknown

Unknown msctf.dll!CThreadInputMgr::ActivateInputProfile() Unknown

Unknown msctf.dll!CThreadInputMgr::OnActiveProfileChange(void) Unknown

Unknown msctf.dll!CThreadInputMgr::TimerProc(struct HWND__ *,unsigned int,unsigned __int64,unsigned long) Unknown

Unknown user32.dll!UserCallWinProc() Unknown

Unknown user32.dll!DispatchMessageWorker() Unknown

Unknown user32.dll!DialogBox2() Unknown

Unknown user32.dll!InternalDialogBox() Unknown

Unknown user32.dll!SoftModalMessageBox() Unknown

Unknown user32.dll!MessageBoxWorker() Unknown

Unknown user32.dll!MessageBoxTimeoutW() Unknown

Unknown user32.dll!MessageBoxW() Unknown

Unknown msvcr120d.dll!__crtMessageBoxW(const wchar_t * lpText=0x0000008d4ddc2260, const wchar_t * lpCaption=0x00007ff877265140, unsigned int uType=73746) Line 250 C

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++

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

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++

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++

C++ msvcr120d.dll!_free_dbg_nolock(void * pUserData=0x000001a3b4141ca0, int nBlockUse=1) Line 1424 C++

C++ msvcr120d.dll!_free_dbg(void * pUserData=0x000001a3b4141ca0, int nBlockUse=1) Line 1265 C++

C++ msvcr120d.dll!operator delete(void * pUserData=0x000001a3b4141ca0) Line 54 C++

C++ opencv_core2413d.dll!00007ff8773146a2() Unknown

Unknown opencv_core2413d.dll!00007ff87731449c() Unknown

Unknown opencv_core2413d.dll!00007ff87730f20d() Unknown

Unknown opencv_core2413d.dll!00007ff87730ac61() Unknown

Unknown opencv_core2413d.dll!00007ff87730b16c() Unknown

Unknown opencv_core2413d.dll!00007ff87731756b() Unknown

GMM.exe!cv::Algorithm::get<std::vector<cv::mat,std::allocator<cv::mat> Unknown > GMM.exe!cv::Algorithm::get<std::vector<cv::Mat,std::allocator<cv::Mat> > >(const char * _name=0x00007ff7a2338bd4) Line 4095 C++

C++ GMM.exe!main() Line 100 C++

C++ GMM.exe!invoke_main() Line 65 C++

C++ GMM.exe!__scrt_common_main_seh() Line 253 C++

C++ GMM.exe!__scrt_common_main() Line 296 C++

C++ GMM.exe!mainCRTStartup() Line 17 C++

C++ kernel32.dll!BaseThreadInitThunk() Unknown

Unknown ntdll.dll!RtlUserThreadStart() Unknown

Unknown

I am using opencv2.4.13 and visual studio 2015. I had read lots of documents, but none of them helps. Please help me with that. Thank you!