# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

from common import *

# !ls data

paths = glob.glob('./data/moto_mask/*')

paths[:3]

import pyson.vision as pv

img = cv2.imread(paths[5], cv2.IMREAD_UNCHANGED)

# +
# plt.figure(dpi=200)
# plt.imshow(img[...,:3][:,:,::-1])
# plt.imshow(img[...,3], alpha=.3)
# plt.show()
# -

mask = img[...,-1]

pv.show(mask)

mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, np.ones([10, 10]))
pv.show(mask)

cnts, hiers = pv.find_contours(mask)





StarcoderdataJupyterScriptsDedupFiltered