corners.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:sudokuextract 作者: hbldh 项目源码 文件源码
def _extraction_iterator_corners(image, use_local_thresholding=False, apply_gaussian=False, n=5):
    # If the image is too small, then double its scale until big enough.
    img = image
    while max(img.shape) < 500:
        img = resize(img, np.array(img.shape) * 2)

    if apply_gaussian:
        img = gaussian_filter(image, (3.0, 3.0))

    for corner_points in iter_blob_extremes(img, n=n):
        try:
            warped_image = geometry.warp_image_by_corner_points_projection(corner_points, img)
            sudoku, bin_image = geometry.split_image_into_sudoku_pieces_adaptive_global(
                warped_image, otsu_local=use_local_thresholding, apply_gaussian=apply_gaussian)
        except SudokuExtractError:
            # Try next blob.
            pass
        except Exception as e:
            raise
        else:
            yield sudoku, bin_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号