AravisProject / aravis

A vision library for genicam based cameras
GNU Lesser General Public License v2.1
892 stars 331 forks source link

Aravis + Python + Docker takes no pictures #956

Open Fran-ATRIA opened 2 days ago

Fran-ATRIA commented 2 days ago

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 commented 2 days ago

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?