文章目录
- 1.下载并安装VisionPro软件
- 2.下载PercipioCameraForVisionPro软件包
- 3.软件部署
- 4.测试流程
- 4.1 遍历VisionPro SDK支持的参数
- 4.2 设置示例
- 4.2.1_cameraSingle.SetTriggerMode
- 4.2.2 _cameraSingle.SetRegistration
- 4.2.3_cameraSingle.SetInt
- 4.2.4 _cameraSingle.GetInt
- 4.2.5 _cameraSingle.SetBool
- 4.2.6 _cameraSingle.GetBool
- 4.2.7 _cameraSingle.SetEnum
- 4.2.8 _cameraSingle.GetEnum
- 4.2.9 _cameraSingle.SetFloat
- 4.2.10 _cameraSingle.GetFloat
- 4.2.11 _cameraSingle.SetScaleUnit
- 4.2.12 _cameraSingle.GetScaleUnit
- 5.ToolBlock完整参考代码例子
- 6.WinFrom参考代码例子
- 7.常见FAQ
1.下载并安装VisionPro软件
请自行下载VisonPro软件。
VisionPro 9.0/9.5/9.6版本经测试,可正常打开图漾相机,建议使用图漾测试过的版本。
2.下载PercipioCameraForVisionPro软件包
使用浏览器下载:https://gitee.com/percipioxyz/camport3_visionpro
使用 git 指令获取本地副本:打开终端,切换到需存放 SDK 的工作目录下,输入 git clone 命令克隆远程仓库。
git clone https://gitee.com/percipioxyz/camport3_visionpro.git
3.软件部署
1.将 PercipioCamera.dll、PercipioCameraExtern.dll、tycam.dll 、opencv_world460.dll拷贝到 VisionPro 的 bin 目录,如果是默认安装,路径位于 C:\ProgramFiles\Cognex\VisionPro\bin。
2.将 PercipioCameraToolBlock.vtt 拷贝到 VisonPro 工具模板目录。如果是默认安装,路径位于 C:\ProgramFiles\Cognex\VisionPro\bin\Templates\Tools。
3.进入VisionPro后,依次点击下图中的位置,调PercipioCameraToolBlock工具。
4.点击PercipioCameraToolBlock界面的“输入/输出”
PercipioCameraToolBlock的输入参数说明:
1.CameraId:需要打开的相机序列号。
2.Z:相机与投影平面在 Z 方向的距离,单位 mm,将深度图向此投影平面做正交投影。结合该距离下的相机视野和深度图分辨率,可以求出单个像素大小 (mm) ,用于后续计算。
3.ScaleUnit:配置相机的ScaleUnit,以输出不同精度的深度值。
4.RegistrationMode:RGBD对齐开关。
0:不对齐; 1:rgb2depth; 2:depth2rgb。
4.测试流程
4.1 遍历VisionPro SDK支持的参数
以PS800-E1相机测试为主,测试项及其测试方法和结果如下表所示
4.2 设置示例
4.2.1_cameraSingle.SetTriggerMode
设置触发模式
int triggermode = (int) En_TRIGGER_MODE.TY_TRIGGER_MODE_SLAVE;
int set_trigger_mode = _cameraSingle.SetTriggerMode(ref triggermode);
if (set_trigger_mode != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("set trigger mode failed, error code: "
+set_trigger_mode);
}
如果设置成软触发工作模式,还需再start capture之后添加以下代码,发送软触发信号:
if(triggermode == (int) En_TRIGGER_MODE.TY_TRIGGER_MODE_SLAVE)
{
int sendsofttrigger = _cameraSingle.sendSoftTrigger();
if(sendsofttrigger != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("send soft trigger failed, error code: " +sendsofttrigger);
}
}
4.2.2 _cameraSingle.SetRegistration
设置对齐模式
_cameraSingle.SetRegistration(0);
也可以直接在PercipioCameraToolBlock页面设置输入参数RegistrationMode,无需写代码。
4.2.3_cameraSingle.SetInt
int set_exp = _cameraSingle.SetInt((int)EnDeviceComponent.TY_COMPONENT_RGB_CAM,(int)En_FEATURE_ID.TY_INT_EXPOSURE_TIME,1088);
if(set_exp != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("set exp failed, error code: " + set_exp);
}
4.2.4 _cameraSingle.GetInt
int exp = 0;
int get_exp = _cameraSingle.GetInt((int) EnDeviceComponent.TY_COMPONENT_RGB_CAM, (int) En_FEATURE_ID.TY_INT_EXPOSURE_TIME, ref exp);
if(get_exp != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("get exp failed, error code: " + get_exp);
}
else
{
//待补充
}
4.2.5 _cameraSingle.SetBool
int set_aec = _cameraSingle.SetBool((int)EnDeviceComponent.TY_COMPONENT_RGB_CAM,(int)En_FEATURE_ID.TY_BOOL_AUTO_EXPOSURE,false );
if(set_aec != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("set aec failed, error code: " +set_aec);
}
4.2.6 _cameraSingle.GetBool
bool aec_status = true;
int get_aec = _cameraSingle.GetBool((int) EnDeviceComponent.TY_COMPONENT_RGB_CAM, (int) En_FEATURE_ID.TY_BOOL_AUTO_EXPOSURE, ref aec_status);
if(get_aec != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("get_aec failed, error code: " + get_aec);
}
4.2.7 _cameraSingle.SetEnum
int resolution = CameraSingle.ImageMode(TY_PIXEL_FORMAT_LIST.TY_PIXEL_FORMAT_DEPTH16, TY_RESOLUTION_MODE_LIST.TY_RESOLUTION_MODE_1280x960);
int set_depth_resolution = _cameraSingle.SetEnum((int) EnDeviceComponent.TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_ENUM_IMAGE_MODE, resolution);
if(set_depth_resolution != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("set depth resolution failed, error code: " + set_depth_resolution);
}
4.2.8 _cameraSingle.GetEnum
int resolution_value = 0;
int get_depth_resolution = _cameraSingle.GetEnum((int) EnDeviceComponent.TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_ENUM_IMAGE_MODE, ref resolution_value);
if(get_depth_resolution != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("get depth resolution failed, error code: " + get_depth_resolution);
}
4.2.9 _cameraSingle.SetFloat
int set_unit = _cameraSingle.SetFloat((int) EnDeviceComponent.TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_FLOAT_SCALE_UNIT, 5f);
4.2.10 _cameraSingle.GetFloat
float scale_unit= 0;
int get_unit = _cameraSingle.GetFloat((int) EnDeviceComponent.TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_FLOAT_SCALE_UNIT, ref scale_unit);
4.2.11 _cameraSingle.SetScaleUnit
float scaleUnit = 0.25f;
int ret = _cameraSingle.SetScaleUnit(scaleUnit);
if(ret != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("Set ScaleUnit Failure!");
}
可以直接在界面上输入,无需写代码。
4.2.12 _cameraSingle.GetScaleUnit
float get_scale = _cameraSingle.GetScaleUnit();
5.ToolBlock完整参考代码例子
#region namespace imports
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;
using Cognex.VisionPro3D;
using Percipio.Basalt.Camera;
using Percipio.Basalt.Core;
using Percipio.Basalt.Internal.PInvoke;
using System.Collections.Generic;
#endregion
public class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase
{
#region Private Member Variables
private Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;
private CameraSingle _cameraSingle;
private string _cameraId;
private float deviceScaleUnit;
private bool _gvspResendSetted = false;
#endregion
/// <summary>
/// Called when the parent tool is run.
/// Add code here to customize or replace the normal run behavior.
/// </summary>
/// <param name="message">Sets the Message in the tool's RunStatus.</param>
/// <param name="result">Sets the Result in the tool's RunStatus</param>
/// <returns>True if the tool should run normally,
/// False if GroupRun customizes run behavior</returns>
public override bool GroupRun(ref string message, ref CogToolResultConstants result)
{
// To let the execution stop in this script when a debugger is attached, uncomment the following lines.
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();
#endif
string cameraId = (string) this.mToolBlock.Inputs["CameraId"].Value;
double z = (double) this.mToolBlock.Inputs["Z"].Value;
ERegistrationMode regMode = (ERegistrationMode) this.mToolBlock.Inputs["RegistrationMode"].Value;
//int _fetchTimeout = (int) this.mToolBlock.Inputs["FetchTimeout"].Value;
if (string.IsNullOrEmpty(cameraId))
{
throw new Exception("error: camera id is empty");
}
if (cameraId != _cameraId)
{
_cameraId = cameraId;
_cameraSingle = null;
}
int ret;
if (_cameraSingle == null)
{
//相机初始化
NativeMethods.initLib();
_cameraSingle = new CameraSingle();
VectorOfDeviceBaseInfo DeviceBaseInfoVecs = new VectorOfDeviceBaseInfo();
NativeMethods.refreshDevices(DeviceBaseInfoVecs.RawPtr);
//打开相机
int openRet = _cameraSingle.open(cameraId);
if (openRet != 0 )
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("open camera failed, error code: " + openRet);
}
BASALT_DEVICE_CONFIGURE_INFO info = new BASALT_DEVICE_CONFIGURE_INFO(true);
//关闭左右IR
// info.irLeftEnable = false;
// info.irRightEnable = false;
//相机组件使能
int configRet = _cameraSingle.configureComponent(ref info);
if (configRet != 0 )
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("config camera failed, error code: " + configRet);
}
}
//设置激光强度,范围(0,100)
int set_laser_power = _cameraSingle.SetInt((uint) EnDeviceComponent.TY_COMPONENT_LASER, (uint) En_FEATURE_ID.TY_INT_LASER_POWER, 100);
//设置深度图分辨率,有1280X960,640X480,320X240
uint resolution = CameraSingle.ImageMode(TY_PIXEL_FORMAT_LIST.TY_PIXEL_FORMAT_DEPTH16, TY_RESOLUTION_MODE_LIST.TY_RESOLUTION_MODE_1280x960);
int set_depth_resolution = _cameraSingle.SetEnum((int) EnDeviceComponent.TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_ENUM_IMAGE_MODE, resolution);
//设置相机SGBM参数
//设置图像数量,范围(1,20)
//int SGBM_IMAGE_NUM = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_IMAGE_NUM, 18);
//视差搜索范围,范围(1,320)
//int SGBM_DISPARITY_NUM = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_DISPARITY_NUM, 256);
//视差值,范围(-1280,1280)
// int SGBM_DISPARITY_OFFSET = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_DISPARITY_OFFSET, -64);
//视差匹配窗口的高,范围(1,21)
//int SGBM_MATCH_WIN_HEIGHT = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_MATCH_WIN_HEIGHT, 21);
//视差匹配窗口的宽,范围(1,9)
//int SGBM_MATCH_WIN_WIDTH = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_MATCH_WIN_WIDTH, 5);
//控制视差平滑度的第一个参数,(0,10000)
//int SGBM_SEMI_PARAM_P1 = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_SEMI_PARAM_P1, 100);
//控制视差平滑度的尺度参数,范围(0,25)
// int SGBM_SEMI_PARAM_P1_SCALE = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_SEMI_PARAM_P1_SCALE, 6);
//控制视差平滑度的第二个参数,(0,10000)
//int SGBM_SEMI_PARAM_P2 = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_SEMI_PARAM_P2, 400);
//唯一性检查时的阈值,范围(0,511)
// int SGBM_UNIQUE_FACTOR = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_UNIQUE_FACTOR, 60);
// 唯一性检查, 绝对值差异,范围(0,10000)
// int SGBM_UNIQUE_ABSDIFF = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_DEPTH_CAM, (int) En_FEATURE_ID.TY_INT_SGBM_UNIQUE_ABSDIFF, 400);
//设置左右IR增益,范围(0,255),模拟增益(0,3)和曝光(3,990)
int set_leftir_gain = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_IR_CAM_LEFT, (int) En_FEATURE_ID.TY_INT_GAIN, 32);
int set_leftir_analog_gain = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_IR_CAM_LEFT, (int) En_FEATURE_ID.TY_INT_ANALOG_GAIN, 3);
int set_leftir_exporsure = _cameraSingle.SetInt((int) EnDeviceComponent. TY_COMPONENT_IR_CAM_LEFT, (int) En_FEATURE_ID.TY_INT_EXPOSURE_TIME, 990);
int set_rightir_gain = _cameraSingle.SetInt((int) EnDeviceComponent.TY_COMPONENT_IR_CAM_RIGHT, (int) En_FEATURE_ID.TY_INT_GAIN, 32);
int set_rightir_analog_gain = _cameraSingle.SetInt((int) EnDeviceComponent.TY_COMPONENT_IR_CAM_RIGHT, (int) En_FEATURE_ID.TY_INT_ANALOG_GAIN, 3);
int set_rightir_exporsure = _cameraSingle.SetInt((int) EnDeviceComponent.TY_COMPONENT_IR_CAM_RIGHT, (int) En_FEATURE_ID.TY_INT_EXPOSURE_TIME, 990);
//设置彩色分辨率,有2560X1920,1920X1440,1280X960,640X480
uint RGB_resolution = CameraSingle.ImageMode(TY_PIXEL_FORMAT_LIST.TY_PIXEL_FORMAT_RGB, TY_RESOLUTION_MODE_LIST.TY_RESOLUTION_MODE_1280x960);
int set_RGB_resolution = _cameraSingle.SetEnum((int) EnDeviceComponent.TY_COMPONENT_RGB_CAM, (int) En_FEATURE_ID.TY_ENUM_IMAGE_MODE, RGB_resolution);
//设置彩色图模拟增益,范围(0,65535)
int set_rgb_analog_gain = _cameraSingle.SetInt((int) EnDeviceComponent.TY_COMPONENT_RGB_CAM, (int) En_FEATURE_ID.TY_INT_ANALOG_GAIN, 1000);
//设置彩色图曝光,范围(0,66600)
int set_rgb_exposure = _cameraSingle.SetInt((int) EnDeviceComponent.TY_COMPONENT_RGB_CAM, (int) En_FEATURE_ID.TY_INT_EXPOSURE_TIME, 10000);
//设置自动曝光
//int set_aec = _cameraSingle.SetBool((int)EnDeviceComponent.TY_COMPONENT_RGB_CAM,(int)En_FEATURE_ID.TY_BOOL_AUTO_EXPOSURE,true);
//设置白平衡
int set_awb = _cameraSingle.SetBool((int)EnDeviceComponent.TY_COMPONENT_RGB_CAM,(int)En_FEATURE_ID.TY_BOOL_AUTO_AWB,true);
// if(set_rgb_exposure != 0)
// {
// _cameraSingle.close();
// NativeMethods.deinitLib();
// _cameraSingle = null;
// throw new Exception("set exp failed, error code: " + set_rgb_exposure);
// }
//设置GVSP 重传
if(!_gvspResendSetted)
{
ret = _cameraSingle.SetBool((uint) EnDeviceComponent.TY_COMPONENT_DEVICE, (uint) En_FEATURE_ID.TY_BOOL_GVSP_RESEND, true);
_gvspResendSetted = true;
}
//设置ScaleUnit
//ret = _cameraSingle.SetScaleUnit(0.5);
//设置对齐模式
_cameraSingle.SetRegistration(regMode);
int triggermode = (int) En_TRIGGER_MODE.TY_TRIGGER_MODE_SLAVE;
ret = _cameraSingle.SetTriggerMode(ref triggermode);
ret = _cameraSingle.startCapture();
if (!(ret == 0 || ret == -1016))
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("startCapture failed, error code: " + ret);
}
deviceScaleUnit = _cameraSingle.GetScaleUnit();
if(triggermode == (int) En_TRIGGER_MODE.TY_TRIGGER_MODE_SLAVE )
{
int sendsofttrigger = _cameraSingle.sendSoftTrigger();
if(sendsofttrigger != 0)
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("send soft trigger failed, error code: " + sendsofttrigger);
}
}
BasaltImageFrame frame = _cameraSingle.fetchFrame(4000, (float) z);
float scaleX = frame.scaleX;
float scaleY = frame.scaleY;
ret = frame.errorcode;
if (!(ret == 0 || ret == -1016))
{
_cameraSingle.close();
NativeMethods.deinitLib();
_cameraSingle = null;
throw new Exception("fetch frame failed, error code: " + ret);
}
_cameraSingle.stopCapture();
CogImage16Grey image16Grey;
CogImage8Grey image8Grey;
//RGB这里要做格式转换,不然设置分辨率不生效
CogImage24PlanarColor image = new CogImage24PlanarColor(frame.colorImg);
this.mToolBlock.Outputs["OutputColorImage"].Value = image;
this.mToolBlock.Outputs["OutputDepthImage"].Value = Create16Range(frame, deviceScaleUnit,out image16Grey,out image8Grey);
this.mToolBlock.Outputs["OutputImage16Grey"].Value = image16Grey;
this.mToolBlock.Outputs["OutputImage8Grey"].Value = image8Grey;
this.mToolBlock.Outputs["OutputScaleX"].Value = scaleX;
this.mToolBlock.Outputs["OutputScaleY"].Value = scaleY;
frame.Dispose();
GC.Collect();
return false;
}
//图像格式转换
private static unsafe CogImage16Range Create16Range(BasaltImageFrame frame, float scaleUnit, out CogImage16Grey image16Grey, out CogImage8Grey image8Grey)
{
int width = frame.depthImg.Width;
int height = frame.depthImg.Height;
image16Grey = new CogImage16Grey(width, height);
ICogImage16PixelMemory image16PixelMemory = image16Grey.Get16GreyPixelMemory((CogImageDataModeConstants) 3, 0, 0, width, height);
image8Grey = new CogImage8Grey(width, height);
ICogImage8PixelMemory image8PixelMemory = image8Grey.Get8GreyPixelMemory((CogImageDataModeConstants) 3, 0, 0, width, height);
ushort* image16Ptr = (ushort*) image16PixelMemory.Scan0.ToPointer();
byte* image8Ptr = (byte*) image8PixelMemory.Scan0.ToPointer();
ushort* depthImagePtr = (ushort*) frame.depthImg.Data().ToPointer();
byte* depthMaskImagePtr = (byte*) frame.depthMaskImg.Data().ToPointer();
int a = frame.depthImg.Width * frame.depthImg.Height / 2 + frame.depthImg.Width / 2;
ushort val = depthImagePtr[a];
for (int row = 0; row < image16PixelMemory.Height; ++row)
{
for (int column = 0; column < image16PixelMemory.Width; ++column)
{
*image8Ptr = depthMaskImagePtr[row * width + column];
++image8Ptr;
*image16Ptr = depthImagePtr[row * width + column];
++image16Ptr;
}
image16Ptr += image16PixelMemory.Stride - image16PixelMemory.Width;
image8Ptr += image8PixelMemory.Stride - image8PixelMemory.Width;
}
double zResolution = 1;
double xResolution = frame.scaleX;
double yResolution = frame.scaleY;
CogTransform2DLinear transform2Dlinear = new CogTransform2DLinear();
//transform2Dlinear.SetScalingsRotationsTranslation(xResolution, yResolution, 0.0, -1.0 * Math.PI, (double) (width / 2), 0.0);
transform2Dlinear.SetScalingsRotationsTranslation(1.0 / xResolution, 1.0 / yResolution, 2.0 * Math.PI, 2.0 * Math.PI, 0.0, 0.0);
image16Grey.CoordinateSpaceTree.AddSpace("@", "Sensor2D", transform2Dlinear, true, CogAddSpaceConstants.DuplicateIsError);
image8Grey.CoordinateSpaceTree.AddSpace("@", "Sensor2D", transform2Dlinear, true, CogAddSpaceConstants.DuplicateIsError);
Cog3DTransformLinear linear3Dtrans = new Cog3DTransformLinear(new Cog3DMatrix3x3(1.0 / xResolution, 0.0, 0.0, 0.0, 1.0 / yResolution, 0.0, 0.0, 0.0, 1.0 / zResolution), new Cog3DVect3(1.0, 1.0, 1.0));
CogImage16Range image16Range = new CogImage16Range(image16Grey, image8Grey, linear3Dtrans);
image16Range.SelectedSpaceName = "Sensor2D";
image8Grey.SelectedSpaceName = "Sensor2D";
image16Grey.SelectedSpaceName = "Sensor2D";
return image16Range;
}
#region When the Current Run Record is Created
/// <summary>
/// Called when the current record may have changed and is being reconstructed
/// </summary>
/// <param name="currentRecord">
/// The new currentRecord is available to be initialized or customized.</param>
public override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord)
{
}
#endregion
#region When the Last Run Record is Created
/// <summary>
/// Called when the last run record may have changed and is being reconstructed
/// </summary>
/// <param name="lastRecord">
/// The new last run record is available to be initialized or customized.</param>
public override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord)
{
}
#endregion
#region When the Script is Initialized
/// <summary>
/// Perform any initialization required by your script here
/// </summary>
/// <param name="host">The host tool</param>
public override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host)
{
// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVE
base.Initialize(host);
// Store a local copy of the script host
this.mToolBlock = ((Cognex.VisionPro.ToolBlock.CogToolBlock) (host));
}
#endregion
}
6.WinFrom参考代码例子
6.1 待补充
7.常见FAQ
1.每次运行只能采一张图,再次点击运行时会报错-1016。
2.使用图漾PercipioViewer软件保存的Png图片,是16位灰度图,可以使用Cog3DImageConvertTool这个Vtt文件,将16位灰度图转换成CogImage16Range,之后供VisionPro的3D工具应用。
3.图漾官网上下载的VisionPro的SDK,是旧的版本,建议使用链接上的V1.0.4版本的SDK。
4.切记使用图漾TOF相机,使用改插件,会有一些问题,有问题,请及时联系图漾技术。