The mask information of the target object

I would like to know, I’m using python, how can I get the mask information of the target object?

Hi,

You first need to set the enable_segmentation parameter to true in the ObjectDetectionParamters structure.

Then, the mask is accessible as a Mat in the ObjectData data structure after calling the retrieve_objects function : https://www.stereolabs.com/docs/api/python/classpyzed_1_1sl_1_1ObjectData.html#aff25fe6cafaf46730a2b278426aaafbb

Jean-Loup MACARIT
R&D Engineer
Stereolabs Support

I’m using the ZED SDK 4.0 and I’m getting an issue like this: ‘pyzed.sl. CameraInformation’ object has no attribute ‘camera_resolution’

Hi @NineSeven,

Without the code, it’s difficult to give an exact answer, but I suppose you’re trying to access camera_resolution through CameraInformation, but it’s an attribute of InitParameters so it gives an error.

Please post a complete code sample if you want me to take a deeper look :slight_smile:

I’ve solved the problem I mentioned above, and now I’m having a problem, I’m trying to combine a custom detector and a mask display, how do I do it?
detector test.py (8.5 KB)

Hi @NineSeven,

The custom detector should output masks, and you can display them with the tool of your choice.
It was actually discussed in this topic: Image segmentation using yolov8 with zed 2i python - #2 by JPlou

I hope this helps!