# -*- coding: UTF-8 -*-
import datetime
import cv2
import numpy as np
import os
def get_convexHull(src2):
h,w=src2.shape[:2]
gray = cv2.cvtColor(src2, cv2.COLOR_BGR2GRAY)
# 二值化
ret, binary = cv2.threshold(gray, 125, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
# 获取结构元素
k = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
# 开操作
binary = cv2.morphologyEx(binary, cv2.MORPH_OPEN, k)
cv2.imshow("binary", binary)
# 轮廓发现
contours, hierarchy = cv2.findContours(binary, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for c in range(len(contours)):
# 是否为凸包
ret = cv2.isContourConvex(contours[c])
if not ret:
# 凸包检测
points =