Skip to main content

Camera Control

Introduction

These functions are responsible for controlling various parameters of the camera.

VxResetUVC

Function:

int VxResetUVC(std::shared_ptr<VxCamera> vxcam)

Function Description:

  • This function is for resetting the UVC device.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • return 0 = PASS, return -1 = FAIL.

Example:

// reset the UVC device
VxResetUVC(vxcam);

VxGetUVCImageProcessingRange

Function:

int VxGetUVCImageProcessingRange(std::shared_ptr<VxCamera> vxcam,
VX_UVC_IMAGE_PROPERTIES propId,
long& min,
long& max,
long& step,
long& def)

Function Description:

  • This function is for the UVC device to get the range of image processing parameters.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().

  • propId : A VX_UVC_IMAGE_PROPERTIES format UVC image processing property for which the range is being queried.

  • min : A long type variable to store the minimum allowable value for the property.

  • max : A long type variable to store the maximum allowable value for the property.

  • step : A long type variable to store the step value for the property.

  • def : A long type variable to store the default value for the property.

  • Return:

    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, min, max, step, def)

      return_code : return 0 = PASS, return -1 = FAIL

  • VX_UVC_IMAGE_PROPERTIES format:

    enum class VX_UVC_IMAGE_PROPERTIES {
    UVC_IMAGE_BRIGHTNESS,
    UVC_IMAGE_CONTRAST,
    UVC_IMAGE_HUE,
    UVC_IMAGE_SATURATION,
    UVC_IMAGE_SHARPNESS,
    UVC_IMAGE_GAMMA,
    UVC_IMAGE_COLORENABLE,
    UVC_IMAGE_WHITEBALANCE,
    UVC_IMAGE_BACKLIGHT_COMPENSATION,
    UVC_IMAGE_GAIN,
    UVC_IMAGE_PAN,
    UVC_IMAGE_TILT,
    UVC_IMAGE_ROLL,
    UVC_IMAGE_ZOOM,
    UVC_IMAGE_EXPOSURE,
    UVC_IMAGE_IRIS,
    UVC_IMAGE_FOCUS,
    UVC_IMAGE_PROP_MAX
    };

Example:

long value = 0, min = 0, max = 0, step = 0, def = 0;
auto propId = static_cast<VX_UVC_IMAGE_PROPERTIES>(0);
// get the UVC image processing range
VxGetUVCImageProcessingRange(vxcam, propId, min, max, step, def);

VxGetUVCImageProcessing

Function:

int VxGetUVCImageProcessing(std::shared_ptr<VxCamera> vxcam,
VX_UVC_IMAGE_PROPERTIES propId,
long& value,
int& flag)

Function Description:

  • This function is for the UVC device to get the image processing parameters’ current value and the flag to indicate whether the property is in auto mode or not.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • propId : A VX_UVC_IMAGE_PROPERTIES format UVC image processing property for which being queried.
  • value : A long type variable to store the current value of the property.
  • flag : An int type variable to indicate whether the property is read only or not. If the flag is 1, it means the property is in auto mode for read-only.
  • Return:
    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, value, flag)

      return_code : return 0 = PASS, return -1 = FAIL

Example:

long value = 0;
int flag = 0;
auto propId = static_cast<VX_UVC_IMAGE_PROPERTIES>(0);
// get the UVC image processing
VxGetUVCImageProcessing(vxcam, propId, value, flag);

VxSetUVCImageProcessing

Function:

int VxSetUVCImageProcessing(std::shared_ptr<VxCamera> vxcam,
VX_UVC_IMAGE_PROPERTIES propId,
long value,
int flag)

Function Description:

  • This function is for the UVC device to set image processing parameters value and the flag.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • propId : A VX_UVC_IMAGE_PROPERTIES format UVC image processing property for which being queried.
  • value : A long type variable to set the value of the property.
  • flag : A int type variable to indicate whether the property is read only or not. If the flag is 1, it means the property is in auto mode for read-only.
  • return 0 = PASS, return -1 = FAIL.

Example:

// set the brightness to 16
VxsetUVCImageProcessing(vxcam, VX_UVC_IMAGE_PROPERTIES::UVC_IMAGE_BRIGHTNESS, 16, 0);

VxGetISPImageProcessingRange

Function:

int VxGetISPImageProcessingRange(std::shared_ptr<VxCamera> vxcam,
VX_ISP_IMAGE_PROPERTIES propId,
VxISPImageProcessingValue& min,
VxISPImageProcessingValue& max,
VxISPImageProcessingValue& step,
VxISPImageProcessingValue& def)

