opencv实现小学试题识别,试题判断正误

2021-01-14 10:26:12 浏览数 (1)

文章目录

  • opencv实现小学试题识别,判断正误
  • 源代码

opencv实现小学试题识别,判断正误

源代码

代码语言:javascript复制
# -*- coding:utf-8 -*-
# /usr/bin/python
'''
Author:Yan Errol  Email:2681506@gmail.com   Wechat:qq260187357
Date:2019-05-08--13:48
File:img2binary.py
Describe:读取图片,图片灰度化处理,灰度处理后的图片二值化
'''

print (__doc__)

import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt


def read_img(path):
    # Load an color image in grayscale
    img = cv.imread(path)
    return img

def imgs2gray(img):
    im_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
    return im_gray

def imgs2binary(img):
    im_at_mean = cv.adaptiveThreshold(img,255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 5,

0 人点赞