HALCON将某个区域绘制到RGB图像上
方法一:分别用三个单通道图像绘制后,合成一个三通道彩色图像
read_image (Image, 'test.png')
gen_rectangle1 (Rectangle, 30, 20, 100, 200)
copy_image (Image, ImageR)
copy_image (Image, ImageG)
copy_image (Image, ImageB)
paint_region (Rectangle, ImageR, ImageR, 255, 'fill')
paint_region (Rectangle, ImageG, ImageG, 255, 'fill')
paint_region (Rectangle, ImageB, ImageB, 0, 'fill')
compose3 (ImageR, ImageG, ImageB, OutImage)
方法二:得到区域内所有的点,然后逐点设置图像像素点值(速度较慢)
read_image (Image, 'test.png')
gen_rectangle1 (Rectangle, 30, 20, 100, 200)
copy_image (Image, ImageR)
copy_image (Image, ImageG)
copy_image (Image, ImageB)
get_region_points (Rectangle, Rows, Columns)
for i := 0 to |Rows|-1 by 1
set_grayval (ImageR, Rows[i], Columns[i], 255)
set_grayval (ImageG, Rows[i], Columns[i], 255)
set_grayval (ImageB, Rows[i], Columns[i], 0)
endfor
compose3 (ImageR, ImageG, ImageB, OutImage)