Halcon+C++摄像头采集图像

bool CWatermeterCheckDlg::OpenCam(const HWindow& window,HObject& ho_Image)
{
    try
    {
        OpenFramegrabber("GigEVision", 0, 0,0,0, 0, 0, "default", -1, "default", -1, "false", "default", "摄像头设备名", 0, -1, &m_hv_AcqHandle);

        window.ClearWindow();
        GrabImage(&ho_Image, m_hv_AcqHandle);                //采集一帧图像
        HImage(ho_Image).GetImageSize(&m_Width,&m_Height);   //得到图像的宽高和指针
        window.SetPart(0, 0, m_Height-1,m_Width-1);          //使图像显示适应窗口大小
        window.DispObj(ho_Image);                            //显示采集的图像
        return true;
    }
    catch (HException& except)
    {
        TRACE(except.ErrorMessage());
        MessageBox(CString(except.ErrorMessage()),L"提示");

        return false;
    }
}

你可能感兴趣的:(C/C++,Halcon,图像识别)