几何尺寸与公差论坛

 找回密码
 注册
查看: 46|回复: 2

将缺陷区域从原始图像中剪切出来,并放置在一张大黑图中

  [复制链接]
发表于 2024-5-13 16:55:19 | 显示全部楼层 |阅读模式
       // 获取灰度值
                    //HTuple Rows, Columns;
                    //HOperatorSet.GetRegionPoints(region.GetRegion(), out Rows, out Columns);
                    //HTuple Grayval;
                    //HObject Image2; // 假设这是您的图像
                    //HOperatorSet.GetGrayval(baseImages[index].HObject, Rows, Columns, out Grayval);
                    //// 黑图
                    //HTuple Width, Height;
                    //HOperatorSet.GetImageSize(baseImages[index].HObject, out Width, out Height);
                    //HObject Imagebg;
                    //HOperatorSet.GenImageConst(out Imagebg, "byte", Width, Height);
                    //for (int k = 0; k < Rows.Length; k++)
                    //{
                    //    HOperatorSet.SetGrayval(Imagebg, Rows[k], Columns[k], Grayval[k]);
                    //} - 效率很慢
 楼主| 发表于 2024-5-13 16:55:47 | 显示全部楼层
                    HOperatorSet.ReduceDomain(baseImages[index].HObject, region.GetRegion(), out HObject imageReduced);
 楼主| 发表于 2024-5-13 16:56:21 | 显示全部楼层
    //string file = "test";
                    //HOperatorSet.WriteImage(imageReduced, "jpg", 0, file);
                    //var img = new HImage(file);
                    //img.GetImageSize(out int width2, out int height2);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-6-7 20:27 , Processed in 0.039127 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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