python cv2.findContours sample

import numpy as numpy
import cv2

def make_list(filepath: str):
    # read
    img = cv2.imread('tmp.bmp', 0)

    # find_contours
    contours, hierarchy = cv2.findContours(img, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

    # make list
    listx =
    listy =
    for tmp in contours[0]:
        x, y = tmp[0]
        listx.append(x)
        listy.append(y)

    # return
    return listx, listy

if __name__ == '__main__':
    listx, listy = make_list('tmp.bmp')