Open gabrielesartor opened 3 years ago
Hello, I use this code to get last frame https://github.com/jeffbass/imagezmq/blob/master/examples/pub_sub_receive.py But if you restart the sub you may have some delay ...
The above suggestion from @MichouTest is a good one and may solve your problem.
There are 2 other things that might be affecting this:
imageZMQ
sends multi-part messages (the message part and the image part). There is a good explanation in this Stackoverflow question. If you read all the answers, there is also an explanation of ZMQ option setting. It may not be possible to use imageZMQ
with the zmq.CONFLATE
option because of this.imageZMQ
and would probably require modification of the context and socket setup in the imageZMQ classes. When I need to set ZMQ options, this is how I do it. It works for me for some ZMQ options, including zmq.RCVTIMEO
and zmq.SNDTIMEO
. You may want to try this way of setting the zmq.CONFLATE
option. I have never used the zmq.CONFLATE
option, so I don't have suggestions of the best way to use it or if it would help your problem.
Is there a way to read directly the last image in a queue with class ImageHub? For example, I'm receiving continuously images on the TCP channel, but the connection goes down. After 20 minutes the connection is restored and I want to receive the images from that moment and not the previous ones.
In other words, I'd like to have a behaviour similar to a receiver using the flag CONFLATE. An example below:
context = zmq.Context() socket = context.socket(zmq.SUB) socket.setsockopt(zmq.CONFLATE,1) print("Collecting updates from weather server...") socket.connect ("tcp://*:5555")
However, it seems that this flag cannot be used with images. Any suggestions? Thank you in advance.