Need location of detected image, Raspberry pi

Is there a way to get an X,Y output of the center of any detected image? A number that is output on a pin in serial format? Something like an X, Y, size and confidence level?

I’m trying to do a “follow me” application where the output will be used to control motors to follow someone.

object detection networks (e.g. YOLO) will give you a bounding box & confidence values in the 2d image plane (pixels)

please, care to explain, what you mean with ‘location’ exactly ?

that is purely a programming issue. it’s not related to OpenCV.

please clarify your question.

Yes, in serial format. I’m a novice, but all the applications I have seen with OpenCV show a detected object on a screen and - at most, indicate whether the object is detected or not, or which person is detected. My first application is to put a camera on the top of a monitor. I would have previously stored a series of 40 or so still images of (say) my face taken from various angles. When a person walked by the monitor, they would be detected and the appropriate stored image would be selected and displayed. That way, my image on the monitor would follow the person as they walked by. It would always be looking straight at them regardless of where they were. If they ducked, the person on the monitor would look down, etc. For future uses, it would also be useful to have some sort of an idea of how far away an object was, based on the image size of common objects. This would also help when two or more people walked by, since the closest person would be the only one followed.

portraits where the eyes follow you are a known illusion. you don’t need to do anything dynamic to do that.