Python (Linux)
Sample Program Overview
Python sample programs are located in VcameraSDK-X.X.X/python/samples and include:
DepthTextureRegistration.py: Configures the camera in software trigger mode and aligns the output depth image with the color image.DepthToPointCloud.py: Configures the camera in continuous acquisition mode and converts depth data into point clouds in real time.FetchFrame.py: Configures the camera in continuous acquisition mode to capture depth images.ListDevices.py: Lists all cameras connected to the computer.SoftTrigger.py: Configures the camera in software trigger mode. After a software trigger command is sent, the camera captures a depth image.GetVersion.py: Displays the current SDK version.DumpAllFeatures.py: Lists all features supported by the camera.DumpDeviceInfo.py: Lists camera information.ReadWriteFeatures.py: Demonstrates how to get the type, name, value, and range of camera features, and how to set them.SetIpAddress.py: Sets a static IP address for the camera.UserSetSelector.py: Selects a user set, which is a saved group of camera feature settings. This sample only applies to Gige_2.1 cameras that support user sets.LogConfig.py: Configures the Vcamera SDK software logging system.SaveFeaturesToStorage.py: Saves parameter settings to the device Storage area. This sample only applies to Gige_2.0 cameras that do not support user sets.LoadFeaturesFromStorage.py: Loads parameter settings from the Storage area and applies them to the camera. This sample only applies to Gige_2.0 cameras that do not support user sets.SaveFeaturesToFile.py: Saves modified parameter settings to a specified JSON file.LoadFeaturesFromFile.py: Loads camera parameter settings from a specified JSON file and applies them to the camera.
Install Dependencies
Dependency 1 - Python
Note
Python 3.8 or later is required. Python 3.8 is recommended because it has passed full compatibility testing. Other versions have not been fully tested and compatibility is not guaranteed.
sudo apt install python3
Dependency 2 - USB Driver (Optional)
If you need to use a USB camera, complete the Set Up USB Camera steps.
Build the Wheel Package
Attention
Do not change the relative positions of the VcameraSDK-X.X.X/python and VcameraSDK-X.X.X/cpp directories.
Open a terminal in VcameraSDK-X.X.X/python and run the build script:
python3 build_wheel.py
After the build is complete, the wheel package is located in VcameraSDK-X.X.X/python/dist.
Install the Wheel Package
Locate the built wheel package in
VcameraSDK-X.X.X/python/dist.Open a terminal, go to that directory, and run the following command to install the wheel package:
pip install <wheel_file_name>.whl
For example:
pip install vcamera_python-26.1.5-cp38-cp38-linux_x86_64.whl
Note
If the terminal displays a message like the following:
vcamera-python is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.the same version of the wheel package is already installed, so reinstallation is unnecessary.
To force reinstallation, run the following command:
pip install --force-reinstall <wheel_file_name>.whl
Verify the Installation
Run the following command in the terminal to verify whether the installation was successful:
python -c "import vcamera as vcam; print(vcam.GetVersionString())"
Run Sample Programs
After installation, open a terminal in VcameraSDK-X.X.X/python/samples and run one of the sample programs:
python samples/ListDevices.py
python samples/FetchFrame.py
Uninstall
pip uninstall vcamera-python