Connect several cameras openCV python

asked Aug 20 '0

KyloEntro gravatar image

updated Aug 20 '0

Hi,

I want to connect to 30 cameras at the same time in my python program. If I execute 30 times a simple python script which connects to a rtsp camera and do .read(), I have no problem.

But, if I create 30 threads in my python program, some thread as delay and then crash. It is because of python GIL and my processor core is not to fast to deal all the thread sequentially ...

So I don't know how to deal with it... May be I could use multiprocessing but how can I share and image between my processus. Or use C++ ?

Preview: (hide)

Comments

Since python is an "interpreted" programming language, you would achieve better performance using C++ instead.

dbots94 gravatar imagedbots94 (Aug 20 '0)edit

(Of course, a program should not crash just due to delays or number of threads. Delays can be handled and threads orhestrated.)

mvuori gravatar imagemvuori (Aug 21 '0)edit

post your code. provide everything required to run it and demonstrate the problem you are describing. we will not speculate. as a rule of thumb, python IS capable of decent multithreading results. you just have to know what to do, and what not to do.

crackwitz gravatar imagecrackwitz (Aug 22 '0)edit

python being interpreted is absolutely irrelevant to the matter at hand. network I/O and video codecs all happen in compiled machine code. python is the glue logic on top of that.

crackwitz gravatar imagecrackwitz (Aug 22 '0)edit