halcon HwindowCtronl 原始比例显示图片

2021-03-04 18:27

阅读:566

标签:比例   The   window   his   art   sage   ima   exception   operator   

    HTuple imgWidth, imgHeight;
            int winRow, winCol, winWidth, winHeight,partWidth, partHeight;
            try
            {
                HOperatorSet.GetImageSize( image,out imgWidth, out imgHeight);
                this.hWindowControl1.HalconWindow.GetWindowExtents(out winRow, out winCol, out winWidth, out winHeight);
                if (winWidth  winHeight)
                {
                    partWidth = imgWidth;
                    partHeight = imgWidth * winHeight / winWidth;
                }
                else
                {
                    partWidth = imgHeight * winWidth / winHeight;
                    partHeight = imgHeight;
                }
                this.hWindowControl1.HalconWindow.SetPart(0, 0, partHeight - 1, partWidth - 1);
                HOperatorSet.DispImage(image,this.hWindowControl1.HalconWindow);
            }
            catch (HalconException hEx)
            {
                MessageBox.Show(hEx.Message);
            }

已验证

halcon HwindowCtronl 原始比例显示图片

标签:比例   The   window   his   art   sage   ima   exception   operator   

原文地址:https://www.cnblogs.com/kita/p/12918303.html


评论


亲,登录后才可以留言!