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

You might also like...
Detect handwritten words in a text-line (classic image processing method).
Detect handwritten words in a text-line (classic image processing method).

Word segmentation Implementation of scale space technique for word segmentation as proposed by R. Manmatha and N. Srimal. Even though the paper is fro

Image processing is one of the most common term in computer vision

Image processing is one of the most common term in computer vision. Computer vision is the process by which computers can understand images and videos, and how they are stored, manipulated, and retrieve details from them. OpenCV is an open source computer vision image processing library for machine learning, deep leaning and AI application which plays a major role in real-time operation which is very important in today’s systems.

A general list of resources to image text localization and recognition 场景文本位置感知与识别的论文资源与实现合集 シーンテキストの位置認識と識別のための論文リソースの要約

Scene Text Localization & Recognition Resources Read this institute-wise: English, 简体中文. Read this year-wise: English, 简体中文. Tags: [STL] (Scene Text L

An advanced 2D image manipulation with features such as edge detection and image segmentation built using OpenCV

OpenCV-ToothPaint3-Advanced-Digital-Image-Editor This application named ‘Tooth Paint’ version TP_2020.3 (64-bit) or version 3 was developed within a w

Thresholding-and-masking-using-OpenCV - Image Thresholding is used for image segmentation
Thresholding-and-masking-using-OpenCV - Image Thresholding is used for image segmentation

Image Thresholding is used for image segmentation. From a grayscale image, thresholding can be used to create binary images. In thresholding we pick a threshold T.

RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition

RepMLP RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Image Recognition Released the code of RepMLP together with an example o

Isearch (OSINT) 🔎 Face recognition reverse image search on Instagram profile feed photos.
Isearch (OSINT) 🔎 Face recognition reverse image search on Instagram profile feed photos.

isearch is an OSINT tool on Instagram. Offers a face recognition reverse image search on Instagram profile feed photos.

Image Recognition Model Generator

Takes a user-inputted query and generates a machine learning image recognition model that determines if an inputted image is or isn't their query

This pyhton script converts a pdf to Image then using tesseract as OCR engine converts Image to Text

Script_Convertir_PDF_IMG_TXT Este script de pyhton convierte un pdf en Imagen luego utilizando tesseract como motor OCR convierte la Imagen a Texto. p

Owner
Yuta Mizuki
I'm a japanese learner and I'm a chinese student ;It's nice to meet you
Yuta Mizuki
Image processing using OpenCv

Image processing using OpenCv Write a program that opens the webcam, and the user selects one of the following on the video: ✅ If the user presses the

M.Najafi 4 Feb 18, 2022
This is a Computer vision package that makes its easy to run Image processing and AI functions. At the core it uses OpenCV and Mediapipe libraries.

CVZone This is a Computer vision package that makes its easy to run Image processing and AI functions. At the core it uses OpenCV and Mediapipe librar

CVZone 648 Dec 30, 2022
A curated list of resources for text detection/recognition (optical character recognition ) with deep learning methods.

awesome-deep-text-detection-recognition A curated list of awesome deep learning based papers on text detection and recognition. Text Detection Papers

null 2.4k Jan 8, 2023
Text recognition (optical character recognition) with deep learning methods.

What Is Wrong With Scene Text Recognition Model Comparisons? Dataset and Model Analysis | paper | training and evaluation data | failure cases and cle

Clova AI Research 3.2k Jan 4, 2023
Sign Language Recognition service utilizing a deep learning model with Long Short-Term Memory to perform sign language recognition.

Sign Language Recognition Service This is a Sign Language Recognition service utilizing a deep learning model with Long Short-Term Memory to perform s

Martin Lønne 1 Jan 8, 2022
Extract tables from scanned image PDFs using Optical Character Recognition.

ocr-table This project aims to extract tables from scanned image PDFs using Optical Character Recognition. Install Requirements Tesseract OCR sudo apt

Abhijeet Singh 209 Dec 6, 2022
Solution for Problem 1 by team codesquad for AIDL 2020. Uses ML Kit for OCR and OpenCV for image processing

CodeSquad PS1 Solution for Problem Statement 1 for AIDL 2020 conducted by @unifynd technologies. Problem Given images of bills/invoices, the task was

Burhanuddin Udaipurwala 111 Nov 27, 2022
Introduction to image processing, most used and popular functions of OpenCV

?? OpenCV 101 Introduction to image processing, most used and popular functions of OpenCV go here.

Vusal Ismayilov 3 Jul 2, 2022
computer vision, image processing and machine learning on the web browser or node.

Image processing and Machine learning labs   computer vision, image processing and machine learning on the web browser or node note Fast Fourier Trans

ryohei tanaka 487 Nov 11, 2022
Image processing in Python

scikit-image: Image processing in Python Website (including documentation): https://scikit-image.org/ Mailing list: https://mail.python.org/mailman3/l

Image Processing Toolbox for SciPy 5.2k Dec 30, 2022