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

is_Focus

uEye Camera Manual Version 3.80

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 (e.g. enable/disable auto focus, return focal distance). 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.

With USB uEye XS cameras, you can use the face detection function to control the auto focus.

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

nCommand

 

FOC_CMD_GET_CAPABILITIES

Returns the focus functions supported by the camera.

More details

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.

More details

pParam: NULL

nSizeOfParam: 0

FOC_CMD_SET_DISABLE_AUTOFOCUS

Disables auto focus.

More details

pParam: NULL

nSizeOfParam: 0

FOC_CMD_GET_AUTOFOCUS_ENABLE

Returns the auto focus status.

More details

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.

More details

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.

More details

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: NULL

nSizeOfParam: 4

FOC_CMD_GET_MANUAL_FOCUS

Returns the manual focus you have set.

More details

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.

More details

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.

More details

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.

More details

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

nSizeOfParam: 4

 

pParam

Pointer to a function parameter; which function parameter is referred to here 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_SUCCESS

Function executed successfully

IS_NO_SUCCESS

General error message

IS_NOT_SUPPORTED

This function is not supported by the current camera

IS_INVALID_CAPTURE_MODE

This function is not supported in the current operating mode

IS_INVALID_PARAMETER

One of the parameters passed is invalid

Code Sample


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!


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