您的位置:首页 > 财经 > 金融 > 广告网页制作模板_凡科商城官网旗舰店_网站权重查询_长春网站建设定制

广告网页制作模板_凡科商城官网旗舰店_网站权重查询_长春网站建设定制

2025/4/3 3:10:07 来源:https://blog.csdn.net/weixin_43940118/article/details/144460101  浏览:    关键词:广告网页制作模板_凡科商城官网旗舰店_网站权重查询_长春网站建设定制
广告网页制作模板_凡科商城官网旗舰店_网站权重查询_长春网站建设定制

halcon随机贴图生成缺陷图片,用于深度学习训练:

read_image (Image, 'C:/Users/61082/Desktop/bentiiamge/omron/S06-1211/ok/ok_images/D246B_CPFNNUBA8LT0SX_AAA_S2412001793_C1216_1733895885320066.jpg')
get_image_size (Image, Width, Height)
gen_rectangle1 (Rectangle, 22, 17, 89, 47)
reduce_domain (Image, Rectangle, ImageReduced)
crop_domain (ImageReduced, ImagePart)
for i:=0 to 100 by 1Rand:=rand(3)paster_Row:=int(Rand[0]*Height)paster_Col:=int(Rand[1]*Width)Angle:=int(Rand[2]*360)minImageWidth:=sqrt(Width*Width+Height*Height)minImageHeight:=sqrt(Width*Width+Height*Height)vector_angle_to_rigid ( Height/2,Width/2, 0, minImageHeight/2, minImageHeight/2, rad(Angle), HomMat2D)*获取图像的通道数count_channels (ImagePart, Channels)*如果是单通道图像if (Channels==1)*生成一个画布gen_image_const (Image1, 'byte', minImageWidth, minImageHeight)*将image放到画布上overpaint_gray (Image1, ImagePart)*图片旋转affine_trans_image (Image1, ImageAffineTrans, HomMat2D, 'constant', 'false')get_image_size (ImageAffineTrans, Width1, Height1)dev_clear_window ()dev_display (ImageAffineTrans)*如果是三通道彩色图像endif if (Channels==3)*分解三通道图像decompose3 (ImagePart, Image11, Image2, Image3)*生成三个画布gen_image_const (Image4, 'byte', minImageWidth, minImageHeight)gen_image_const (Image5, 'byte', minImageWidth, minImageHeight)gen_image_const (Image6, 'byte', minImageWidth, minImageHeight)*依次将三个单通道图像overpaint到画布上overpaint_gray (Image4, Image11)overpaint_gray (Image5, Image2)overpaint_gray (Image6, Image3)*仿射变换单通道图像affine_trans_image (Image4, ImageAffineTrans1, HomMat2D, 'constant', 'false')affine_trans_image (Image5, ImageAffineTrans2, HomMat2D, 'constant', 'false')affine_trans_image (Image6, ImageAffineTrans3, HomMat2D, 'constant', 'false')*三个单通道图像合成彩色图像compose3 (ImageAffineTrans1, ImageAffineTrans2, ImageAffineTrans3, rotateImage)dev_clear_window ()dev_display (rotateImage)endifdev_update_off ()*rgb分离decompose3 (Image, ImageR, ImageG, ImageB)decompose3 (rotateImage, ImagePartR, ImagePartG, ImagePartB)*小图去背景threshold (ImagePartR, Regions1, 210, 255)connection (Regions1, ConnectedRegions2)select_shape_std (ConnectedRegions2, SelectedRegions3, 'max_area', 70)fill_up (SelectedRegions3, SelectedRegions3)smallest_rectangle1 (SelectedRegions3, Row1, Column1, Row2, Column2)get_region_points (SelectedRegions3, oriPartRows, oriPartColumns)count:=|oriPartRows|subRs:=gen_tuple_const(count, Row1)subCs:=gen_tuple_const(count, Column1)PartRows:=oriPartRows-subRsPartColumns:=oriPartColumns-subCsif ((paster_Row+(Row2-Row1)>=Height) or (paster_Col+(Column2-Column1)>=Width))continueendifstartRs:=gen_tuple_const(count, paster_Row)startCs:=gen_tuple_const(count, paster_Col)*将所有像素坐标加上偏移量Rows:=startRs+PartRowsCols:=startCs+PartColumns*r绘制get_grayval (ImagePartR, oriPartRows, oriPartColumns, Grayval)copy_image (ImageR, DupImageR)set_grayval (DupImageR, Rows, Cols, Grayval)*g绘制get_grayval (ImagePartG, oriPartRows, oriPartColumns, Grayval1)copy_image (ImageG, DupImageG)set_grayval (DupImageG, Rows, Cols, Grayval1)*b绘制get_grayval (ImagePartB, oriPartRows, oriPartColumns, Grayval2)copy_image (ImageB, DupImageB)set_grayval (DupImageB, Rows, Cols, Grayval2)compose3 (DupImageR, DupImageG, DupImageB, MultiChannelImage)dev_clear_window()dev_display(MultiChannelImage)wait_seconds(1)
endfor

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com