Function Description:

  • This function is for the ISP device to get the range of image processing parameters.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().

  • propId : A VX_ISP_IMAGE_PROPERTIES format ISP image processing property for which the range is being queried.

  • min : A long type variable to store the minimum allowable value for the property.

  • max : A long type variable to store the maximum allowable value for the property.

  • step : A long type variable to store the step value for the property.

  • def : A long type variable to store the default value for the property.

  • Return:

    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, min, max, step, def)

      return_code : return 0 = PASS, return -1 = FAIL

  • VX_ISP_IMAGE_PROPERTIES format:

    enum class VX_ISP_IMAGE_PROPERTIES {
    ISP_IMAGE_BRIGHTNESS,
    ISP_IMAGE_CONTRAST,
    ISP_IMAGE_SATURATION,
    ISP_IMAGE_WHITEBALANCE_MODE,
    ISP_IMAGE_WHITEBALANCE_TEMPERATURE,
    ISP_IMAGE_EXPOSURE_MODE,
    ISP_IMAGE_EXPOSURE_TIME,
    ISP_IMAGE_EXPOSURE_MIN_TIME,
    ISP_IMAGE_EXPOSURE_MAX_TIME,
    ISP_IMAGE_EXPOSURE_GAIN,
    ISP_IMAGE_GAMMA,
    ISP_IMAGE_SHARPNESS,
    ISP_IMAGE_BACKLIGHT_COMPENSATION,
    ISP_IMAGE_SPECIAL_EFFECT_MODE,
    ISP_IMAGE_DENOISE,
    ISP_IMAGE_FLIP_MODE,
    ISP_IMAGE_PAN,
    ISP_IMAGE_TILT,
    ISP_IMAGE_ZOOM,
    ISP_IMAGE_FLICK_MODE,
    ISP_IMAGE_JPEG_QUALITY,
    ISP_IMAGE_PROP_MAX
    };

Example:

long value = 0, min = 0, max = 0, step = 0, def = 0;
auto propId = static_cast<VX_ISP_IMAGE_PROPERTIES>(0);
// get the ISP image processing range
VxGetISPImageProcessingRange(vxcam, propId, min, max, step, def);

VxGetISPImageProcessing

Function:

int VxGetISPImageProcessing(std::shared_ptr<VxCamera> vxcam,
VX_ISP_IMAGE_PROPERTIES propId,
VxISPImageProcessingValue& value,
int& flag)

Function Description:

  • This function is for the ISP device to get an image processing parameter value and the flag.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().

  • propId : A VX_ISP_IMAGE_PROPERTIES format ISP image processing property for which being queried.

  • value : A VxISPImageProcessingValue format variable to store the current value of the property.

  • flag : An int type variable to indicate whether the property is read only or not. If the flag is 1, it means the property is read-only.

  • Return:

    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, value, flag)

      return_code : return 0 = PASS, return -1 = FAIL

  • VxISPImageProcessingValue format

    using VxISPImageProcessingValue = std::variant<int, double>;

Example:

auto propId = static_cast<VX_ISP_IMAGE_PROPERTIES>(0);
VxISPImageProcessingValue value;
int flag = 0;
// get the ISP image processing value and flag
VxGetISPImageProcessing(vxcam, propId, value, flag);

VxSetISPImageProcessing

Function:

int VxSetISPImageProcessing(std::shared_ptr<VxCamera> vxcam,
VX_ISP_IMAGE_PROPERTIES propId,
int value)

Function Description:

  • This function is for the ISP device to set an image processing parameter value.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • propId : A VX_ISP_IMAGE_PROPERTIES format ISP image processing property for which being queried.
  • value : A int variable to set the value of the property.
  • return 0 = PASS, return -1 = FAIL.

Example:

// set the brightness to 16
VxSetISPImageProcessing(vxcam, VX_ISP_IMAGE_PROPERTIES::ISP_IMAGE_BRIGHTNESS, 16);

VxSetISPImageProcessingDefault

Function:

int VxSetISPImageProcessingDefault(std::shared_ptr<VxCamera> vxcam)

Function Description:

  • This function is for the ISP device to set an image processing parameter to the default value.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • return 0 = PASS, return -1 = FAIL.

Example:

// set the ISP image processing to default value
VxSetISPImageProcessingDefault(vxcam);

VxGetCurrentGain

Function:

int VxGetCurrentGain(std::shared_ptr<VxCamera> vxcam, uint8_t& gain)

Function Description:

  • This function is for the device to obtain the current exposure gain value.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • gain : A reference of the uint8_t variable that stores the gain value.
  • Return:
    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, gain)

      return_code : return 0 = PASS, return -1 = FAIL

Example:

uint8_t gain;
// get the gain value
VxGetCurrentGain(vxcam, gain);

VxGetCurrentExposure

Function:

