memory_block_to_imageT_memory_block_to_imageMemoryBlockToImageMemoryBlockToImagememory_block_to_image (Operator)

Name

memory_block_to_imageT_memory_block_to_imageMemoryBlockToImageMemoryBlockToImagememory_block_to_image — Read an image from a memory block with different file formats.

Signature

memory_block_to_image( : Image : MemoryBlockHandle : )

Herror T_memory_block_to_image(Hobject* Image, const Htuple MemoryBlockHandle)

void MemoryBlockToImage(HObject* Image, const HTuple& MemoryBlockHandle)

void HImage::MemoryBlockToImage(const HMemoryBlock& MemoryBlockHandle)

static void HOperatorSet.MemoryBlockToImage(out HObject image, HTuple memoryBlockHandle)

void HImage.MemoryBlockToImage(HMemoryBlock memoryBlockHandle)

def memory_block_to_image(memory_block_handle: HHandle) -> HObject

Description

The operator memory_block_to_imagememory_block_to_imageMemoryBlockToImageMemoryBlockToImageMemoryBlockToImagememory_block_to_image reads image data from the indicated memory block MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle and generates the image ImageImageImageImageimageimage.

The formats JPEG and PNG can be read. The file formats are recognized by the internal structure of the memory block. In case of colored images an image with three color channels is created, the red channel being stored in the first, the green channel in the second and the blue channel in the third component (channel number).

For the PNG image format binary alpha channels are interpreted as domains. Otherwise, the domain of the generated image object (all pixels of the matrix) is chosen maximal.

Attention

If CMYK or YCCK JPEG memory blocks are read, HALCON assumes that these follow the Adobe Photoshop convention that the CMYK channels are stored inverted, i.e., 0 represents 100% ink coverage, rather than 0% ink as one would expect. The images are converted to RGB images using this convention. If the JPEG memory block does not follow this convention, but stores the CMYK channels in the usual fashion, invert_imageinvert_imageInvertImageInvertImageInvertImageinvert_image must be called after reading the image.

If PNG images that contain an alpha channel are read, the alpha channel is returned as the second or fourth channel of the output image, unless the alpha channel contains exactly two different gray values, in which case a one or three channel image with a reduced domain is returned, in which the points in the domain correspond to the points with the higher gray value in the alpha channel.

Execution Information

Parameters

ImageImageImageImageimageimage (output_object)  image objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / complex / int2 / uint2 / vector_field / int4 / int8 / real)

Read image.

MemoryBlockHandleMemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle (input_control)  memory_block HMemoryBlock, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Memory block handle.

Result

If the parameters are correct the operator memory_block_to_imagememory_block_to_imageMemoryBlockToImageMemoryBlockToImageMemoryBlockToImagememory_block_to_image returns the value 2 ( H_MSG_TRUE) . Otherwise an exception is raised.

Possible Predecessors

read_memory_blockread_memory_blockReadMemoryBlockReadMemoryBlockReadMemoryBlockread_memory_block, deserialize_tupledeserialize_tupleDeserializeTupleDeserializeTupleDeserializeTupledeserialize_tuple

Possible Successors

disp_imagedisp_imageDispImageDispImageDispImagedisp_image, thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, count_channelscount_channelsCountChannelsCountChannelsCountChannelscount_channels, decompose3decompose3Decompose3Decompose3Decompose3decompose3, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, fill_interlacefill_interlaceFillInterlaceFillInterlaceFillInterlacefill_interlace, zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizeZoomImageSizezoom_image_size, zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor, crop_partcrop_partCropPartCropPartCropPartcrop_part, write_imagewrite_imageWriteImageWriteImageWriteImagewrite_image, rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayRgb1ToGrayrgb1_to_gray

Module

Foundation