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.11-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl (999.5 kB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

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

Uploaded PyPymanylinux: glibc 2.28+ i686

pycameleon-0.2.11-cp39-abi3-win_amd64.whl (757.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

pycameleon-0.2.11-cp39-abi3-win32.whl (706.4 kB view details)

Uploaded CPython 3.9+Windows x86

pycameleon-0.2.11-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.11-cp39-abi3-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pycameleon-0.2.11-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.11-cp39-abi3-manylinux_2_28_s390x.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ s390x

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ ppc64le

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ i686

pycameleon-0.2.11-cp39-abi3-manylinux_2_28_armv7l.whl (1.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARMv7l

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pycameleon-0.2.11-cp39-abi3-macosx_11_0_arm64.whl (867.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pycameleon-0.2.11-cp39-abi3-macosx_10_12_x86_64.whl (885.0 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0627931176c5998110d03b7c72d1ed504ba859b223557eb190d8424563638267
MD5 ee2c7fc935ea7dbef20761ccea70630d
BLAKE2b-256 98ccf260f4b61522ed85b5a80c534eaed09f81469a9078ea0ff1312bdfe4f471

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-pp311-pypy311_pp73-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 0066a9157c330db63e87c8ae2885fab36e2e1b37ca13a81b8937d78fbbee0a2a
MD5 18c07b8839b639268c88c33b08c2363c
BLAKE2b-256 e27e68d520dadac7f50be068f777a41196af05ebd521a501d01b52254e7d839c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 58b04efe25ce2d77e7512fbc3bf3e390a1604390d716d9bbe8087925c71d3b1f
MD5 2734964cbd9c24920d37f4a011099e6b
BLAKE2b-256 24ec9378890dab11c019ee7cb7c68030eeaf0def2b4f01bf6e2f371f03fc98bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycameleon-0.2.11-cp39-abi3-win32.whl
  • Upload date:
  • Size: 706.4 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.11-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 7d924898ac78f7d669e0d88256edcf113e05593227738d86f50ef6f5f7df4657
MD5 1c4e60c03b79ea9ed7c9efcc2c3635d5
BLAKE2b-256 d0694dd16efc9235d8fcfc1058f62220d722d1328240a830bd5cdcbd9fb459fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 059a5be81cadff3198fa2768829bccd7884dfd5b504fe14970f84194b9ab7cd1
MD5 4623f18bae551bf7172f07a954408395
BLAKE2b-256 56c741d236057ee452e600de3c2a7a928005c445e4c72dea72ca236200177a15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 22a10bb37add9336a7d7296ce001a4196feecc665ef1142ec30ebf39e89fccdb
MD5 a82bc4631a4470f33aeee035192bd159
BLAKE2b-256 5aebcc175cfeb70e87830e903ef5d11db2472a2ce628f16a1bb2085193af71a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0fa40acda10b2a43b3fc6b77c0a0b7d52ada2ac4d1665ec6b6fdf4f1ad20a7c4
MD5 ecffdcfcb43809cdb14a1578e9fedd11
BLAKE2b-256 076377f781d3daf5cac5d8d11291a027fd1e6072b3c93055f6b169ab5b73186b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 35b7d2ddb9ab01b9d49faea6d947e61e92a23125f1749e168d269bbe8af348a5
MD5 3422f4cb7544047ab13248fc6b8911c0
BLAKE2b-256 6f17641c15290394b7eac1a76d0c10251de4969dc97c76921154562fe300f68c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b0db4ec5a33d63378ddb1610353c58d14fd49dd91f1b95cae14adbe289b326d
MD5 7521ba869ac8b12817d454bcc4705062
BLAKE2b-256 1d642ede9c39640e96006bc9a307c2b757969536b3f32534fb1c83ed9bcdf9ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 1c91a6e8a0f97d76fae4a496ec3c3510ce33de119114aea389d7215fe686c619
MD5 033aadcb8f01cf9fda3f565755499af6
BLAKE2b-256 dd672ff6d6d872f2ebbd84755415f4b1ed59cc46d884843b2651fe22f0394451

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 1dce21c7d24a2a22b1f3527e7c930a63776fdef2a76e6540d4c5b4b7149000fd
MD5 dea531cc28cefcd6c1969d5c8b0825e8
BLAKE2b-256 35bc0c95e4ca1cab5db0a7756b2f2e6dc3ec984ecd9d9923a3ed1b210ac6797d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 7ac8b002f1751adb694938c107931dfc58f889e7b4d8741062d8477e0258ce26
MD5 084f8adcb351e7403012b5f922d2318d
BLAKE2b-256 3df87a3d429d2e8b1bed6aea562e04382366718b4117ad1d1629979e4e000d0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 433819fc4b8f117ed97c6503356b4758b2600cec1ecfce14899714dd276ae89a
MD5 1bce898cb4e880fc796bf31f6faf91f4
BLAKE2b-256 065698ff363c995809131a989a44c4c39177de572d24c075ad1f52cf9fe4f1c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 17769580fb6f22d37ebf5500a35e95f0c8648640768ff9d62eb6d1ea1dbe58dc
MD5 1be8b6724122f050b52368a0bdfd107f
BLAKE2b-256 a2481280e3dc50aa5541ccf3f1bad95fa63cdf63712d35f58b5f8fc624f65610

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb28051802688fe0de9abc9b146d9cfe77535f9f6ef993bfad16875c1e1f3bed
MD5 69b1e457ed8e8f85f1c493df0ca76278
BLAKE2b-256 5cdf282f451ed8ed4e2a5a97649793524c787e52acc47bd02910e52125551f13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.11-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e5f3dcaab1b446a469722c98080fd0c46cfa3a4d5b776eeb80a44942cf6fd934
MD5 ac5ccebb5cc21fae8f6b689f0d9ed95b
BLAKE2b-256 399ce5f29a37985e81716b253823491f541ae910093ec5e44d12afcda481661a

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