Skip to main content

No project description provided

Project description

Pycameleon

CI PyPI PyPI Downloads PyPI Python

A python binding for cameleon, a rust crate to interact with U3V (USB 3 Vision) camera that implement GenICam.

⚠️ Work in Progress
This project is currently under active development. Features are being added, and APIs may change as we improve the design.

We welcome new contributors! If you want to help, here’s how you can get involved:

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 2676 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 1000MB. You could set the value as following:

echo 1000 > /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

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

Uploaded PyPymanylinux: glibc 2.28+ x86-64

pycameleon-0.2.4-pp311-pypy311_pp73-manylinux_2_28_i686.whl (891.8 kB view details)

Uploaded PyPymanylinux: glibc 2.28+ i686

pycameleon-0.2.4-cp39-abi3-win_amd64.whl (630.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

pycameleon-0.2.4-cp39-abi3-win32.whl (583.8 kB view details)

Uploaded CPython 3.9+Windows x86

pycameleon-0.2.4-cp39-abi3-musllinux_1_2_x86_64.whl (996.7 kB view details)

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

pycameleon-0.2.4-cp39-abi3-musllinux_1_2_i686.whl (1.1 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

pycameleon-0.2.4-cp39-abi3-musllinux_1_2_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

pycameleon-0.2.4-cp39-abi3-musllinux_1_2_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_x86_64.whl (827.9 kB view details)

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

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_s390x.whl (846.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ s390x

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_ppc64le.whl (997.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ppc64le

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_i686.whl (902.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ i686

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_armv7l.whl (821.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARMv7l

pycameleon-0.2.4-cp39-abi3-manylinux_2_28_aarch64.whl (815.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pycameleon-0.2.4-cp39-abi3-macosx_11_0_arm64.whl (704.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pycameleon-0.2.4-cp39-abi3-macosx_10_12_x86_64.whl (729.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3cf0426b4efdcced1fdbd03f5def15d88c7138da14890aa2a47451002725487
MD5 cff82851638b6682797eb56142940a13
BLAKE2b-256 5296a1e259eb7b5d7237419d0f41b6ea0b9df597350534fedcffbf4827838eca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-pp311-pypy311_pp73-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 abf7cf8e8fffc33a3ec7223f9bdff54e36dd0cb23e8e159f0012ad58d18950f0
MD5 3ab1bb84919d17e221e2cb982703e924
BLAKE2b-256 167884084f574f7f26e8e78f6f5725b0e77b648745826f2eec645871508ba7bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycameleon-0.2.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 630.1 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 28ba542dc20f036261aa2a84627bd1740853100dad59eea979ad26e6ac31b542
MD5 4a08c370305b13566cf3b920d0f589b9
BLAKE2b-256 a817d4f1f2c6f395f37918ba68d13456adddd1035c559a1e35adb91544843a60

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 0c3a3a58717e59e4f0afce6b4aa02b83be54d114166b75b91b106eed091a5e3e
MD5 02f8def910cdaff1bd7606b121ae043b
BLAKE2b-256 2aa19dff2d09c5509de25a456c0fed343ca4aa3c836f928afb42533300875822

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e6158e9aeb1243c67abe53434ed10d98d008775ed7e016efdf995b0447acbe3d
MD5 b67e3b33a4bbdef17b73431f8889037b
BLAKE2b-256 b909592bc9b771652094d614c25df9e10af66e3854a5bb4b4bfd37e577ee7107

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d6b2580ecccdbc74fa01466af3f0d5b027e6fceb9cb6a9515d1a55809ceec821
MD5 37695b6857e6dbefcb77584f40dff716
BLAKE2b-256 95f67bf9e5992f8dd719ec6347c94e7970d206533c5459da8e655796a9a5406f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 d460ff8e006ac9e0f8a56f1aa2701104dfef36117ce5d2f7d86f30eeb03a5ca2
MD5 3bdf360a44a10e071faea09f44ec7949
BLAKE2b-256 4ef1ba2ec597a1bd0e8b89644315ba87d6537b51d6153b1ea7da4ef882b8de53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b79f7f3113edaaff4e7b1cfc6cee387c9301c3342f44d58df76d963290c58a09
MD5 d8a19fe6088cce870a227bfd2b456aed
BLAKE2b-256 c0d813ada9d9059e2e4e306235f34bb2d04e797de0ae86b91adbe31dcee5f958

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d536a3c0a91d104814de51dc1b294c36e1c115669345d2e21ba410a008546df
MD5 de73deef6ed6acc5ac17bffb62ccb324
BLAKE2b-256 03b8b13d1b1ccb068a9b8bca92e8b91a197eaad8510adaaf898f64acf641e323

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_s390x.whl
Algorithm Hash digest
SHA256 78aa9f6c5cdaa8e4172b3ae70c56af41262133ccd42602ae038f312d818418ab
MD5 7c2fe3e08d154f1499241412d7998ce0
BLAKE2b-256 e0988d1afdb23be14f15c59380ad8ccb38a8f781727c41a02588203ee0a04127

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 340d4607fae3e2b87dec3925c2ae3217f06d02ee3f3c48bffa4e4081f30d4ed6
MD5 85ac91286138132134d1e07dfe5929aa
BLAKE2b-256 df878da980e9a5e7647fc6b5f1bc92b9617b95f1e9f11ef5ce74ae45fe99565a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_i686.whl
Algorithm Hash digest
SHA256 ab7906e4adf9ef878896024d8e22f1f3f0a74f3f323fb20543b787d896ac16d3
MD5 4fef59334b6be582e8ebf9ab5a0f3ea6
BLAKE2b-256 8743df64d9248973d4d7f45fdd022cec2a6f47ee847d032992872da69db8d99f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_armv7l.whl
Algorithm Hash digest
SHA256 4433fbb9c1f2547e1ab3e819650b7cef426f06de3155a0b3a662c9023de7a583
MD5 f6cbc91c8c470b3c82050670a062b0d3
BLAKE2b-256 6ff2ac184f70e7f9078f5171284c953af4840aad2a66332f8bd3be37560339da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 968579540f2077edae4795b83bed2898d20f395556e6b8f543242eeef7d55684
MD5 f820a728961ec361c4b9e73b0701322d
BLAKE2b-256 0b89b04508e0a4113c79289cd190ac0e9e0b40b15cb9d641f67c94c79944aca3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 783a7df59acbce2425daa19a29380c8f4d3346aad8a14157706ebd3acf00f692
MD5 70f63f82109f8125ba6d4270b85a8785
BLAKE2b-256 7400976bf82cdf48be541b5c1efb40fdf346b7cc988ae53a5e01a5c1b25cf9cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycameleon-0.2.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 598b28489e03ca71ee810847fd17ebd08338a8a6ae7b4284ae5a0ebfd2e3777e
MD5 a9f82d0a52638f81fe64b040dfd3815d
BLAKE2b-256 0b73350cee0c890d8f0ac59d984bc6b9cad49b87be33b944e9b1667d11a19122

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