Multi image tile display of Halcon image processing


Use MFC and Halcon to display the demonstration results in HDevelop in the form of dialog box in MFC

1, Results

1.1 Halcon presentation results

2, Halcon code

read_image (Image, 'claudia')                   //Read image
concat_obj (Image, Image, Images)               //Connect two iconic object tuples
tile_images (Images, TiledImage1, 1, 'vertical')  //Tile multiple image objects into a large image
tile_images (Images, TiledImage2, 2, 'horizontal')
scale_image (Image, ImageInverted, -1, 256)         //Scales the gray value of the image.
concat_obj (ImageInverted, ImageInverted, ImagesInverted) //Connect two iconic object tuples
concat_obj (Images, ImagesInverted, Images4)
tile_images (Images4, TiledImage3, 2, 'horizontal')
tile_images (Images4, TiledImage4, 2, 'vertical')
mirror_image (Image, ImageMirror, 'row')                  //mirror image
concat_obj (Images4, ImageMirror, Images5)
tile_images (Images5, TiledImage5, 3, 'horizontal')
tile_images (Images5, TiledImage6, 3, 'vertical')
mirror_image (Image, ImageMirror2, 'column')
concat_obj (ImageMirror2, ImageMirror2, ImagesMirror)
concat_obj (Images5, ImagesMirror, Images7)
tile_images (Images7, TiledImage7, 5, 'horizontal')
tile_images (Images7, TiledImage8, 5, 'vertical')

2.1 key function analysis

2.1.1 concat_obj (Operator)

concat_obj -- connecting two iconic object tuples

concat_obj(Objects1, Objects2 : ObjectsConcat : : )
//Objects1 (input_object)   	--Object tuple 1.
//Objects2 (input_object)   	--Object tuple 2.
//ObjectsConcat (output_object) --Concatenated objects. description

concat_obj connects the two tuples of the symbolic objects Objects1 and Objects2 into a new symbolic object ObjectsConcat tuple. Therefore, this tuple contains all the symbolic objects of the two input tuples:

ObjectsConcat = [Objects1,Objects2]

In ObjectsConcat, the objects of Objects1 are stored first, followed by the objects of Objects2, that is, the order of objects is preserved. Note that only references to the corresponding images and regions are stored in ObjectsConcat, that is, no new memory is allocated. In addition, this means modification of the input image, for example, using set_grayval,overpaint_gray or overpaint_region directly affects the image of the output tuple ObjectsConcat, and vice versa.

concat_obj should not be confused with union1 or union2. They merge regions, that is, they modify the number of objects.

concat_obj can be used to connect objects of different image object types (for example, image and XLD outline) into a single object. This is recommended only when accumulation is required in a single object variable, for example, the result of an image processing sequence. It should be noted that the only operator that can handle this mixed type object tuple is concat_obj,copy_obj,select_obj and disp_obj.

2.1.1 tile_images (Operator)

tile_images - tile multiple image objects into a large image.

tile_images(Images : TiledImage : NumColumns, TileOrder : )
//Images (input_object)     	--Input images.
//TiledImage (output_object)    --Tiled output image.
//NumColumns (input_control) -- the number of columns used to output the image
	Default value: 1
	Suggested values: 1, 2, 3, 4, 5, 6, 7
	Restriction: NumColumns >= 1
//TileOrder (input_control)    	-- The order of the input image in the output image.
	Default value: 'vertical'
	List of values: 'horizontal', 'vertical'

tile_images tiles multiple input image objects (which must contain the same number of channels) into a large image. The input image object images contains num images, which may have different sizes. The output image TiledImage contains as many channels as the input image. In the output image, the num input image is tiled into the NumColumns column. Each block has the same size, which is determined by the maximum width and height of all input images. If the input image is smaller than the block size, it is copied to the center of the corresponding block. When NumColumns has not been determined (that is, if NumColumns! = 1 and NumColumns! = Num), the parameter TileOrder determines the order in which images are copied into the output. If TileOrder = 'horizo ntal', the image will be copied horizontally, that is, the second image of the image will be to the right of the first image. If TileOrder = 'vertical', the image will be copied vertically, that is, the second image of the image will be below the first image. TiledImage's domain is obtained by copying the domains of images to the corresponding position in the output image. If num is not a multiple of NumColumns, the output image will have an undefined grayscale value in the lower right corner of the image. The output field will reflect this.

Tags: AI image processing MFC Halcon

Posted on Wed, 10 Nov 2021 01:09:17 -0500 by rupturedtoad