Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aravis + Python + Docker takes no pictures #956

Open
Fran-ATRIA opened this issue Nov 5, 2024 · 6 comments
Open

Aravis + Python + Docker takes no pictures #956

Fran-ATRIA opened this issue Nov 5, 2024 · 6 comments
Labels
1. Platform support Platform support issue 7. Containers Issue specific to containers

Comments

@Fran-ATRIA
Copy link

I’m just starting to use Aravis and I’m stuck trying to get the Python libary to work.

My system is a Docker (ubuntu:latest) container running over Windows 10 with WSL2. I have a HIKVision GigE camera connected on my local network and I can see it from inside the container (via ping).

I believe everything is properly installed, because from my init code:

self.cam = Aravis.Camera.new(self.ip)
self.stream = self.cam.create_stream(None, None)
self.device = self.cam.get_device()
print(f"Camera vendor : {self.cam.get_vendor_name ()}")
print(f"Camera model  : {self.cam.get_model_name ()}")
print(f"Pixel format  : {self.cam.get_pixel_format_as_string()}")
print(f"Stream: {self.stream}")
print(f"Device: {self.device}")

I can get these variables:

Camera vendor : Hikrobot
Camera model  : MV-CS200-10GC
Pixel format  : BayerGB8
Stream: <Aravis.GvStream object at 0x7f2025103c80 (ArvGvStream at 0x25c11a0)>
Device: <Aravis.GvDevice object at 0x7f2025109680 (ArvGvDevice at 0x1f49830)>

When I launch my code, this fragment:

payload = self.cam.get_payload()
self.stream.push_buffer(Aravis.Buffer.new_allocate(payload))
self.cam.start_acquisition()
image = self.stream.timeout_pop_buffer(10000000)
data = image.get_data()

Gives the following error:
AttributeError: 'NoneType' object has no attribute 'get_data'

If I use a non-timeout function, I’m stuck forever waiting for the buffer to pop.

What might be going on here? Can you please help me?

Thanks in advance.

@Fran-ATRIA
Copy link
Author

Also some extra info, this is what I see on the debug:

[11:53:07.556] 🅸 stream > [GvStream::stream_new] Stream channel = 0
[11:53:07.561] 🅸 stream > [GvStream::stream_new] Packet size = 8164 byte(s)
[11:53:07.586] 🅸 stream > [GvStream::stream_new] Destination stream port = 57851
[11:53:07.586] 🅸 stream > [GvStream::stream_new] Source stream port = 9001
[11:53:07.657] 🅸 stream > [GvStream::loop] Packet socket method
[11:53:08.879] 🅸 stream >     bins    ;frame_retent; packet_time;inter_packet
                                    0;           0;           0;           0
                         -------------
                         >=      2000;           0;           0;           0
                         <          0;           0;           0;           0
                         min         :         n/a;         n/a;         n/a
                         max         :         n/a;         n/a;         n/a
                         last max at :           0;           0;           0
                         counter     :           0:           0:           0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_completed_buffers    = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_failures             = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_underruns            = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_timeouts             = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_aborted              = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_missing_frames       = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_size_mismatch_errors = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_received_packets     = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_missing_packets      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_error_packets        = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_ignored_packets      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_requests      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resent_packets       = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_ratio_reached = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_disabled      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_duplicated_packets   = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_transferred_bytes    = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_ignored_bytes        = 0
[11:53:08.880] 🅸 stream > [Stream::finalize] Flush 1 buffer[s] in input queue
[11:53:08.880] 🅸 stream > [Stream::finalize] Flush 0 buffer[s] in output queue

Maybe it's related to 759?

@eudoxos
Copy link
Contributor

eudoxos commented Nov 11, 2024

I suspect it is still the good old #232. Try with Linux and --network=host. Or native Windows Aravis build. the timeout_pop_buffer returning None means no frame was received, because it got lost on the way: the NAT does not know about that channel (it is a connection from the camera to a different port operated by Aravis, not a response to on the control port) and will discard it.

@Fran-ATRIA
Copy link
Author

Thanks @eudoxos. But when you say native Windows build I understand that you mean Docker is not an option then?

@KNSd2
Copy link

KNSd2 commented Nov 12, 2024

Also some extra info, this is what I see on the debug:

[11:53:07.556] 🅸 stream > [GvStream::stream_new] Stream channel = 0
[11:53:07.561] 🅸 stream > [GvStream::stream_new] Packet size = 8164 byte(s)
[11:53:07.586] 🅸 stream > [GvStream::stream_new] Destination stream port = 57851
[11:53:07.586] 🅸 stream > [GvStream::stream_new] Source stream port = 9001
[11:53:07.657] 🅸 stream > [GvStream::loop] Packet socket method
[11:53:08.879] 🅸 stream >     bins    ;frame_retent; packet_time;inter_packet
                                    0;           0;           0;           0
                         -------------
                         >=      2000;           0;           0;           0
                         <          0;           0;           0;           0
                         min         :         n/a;         n/a;         n/a
                         max         :         n/a;         n/a;         n/a
                         last max at :           0;           0;           0
                         counter     :           0:           0:           0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_completed_buffers    = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_failures             = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_underruns            = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_timeouts             = 0
[11:53:08.879] 🅸 stream > [GvStream::finalize] n_aborted              = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_missing_frames       = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_size_mismatch_errors = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_received_packets     = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_missing_packets      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_error_packets        = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_ignored_packets      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_requests      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resent_packets       = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_ratio_reached = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_resend_disabled      = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_duplicated_packets   = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_transferred_bytes    = 0
[11:53:08.880] 🅸 stream > [GvStream::finalize] n_ignored_bytes        = 0
[11:53:08.880] 🅸 stream > [Stream::finalize] Flush 1 buffer[s] in input queue
[11:53:08.880] 🅸 stream > [Stream::finalize] Flush 0 buffer[s] in output queue

Maybe it's related to 759?

Did you check if indows firewall blocks some packets? With the default firewall settings of Windows you can connect to the camera, but the stream is blocked (on my system anyway).

@Fran-ATRIA
Copy link
Author

@KNSd2 if I turn off the firewall and the antivirus the same happens, so I guess it's not that.

@eudoxos
Copy link
Contributor

eudoxos commented Nov 12, 2024

This has nothing to do with firewall. GigEVision has two network channels (port connections), one for control and one for streaming. The streaming connection is initiated by the camera to an open port (this is what Aravis does) on the host (computer), but Aravis will open the port bound to the interface (IP address) seen from within the Docker, but that one is different the one than what the OS uses outside of Docker (with --net=host, they are the same, that's why Docker under Linux will work). See e.g. docker/for-win#6736 .

@EmmanuelP EmmanuelP added 1. Platform support Platform support issue 7. Containers Issue specific to containers labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Platform support Platform support issue 7. Containers Issue specific to containers
Projects
None yet
Development

No branches or pull requests

4 participants