int VxGetCurrentExposure(std::shared_ptr<VxCamera> vxcam, uint32_t& exp)

Function Description:

  • This function is for the device to obtain the current exposure time value.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • exp : A reference of the uint32_t variable which stored the exposure value.
  • Return:
    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : tuple(return_code, exp)

      return_code : return 0 = PASS, return -1 = FAIL

Example:

uint32_t exp;
// get the exposure time value
VxGetCurrentGain(vxcam, exp);

VxGetMaxFPS & VxSetMaxFPS

Function:

int VxGetMaxFPS(std::shared_ptr<VxCamera> vxcam, uint8_t& fps)
int VxSetMaxFPS(std::shared_ptr<VxCamera> vxcam, uint8_t fps)

Function Description:

  • VxGetMaxFPS : This function is for retrieving the maximum frame rate supported by the camera.
  • VxSetMaxFPS : This function is for the device to set the maximum frame rate

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • fps : A reference of a uint8_t variable that will be used to get or set the maximum frame rate.
  • VxGetMaxFPS :
    • C++ : return 0 = PASS, return -1 = FAIL

    • Python : return tuple(return_code, fps)

      return_code: return 0 = PASS, return -1 = FAIL

    • VxSetMaxFPS : return 0 = PASS, return -1 = FAIL.

Example:

uint8_t max_fps;
// get the maximum frame rate
VxGetMaxFPS(vxcam, max_fps);
// Set the frame rate to the maximum value
VxSetMaxFPS(vxcam, max_fps);

VxGetThroughPut & VxSetThroughPut

Function:

int VxGetThroughPut(std::shared_ptr<VxCamera> vxcam, uint16_t& throughPut)
int VxSetThroughPut(std::shared_ptr<VxCamera> vxcam, uint16_t throughPut)

Function Description:

  • VxGetThroughPut : This function is for retrieving the throughput value from the camera.
  • VxSetThroughPut : This function is for the device to set the throughput value.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().

  • throughPut : A uint16_t variable that will be used to get or set the throughput value.

  • VxGetThroughPut :

    • C++ : return 0 = PASS, return -1 = FAIL
    • Python : return tuple(return_code, throughPut)

      return_code : return 0 = PASS, return -1 = FAIL

  • VxSetThroughPut : return 0 = PASS, return -1 = FAIL.

Example:

uint16_t throughPut;
// get the throughPut
VxGetThroughPut(vxcam, throughPut);
// set the throughPut
VxSetThroughPut(vxcam, throughPut);

VxGetTimestamp & VxGetFrameCount

Function:

int VxGetTimestamp(std::shared_ptr<VxCamera> vxcam, float& timestamp)
int VxGetFrameCount(std::shared_ptr<VxCamera> vxcam, uint8_t& frameCount)

Function Description:

  • VxGetTimeStamp : This function is for retrieving the timestamp value from the camera.
  • VxGetFrameCount : This function is for retrieving the frame count value from the camera.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • timestamp : A float variable that will be used to get the timestamp value.
  • frameCount : A uint8_t variable that will be used to get the frame count value.
  • VxGetTimestamp & VxGetFrameCount:
    • C++ : return 0 = PASS, return -1 = FAIL
    • Python :
      1. VxGetTimestamp : return tuple(return_code, timestamp)
      2. VxGetFrameCount : return tuple(return_code, frameCount)

      return_code : return 0 = PASS, return -1 = FAIL

Example:

// get image
uint8_t* raw_data = new uint8_t[3840 * 2160 * 2];
int raw_size = 0;
float timestamp;
uint8_t framecnt;
VxGetImage(vxcam, raw_data, &raw_size, 3000)

// get the timestamp and frame count value after getting image
VxGetTimestamp(vxcam, timestamp);
VxGetFrameCount(vxcam, framecnt);
std::cout << "TimeStamp: " << timestamp << std::endl;
std::cout << "framecnt: " << framecnt << std::endl;

VxResetTimestamp & VxResetFrameCount

warning

These reset functions must be used when the camera is not in standby mode.

Function:

int VxResetTimestamp(std::shared_ptr<VxCamera> vxcam)
int VxResetFrameCount(std::shared_ptr<VxCamera> vxcam)

Function Description:

  • VxResetTimeStamp : This function is for resetting the timestamp value from the camera.
  • VxResetFrameCount : This function is for resetting the frame count value from the camera.

Parameter Description:

  • vxcam : A pointer shared ownership of a camera obtained from VxInitialCameraDevice().
  • VxResetTimestamp & VxResetFrameCount: return 0 = PASS, return -1 = FAIL

Example:

// start streaming
VxStartStreaming(vxcam);
// reset the timestamp and frame count
VxResetTimestamp(vxcam);
VxResetFrameCount(vxcam);