Camera Control
  • 15 Apr 2025
  • 11 Minutes to read
  • Dark
    Light
  • PDF

Camera Control

  • Dark
    Light
  • PDF

Article summary

Introduction

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

VxResetUVC

  • Function:

int VxResetUVC(std::shared_ptr<VxCamera> vxcam)
def VxResetUVC(vxcam)
  • Function Description:

  1. This function is for resetting the UVC device.

  • Parameter Description:

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

  2. return 0 = PASS, return -1 = FAIL.

  • Example:

// reset the UVC device
VxResetUVC(vxcam);
# reset the UVC device
pyvizionsdk.VxResetUVC(vxcam);

VxGetUVCImageProcessingRange

  • Function:

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

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

  • Parameter Description:

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

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

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

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

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

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

  7. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, min, max, step, def)

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

  8. 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
};
class VX_UVC_IMAGE_PROPERTIES(Enum):
    UVC_IMAGE_BRIGHTNESS = 0
    UVC_IMAGE_CONTRAST = 1
    UVC_IMAGE_HUE = 2
    UVC_IMAGE_SATURATION = 3
    UVC_IMAGE_SHARPNESS = 4
    UVC_IMAGE_GAMMA = 5
    UVC_IMAGE_COLORENABLE = 6
    UVC_IMAGE_WHITEBALANCE = 7
    UVC_IMAGE_BACKLIGHT_COMPENSATION = 8
    UVC_IMAGE_GAIN = 9
    UVC_IMAGE_PAN = 10
    UVC_IMAGE_TILT = 11
    UVC_IMAGE_ROLL = 12
    UVC_IMAGE_ZOOM = 13
    UVC_IMAGE_EXPOSURE = 14
    UVC_IMAGE_IRIS = 15
    UVC_IMAGE_FOCUS = 16
    UVC_IMAGE_PROP_MAX = 17
  • 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);
from pyvizionsdk import VX_UVC_IMAGE_PROPERTIES
# get the UVC image processing range
result, brightness_min, brightness_max, brightness_step, brightness_def = pyvizionsdk.VxGetUVCImageProcessingRange(vxcam, VX_UVC_IMAGE_PROPERTIES.UVC_IMAGE_BRIGHTNESS)
print("UVC brightness range:", brightness_min, brightness_max, brightness_step, brightness_def)
print("Return code:", result)

VxGetUVCImageProcessing

  • Function:

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

  1. 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:

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

  2. propId: A VX_UVC_IMAGE_PROPERTIES format UVC image processing property for which being queried.

  3. value: A long type variable to store the current value of the property.

  4. 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.

  5. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, value, flag)

      ※ return_code: 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);
from pyvizionsdk import VX_UVC_IMAGE_PROPERTIES
# get the UVC image processing
result, brightness, flag = pyvizionsdk.VxGetUVCImageProcessing(vxcam, VX_UVC_IMAGE_PROPERTIES.UVC_IMAGE_BRIGHTNESS)
print("UVC brightness:", brightness)
print("Flag:", flag)
print("Return code:", result)

VxSetUVCImageProcessing

  • Function:

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

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

  • Parameter Description:

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

  2. propId: A VX_UVC_IMAGE_PROPERTIES format UVC image processing property for which being queried.

  3. value: A long type variable to set the value of the property.

  4. 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.

  5. return 0 = PASS, return -1 = FAIL.

  • Example:

// set the brightness to 16
VxsetUVCImageProcessing(vxcam, VX_UVC_IMAGE_PROPERTIES::UVC_IMAGE_BRIGHTNESS, 16, 0);
from pyvizionsdk import VX_UVC_IMAGE_PROPERTIES
# set the UVC image processing
result = pyvizionsdk.VxSetUVCImageProcessing(vxcam, VX_UVC_IMAGE_PROPERTIES.UVC_IMAGE_BRIGHTNESS, 12, 0)
print("Set UVC brightness return code:", result)

