设置首页收藏本站
开启左侧

Cognex获取训练时的记录(轮廓)

[复制链接]
huanghai 发表于 2018-12-11 13:20:17 | 显示全部楼层 |阅读模式
悬赏5视觉币
单单把训练时产生的青色这种记录(轮廓)提取出来显示到另一个CogRecordDisplay上,并可以在CogRecordDisplay上下左右移动旋转角度。
就像Halcon中的get_shape_model_contours()获取模板轮廓和affine_trans_contour_xld()这两个 功能

我尝试过用以下办法,似乎不行,它不仅把记录(轮廓)获取过去了,也把还有那个坐标轴、掩膜那些东西都获取过去了
tmpRecord = tmpRecord.SubRecords.Item("TrainImage")
CogRecordDisplay1.Record = tmpRecord


111.png

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
lxd 发表于 2018-12-12 13:56:38 | 显示全部楼层
vs上,怎么配置visionpro的开发环境啊?
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
回复

使用道具 举报

AsmDebuger 发表于 2019-1-19 17:01:34 | 显示全部楼层
namespace AutoActivateVisionPro
{
    class Program
    {
        private static void Activate()
        {
            var cmd                              = new System.Diagnostics.Process();
            cmd.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
            cmd.StartInfo.FileName               = "cmd";
            cmd.StartInfo.CreateNoWindow         = true;
            cmd.StartInfo.UseShellExecute        = false;
            cmd.StartInfo.RedirectStandardInput  = true;
            cmd.StartInfo.RedirectStandardOutput = true;
            
            cmd.OutputDataReceived += (sender, e) =>
            {
                if (!string.IsNullOrEmpty(e.Data))
                {
                    string[] outs = e.Data.Split(new char[] { '\n', '\r' });
                    for (int i = 0; i < outs.GetLength(0); i++)
                    {
                        System.Console.WriteLine(outs[i]);
                    }
                }
            };
            cmd.Start();
            cmd.BeginOutputReadLine();

            var cmdWriter = cmd.StandardInput;

            // 切换到C盘
            cmdWriter.WriteLine("C:");

            // 获取VP的密匙管理中心的路径
            string rootFolder = string.Empty;
            if (System.Environment.Is64BitOperatingSystem)
            {
                rootFolder = "\"" + "C:/Program Files (x86)/Common Files/Cognex/Software Licensing Center/" + "\"";
            }
            else
            {
                rootFolder = "\"" + "C:/Program Files/Common Files/Cognex/Software Licensing Center/" + "\"";
            }

            // 切换执行目录到VP密匙管理中心目录
            cmdWriter.WriteLine("cd " + rootFolder);


            // 1. 将命名为CVL.zip的VisionPro激活备份文件添加到项目资源中
            // 2. 解压该资源文件到系统临时目录
            var strTmpDirectory = System.IO.Path.GetTempPath() + "CVL.zip";
            System.IO.File.WriteAllBytes(strTmpDirectory, Properties.Resources.CVL);

            // 加载VP激活备份文件
            cmdWriter.WriteLine(@"cogslc --restore " + "\"" + strTmpDirectory + "\"");

            // 执行激活命令
            cmdWriter.WriteLine(@"cogslc --emergency install --edir ./Emergency/VisionPro");
            cmdWriter.Close();
            cmd.Close();
        }


        static void Main(string[] args)
        {
            // 需要保证程序以管理员权限运行
            if (!string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("VPRO_ROOT")))
            {
                Program.Activate();
            }
        }
    }
}
---------------------
作者:zhy29563
来源:CSDN


这位同学研究的已经非常透彻了.
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表