Skip to main content

Defining the Future of 3D Machine Vision

Project description

Zivid Python

Zivid Python is the official Python package for Zivid 3D cameras. Read more about Zivid at zivid.com.

Build Status PyPI Package Zivid Image


Contents: Installation | Quick Start | Examples | Versioning | License | Support | Test Matrix


Installation

Dependencies

Ubuntu users must install Python headers (apt install python3-dev) in addition to the regular python3 package.

Windows users also needs to make sure that the Zivid SDK installation folder is in system PATH before using the package, not only the terminal PATH variable. The default install location that should be added to system PATH is C:\Program Files\Zivid\bin.

Installing official version from PyPI using PIP

After having installed the latest Zivid SDK, the easiest way to install Zivid Python is to use PIP to fetch the latest official version from PyPI:

pip install zivid

Note:

If you don't use the latest Zivid SDK version you need to manually specify the version. See Versioning.

Installation may take some time since the setup.py script will download additional dependencies and compile C++ source code in the background.

On some systems Python 3 pip is called pip3. In this guide we assume it is called pip. When using PIP version 19 or higher build dependencies are handled automatically.

Old PIP

If you are using a version of PIP older than version 19 please manually install the dependencies listed in pyproject.toml before installing zivid.

pip install <packages listed in pyproject.toml>
pip install zivid

Installing from source

git clone <zivid-python clone URL>
cd zivid-python
pip install .

The above pip install . command may give permission issues on some Windows machines. If so, try the following instead:

