当前位置:网站首页>Halcon 绘制区域 到图片中
Halcon 绘制区域 到图片中
2022-06-24 13:00:00 【廷益--飞鸟】
将区域绘制到图片中(灰度图)
区域颜色使用的是 白色
public static HImage WriteRegion(HImage baseImg, HRegion wRegion)
{
int nWidth, nHeight;
baseImg.GetImageSize(out nWidth, out nHeight);
HImage zeroImage = new HImage();
zeroImage.GenImageConst("byte", nWidth, nHeight);
zeroImage = zeroImage.PaintRegion(wRegion, (HTuple)255, "fill");
return zeroImage;
}
将区域绘制到图片中 (彩色图片)
区域的颜色可以使用 RGB分量设置。
public static HImage GetRegionRGB(HImage baseImg, HRegion wRegion, int iR, int iG, int iB)
{
HImage imgResult = baseImg.CopyImage();
HImage imgR = new HImage();
HImage imgB = new HImage();
HImage imgG = new HImage();
HRegion wBig = wRegion.DilationCircle(3.5);
HRegion wInside = wRegion.DilationCircle(1.5);
HRegion outRegion = wBig.Difference(wInside);
imgR = imgResult.Decompose3(out imgG, out imgB);
imgR = imgR.PaintRegion(outRegion, (HTuple)iR, "fill");
imgG = imgG.PaintRegion(outRegion, (HTuple)iG, "fill");
imgB = imgB.PaintRegion(outRegion, (HTuple)iB, "fill");
imgResult = imgR.Compose3(imgG, imgB);
return imgResult;
}
边栏推荐
- NPM package [details] (including NPM package development, release, installation, update, search, uninstall, view, version number update rules, package.json details, etc.)
- Daily question 8-515 Find the maximum value in each tree row
- HarmonyOS.2
- SAP Marketing Cloud 功能概述(三)
- 2022年煤炭生产经营单位(安全生产管理人员)考试题模拟考试平台操作
- Rongyun communication has "hacked" into the heart of the bank
- 百度地图API绘制点及提示信息
- 遠程辦公之:在家露營辦公小工具| 社區征文
- 4个不可不知的“安全左移”的理由
- One click to generate University, major and even admission probability. Is it so magical for AI to fill in volunteer cards?
猜你喜欢
随机推荐
2022年江西省安全员B证考试题库模拟考试平台操作
位于相同的分布式端口组但不同主机上的虚拟机无法互相通信
How to manage tasks in the low code platform of the Internet of things?
钛星数安加入龙蜥社区,共同打造网络安全生态
The project manager needs to look at six characteristics to build a team
SAP Marketing Cloud 功能概述(四)
项目经理的晋级之路
OpenHarmony 1
杰理之检测 MIC 能量自动录音自动播放参考【篇】
Activity生命周期
【sdx62】WCN685X IPA不生效问题分析及解决方案
2022 construction elevator driver (construction special type of work) examination questions and online simulation examination
如何在物联网低代码平台中进行任务管理?
greendao使用问题
The real project managers are all closed-loop masters!
Gatling 性能测试
**Unity中莫名其妙得小问题-灯光和天空盒
Simulated 100 questions and answers of fluorination process examination in 2022
#21Set经典案例
Jerry added an input capture channel [chapter]







![[5g NR] 5g NR system architecture](/img/78/6db70c18887c7a3920843d1cb4bdf3.png)
