[Python] How to get x,y position of contours in Python OpenCV when cv2.CHAIN_APPROX_SIMPLE

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to get x and y positions of contours from the following image, but I messed up. the image

    [​IMG]

    I just need to find x and y positions of contours or center of the contours.

    The results will be something like the following as I manually look up their positions from GIMP.

    290, 210 982, 190 570, 478

    I believe it can be done with cv2.findContours method, but I'm really out of ideas right now.

    -Offtopic-

    I will use these values in setting cursor position usingwin32api.SetCursorPos((xposition,yposition))

    Thanks

    Continue reading...

Compartilhe esta Página