16,472
社区成员
发帖
与我相关
我的任务
分享
BOOL CGigeCameraDemoDlg::OnInitDialog()
{
......
// Select acquisition server from dialog
// Only the servers that support "AcqDevice" resource are listed
CAcqConfigDlg dlg(this, CAcqConfigDlg::ServerAcqDevice);
if (dlg.DoModal() != IDOK)
{
MessageBox(_T("No GigE-Vision cameras found or selected"));
EndDialog(TRUE);
return FALSE;
m_AcqDevice = new SapAcqDevice(dlg.GetLocation(), dlg.GetConfigFile());
m_Buffers = new SapBufferWithTrash(2, m_AcqDevice);
m_Xfer = new SapAcqDeviceToBuf(m_AcqDevice, m_Buffers, XferCallback, this);[/color]
m_View = new SapView(m_Buffers);
// Attach sapview to image viewer
m_ImageWnd.AttachSapView(m_View);
// Create all objects
if (!CreateObjects())
{
EndDialog(TRUE);
return FALSE;
}
m_ImageWnd.AttachEventHandler(this);
m_ImageWnd.CenterImage();
m_ImageWnd.Reset();
UpdateMenu();
return TRUE; // return TRUE unless you set the focus to a control
}
void CGigeCameraDemoDlg::XferCallback(SapXferCallbackInfo *pInfo)
{
CGigeCameraDemoDlg *pDlg= (CGigeCameraDemoDlg *) pInfo->GetContext();
//////////////////////////////////////////
添加函数处理操作
//////////////////////////////////////
// If grabbing in trash buffer, do not display the image, update the
// appropriate number of frames on the status bar instead
if (pInfo->IsTrash())
{
CString str;
str.Format(_T("Frames acquired in trash buffer: %d"), pInfo->GetEventCount());
pDlg->m_statusWnd.SetWindowText(str);
}
// Refresh view
else
{
pDlg->m_View->Show();
}
}
可是那个m_Buffers是怎么传进来的?这个m_Buffers是相机获取发图像数据,存放在m_Buffers里面,demo给的原始的回调函数就是把m_Buffers进行了显示。