Skip to main content

No project description provided

Project description

Pycameleon

CI PyPI PyPI Downloads

A python binding for cameleon, a rust crate to interact with GenICam compatible U3V (USB3 Vision) camera.

Example demo using Rerun viewer and SILIOS Toucan camera

We welcome new contributors!

Your contributions, whether code, documentation, or ideas are highly appreciated!

Instalation

PyPI (Recommended)

This package is available in PyPI.

pip install pycameleon

Build from source

Build dependencies:

  • Rust/Cargo toolchain installed
  • maturin pip install maturin/pipx install maturin
  • libusb header (See cameleon FAQ)

First install maturin using pip or pipx or other package manager.

pip install maturin

Then run the following to install the package into the current environment.

maturin develop

Linux

By default, many devices are only accessible to root and need udev rules for non root users to access.

First use lsusb to list vendor and product id ID vendor_id:product_id.

Then, create an udev rule file at /etc/udev/rules.d/, for example /dev/udev/rules.d/99-u3v.rules

Choose and change vendor and product id with your own.

# Example: USB with vendor Id 2676 and product id 5678
SUBSYSTEM=="usb", ATTRS{idVendor}=="2676", ATTR{idProduct}=="5678", MODE:="0666", TAG+="uaccess", TAG+="udev-acl"
# Example: USB with vendor Id 1234 with any product id
SUBSYSTEM=="usb", ATTRS{idVendor}=="1234", MODE:="0666", TAG+="uaccess", TAG+="udev-acl"

If the framerate is low, you may need to increase usbfs_memory_mb limit. By default, USB-FS on Linux systems only allows 16 MB of buffer memory for all USB devices. This is quite low for high-resolution image streaming. We recommend you to set the value to 1024MB. You could set the value as following as root:

echo 1024 > /sys/module/usbcore/parameters/usbfs_memory_mb

or using sudo tee

echo 1024 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb

Windows

For Windows, driver supported by libusb like WinUSB is required.

In most case, Zadig is recommended as an Automated Driver Installer GUI application.

NOTE: Make sure to install a driver to a composite device not to its child devices. To do this, you need to list all devices connected to the host computer with Zadig like below.

MacOS

MacOS should have out of box support after installing the pip package, for building from source, the libusb package is available in homebrew.

Quick Usage

See ours example repository that contain code snippet for generic Mono8/Mono12 camera and SILIOS Toucan multispectral camera.

Or quick starter cheatsheet below.

import pycameleon


# List all available cameras
available_camera = pycameleon.enumerate_cameras()

# Get the first U3V camera
cam = available_camera[0]

# Open the device in USB level
cam.open()

# Load the GenApi context and return it as XML string
gen_api_context = cam.load_context_from_camera()

# As a alternative, you can load gen api context dumped previously as `.load_context_from_camera()` can fail if already streaming or in invalid state.
# cam.load_context_from_xml(read_xml_to_string(str(cam)))


# After loading the context, we can read/write nodes and execute commands.
# Depending on the camera model, some nodes may not be available.
# Check the dumped GenApi XML for available nodes.

# Reset the device, need to enumerate it again and open from scratch after this.
# cam.execute("DeviceReset")

# Tell the camera to use Mono8 pixel format
cam.write_enum_as_str("PixelFormat", "Mono8")

# Start streaming and prepare a payload buffer for 1 channel.
payload = cam.start_streaming(1)

# Receive a single image from camera.
img, info = cam.receive_raw(payload)

# `img`` is an numpy array with type uint8, it's the raw byte array received from camera.

# `info` contain image information such as width, height and pixel format.


