basler相机参数设置

/*index

= 0//设置相机为内触发  

= 1//设置相机为外触发 
= 2//设置曝光时间
= 3//设置增益
= 4//设置频率
= 5//设置图片宽度
= 6//设置图片高度
= 7/设置输出源,触发频闪灯
*/
static void SetupCamera( Pylon::CInstantCamera& camera, int index)
{  
     using namespace GenApi;

     //获取设备节点列表,用于获取节点指针并赋值
     INodeMap &cameraNodeMap = camera.GetNodeMap();
   
    if(index == 0)
    {
        CEnumerationPtr  ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");
        ptrTriggerSel->FromString("FrameStart");
        CEnumerationPtr  ptrTrigger  = cameraNodeMap.GetNode ("TriggerMode");
         ptrTrigger->SetIntValue(0);
    }
    else if(index == 1)
    {

        //设置为外触发,并指定触发源
        CEnumerationPtr  ptrTriggerSel = cameraNodeMap.GetNode ("TriggerSelector");
        ptrTriggerSel->FromString("FrameStart");
        CEnumerationPtr  ptrTrigger  = cameraNodeMap.GetNode ("TriggerMode");
        ptrTrigger->SetIntValue(1);
        CEnumerationPtr  ptrTriggerSource = cameraNodeMap.GetNode ("TriggerSource");
        ptrTriggerSource->FromString("Line1");
    }
    else if(index == 2)
    {
        const CFloatPtr exposureTime = cameraNodeMap.GetNode("ExposureTimeAbs");
        exposureTime->SetValue(theApp.m_iExposeTime);
    }
    else if(index == 3)
    {
        const CIntegerPtr cameraGen = cameraNodeMap.GetNode("GainRaw");
        cameraGen->SetValue(theApp.m_iGain);
    }
    else if(index == 4)
    {
        const CBooleanPtr frameRate = cameraNodeMap.GetNode("AcquisitionFrameRateEnable");
        frameRate->SetValue(TRUE);
        const CFloatPtr frameRateABS = cameraNodeMap.GetNode("AcquisitionFrameRateAbs");
        frameRateABS->SetValue(theApp.m_iHZ);
    }
    else if(index == 5)
    {
        const CIntegerPtr widthPic = cameraNodeMap.GetNode("Width");
        widthPic->SetValue(theApp.m_Width);
    }
    else if(index == 6)
    {
        const CIntegerPtr heightPic = cameraNodeMap.GetNode("Height");
        heightPic->SetValue(theApp.m_Height);
    }
    else if(index == 7)
    {
        CEnumerationPtr  ptrLineSource = cameraNodeMap.GetNode ("LineSource");
        ptrLineSource->SetIntValue(2);
    }

}

 

你可能感兴趣的:(工业相机)