VxGetISPImageProcessingRange

  • Function:

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

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

  • Parameter Description:

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

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

  3. min: A int type variable to store the minimum allowable value for the property.

  4. max: A int type variable to store the maximum allowable value for the property.

  5. step: A int type variable to store the step value for the property.

  6. def: A int type variable to store the default value for the property.

  7. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, min, max, step, def)

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

  8. 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
};
class VX_ISP_IMAGE_PROPERTIES(Enum):
    ISP_IMAGE_BRIGHTNESS = 0
    ISP_IMAGE_CONTRAST = 1
    ISP_IMAGE_SATURATION = 2
    ISP_IMAGE_WHITEBALANCE_MODE = 3
    ISP_IMAGE_WHITEBALANCE_TEMPERATURE = 4
    ISP_IMAGE_EXPOSURE_MODE = 5
    ISP_IMAGE_EXPOSURE_TIME = 6
    ISP_IMAGE_EXPOSURE_MIN_TIME = 7
    ISP_IMAGE_EXPOSURE_MAX_TIME = 8
    ISP_IMAGE_EXPOSURE_GAIN = 9
    ISP_IMAGE_GAMMA = 10
    ISP_IMAGE_SHARPNESS = 11
    ISP_IMAGE_BACKLIGHT_COMPENSATION = 12
    ISP_IMAGE_SPECIAL_EFFECT_MODE = 13
    ISP_IMAGE_DENOISE = 14
    ISP_IMAGE_FLIP_MODE = 15
    ISP_IMAGE_PAN = 16
    ISP_IMAGE_TILT = 17
    ISP_IMAGE_ZOOM = 18
    ISP_IMAGE_FLICK_MODE = 19
    ISP_IMAGE_JPEG_QUALITY = 20
    ISP_IMAGE_PROP_MAX = 21
  • 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);
from pyvizionsdk import VX_ISP_IMAGE_PROPERTIES
# get the ISP image processing range
result, brightness_min, brightness_max, brightness_step, brightness_def = pyvizionsdk.VxGetISPImageProcessingRange(vxcam, VX_ISP_IMAGE_PROPERTIES.ISP_IMAGE_BRIGHTNESS)
print("ISP brightness range:", brightness_min, brightness_max, brightness_step, brightness_def)
print("Return code:", result)

VxGetISPImageProcessing

  • Function:

int VxGetISPImageProcessing(std::shared_ptr<VxCamera> vxcam,
                            VX_ISP_IMAGE_PROPERTIES propId,
                            int& value,
                            int& flag)
def VxGetISPImageProcessing(vxcam, propId)
  • Function Description:

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

  • Parameter Description:

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

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

  3. value: An int type variable to store the current value of the property.

  4. 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.

  5. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, value, flag)

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

  • Example:

auto propId = static_cast<VX_ISP_IMAGE_PROPERTIES>(0);
int value;
int flag = 0;
// get the ISP image processing value and flag
VxGetISPImageProcessing(vxcam, propId, value, flag);
from pyvizionsdk import VX_ISP_IMAGE_PROPERTIES
# get the ISP image processing value and flag
result, brightness, flag = pyvizionsdk.VxGetISPImageProcessing(vxcam, VX_ISP_IMAGE_PROPERTIES.ISP_IMAGE_BRIGHTNESS)
print("ISP brightness:", brightness)
print("Flag:", flag)
print("Return code:", result)

VxSetISPImageProcessing

  • Function:

int VxSetISPImageProcessing(std::shared_ptr<VxCamera> vxcam,
                            VX_ISP_IMAGE_PROPERTIES propId,
                            int value)
def VxSetISPImageProcessing(vxcam, propId, value)
  • Function Description:

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

  • Parameter Description:

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

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

  3. value: A int variable to set the value of the property.

  4. return 0 = PASS, return -1 = FAIL.

  • Example:

// set the brightness to 16
VxSetISPImageProcessing(vxcam, VX_ISP_IMAGE_PROPERTIES::ISP_IMAGE_BRIGHTNESS, 16);
from pyvizionsdk import VX_ISP_IMAGE_PROPERTIES
# set the brightness to 16
result = pyvizionsdk.VxSetISPImageProcessing(vxcam, VX_ISP_IMAGE_PROPERTIES.ISP_IMAGE_BRIGHTNESS, 16)
print("Set ISP brightness return code:", result)

VxSetISPImageProcessingDefault

  • Function:

int VxSetISPImageProcessingDefault(std::shared_ptr<VxCamera> vxcam)
def VxSetISPImageProcessingDefault(vxcam)
  • Function Description:

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

  • Parameter Description:

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

  2. return 0 = PASS, return -1 = FAIL.

  • Example:

// set the ISP image processing to default value
VxSetISPImageProcessingDefault(vxcam);
# set the ISP image processing to default value
result = pyvizionsdk.VxSetISPImageProcessingDefault(vxcam)
print("Return code:", result)

VxGetCurrentGain

  • Function:

int VxGetCurrentGain(std::shared_ptr<VxCamera> vxcam, uint8_t& gain)
def VxGetCurrentGain(vxcam)
  • Function Description:

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

  • Parameter Description:

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

  2. gain: A reference of the uint8_t variable that stores the gain value.

  3. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, gain)

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

  • Example:

uint8_t gain;
// get the gain value
VxGetCurrentGain(vxcam, gain);
# get the gain value
result, gain = pyvizionsdk.VxGetCurrentGain(vxcam)
print("Gain value:", gain)
print("Return code:", result)

