Comments (5)
Thanks for your reply. I
Either create different InstantCameras in each process ( although only one have to have the camera "open" at any time )
I tried this, but it also did not work.
The problem described above only occurs when the program structure is like this:
Main Process
.... do some stuff ....
open camera
read params
close camera
start subprocess
open camera
I found a workaround by starting a subprocess just to read out the camera params now, this works
Main Process
.... do some stuff ....
start subprocess_1
open camera
read params
close cam
kill subprocess
start subprocess_2
open camera
start streaming
from pypylon.
your code will try to transfer the InstantCamera between processes.
def __new__(cls):
if cls._instance is None:
cls._instance = super(Basler, cls).__new__(cls)
cls._instance.camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
cls._instance.is_streaming = Value('b', False)
return cls._instance
The communication in python multiprocessing is via pickling/unpickling of objects between the processes. This doesn't work and would be extremely inefficient for the InstantCamera.
Either create different InstantCameras in each process ( although only one have to have the camera "open" at any time )
Or by adding additional methods to set/get parameters or a list of parameters from the other process.
The objects transferred have to be pure python.
In #513 (comment) I gave an example how to run pypylon in one process and transfer video data to other process via shared memory to be efficient.
from pypylon.
We had the same issue -- your fix resolved it for us. Would still like to understand the root cause so we can avoid it!
EDIT: it appears to be an issue with multiprocessing using spawn instead of fork on Linux. The problem wasn't present on Windows, and we solved it equally well with:
current_mp_start_method = mp.get_start_method()
if current_mp_start_method != "spawn":
mp.set_start_method("spawn", force=True)
from pypylon.
The root cause is described in #714 (comment).
You have to centralize the camera access ( InstantCamera) in one process.
The object can't move between processes.
Best practice is linked in the above comment. Only process the data in sub processes.
This can be optimized by using shared memory for the image data
from pypylon.
Ok — I think I'm experiencing a slightly distinct problem that is better described in #659 — going to take this over there.
from pypylon.
Related Issues (20)
- _genicam.AccessException: Node is not writable. HOT 4
- "Payload data has been discarded" when using tensorflow lite in a separate thread. HOT 10
- 3791651346 Payload data has been discarded, (but only infrequently) HOT 2
- GigE PTP synchronization problem using a2A2448-105g5mBAS cameras HOT 6
- BUG: pylon/pypylon breaks Linux PATH HOT 1
- Support for color calibration HOT 6
- Segmentation fault after sudo apt-get update && sudo apt-get upgrade at 'from pypylon import pylon' HOT 1
- pypylon is not recognized in os root in jetson: HOT 6
- basler USB3 camera field of view HOT 7
- GigE cameras periodically failing and/or displaying "Camera physically removed" HOT 3
- Internal buffer overflow error using acA1920-155um on Raspberry HOT 1
- Does StartGrabbing put the camera into free-run mode? Should StartGrabbing not be used with hardware triggers? HOT 2
- Camera frame and encoder position get out of sync in high belt speed HOT 2
- RuntimeException thrown (file 'tlfactory.cpp', line 694) HOT 13
- Synchronously recording from multiple cameras using PTP HOT 1
- Installation failed: "Wheel not supported" error when installing on 64bit Windows11 HOT 2
- Image recognition using camera basler and Yolo HOT 1
- Line Scan Camera not detected in Pypylon HOT 14
- Failed to Open camera in another class HOT 1
- Function 'PylonCreateDeviceByIndex' failed in source file ,device cannot be operated on an USB 2.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypylon.