关闭

basler设置相机参数

2806人阅读 评论(0) 收藏 举报


/*index = 0//设置相机的内触发 
        = 1//设置相机的外触发 
= 2//设置相机的曝光时间
= 3//设置相机的增益
= 4//相机的频率
= 5//图片的宽度
= 6//图片的高度
= 7//灯的触发信号
*/
static void SetupCamera( Pylon::CInstantCamera& camera, int index)
{  
int i = 0;
try
{
   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);
}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:38200次
    • 积分:794
    • 等级:
    • 排名:千里之外
    • 原创:44篇
    • 转载:11篇
    • 译文:0篇
    • 评论:1条
    最新评论