question‘s area recognition using image processing and regular expression

Overview

========================================

Paper-Question-recognition

========================================

question‘s area recognition using image processing and regular expression

image

bilibili宣传视频: https://www.bilibili.com/video/av53893090

当前系统及库版本

Windows:win10 anaconda: Anaconda navigator 1.9.2 opencv: Opencv3 3.1.0 AipOcr: 百度ocr库最新 re: re库,自带 python:Python 3.7.0

系统总体思路

image

预处理

image

透视矫正:目标找到纸的四个点然后矫正成右下图的样子

image

如何找到四个点? 有两大方法:Canny边缘检测和霍夫直线检测

边缘检测效果:得到近似轮廓从而获得四个点的位置

image

双页试卷处理: 类似这种图片,需要把试卷分成左右两份

image

我们的思路是: 1.选取中间部分的区域(如40%~60%)我们考虑上下也各截取了一部分,将该区域二值化
2.找到连续白色区域最多,但又远大于字与字空隙的距离的区域
3.计算这个区域的中心线后,这条线就是我们要找的双页试卷的切割线(橙色)

image

这个方法甚至可以处理两页之间中间有直线的试卷。只要存在满足一定条件的空白区域就可以找到分割线。

文字识别 最初我们用teseeract库作识别,但是识别精度感人,jTesssBoxEditor训练字库的效果也很感人。

时间紧迫,我们就选择了百度Ocr的API接口作为文字识别的工具。缺点是,免费版低精度一天只有500次的使用次数。

自然语言处理

这一部分是划分题目的重中之重。 我们之前的想法是,判断识别出的某一段是否为题干,如果是题干,那么就把它和上面的部分划分开来。 但是,判断题干的效果并不好。原因在于: 1.ocr文字识别出现误差,没有识别出必要的题号等标志性词。 2.没有良好的分词。 3.正则表达式判断题干情感(比如:‘’请问…的答案是‘’、‘’以下…正确的是“ 这种一看就是题目的题干的结构)难以尽善尽美,往往需要后期debug才能补充; 简而言之,能否正确识别出题干,是我们最需要关心的。 只要识别出题干,那么上一题就被分出来了。

image

另外还要考虑一下 注意事项,等无关紧要的东西不要被划分成题目。 划分出选择题的思路大致也和上面一样

划分题目区域

由于百度ocr接口除了文字还附带位置信息,所以我们只需要把每道题的题干+题目内容的位置信息合并就可以知道整道题的位置信息了。 ocr接口位置信息有4个变量(top,left,height,width),如下。

image

一道题按理来说就包括了图中的两个红框的位置信息,只要综合考虑位置信息,一定可以得到整道题的位置信息。

image

但是实际操作中出现了意外,一道题当最后一行压根没有识别出来怎么办。
解决办法是,根据下一道题的top信息来计算上一道题的height,这样就避免了 A.北京人遗址这一行没被识别出来的尴尬。

image

前端

综合考虑,我们还是使用了python的tkinter库制作前端。 很简单,很朴素。

image

包括了选择图片所在的文件夹,切题结果保存的文件夹,预处理,是否 人工校对,开始切题的功能。

如果开启了人工校对,切题完成后会出现校对页面。右边是原图,左边是切题结果。

image

Owner
Yuta Mizuki
I'm a japanese learner and I'm a chinese student ;It's nice to meet you
Yuta Mizuki
Create single line SVG illustrations from your pictures

Create single line SVG illustrations from your pictures

Javier Bórquez 686 Dec 26, 2022
Automatic Number Plate Recognition (ANPR) is a highly accurate system capable of reading vehicle number plates without human intervention

ANPR ANPR is therefore the underlying technology used to find a vehicle license/number plate and it, in turn, supplies this information to a next stag

Melih Emin Kılıçoğlu 1 Jan 09, 2022
Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight'

SSTDNet Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight' using pytorch. This code is work for general object detecti

