visionpro如何保存图片
发布网友
发布时间:2022-04-24 02:01
我来回答
共1个回答
热心网友
时间:2023-10-20 14:49
保存图像在图像处理中是基本的操作,下面C#语言显示保存图像为IDB格式:
private int tNum;
private CogFrameGrabbers myFrameGrabbers;
private
ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;
private CogImageFile myImageFileTool;
private bool logImages;
private void InitializeFifo() //初始化,Sony CX75相机,分辨率640X480
{
const
string VIDEO_FORMAT = "Sony XC75 640x480";
myFrameGrabbers = new
CogFrameGrabbers();
myFrameGrabber = myFrameGrabbers[0];
myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT,
Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);
myImageFileTool = new CogImageFile();
logImages = false;
}
private void InitializeImageFile() //初始化文件idb1.idb
{
myImageFileTool.Open("C:\\home\\VisionPro\\idb1.idb",
CogImageFileModeConstants.Update);
}
private void button2_Click(object sender, System.EventArgs e)
{
logImages = true; //保存文件开始标志
}
private void button1_Click(object sender, System.EventArgs e)
//显示并保存
{
cogDisplay1.Image = myAcqFifo.Acquire(out tNum);
if (logImages == true)
myImageFileTool.Append(cogDisplay1.Image);
}
热心网友
时间:2023-10-20 14:49
保存图像在图像处理中是基本的操作,下面C#语言显示保存图像为IDB格式:
private int tNum;
private CogFrameGrabbers myFrameGrabbers;
private
ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;
private CogImageFile myImageFileTool;
private bool logImages;
private void InitializeFifo() //初始化,Sony CX75相机,分辨率640X480
{
const
string VIDEO_FORMAT = "Sony XC75 640x480";
myFrameGrabbers = new
CogFrameGrabbers();
myFrameGrabber = myFrameGrabbers[0];
myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT,
Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);
myImageFileTool = new CogImageFile();
logImages = false;
}
private void InitializeImageFile() //初始化文件idb1.idb
{
myImageFileTool.Open("C:\\home\\VisionPro\\idb1.idb",
CogImageFileModeConstants.Update);
}
private void button2_Click(object sender, System.EventArgs e)
{
logImages = true; //保存文件开始标志
}
private void button1_Click(object sender, System.EventArgs e)
//显示并保存
{
cogDisplay1.Image = myAcqFifo.Acquire(out tNum);
if (logImages == true)
myImageFileTool.Append(cogDisplay1.Image);
}