kris-wang

软件环境

Vision Acquisition Software:该软件为NI视觉采集集成环境

  1. 新建C#工程
  2. 添加引用(位于’C:\Program Files (x86)\National Instruments\MeasurementStudioVS2008\DotNET\Assemblies\Current’文件夹下)
  • NationalInstruments.Common
  • NationalInstruments.Vision.Common
  • NationalInstruments.Vision.Aquisition.Imaqdx
  1. 获得在线的所有相机
	ImaqdxCameraInformation[] cameraList = ImaqdxSystem.GetCamerInformation(true);
  1. 打开所有相机
public bool OpenCameraDevice()
{
	try
	{
		List<ImaqdxSession> cameraSessionList = new List<ImaqdxSession>();
		foreach(var camera in cameraList)
		{
			cameraSessionList.Add(new ImaqdxSession(camera.Name));
			return true;
		}
	}
	catch()
	{
		return false;
	}
}
  1. 关闭所有相机
public void CloseCameraDevice()
{
	foreach(ImaqdxSession session in cameraSessionList)
	{
		if(session != null)
			session.Close();
	}
}
  1. 拍照及显示
public bool SnapPictureAndShow(int cameraIndex)
{
	VisionImage image = new VisionImage();
	try
	{
		cameraSessionList[cameraIndex].Snap(image);
		Algorithms.Copy(image, NI_ImageViewer.Image);
		return true;
	}
	catch()
	{
		return false;
	}
}

分类:

技术点:

相关文章:

  • 2022-02-09
  • 2021-09-18
  • 2021-09-13
  • 2021-09-18
  • 2021-09-18
  • 2021-11-12
  • 2022-01-30
  • 2021-09-18
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2021-05-27
  • 2021-09-18
  • 2021-07-05
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案