我有一个VC++
项目来编程相机、帧显示,并使用OpenCV
. 问题是该程序在调试模式下工作正常,它显示了来自相机的实时捕捉,但是当我将它更改为发布模式时,程序的 .exe 文件不会隐藏窗口并且它不会显示来自相机的任何东西. 这是我的代码:
//allocate memory
if((_memoryAllc = Fg_AllocMemEx(fg,totalBufSize, CG_Options::getNBuffer()))!=NULL){
if(Fg_AcquireEx(fg,nCamPort,GRAB_INFINITE,ACQ_STANDARD,_memoryAllc)<0){
CExceptionHandler::GrabberErrorMessage(fg,"Can not start Acquiring images .");
}
else{
//create a window and set the handler from openCV to win32
cv::namedWindow("test",cv::WINDOW_AUTOSIZE);
hWnd2 = (HWND) cvGetWindowHandle("test");
hParent = ::GetParent(hWnd2);
::SetParent(hWnd2, hWnd);
::ShowWindow(hParent, SW_HIDE);
_liveCapturing=true;
lastPicNr = 0;
SetWindowTextW(hStatus, L"Live Capturing ... ");
while(IsWindowVisible(hWnd2)){ //show the data while the window is open and visible
lastPicNr = Fg_getLastPicNumberBlockingEx(fg,lastPicNr+1,nCamPort,10,_memoryAllc);
iPtr=(unsigned char*)Fg_getImagePtrEx(fg,lastPicNr,0,_memoryAllc);
cv::Mat _matrixImage(cv::Size(CG_Options::getWidth(),CG_Options::getHeight()), CV_8UC1,iPtr , cv::Mat::AUTO_STEP);
cv::imshow("test",_matrixImage);
cv::waitKey(10);
}
}
}
有人有什么想法吗?