Please enable JavaScript to view this site.

IDS Software Suite 4.96.1

Windows_Logo
Linux_Logo

USB 2.0

USB 3.x

GigE

USB 2.0

USB 3.x

GigE

Syntax

INT is_SetAllocatedImageMem (HIDS hCam, INT width, INT height, INT bitspixel, char* pcMem, int* pnMemId)

Description

Using is_SetAllocatedImageMem(), you can make a memory allocated by a user the active memory for storing digitized images in it. The allocated memory must be large enough and must always be locked globally.

Depending on the selected image format you need more than one byte per pixel for image memory:

unsigned int uBytesPerPixel = (bitspixel+7)/8;
unsigned int uImageSize = width * height * uBytesPerPixel;

You can call the is_AddToSequence() function to add a memory which was set using is_SetAllocatedImageMem() to a sequence.

The address of this memory will be passed to the uEye driver. For this, you can use the is_SetAllocatedImageMem() function. In addition, you need to specify the image size, just as you do when calling is_AllocImageMem(). The returned memory ID is required by other functions for memory access.

The memory area must be removed from the driver management again using the is_FreeImageMem() function. Please note that this does not release the memory. You then need to make sure that the memory will be released again.

After is_SetAllocatedImageMem() you must call is_SetImageMem() or is_AddToSequence() in order that the image caption can be carried out in the image memory.

Input parameters

hCam

Camera handle

width

Image width

height

Image height

bitspixel

Image color depth (bits per pixel)

pcMem

Pointer to the starting address of the allocated memory

pnMemId

Returns the ID of this memory.

Return values

IS_CANT_ADD_TO_SEQUENCE

The image memory is already included in the sequence and cannot be added again.

IS_INVALID_CAMERA_HANDLE

Invalid camera handle

IS_INVALID_MEMORY_POINTER

Invalid pointer or invalid memory ID

IS_INVALID_PARAMETER

One of the submitted parameters is outside the valid range or is not supported for this sensor or is not available in this mode.

IS_NO_SUCCESS

General error message

IS_OUT_OF_MEMORY

No memory could be allocated.

IS_SEQUENCE_BUF_ALREADY_LOCKED

The memory could not be locked. The pointer to the buffer is invalid.

IS_SUCCESS

Function executed successfully

Related functions

is_AllocImageMem()

is_FreeImageMem()l

is_AddToSequence()

is_SetImageMem()

is_GetColorDepth()

is_GetImgMemPitch()

Example Windows

HANDLE hMem = GlobalAlloc(0, uImageSize);
char* pcMem = (char*)GlobalLock(hMem);
INT nRet = is_SetAllocatedImageMem(hCam, uWidth, uHeight, uBitspixel, pcMem, &iMemID);
[…]
nRet = is_FreeImageMem(hCam, pcMem, iMemID);
GlobalUnlock(hMem);
GlobalFree(hMem);

Example Linux

char* pcMem = (char*)malloc(uImageSize);
int iRet = mlock(pcMem, uImageSize);
INT nRet = is_SetAllocatedImageMem(hCam, uWidth, uHeight, uBitspixel, pcMem, &iMemID);
[…]
nRet = is_FreeImageMem(hCam, pcMem, iMemID);
iRet = munlock(pcMem, uImageSize);
free(pcMem);

© 2022 IDS Imaging Development Systems GmbH