我使用这个小代码:
Mat roulette_template = imread( "roulette_vorlage.jpg", CV_LOAD_IMAGE_GRAYSCALE );
Mat greyMat = imread( "roulette_vorlage.jpg", CV_LOAD_IMAGE_GRAYSCALE );
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_1, keypoints_2;
detector.detect( roulette_template, keypoints_1 );
detector.detect( greyMat, keypoints_2 );
在detector.dectet之后,堆已损坏。 当我在我的其他项目中使用此代码段时,它工作正常。 它在我的ProcessingCallback函数中被调用,该函数从我的framegrabber中调用。 我没有使用任何opencv函数从我的相机获取immage。
整个代码看起来像这样:
void PicoloVideo::ProcessingCallback2(PMCSIGNALINFO SigInfo)
{
switch(SigInfo->Signal)
{
case MC_SIG_SURFACE_PROCESSING:
// Update "current" surface address pointer
McGetParamInt (SigInfo->SignalInfo, MC_SurfaceAddr, (PINT32) &m_pCurrent);
// Post screen refresh message only if previous refresh completed
if(m_bScreenRefreshCompleted)
{
Mat roulette_template = imread( "roulette_vorlage.jpg", CV_LOAD_IMAGE_GRAYSCALE );
Mat greyMat = imread( "roulette_vorlage.jpg", CV_LOAD_IMAGE_GRAYSCALE );
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_1, keypoints_2;
detector.detect( roulette_template, keypoints_1 );
detector.detect( greyMat, keypoints_2 );
if(waitKey(5) >= 0) break;
}
break;
case MC_SIG_END_CHANNEL_ACTIVITY:
m_bChannelActive = FALSE;
break;
case MC_SIG_ACQUISITION_FAILURE:
//MessageBox(NULL, "Acquisition Failure !", "PicoloVideo", MB_OK);
break;
default:
break;
}
}
如果不知道为什么我会在堆中获得probs。 任何人都知道为什么检测到东西会杀死它?