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_imageMemoryBlockToImageMemoryBlockToImagememory_block_to_image reads image data from the indicated memory block MemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_block_handle and generates the image ImageImageImageimageimage.

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_imageInvertImageInvertImageinvert_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

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

Read image.

MemoryBlockHandleMemoryBlockHandleMemoryBlockHandlememoryBlockHandlememory_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_imageMemoryBlockToImageMemoryBlockToImagememory_block_to_image returns the value 2 ( H_MSG_TRUE) . Otherwise an exception is raised.

Possible Predecessors

read_memory_blockread_memory_blockReadMemoryBlockReadMemoryBlockread_memory_block, deserialize_tupledeserialize_tupleDeserializeTupleDeserializeTupledeserialize_tuple

Possible Successors

disp_imagedisp_imageDispImageDispImagedisp_image, thresholdthresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, count_channelscount_channelsCountChannelsCountChannelscount_channels, decompose3decompose3Decompose3Decompose3decompose3, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm, gauss_filtergauss_filterGaussFilterGaussFiltergauss_filter, fill_interlacefill_interlaceFillInterlaceFillInterlacefill_interlace, zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size, zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorzoom_image_factor, crop_partcrop_partCropPartCropPartcrop_part, write_imagewrite_imageWriteImageWriteImagewrite_image, rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayrgb1_to_gray

See also

image_to_memory_blockimage_to_memory_blockImageToMemoryBlockImageToMemoryBlockimage_to_memory_block

Module

Foundation