Sapera开发笔记

一:SapManager类

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

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

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

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

二:SapAcquisition类

 private   SapAcquisition  Acquisition  ;

 SapAcquisition Acquisiton=SapAcquisition(string ServerLocation, string  ConfigFileName )

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

 Acquisition.Initialized  设备是否加载

三:SapBuffer类

SapBuffer.IsBufferTypeSupported (ServerLocation , SapBuffer.MemoryType .ScatterGather )

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格式。

猜你喜欢

转载自blog.csdn.net/abaqus3_0/article/details/79768724