Halcon学习之八:图像区域叠加与绘制
Halcon學習之八:圖像區域疊加與繪制
overpaint_gray ( ImageDestination, ImageSource : : : )
將灰度值不相同區域用不同顏色繪制到ImageDestination中,ImageSource包含希望的灰度值圖像
overpaint_region ( Image, Region : : Grayval, Type : )
將Region以一個恆定的灰度值繪制到Image圖像中
paint_gray ( ImageSource, ImageDestination : MixedImage : : )
將ImageSource的圖像繪制到ImageDestination中,形成MixedImage。
paint_region ( Region, Image : ImageResult : Grayval, Type : )
將Region以一個恆定的灰度值繪制到Image圖像中
paint_xld ( XLD, Image : ImageResult : Grayval : )
將XLD以一個恆定的灰度值繪制到Image圖像中
set_grayval ( Image : : Row, Column, Grayval : )
設置Image圖像中坐標為(Row,Column)的灰度值
程序:
[c-sharp]view plaincopy
1read_image (Image, 'G:/Halcon/images/images/claudia.png')
2gen_circle (Circle, 200, 200, 100.5)
3reduce_domain (Image, Circle, ImageReduced)
4gen_image_proto (Image, ImageCleared, 32)
5overpaint_gray (ImageCleared, ImageReduced)
6gen_image_const (Image1, 'byte', 512, 512)
7overpaint_region (Image1, Circle, 255, 'fill')
8* /* Copy a circular part of the image into the image : */
9read_image (Image2, 'G:/Halcon/images/images/brycecanyon1.png')
10paint_gray (ImageReduced, Image2, MixedImage)
11* /* Paint a rectangle into the image */
12read_image (Image3, 'G:/Halcon/images/images/pads.png')
13gen_rectangle1 (Rectangle1, 30, 20, 100, 200)
14paint_region (Rectangle1, Image3, ImageResult, 255, 'fill')
15* /* Paint colored xld objects into a gray image */
16* /* read and copy image to generate a three channel image */
17copy_image (Image2, image0)
18copy_image (Image2, image1)
19compose3 (image0, Image2, image1, MultiChannelImage)
20* /* extract subpixel border */
21threshold_sub_pix (MultiChannelImage, Border, 128)
22* /* select the circle and the arrows */
23circle := Border[14]
24arrow := Border[16]
25ObjectsConcat := [circle,arrow]
26* /* paint a green circle and white arrows (to paint all
27* * objects e.g. blue, pass [0,0,255] tuple for GrayVal) */
28paint_xld (ObjectsConcat, MultiChannelImage, ImageResult1, [0,1,0,1,1,255]) 處理效果: