代码:

 void ShowRect(int iWideSize)
        {
            hWindowControl1.HalconWindow.ClearWindow();
            hWindowControl1.HalconWindow.SetPart(0, 0, iWideSize, iWideSize);
            HObject rect;
            HOperatorSet.GenRectangle1(out rect, 0, 0, iWideSize, iWideSize);
            hWindowControl1.HalconWindow.DispObj(rect);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            ShowRect(100);
        }        
        private void button2_Click(object sender, EventArgs e)
        {
            ShowRect(200);
        }

结果:

 经测试:127正常,128就异常,刚好是byte 范围。

如下修改就好了,可能是halcon10的缺陷。

  private void button2_Click(object sender, EventArgs e)
        {
            HObject img;
            HOperatorSet.GenImageConst(out img,"byte", 2000, 2000);
            img.Dispose();
            ShowRect(2000);
        }

 

 

posted on   闻缺陷则喜何志丹  阅读(44)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
历史上的今天:
2021-02-28 敏捷开发



点击右上角即可分享
微信分享提示