def _extraction_iterator_map(image, use_local_thresholding=False, apply_gaussian=False, n=5):
if apply_gaussian:
img = gaussian_filter(image, (3.0, 3.0))
else:
img = image
for edges in iter_blob_contours(img, n=n):
try:
warped_image = geometry.warp_image_by_interp_borders(edges, 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 as e:
pass
except Exception as e:
# Try next blob
raise
else:
yield sudoku, bin_image
评论列表
文章目录