Sample code for pyvizionsdk
  • 11 Apr 2025
  • 1 Minute to read
  • Dark
    Light
  • PDF

Sample code for pyvizionsdk

  • Dark
    Light
  • PDF

Article summary

Introduction

This is a simple project for demonstrating how to use pyvizionsdk.
You can download the Sample code here.

Run the project

Run the python sample on the terminal.

python pyvizionSample.py

Example

For this section, we will introduce some functions from pyizionsdk in this sample.

Start the device

Discover the devices and start the index 0 device.

result, camera_list = pyvizionsdk.VxDiscoverCameraDevices()
print("Discovered cameras:", camera_list)

# print camera_list
for camera in camera_list:
    print(camera)

# initialize camera device
camera = pyvizionsdk.VxInitialCameraDevice(0)

# open camera
result = pyvizionsdk.VxOpen(camera)
print("Open camera return code:", result)

Device Information

Get the device name and type of interface.

# get the camera device name 
result, name = pyvizionsdk.VxGetDeviceName(camera)
print("Device name:", name)

# get interface type
result, tyname = pyvizionsdk.VxGetDeviceInterfaceType(camera)
print("Device Interface type name:", tyname)

Set the Brightness

Get the brightness and set the brightness of device

# UVC Image Processing
result, brightness, flag = pyvizionsdk.VxGetUVCImageProcessing(camera, VX_UVC_IMAGE_PROPERTIES.UVC_IMAGE_BRIGHTNESS)
print("UVC brightness:", brightness)
print("Flag:", flag)
print("Return code:", result)

# set the brightness
result = pyvizionsdk.VxSetUVCImageProcessing(camera, VX_UVC_IMAGE_PROPERTIES.UVC_IMAGE_BRIGHTNESS, 12, 0)
print("Set UVC brightness return code:", result)


Was this article helpful?