Python Multiprocess Can't Pickle Opencv Videocapture Object
I am trying to create a independent process to handle my image acquire from camera. But multiprocessing seems to have difficulty pickling videocapture module from opencv. Can anyon
Solution 1:
I am not an expert, but i had the same issue and i solved in this way.
Instead of using cv2.VideoCapture(0) in init fuction
def__init__(self, ):
self.process = Process(target = self.run, args=())
self.exit = mp.Event()
self.logger.info("initialize class")
self.capture = cv2.VideoCapture(0)
I moved the initialization to run function
defrun(self):
self.capture = cv2.VideoCapture(0)
whilenotself.exit.is_set():
And it works for me. Maybe it helps you too
Post a Comment for "Python Multiprocess Can't Pickle Opencv Videocapture Object"