HotaekHan 84 Jan 05, 2022
Shape Detection - It's a shape detection project with OpenCV and Python.

Shape Detection It's a shape detection project with OpenCV and Python. Setup pip install opencv-python for doing AI things. pip install simpleaudio fo

1 Nov 26, 2022
A semi-automatic open-source tool for Layout Analysis and Region EXtraction on early printed books.

LAREX LAREX is a semi-automatic open-source tool for layout analysis on early printed books. It uses a rule based connected components approach which

162 Jan 05, 2023
TextField: Learning A Deep Direction Field for Irregular Scene Text Detection (TIP 2019)

TextField: Learning A Deep Direction Field for Irregular Scene Text Detection Introduction The code and trained models of: TextField: Learning A Deep

Yukang Wang 101 Dec 12, 2022
Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. This Neural Network (NN) model recognizes the text contained in the images of segmented words.

Handwritten-Text-Recognition Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. T

27 Jan 08, 2023
Apply different text recognition services to images of handwritten documents.

Handprint The Handwritten Page Recognition Test is a command-line program that invokes HTR (handwritten text recognition) services on images of docume

Caltech Library 117 Jan 02, 2023
Fast image augmentation library and easy to use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about library: https://www.mdpi.com/2078-2489/11/2/125

Albumentations Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to inc

11.4k Jan 02, 2023
Code for the AAAI 2018 publication "SEE: Towards Semi-Supervised End-to-End Scene Text Recognition"

SEE: Towards Semi-Supervised End-to-End Scene Text Recognition Code for the AAAI 2018 publication "SEE: Towards Semi-Supervised End-to-End Scene Text

Christian Bartz 572 Jan 05, 2023
Repository of conference publications and source code for first-/ second-authored papers published at NeurIPS, ICML, and ICLR.

Repository of conference publications and source code for first-/ second-authored papers published at NeurIPS, ICML, and ICLR.

Daniel Jarrett 26 Jun 17, 2021
Rubik's Cube in pygame with OpenGL

Rubik Rubik's Cube in pygame with OpenGL The script show on the screen a Rubik Cube buit with OpenGL. Then I have also implemented all the possible mo

Gabro 2 Apr 15, 2022
A simple demo program for using OpenCV on Android

Kivy OpenCV Demo A simple demo program for using OpenCV on Android Build with: buildozer android debug deploy run Run (on desktop) with: python main.p

Andrea Ranieri 13 Dec 29, 2022
Repository relating to the CVPR21 paper TimeLens: Event-based Video Frame Interpolation

TimeLens: Event-based Video Frame Interpolation This repository is about the High Speed Event and RGB (HS-ERGB) dataset, used in the 2021 CVPR paper T

Robotics and Perception Group 544 Dec 19, 2022
This is a implementation of CRAFT OCR method

This is a implementation of CRAFT OCR method

Esaka 0 Nov 01, 2021
a micro OCR network with 0.07mb params.

MicroOCR a micro OCR network with 0.07mb params. Layer (type) Output Shape Param # Conv2d-1 [-1, 64, 8,

william 29 Aug 06, 2022
Creating of virtual elements of the graphical interface using opencv and mediapipe.

Virtual GUI Creating of virtual elements of the graphical interface using opencv and mediapipe. Element GUI Output Description Button By default the b

Aleksei 4 Jun 16, 2022
The world's simplest facial recognition api for Python and the command line

Face Recognition You can also read a translated version of this file in Chinese 简体中文版 or in Korean 한국어 or in Japanese 日本語. Recognize and manipulate fa

Adam Geitgey 47k Jan 07, 2023
Qrcode Attendence System with Opencv and Pyzbar

Setup process Creates a virtual environment (Scripts that ensure executed Python code uses the Python interpreter and site packages installed inside t

Ganesh 5 Aug 01, 2022
A curated list of promising OCR resources

Call for contributor(paper summary,dataset generation,algorithm implementation and any other useful resources) awesome-ocr A curated list of promising

wanghaisheng 1.6k Jan 04, 2023