python截取图片中的圆形区域
# coding=utf-8
import pathlib
import time
import cv2
import numpy as np
def detect_circle_single(source_file, target_file):
"""
识别图像中的圆形并裁切出相应的矩形保存到目标文件中
source_file:源文件
target_file:生成后的文件
"""
bias = 20
img = cv2.imread(source_file)
h, w, _ = img.shape
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) # 灰度图像
gray = cv2.GaussianBlur(gray, (5, 5),