I have applied the object detection algorithm to detect the cow 4 teat. Now I want to find the centre point for a particular detected object as described in the below image in red colour dot.
Any suggestion or approach to do such things using OpenCV?
You asked for suggestions, here is mine, a random one.
You already detected the object of interest, it’s oblong.
The black foreground makes it easy to get a binary image by using threshold, let’s start with Otsu threshold (it’s an automatic threshold level), then get contours of the object.
Adrian Rosebrock at PyImageSearch has a fine example on finding extreme points in contours:
Keep in mind this example look for extremes on one edge at the time (x and y). You need to apply more elaborate math to find the extreme in one arbitrary direction.