@gvdhoorn gave you very useful information and examples of similar message types which is interesting but having the same use case as yours I'm going with the following solution:
To acheive what you want, I think that you need to create and build your own message type, every detected face is sort of a ROI and the number of detections is rondom.
There is a predefined message type describing a ROI which is sensor_msgs/RegionOfInterest, so a message for a simple list of detected faces DetectedFaces.msg
can be defined as follows:
sensor_msgs/RegionOfInterest[] detected_faces
But it will be also useful to set an id or label for each detection and maybe a weigh or a score in order to pass all the intresting things to know about every single detection to your tracker or whatever subscriber to this message.
So I suggest creating two messages, one for a single detected face description DetectedFace.msg
and a second one which is a list of all the detections DetectedFaceArray.msg
so their msg definitions can be done as follows:
std_msgs/Int32 label
sensor_msgs/RegionOfInterest detected_face
std_msgs/Float32 weigh
and
your_pkg_name/DetectedFace[] detected_faces
You can also add headers to these messages and any other information that you find useful.
See this tutorial for more details about the steps and configuration needed to create and build msg files. and make sure to add the sensor_msgs
and std_msgs
as DEPENDENCIES
in your package definition.
Once your msgs are compiled try to create a simple publisher and subscriber to check them out.
Good luck!