c语言sscanf函数的用法是什么
276
2022-10-01
c#+halcon1.3 从窗口创建形状匹配模板
前面版添加创建模板按钮,并在单机事件中添加如下代码HOperatorSet.SetColor(hWindowControl1.HalconWindow, "green"); hWindowControl1.Focus(); HTuple r, c, phi, len1, len2; HObject rectangle; hWindowControl1.Focus(); HOperatorSet.DrawRectangle2(hWindowControl1.HalconWindow, out r, out c, out phi, out len1, out len2); HOperatorSet.GenRectangle2(out rectangle, r, c, phi, len1, len2); HOperatorSet.DispObj(rectangle, hWindowControl1.HalconWindow); HOperatorSet.ReduceDomain(himage, rectangle,out temp); HOperatorSet.CreateShapeModel(temp, 4, (new HTuple(0)).TupleRad(), (new HTuple(360)).TupleRad(), (new HTuple(0.1)).TupleRad(), "auto", "use_polarity", (new HTuple(4)).TupleConcat(30), 4,out modelID); HOperatorSet.GetShapeModelContours(out ho_ModelContours, modelID, 1); //HOperatorSet.GetImageSize(ho_ModelContours, out hv_Width, out hv_Height);//获取图像尺寸 //HOperatorSet.SetPart(hWindowControl2.HalconWindow, 0, 0, hv_Height - 1, hv_Width - 1);//设置显示控件尺寸 HOperatorSet.SmallestRectangle1Xld(ho_ModelContours, out hv_Row1, out hv_Column1, out hv_Row2, out hv_Column2); hv_RefRow = ((hv_Row2.TupleMax()) - (hv_Row1.TupleMin())) / 2; hv_RefColumn = ((hv_Column2.TupleMax()) - (hv_Column1.TupleMin())) / 2; HOperatorSet.VectorAngleToRigid(0, 0, 0, hv_RefRow, hv_RefColumn, 0, out hv_HomMat2D); HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_TransContours, hv_HomMat2D); HOperatorSet.SetColor(hWindowControl2.HalconWindow, "green"); HOperatorSet.DispObj(ho_TransContours, hWindowControl2.HalconWindow);-----------------------------------------------------其作用是HOperatorSet.DrawRectangle2----从窗口通过鼠标交互创建矩形roiHOperatorSet.GenRectangle2-----获取窗口鼠标输出的位置和角度生成矩形regionHOperatorSet.ReduceDomain-----使用region裁剪图像为temp图像HOperatorSet.CreateShapeModel-----对temp图像进行学习输出modelID剩下的就是显示形状匹配模板。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~