How to send cropped image through msgbroker using python

I have difficulty to refer cropped image to generate_event_msg_meta() and attach object to buffer as metadata.

• Hardware Platform = Jetson
• DeepStream Version = 5.0

Pls specify your issue, thanks.

I want to send image via rabbitmq and I read this question:

https://forums.developer.nvidia.com/t/frame-crop-based-on-detected-bounding-box-and-send-the-crop-image-via-kafka/155325

But I face difficulty on how to use “extMsg” and “extMsgSize” fields for custom objects and how to provide copy/free function and attach that object to buffer as metadata using python

Any help?

You can refer deepstream_test_4.py, generate_event_msg_meta() for how to use “extMsg” and “extMsgSize” fields for custom objects.

How I can create custom structure and fill it and assign it as extMsg?

You should define the structure in C++ and add bindings for it. then they can attach it as user meta. you should be able to do all this in the bindings module if you only want to access the struct in python. If you also want to access it from a plug-in, then you need to provide a C++ lib too.

Is that how I should do it to send an image through msgbrocker? Because I am stuck on how to send image using python

Also, I do not want to send cropped image separated from its data like when I want to send vehicle meta. So how I can add the image to the vehicle meta

def generate_vehicle_meta(data):
obj = pyds.glist_get_nvds_vehicle_object(data);
obj.type ="sedan"
obj.color="blue"
obj.make ="Bugatti"
obj.model = "M"
obj.license ="XX1234"
obj.region ="CA"
return obj

Hi,
Just as comment 10#, you need define the structure in C++ and add bindings for it. specifically for your case, you need to add one field in NvDsVehicleObject which contains the image. and add binding for it. for how to access and save the cropped image you can refer to python sample deepstream-imagedata-multistream function tiler_sink_pad_buffer_probe

The vehicle object has only these fields (type, color, make, model license, and region), How I can add a new field that contains an image?

You need to add one field in the structure NvDsVehicleObject.

Hey, I am also trying to use custom objects in pyds. I asked here. I understand now, that I have to add the classes in Cpp (did that already for the C Version of my project). How can I now re-generate the pyds binding with the added object classes? It does not seem like the pyds bindings are open-source as it only comes as a precompiled .so file?

Please refer to this, DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums