Baumer堡盟相机SDK开发示例(C#调用)
简介
工作中使用到堡盟的彩色相机,在此将调用SDK采集图像相关内容进行整理记录。
开发环境
Windows7
VS2013 64位
halcon12
之所以用到halcon,是因为获取到相机采集的图像后,需要利用halcon图像库进行处理,所以直接将图像转换为halcon库可以处理的格式。
引用库文件
在VS中创建项目,根据自己的环境引用对应的文件。
32-Bit:
\Components\Dev\C_Sharp\Win32\
bgapi2_genicam_dotnet.dll
64-Bit
\Components\Dev
bgapi2_genicam_dotnet.dll
将下列四个文件复制到项目的生产目录中
32-Bit:
\Components\Bin\Win32\目录下
bgapi2_genicam.dll
bgapi2_img.dll
bopfdrvctl.dll
MathParser.dll
64-Bit
\Components\Bin\x64\目录下
bgapi2_genicam.dll
bgapi2_img.dll
bopfdrvctl.dll
MathParser.dll
编写相机类CameraClass
public CameraClass(string id)
{
this.cameraSN = id;
}
public int connect()//连接相机函数,返回0成功返回-1失败
{
try
{
imgProcessor = BGAPI2.ImageProcessor.Instance;
if (imgProcessor.NodeList.GetNodePresent("DemosaicingMethod") == true)
{
imgProcessor.NodeList["DemosaicingMethod"].Value = "NearestNeighbor";
}
systemList = BGAPI2.SystemList.Instance;
systemList.Refresh();//刷新系统列表
if (systemList.Count == 0)
{
//没有找到系统
return -1;
}
foreach (KeyValuePair<string, BGAPI2

本文档详细介绍了如何在C#环境下使用Baumer堡盟相机的SDK进行图像采集,涉及到Windows7平台、VS2013 64位及halcon12图像处理库的整合。在开发过程中,需要引用特定的dll库文件,并创建相机类进行连接、打开和图像抓取操作。为了获取图像,需将相机设置为软触发模式。
最低0.47元/天 解锁文章
631

被折叠的 条评论
为什么被折叠?



