Home > C: Programming > Function descriptions > History back  Previous chapter  Next chapter  Print  

is_Focus

uEye Camera Manual Version 4.00

is_Focus

Windows_Logo

Linux_Logo

USB uEye XS

USB uEye XS

Syntax

INT is_Focus (HIDS hCam,
             UINT nCommand,
             void *pParam,
             UINT nSizeOfParam)

Description

Using is_Focus(), you can control the focus of the objective lens if supported by your uEye model.

The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the nSizeOfParam input parameter.

Hinweis

This function is currently only supported by the USB uEye XS camera model.

Achtung

According to the sensor manufacturer, there is no guarantee that a focal point set manually for the uEye XS will lead to a reproducible focal distance. A focal value determined with one uEye XS model will not necessarily result in the same focal point for a different model.

Input parameters

hCam

Camera handle

FOC_CMD_GET_CAPABILITIES

Returns the focus functions supported by the camera.

pParam: Pointer to bit mask of type UINT
In the bit mask, the status flags from FOCUS_CAPABILITY_FLAGS are returned.

nSizeOfParam: 4

FOC_CMD_SET_ENABLE_AUTOFOCUS

Enables auto focus.

pParam: NULL

nSizeOfParam: 0

FOC_CMD_SET_DISABLE_AUTOFOCUS

Disables auto focus.

pParam: NULL

nSizeOfParam: 0

FOC_CMD_GET_AUTOFOCUS_ENABLE

Returns the auto focus status.

pParam: Pointer to variable of type UINT
The bit mask returns either:
0 = auto focus disabled
1 = auto focus enabled

nSizeOfParam: 4

FOC_CMD_GET_DISTANCE

Returns the approximate distance in millimeters to the focused object when auto focus is enabled.

pParam: Pointer to variable of type UINT returning the distance to the focused object. The uEye XS distinguishes three distances:
macro = 100 mm
near = 500 mm
far = 20,000 mm

nSizeOfParam: 4

FOC_CMD_SET_MANUAL_FOCUS

Sets a manual focal point.

To query the value range for the manual focus, use FOC_CMD_GET_MANUAL_FOCUS_MIN and FOC_CMD_GET_MANUAL_FOCUS_MAX. You can also query the increment with FOC_CMD_GET_MANUAL_FOCUS_INC.

pParam: Pointer to variable of type INT that passes the value to be set.

nSizeOfParam: 4

FOC_CMD_GET_MANUAL_FOCUS

Returns the manual focus you have set.

pParam: Pointer to variable of type UINT returning the manual focus you have set.
0 = No valid manual focus has been set.

nSizeOfParam: 4

FOC_CMD_GET_MANUAL_FOCUS_MIN

Returns the minimum value for manually setting the focal point.

pParam: Pointer to variable of type UINT returning the minimum manual focal point.

nSizeOfParam: 4

FOC_CMD_GET_MANUAL_FOCUS_MAX

Returns the maximum value for manually setting the focal point.

pParam: Pointer to variable of type UINT returning the maximum manual focal point.

nSizeOfParam: 4

FOC_CMD_GET_MANUAL_FOCUS_INC

Returns the increment for manually setting the focal point.

pParam: Pointer to variable of type UINT returning the increment for the manual focus.

nSizeOfParam: 4

pParam

Pointer to a function parameter, whose function depends on nCommand.

nSizeOfParam

Size (in bytes) of the memory area to which pParam refers.

Status flags from FOCUS_CAPABILITY_FLAGS

FOC_CAP_INVALID

The camera does not support focus settings

FOC_CAP_AUTOFOCUS_SUPPORTED

The camera supports auto focus

FOC_CAP_MANUAL_SUPPORTED

The camera supports manual focus

FOC_CAP_GET_DISTANCE

The camera supports querying the focal distance

FOC_CAP_SET_AUTOFOCUS_RANGE

The camera supports the selection of the auto focus range

Return values

IS_CANT_COMMUNICATE_WITH_DRIVER

Communication with the driver failed because no driver has been loaded.

IS_CANT_OPEN_DEVICE

An attempt to initialize or select the camera failed (no camera connected or initialization error).

IS_INVALID_CAPTURE_MODE

The function can not be executed in the current camera operating mode (free run, trigger or standby).

IS_INVALID_CAMERA_HANDLE

Invalid camera handle

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_IO_REQUEST_FAILED

An IO request from the uEye driver failed. Possibly the versions of the ueye_api.dll (API) and the driver file (ueye_usb.sys or ueye_eth.sys) do not match.

IS_NO_SUCCESS

General error message

IS_NOT_SUPPORTED

The camera model used here does not support this function or setting.

IS_SUCCESS

Function executed successfully

Example

UINT uiCaps = 0;

 

// Query if the camera supports auto focus

INT nRet = is_Focus (m_hCam, FDT_CMD_GET_CAPABILITIES, &uiCaps, sizeof (uiCaps) );

 

if (nRet == IS_SUCCESS && (uiCaps & FOC_CAP_AUTOFOCUS_SUPPORTED))

{

//If supported, enable auto focus

nRet = is_Focus (m_hCam, FOC_CMD_SET_ENABLE_AUTOFOCUS, NULL, 0);

}


Suggestion for improvement? Send us your short Feedback on this chapter. Thank you very much!

For technical questions please contact you local distributor or use the support form on our website.


© 2012 IDS Imaging Development Systems GmbH
http://www.ids-imaging.com