VxGetCurrentExposure

  • Function:

int VxGetCurrentExposure(std::shared_ptr<VxCamera> vxcam, uint32_t& exp)
def VxGetCurrentExposure(vxcam)
  • Function Description:

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

  • Parameter Description:

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

  2. exp: A reference of the uint32_t variable which stored the exposure value.

  3. Return:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: tuple(return_code, exp)

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

  • Example:

uint32_t exp;
// get the exposure time value
VxGetCurrentGain(vxcam, exp);
# get the exposure value
result, exp = pyvizionsdk.VxGetCurrentExposure(vxcam)
print("Exposure value:", exp)
print("Return code:", result)

VxGetMaxFPS & VxSetMaxFPS

  • Function:

int VxGetMaxFPS(std::shared_ptr<VxCamera> vxcam, uint8_t& fps)
int VxSetMaxFPS(std::shared_ptr<VxCamera> vxcam, uint8_t fps)
def VxGetMaxFPS(vxcam)
def VxSetMaxFPS(vxcam, 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:

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

  2. fps: A reference of a uint8_t variable that will be used to get or set the maximum frame rate.

  3. VxGetMaxFPS:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: return tuple(return_code, fps)

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

  4. 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);
# get the maximum frame rate
result, max_fps = pyvizionsdk.VxGetMaxFPS(vxcam, max_fps)
print("Max FPS:", max_fps)
print("Return code:", result)
# Set the frame rate to the maximum value
result = pyvizionsdk.VxSetMaxFPS(vxcam, max_fps)
print("Return code:", result)

VxGetThroughPut & VxSetThroughPut

  • Function:

int VxGetThroughPut(std::shared_ptr<VxCamera> vxcam, uint16_t& throughPut)
int VxSetThroughPut(std::shared_ptr<VxCamera> vxcam, uint16_t throughPut)
def VxGetThroughPut(vxcam)
def VxSetThroughPut(vxcam, 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:

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

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

  3. VxGetThroughPut:

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python: return tuple(return_code, throughPut)

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

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

  • Example:

uint16_t throughPut;
// get the throughPut
VxGetThroughPut(vxcam, throughPut);
// set the throughPut
VxSetThroughPut(vxcam, throughPut);
# get the throughput value
result, throughPut = pyvizionsdk.VxGetThroughPut(vxcam)
print("ThroughPut:", throughPut)
print("Return code:", result)
# Set the throughput value
result = pyvizionsdk.VxSetThroughPut(vxcam, throughPut)
print("Return code:", result)

VxGetTimestamp & VxGetFrameCount

  • Function:

int VxGetTimestamp(std::shared_ptr<VxCamera> vxcam, float& timestamp)
int VxGetFrameCount(std::shared_ptr<VxCamera> vxcam, uint8_t& frameCount)
def VxGetTimestamp(vxcam)
def VxGetFrameCount(vxcam)
  • 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:

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

  2. timestamp: A float variable that will be used to get the timestamp value.

  3. frameCount: A uint8_t variable that will be used to get the frame count value.

  4. VxGetTimestamp & VxGetFrameCount :

    1. C++: return 0 = PASS, return -1 = FAIL

    2. Python:

      1. VxGetTimestamp: return tuple(return_code, timestamp)

      2. VxGetFrameCount: return tuple(return_code, frameCount)

        ※ return_code: 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;
# get image
result, format_list = pyvizionsdk.VxGetFormatList(vxcam)
mjpg_format = None
min_resolution = float('inf')
for format in format_list:
    # get mjpg format and minimum resolution
    if format.format == VX_IMAGE_FORMAT.VX_IMAGE_FORMAT_MJPG:
        resolution = format.width * format.height
        if resolution < min_resolution:
            min_resolution = resolution
            mjpg_format = format
result, image = pyvizionsdk.VxGetImage(vxcam, 1000, mjpg_format)

# get the timestamp and frame count value after getting image
result, timestamp = pyvizionsdk.VxGetTimestamp(vxcam)
print("Timestamp: ", timestamp)
result, frameCount = pyvizionsdk.VxGetFrameCount(vxcam)
print("FrameCount: ", frameCount)

VxResetTimestamp & VxResetFrameCount

  • Function:

int VxResetTimestamp(std::shared_ptr<VxCamera> vxcam)
int VxResetFrameCount(std::shared_ptr<VxCamera> vxcam)
def VxResetTimestamp(vxcam)
def VxResetFrameCount(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.

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

  • Parameter Description:

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

  2. VxResetTimestamp & VxResetFrameCount : return 0 = PASS, return -1 = FAIL

  • Example:

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


Was this article helpful?