python continuous-integration/windows/create_binary_distribution.py
pip install ./dist/*.whl

You may want to build Zivid Python against a different (but compatible) version of Zivid SDK. An example would be if Zivid SDK 2.1 was released but the official Zivid Python still formally only supports SDK 2.0. Since all the features of the 2.0 API exist in the 2.1 API, Zivid Python can still be built with the new SDK (but without wrapping the latest features). In order to achieve this, edit sdk_version.json to target the new SDK version before doing pip install .. Note that this option is considered experimental/unofficial.

Quick Start

Point cloud capture

To quickly capture a point cloud using default settings, run the following code:

import zivid

app = zivid.Application()
camera = app.connect_camera()
settings = zivid.Settings(
    acquisitions=[zivid.Settings.Acquisition()],
    color=zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()]),
)
frame = camera.capture_2d_3d(settings)
frame.save("result.zdf")

Instead of using the API to define capture settings, it is also possible to load them from YML files that have been exported from Zivid Studio or downloaded from the Zivid Knowledge Base settings library. This can be done by providing the filesystem path to such a file, for example:

settings = Settings.load("ZividTwo_Settings_2xHDR_Normal.yml")
frame = camera.capture_2d_3d(settings)

Point cloud data access

Data can easily be accessed in the form of Numpy arrays:

import zivid

app = zivid.Application()
camera = app.connect_camera()
settings = zivid.Settings(
    acquisitions=[zivid.Settings.Acquisition()],
    color=zivid.Settings2D(acquisitions=[zivid.Settings2D.Acquisition()]),
)
frame = camera.capture_2d_3d(settings)
xyz = frame.point_cloud().copy_data("xyz")  # Get point coordinates as [Height,Width,3] float array
rgba = frame.point_cloud().copy_data("rgba")  # Get point colors as [Height,Width,4] uint8 array
bgra = frame.point_cloud().copy_data("bgra")  # Get point colors as [Height,Width,4] uint8 array

Capture Assistant

Instead of manually adjusting settings, the Capture Assistant may be used to find the optimal settings for your scene:

import zivid

app = zivid.Application()
camera = app.connect_camera()
capture_assistant_params = zivid.capture_assistant.SuggestSettingsParameters()
settings = zivid.capture_assistant.suggest_settings(camera, capture_assistant_params)
frame = camera.capture_2d_3d(settings)
frame.save("result.zdf")

Using camera emulation

If you do not have a camera, you can use the FileCameraZivid2M70.zfc file in the Sample Data to emulate a camera.

import zivid

app = zivid.Application()
camera = app.create_file_camera("path/to/FileCameraZivid2M70.zfc")
settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition()])
frame = camera.capture_3d(settings)
frame.save("result.zdf")

Examples

Basic example programs can be found in the samples directory. Many more advanced example programs may be found in the separate zivid-python-samples repository.

Versioning

This python module is released with the same version number as the Zivid SDK that it supports. The Zivid SDK is using semantic versioning with major, minor, and patch versions.

If a patch is released to fix an issue with this python module separately from a Zivid SDK patch release, then a fourth number signifying the patch version of the python module will be added to the end:

Version breakdown

                              Zivid SDK version = 2.16.0
                              v vv v
Zivid Python module version = 2.16.0.1
                                     ^
                                     Zivid Python module patch version (omitted if 0)

[!NOTE] Versioning Prior to 2.16.0

Before version 2.16.0, this python module used a similar but different versioning scheme with six numbers. In this scheme, the first three numbers specified the semantic version of the python module while the next three numbers specified the semantic version of the supported Zivid SDK. In some early versions of the python module, these semantic versions could be different, but eventually they were synced up, and from version 2.16.0 the versioning system was simplified as explained above.

PyPI

When installing using PIP it is possible to specify the required version. This can be useful if using an older version of the Zivid SDK.

To see the complete list of released versions of this python module, see zivid-python-releases-url or run pip index versions zivid.

Note that as explained above, the versioning system was simplified starting with version 2.16.0 such that the Zivid Python is the same as the supported Zivid SDK version. Older releases used a different versioning scheme, which is also explained above.

Install latest version of Zivid Python using latest available version of Zivid SDK

pip install zivid

Note: The installation may fail if the latest available version of Zivid SDK is not installed on the system. See Installation.

Install a specific version of Zivid Python

pip install zivid==2.16.0

This requires Zivid SDK version 2.16.0 to be installed on the system.

Using the old versioning scheme, install version 2.6.0 of the Zivid Python wrapper supporting Zivid SDK 2.7.0

pip install zivid==2.6.0.2.7.0

This requires Zivid SDK version 2.7.0 to be installed on the system.

License

This project is licensed, see the LICENSE file for details. The licenses of dependencies are listed license dependencies.

Support

Please visit Zivid Knowledge Base for general information on using Zivid 3D cameras. If you cannot find a solution to your issue, please contact customersuccess@zivid.com.

Test matrix

The test matrix shows which Python versions and operating systems are tested in CI. Check text matrix here to go to the test matrix.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zivid-2.17.2.tar.gz (122.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zivid-2.17.2-cp314-cp314-win_amd64.whl (798.5 kB view details)

Uploaded CPython 3.14Windows x86-64

zivid-2.17.2-cp313-cp313-win_amd64.whl (781.7 kB view details)

Uploaded CPython 3.13Windows x86-64

zivid-2.17.2-cp312-cp312-win_amd64.whl (781.7 kB view details)

Uploaded CPython 3.12Windows x86-64

zivid-2.17.2-cp311-cp311-win_amd64.whl (772.2 kB view details)

Uploaded CPython 3.11Windows x86-64

zivid-2.17.2-cp310-cp310-win_amd64.whl (771.1 kB view details)

Uploaded CPython 3.10Windows x86-64

zivid-2.17.2-cp39-cp39-win_amd64.whl (953.1 kB view details)

Uploaded CPython 3.9Windows x86-64

zivid-2.17.2-cp38-cp38-win_amd64.whl (770.4 kB view details)

Uploaded CPython 3.8Windows x86-64

zivid-2.17.2-cp37-cp37m-win_amd64.whl (751.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

Details for the file zivid-2.17.2.tar.gz.

File metadata

  • Download URL: zivid-2.17.2.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2.tar.gz
Algorithm Hash digest
SHA256 763ebe95d4e5c4a3cafcb1b6850486b35814589ef59d82e756cb9263407062b4
MD5 0d8f0d23515be7a2b79e1b4a4b0cd2fa
BLAKE2b-256 5bcfab2cd867f4dae183517617d8528d58d1d12dd65912d7c2265951ca7058fd

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 798.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 85b024bd3093f7e0280b5bc11a2cd3a6fd456a457d119d3996524963433c1985
MD5 b492eb5219b5c5fa3890878aee6777e3
BLAKE2b-256 ea820e13047e0c2044cc69093371350dcae59e8fcf31dd544119bdbaf3dce808

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 781.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 04c1cd345962448e91a4cab2a348f28fd2357ba339f264832f2c8a0628846f4d
MD5 02afdd8b1bb62b6db602f07af31f0180
BLAKE2b-256 c507db237075f9d532baafd682a864df01180032fead35037d48adc05079bc96

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 781.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a701b82955e3062545f23e2c95f2150f1bcf70db2996613dee24f1ede41728d5
MD5 3d44b40570b31916ae65369da0bea001
BLAKE2b-256 231a9a6b7263a6d4d2339a69976d615ca2ee6523808ebb6dafc7f28668217925

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 772.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e5489f5d6c2339a1ab5f200017bf03115750672fe7eda4481770abcb093d6f27
MD5 aaa83af68585b81e23070bfbb4f50f71
BLAKE2b-256 1942acb1dcbee1e0169c6aaf667a16368207ffb019f9dcd0fa6bdd2dae57ec28

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 771.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 75dabeeb8c1f5225dcb07b034bf4b3aa986c05c5b30843a1bd96e1c0490e47f7
MD5 49b9f19f74f989e2e0229a856e6896d3
BLAKE2b-256 90875b0c6cea44f5092d9de53f8882075edacecd613b4f75c0612224c3d70fca

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 953.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2aa02de7839ec1344f0788297323a88e08e34ed9b7eada6a8565e4e0b1097223
MD5 4895faf6010fe3d93a3f9732d5df3e85
BLAKE2b-256 d536b7cc896ee3b1ca6955f6dc640d1ec704f68f4007b5ef1212452adeb072c6

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 770.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7a127cae863a61f656dde50bdb88a35b2d09e963527eeacbbdc69905d89fd77a
MD5 366e71adf0c4c6f0390e94667732d772
BLAKE2b-256 dd5773c636a9f687bde2f1e3b070f79fd4fe0a6ddb1d6e4fcf8d422989e70569

See more details on using hashes here.

File details

Details for the file zivid-2.17.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: zivid-2.17.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 751.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for zivid-2.17.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 20f978d542822a795d9727136bc9fd3223e84d4e787ee2a8c8da30692d47213c
MD5 8fc9a86a40afc42dc9c236ddcbbb3d5f
BLAKE2b-256 d6ddce5de6dca631e80c23173b39c3ee9dcfbb676f10b766e6be8154955eeb46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page