# At the end, close the camera to release USB handler.
cam.close()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl (999.7 kB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_i686.whl (1.1 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ i686

pycameleon-0.2.10-cp39-abi3-win_amd64.whl (757.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

pycameleon-0.2.10-cp39-abi3-win32.whl (706.5 kB view details)

Uploaded CPython 3.9+Windows x86

pycameleon-0.2.10-cp39-abi3-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

pycameleon-0.2.10-cp39-abi3-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

pycameleon-0.2.10-cp39-abi3-musllinux_1_2_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

pycameleon-0.2.10-cp39-abi3-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_s390x.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ s390x

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_ppc64le.whl (1.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ppc64le

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_i686.whl (1.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ i686

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_armv7l.whl (999.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARMv7l

pycameleon-0.2.10-cp39-abi3-manylinux_2_28_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pycameleon-0.2.10-cp39-abi3-macosx_11_0_arm64.whl (866.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pycameleon-0.2.10-cp39-abi3-macosx_10_12_x86_64.whl (884.9 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9bf0c802f23bbaa8ba398e02013e9bb72085473b71c6a4ad9adbe7d15be027ca
MD5 74efccec4b1879ed50103619456c223d
BLAKE2b-256 6556f30acba9397589e98638a58c8264ad0919dfa1340cff57644aa4cf131a92

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-pp311-pypy311_pp73-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 5ac693c690b86a2b8285e611056a849cb9e494011231e63e7d4dcda4cb121c50
MD5 43b03710891c4ee6d4145729ac0b8309
BLAKE2b-256 6109ae3436bc45e6390c91f08d19460730f61eb0843f1401310b1f36bf582eef

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6e707ea059a4f19ea2a23a0229799f6eb6c54798348d77ca9df108b24e1e042d
MD5 bfa5c7f2abde4fef6265c1013d761303
BLAKE2b-256 39716ff08344528ff35f538f83335a94db0cc3578991cd2b6dc16e252714667c

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-win32.whl.

File metadata

  • Download URL: pycameleon-0.2.10-cp39-abi3-win32.whl
  • Upload date:
  • Size: 706.5 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 6a80e90aea671784a5afad7f62489735f99f4a53baf90032fcd4501428414bc0
MD5 9d1fd499fafbbcc8890858036e01305a
BLAKE2b-256 46b09dce6b9997a62ac19d40045986024c60f1606cae53d5f6161007acdd58b6

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5371b43855062d6b2485cfdd6f6200a167ac712fef7ac8dffa5f35517fb540ef
MD5 fd72596e62984da9fcdcc8fe60d6c3b2
BLAKE2b-256 583303347c0797d07c2ed29e420f9304629c172ebc98e2ed3b0225b78eef6c0b

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 37cca739247019dadd219c412ff67225c5a69915665926d02cd9bcb1a7b2113f
MD5 9a5f1ce5be55d77b802ef6f77f8d2bcc
BLAKE2b-256 45e0ea100be2f3a8c4b98715593efad4f9be479eaa52fd05ee174f445fc0b42b

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 978f6274d85b472355a4ad02bdecd561b54b24d450c57fb90f0e960cdfbb9aec
MD5 44b96550842279b52cbbef470a8c964e
BLAKE2b-256 28bd3a9e393602dfb72b5df6710b9deaca99c297dbcf6d973da1687177d8e88e

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0be658d5e179bbcec538afc01941b81675f14e6538eaa45b867ed7f307a38a61
MD5 18951e09d8a35fd9a2a0b1e9074fdd51
BLAKE2b-256 df476af003e067457cb33648c0c162123b350165ba1f5dc6125b76edb1ab9cee

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2aabdc5ffaa83ae75888d0523215f4b07a3b149727a0b5e495c65a9c317fddd
MD5 b6f5d6e24eae2c032bbbed0a65989f35
BLAKE2b-256 196b33f6799c44b2ea124f0b67706d66e6d49b550586f1297843f7713df8f335

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_s390x.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 bb8662d33a366d5b12302fae2285ab5a4c02fbe2df054c9a5215ef3f6a7458b4
MD5 a2148d44b0aa58c51b3e0ce6430c3d3c
BLAKE2b-256 5003c1adc8bb0425191b6a37bbcc6bfa1f0f570be4bfff6bacb1b6678de3ce4c

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 4810f8f611e3356fa2251c23d5a52d52f8af86c327d01163c30ca68bc2d978a7
MD5 712a5b918e1dbbf28114d92f706c1f15
BLAKE2b-256 b90959ce5b13f9418e5207c4ff003e607b223456039d3cae062056770e17fa4e

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_i686.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 bf778784000fb15d425faf62c8d61747ac5f82771c77b7483a0e8cefc39e75fb
MD5 1f3308ee4d2c1ec8499b6a8cddcf9a65
BLAKE2b-256 9e09b826bafb3a7dc87e719c6823b5d7f8def0fd770c5bc28a56bfdd18b161fc

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_armv7l.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 c03b74f5bd7ebd18f322f4be7380b5c1c824aed6868599e987a190db93ab76d4
MD5 1f219b8859249e6b2a49568e98e08181
BLAKE2b-256 8efa5c125def7f448858129aab8b858998025a994aa6edfafa313b7919c5d909

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 93761675ba2a6564c23414af4d9c0eb28f0c5fb4e7ff27a3b50a96a2bc6d6d6f
MD5 ec822fe7de8d9c1ae5a9cc71b61e743c
BLAKE2b-256 1246fbe448ad6bebc829d0459b5259430a5834f725c5d6eb0289215cf698426c

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b13a5d71c23e100702efbf6681521814f2e72d72349148dd153d04d36184f7a9
MD5 e2573df9d01c73f2da20cd85695cd587
BLAKE2b-256 993716ee469836640f11fc64c48dd80b9fbcf674da91f461ccf0b61b8cc06ba1

See more details on using hashes here.

File details

Details for the file pycameleon-0.2.10-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pycameleon-0.2.10-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 876f753bad3a17ce8080a26437f57ca7c98359565765519988a1f53616e3d258
MD5 37f7a46f0c80f2020cc2fc49ae540e4f
BLAKE2b-256 dca7a55040bfcaa1144f461c53cf2edc1b443c995e923f64847b579e63ad94d4

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