You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone,
I am wondering - is it possible to use Python's multiprocessing Pool method to record from several different cameras on different processes? I tried to do it, but every time the code gets stuck (with no error) on the InstantCamera initialization line.
Attached is sample code (please note the cameras are on a hardware trigger):
from pypylon import pylon
import multiprocessing as mp
def record_video(device_fn):
cam = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateDevice(device_fn))
cam.StartGrabbing(pylon.GrabStrategy_OneByOne)
for i in range(2500):
grab_result = cam.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
if grab_result.GrabSucceeded():
img = grabResult.Array
cv2.imwrite("/home/elhanan_la/Videos/cam{}_frame{}.tiff".format(grab_result.GetCameraContext(), i), img)
grab_result.Release()
def main():
tl_factory = pylon.TlFactory.GetInstance()
devices = tl_factory.EnumerateDevices()
with mp.Pool(3) as p:
p.map(record_video, [devices[i].GetFullName() for i in range(3)])
p.close()
p.join()
if __name__ == "__main__":
main()
I've also tried to first initialize the cameras via the InstantCameraArray method, and then send each camera object to the pool, but then I'm getting the error: LogicalErrorException: Node not existing (file 'genicam_wrap.cpp', line 16600)
Thanks
The text was updated successfully, but these errors were encountered:
Hello everyone,
I am wondering - is it possible to use Python's multiprocessing Pool method to record from several different cameras on different processes? I tried to do it, but every time the code gets stuck (with no error) on the InstantCamera initialization line.
Attached is sample code (please note the cameras are on a hardware trigger):
I've also tried to first initialize the cameras via the InstantCameraArray method, and then send each camera object to the pool, but then I'm getting the error:
LogicalErrorException: Node not existing (file 'genicam_wrap.cpp', line 16600)
Thanks
The text was updated successfully, but these errors were encountered: