Registry / storage / harvesters

harvesters

JSON →
library1.4.3pypypi✓ verified 83d ago

Harvesters is an image acquisition library for GenICam-based machine vision cameras. It provides a Pythonic interface to GenICam GenTL producers, supporting multiple transport layers (USB3 Vision, GigE Vision, etc.). Current version 1.4.3, released December 2022. Maintained by the GenICam community.

pip install harvesters
INSTALL
IMPORT
SIG · HARVESTERS
H
harvesters
storagepythonv1.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Harvester
from harvesters.core import Harvester
from harvesters import Harvester
Harvester is in the 'core' submodule, not package root.

Initialize harvester, connect to first camera, acquire one buffer.

from harvesters.core import Harvester import os cti_file = os.environ.get('GENICAM_GENTL64_PATH', 'path/to/cti/file.cti') h = Harvester() h.add_file(cti_file) h.update_device_info_list() if len(h.device_info_list) > 0: ia = h.create_image_acquirer(0) ia.start_image_acquisition() with ia.fetch_buffer() as buffer: print(f'Buffer acquired: {buffer.width}x{buffer.height}') ia.stop_image_acquisition() ia.destroy() h.reset()
Debug
Known issues
gotchaHarvester does not manage GenTL transport layers; you must provide a .cti file (producer) path via environment variable GENICAM_GENTL64_PATH or add it manually.
fix
Set GENICAM_GENTL64_PATH to the directory containing your .cti file, or use h.add_file('/path/to/producer.cti').
affects: all
gotchaBuffer objects are only valid inside a 'with' block. Accessing buffer data outside will raise an error or return invalid data.
fix
Always use 'with ia.fetch_buffer() as buffer:' to ensure buffer is valid.
affects: all
breakingIn version 1.4.x, the 'Harvester' class requires explicit call to 'update_device_info_list()' before creating an image acquirer. Older versions may have automatically refreshed.
fix
Always call h.update_device_info_list() after adding files and before accessing device_info_list.
affects: >=1.4.0
Errors
Common errors & fixes
harvesters.core.HarvesterError: No devices found
No GenTL producer loaded or no cameras detected. The GENICAM_GENTL64_PATH environment variable may not point to a valid .cti file or no cameras are connected.
fix
Check if GENICAM_GENTL64_PATH is set correctly and contains a .cti file. Verify camera is connected and powered. Call h.update_device_info_list() after adding file.
AttributeError: module 'harvesters' has no attribute 'core'
The harvesters package was imported incorrectly or an older version without the core module.
fix
Install latest version: pip install --upgrade harvesters. Then import from harvesters.core import Harvester.
RuntimeError: Buffer timed out
The fetch_buffer() call waited too long for an image buffer. This can happen if camera is not streaming or acquisition not started.
fix
Ensure ia.start_image_acquisition() is called before fetch_buffer, and the camera is configured to trigger or stream continuously.
Upgrade
Version history
1.4.3latest on PyPI · released May 16, 2024
Audit
Dependencies
genicamoptionalProvides GenICam GenTL support for harvesters.
numpyoptionalUsed for image buffer handling.
Agent activity
23 hits · last 30 days
node
22
Amazon
1
Resources
harvesters — pip install harvesters · libregistry