0

I'm trying to send images (4000, 3000, 3) between two processes. My first process acquires the image with a camera, attaches to it some metadata, another image and then sends the whole thing to the second process, which processes it.

I want to have a maximal delay of 0.2 seconds between the moment the image is acquired and the moment the processing is over.

Let's assume the way I acquire and process the image is optimal.

I tried 2 methods to send the image, with a queue (mp.Queue) and with a shared array (mp.Array('i', 4000*3000*3)) Both took to much time. The Queue.put() method takes about 0.5 seconds to send the package. Copying the image in a shared array like this:

shared_array[:] = img.copy()

Takes about 2 seconds.

So my question is, is anyone aware of a faster way to transit two images between two processes?

Thanks for your time!

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Roux
  • 47
  • 1
  • 11
  • Does this answer your question? [Most efficient way to send images across processes](https://stackoverflow.com/questions/2536331/most-efficient-way-to-send-images-across-processes) – APhillips Jan 07 '20 at 16:04
  • @APhillips thanks for your answer, I understood the first part, but none of what he said in the image transfer via shared memory part. I'll investigate and get back to you. – Roux Jan 07 '20 at 16:13
  • It doesn't answer my question, but found this topic which did: https://stackoverflow.com/questions/17785275/share-large-read-only-numpy-array-between-multiprocessing-processes – Roux Jan 09 '20 at 09:48
  • Does this answer your question? [Share Large, Read-Only Numpy Array Between Multiprocessing Processes](https://stackoverflow.com/questions/17785275/share-large-read-only-numpy-array-between-multiprocessing-processes) – Roux Jan 09 '20 at 09:50

1 Answers1

0

EDIT: I found this question, which has been answered, and addressed my problem using sharedmem module

Roux
  • 47
  • 1
  • 11