Dalsa Sapera开发 C#笔记

一:SapManager类

功能:描述当前系统上的Sapera资源,同时包括错误管理功能。


SapManager.GetServerName(i):返回0 1 2  。其中0是System ,1是相机名称(Acq服务设备)即我需要的设备名称   2是面阵相机

SapManager.GetResourceCount(int serverIndex, SapManager.ResourceType)  :返回满足相机设备的像素格式

如:

SapManager.GetResourceCount(serverIndex, SapManager.ResourceType.Acq)//扫描所有的采集卡

 int serverIndex是 从0开始索引 。      SapManager.ResourceType 设备类型是Acq还是AcqDevice

 SapManager.IsResourceAvailable(int serverIndex, SapManager.ResourceType, int ResourceIndex )判断设备类型下所选择的像素格式是否满足要求,可排除一些不需要的像素格式。

int deviceCount = SapManager.GetResourceCount(acqParams.ServerName, SapManager.ResourceType.Acq);  //扫描当前采集卡下的相机设备
deviceName = SapManager.GetResourceName(acqParams.ServerName, SapManager.ResourceType.Acq, deviceIndex);//扫描遍历相机设备的名字

二:SapLocation类

功能:识别Saperaserver/resource对(物理设备的抽象表示)

常用方法:

		SapLocation::GetResourceIndex

        SapLocation::GetServerName 采集卡或相机的名字

 

 SapLocation loc = new SapLocation(acqParams.ServerName, acqParams.ResourceIndex);//采集卡,资源序号

二:SapAcquisition类

SapAcquisition:控制与板卡相连接的设备


 private   SapAcquisition  Acquisition  ;

 SapAcquisition Acquisiton=SapAcquisition(string ServerLocation, string  ConfigFileName )

SapAcquisition Acq = new SapAcquisition(loc, acqParams.ConfigFileName);

Acquisition.Create();返回为bool类型,判断设备是否创建

 Acquisition.Initialized  设备是否加载

三:SapBuffer类

功能:操作buffer资源
SapBuffer.IsBufferTypeSupported (ServerLocation , SapBuffer.MemoryType .ScatterGather )

SapBuffer Buffers     = new SapBuffer(1, Acq, SapBuffer.MemoryType.ScatterGather);

SapAcqToBuf :转换类

SapAcqToBuf Xfer= new SapAcqToBuf(Acq, Buffers);

SapView:

功能:通过SapDisplay对象显示存放在SapBuffer中的资源,SapView和SapTransfer的同步性使得能够实时显示buffer中的数据而不会出现丢失数据的情况

SapView View == new SapView(Buffers);

buffer.save(string filename ,string option) 

                IntPtr buffdata =(IntPtr)00000;//IntPtr这个地址如何获取  
                int numread;//numread指的是哪个值
                n_Buffer.ReadLine(0, 0, 1, 1, buffdata, out numread);//读取的一行是什么数据(感光原件上的数据还是转换为图像的)
                n_Buffer.ReadRect(0, 0, 1, 1, 1, buffdata);//rectangle四方形的意思,获取一个四方形,是指什么范围的。获取的是什么值。

                SapDataFRGB wbCoef=new SapDataFRGB();
                n_Buffer = new SapBufferWithTrash(2, n_Acquisition, SapBuffer.MemoryType.ScatterGather);
                n_Buffer.ColorWhiteBalance(SapBuffer.ColorAlign.RGBG,wbCoef); //白平衡是对图像进行处理。    
              
                int pitch = n_Buffer.Pitch;//Pitch是什么
                n_Buffer.PageFormats; //page又是什么,它有什么格式             
                SapBuffer firstSrc, secondSrc, thirdSrc;
                firstSrc = new SapBufferWithTrash(2,n_Acquisition,SapBuffer.MemoryType.ScatterGather);            
                n_Buffer.MergeComponents(firstSrc,secondSrc,thirdSrc);
                
                //可能是获取原始图像的关键函数,获取之后进行图像处理,白平衡,去噪,转化为数字图像格式,最后保存
                int perpixel = n_Buffer.BytesPerPixel;

其中filename是要保存的文件夹,option是要保存的图片格式(“-format jpg”)-format和识别标志,jpg是图片格式

备注:如何找到这个option格式。

(684条消息) 【Machine Vision】Dalsa Sapera初级开发步骤_洞庭渔人的博客-CSDN博客

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值