图像修复: 这个示例程序展示了如何使用inpainting_ct把外部钢网从图片中移出(类似去除水印)

By admin at 2019-04-23 • 0人收藏 • 1205人看过

image.png

import win.ui;
/*DSG{{*/
mainForm = win.form(text="aardio + Halcon 祛除水印(钢网), 来自 Aardio.com.cn";right=1518;bottom=573)
mainForm.add(
button={cls="button";text="抹除钢网";left=13;top=20;right=200;bottom=88;z=2};
picturebox={cls="picturebox";left=207;top=0;right=868;bottom=574;z=1};
picturebox2={cls="picturebox";left=858;top=0;right=1519;bottom=574;z=3}
)
/*}}*/

//import console
//console.open()

//import HOperatorSetX;
import com;
HOperatorSetX = com.CreateObject("{6ebd90e2-d219-11d2-ade5-0000c00f4ef9}")

Image = HOperatorSetX.ReadImage( "img/lynx" );
var Width , Height = HOperatorSetX.GetImageSize( Image );
var WindowHandleleft = HOperatorSetX.OpenWindow( 0 , 0 , mainForm.picturebox.width , mainForm.picturebox.height , mainForm.picturebox.hwnd , "transparent", "" );
var WindowHandle = HOperatorSetX.OpenWindow( 0 , 0 , mainForm.picturebox2.width , mainForm.picturebox2.height , mainForm.picturebox2.hwnd , "transparent", "" );



HOperatorSetX.DispObj( Image , WindowHandleleft );
HOperatorSetX.DispObj( Image , WindowHandle );


mainForm.button.oncommand = function(id,event){
 
	//This example program shows how inpainting_ct can be used to remove the
	//fence from an image of a lynx.
	//var Image = HOperatorSetX.ReadImage(  'img/lynx' );
	//var  Width, Height = HOperatorSetX.GetImageSize( Image );
	//dev_close_window ()
	//dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
	//set_display_font(WindowHandle, 16, 'mono', 'true', 'false')
	//dev_display (Image)
	//Message = 'Image to be inpainted'
	//disp_message(WindowHandle, Message, 'window', 12, 12, 'black', 'true')
	//stop()
	var Region = HOperatorSetX.ReadRegion(  'img/lynx_mask' );
	//dev_display (Image)
	//dev_set_color ('blue')
	//dev_display (Region)
	//Message = 'Inpainting region'
	//disp_message(WindowHandle, Message, 'window', 12, 12, 'black', 'true')
	//stop()
	var  InpaintedImage = HOperatorSetX.InpaintingCt( Image, Region, 13, 70, 1.2, 4, 1 );
	//dev_display (InpaintedImage)
	//Message = 'Inpainted image'
	//disp_message(WindowHandle, Message, 'window', 12, 12, 'black', 'true')
	HOperatorSetX.DispObj( InpaintedImage , WindowHandle );	
	
	
}

mainForm.show();
return win.loopMessage();

这里获取到region之后 , 直接利用inpainting_ct函数执行修复

功能:通过连贯传送执行图像修复

官方示例路径:

C:\Program Files\MVTec\HALCON-13.0\examples\hdevelop\Filters\Inpainting\inpainting_ct.hdev

登录后方可回帖

登 录
信息栏
 私人小站

本站域名

ChengXu.XYZ

投诉联系:  popdes@126.com



快速上位机开发学习,本站主要记录了学习过程中遇到的问题和解决办法及上位机代码分享

这里主要专注于学习交流和经验分享.
纯私人站,当笔记本用的,学到哪写到哪.
如果侵权,联系 Popdes@126.com

友情链接
Aardio官方
Aardio资源网


才仁机械


网站地图SiteMap

Loading...