当前位置:网站首页>[actual combat] realize page distortion correction with OpenCV
[actual combat] realize page distortion correction with OpenCV
2022-07-28 18:47:00 【Xiaobai learns vision】
Click on the above “ Xiaobai studies vision ”, Optional plus " Star standard " or “ Roof placement ”
Heavy dry goods , First time delivery Preface
Today's content is about page distortion correction , In order to let everyone have a related concept , Let's preview the renderings first

Principle of page distortion correction
The purpose of the author writing this article is also very interesting , because The author's wife is a teacher , Her students often send her some picture homework , However, it is inevitable that due to various reasons such as photography technology and conditions , It makes it more difficult to correct homework , So the author for his wife , We worked out this plan .( The magic of love )

For some classic ideas of text correction ( for example Leptonica dewarping method and the CTM method) Break down the problem into :
1. Break the text into lines
2. Find the mapping or coordinate transformation that makes the lines parallel and horizontal
The author of this article also adopts a similar idea , Build a parameter model for the page ( Text ) Correction of , The main parameters considered in the model :
The rotation vector of the page in three-dimensional space r Vector of peaceful shift t
Specify the two curvatures of the page surface α and β
On the page n Vertical offset of a horizontal span
For each span , In horizontal span m The horizontal offset of a point
For some of the above parameters , My understanding is that page distortion exists the transformation of rotation and offset , Because the text content is divided into several lines , So think of each line of text as a curve , Let's assume that it turns into a cubic spline after being twisted , By two coefficients a and b control . Vertical offset refers to the distance between each row after segmentation , Horizontal offset refers to setting points on each line , For subsequent correction and transformation processing .
( Personal understanding , There may be a little deviation from the original )

The next operation is very awesome , The author simulates the page , Set different parameters to observe the rules

Finally, the author found that when the set parameters are fixed , Each key point on the page can find a certain corresponding point in the plane of the image .

The red ones are the key points detected on the text , The blue is the point through the re projection of the model . The blue dots on the left are collinear ( Suppose the text is straight at first ), The image on the right will determine the posture of the page / shape , Make the blue dot almost on the red dot .
Implementation details
The above is the general implementation principle , Next is the main steps for the author to realize the function :
1、 Get the boundary of the page . The whole picture is not used here , Instead, it cleverly uses the internal text content and the approximate distance between the text and the boundary to determine the boundary of the page .
2、 Detect the outline of the text . Through adaptive threshold ——> inflation + corrosion ——> Connected region analysis +PCA To approximate the text

3、 Make the text span .

4、 Sample span . Generate representative points on each span .

5、 Create initial parameter estimation . Realize projection into the picture plane .
6、 Optimize ! Reduce the error of re projection
7、 Remap image and threshold .

summary
This project is used before , Today I specially share it with you , Baidu search out few related content , Because I think sharing is quite meaningful , Due to my limited understanding of the content , There may be some deviations , But it really took a lot of effort to interpret .
It's not difficult to use , But because of the author's hypothesis , For texts that are not in this case , And the correction effect of excessive deformation is not very ideal . It's not easy to create , I hope I can watch it , Forward first hand , Due to the lack of message function , therefore , Only through the data feedback in the background can we know whether the content we share is really helpful to everyone , Everyone's reading is watching and forwarding , I am very grateful .
The good news !
Xiaobai learns visual knowledge about the planet
Open to the outside world

download 1:OpenCV-Contrib Chinese version of extension module
stay 「 Xiaobai studies vision 」 Official account back office reply : Extension module Chinese course , You can download the first copy of the whole network OpenCV Extension module tutorial Chinese version , Cover expansion module installation 、SFM Algorithm 、 Stereo vision 、 Target tracking 、 Biological vision 、 Super resolution processing and other more than 20 chapters .
download 2:Python Visual combat project 52 speak
stay 「 Xiaobai studies vision 」 Official account back office reply :Python Visual combat project , You can download, including image segmentation 、 Mask detection 、 Lane line detection 、 Vehicle count 、 Add Eyeliner 、 License plate recognition 、 Character recognition 、 Emotional tests 、 Text content extraction 、 Face recognition, etc 31 A visual combat project , Help fast school computer vision .
download 3:OpenCV Actual project 20 speak
stay 「 Xiaobai studies vision 」 Official account back office reply :OpenCV Actual project 20 speak , You can download the 20 Based on OpenCV Realization 20 A real project , Realization OpenCV Learn advanced .
Communication group
Welcome to join the official account reader group to communicate with your colleagues , There are SLAM、 3 d visual 、 sensor 、 Autopilot 、 Computational photography 、 testing 、 Division 、 distinguish 、 Medical imaging 、GAN、 Wechat groups such as algorithm competition ( It will be subdivided gradually in the future ), Please scan the following micro signal clustering , remarks :” nickname + School / company + Research direction “, for example :” Zhang San + Shanghai Jiaotong University + Vision SLAM“. Please note... According to the format , Otherwise, it will not pass . After successful addition, they will be invited to relevant wechat groups according to the research direction . Please do not send ads in the group , Or you'll be invited out , Thanks for your understanding ~边栏推荐
- Software testing needs more and more talents, but fewer people are on the road of testing?
- Ue5 gas learning notes 1.3 attribute
- Brief introduction: basic principle of srv6
- 高德地图实现自定义小蓝点 自定义点标记 绘制多边形/圆形区域 根据地图的移动显示或者隐藏自定义点标记的相关实现
- MYSQL入门与进阶(十)
- Calibration of vector network analyzer (vector network)
- Introduction and advanced level of MySQL (6)
- GO exe生成图标版本信息
- UE5 GAS 学习笔记 1.7 任务Ability Tasks
- Is it difficult for novices to change careers through self-study software testing?
猜你喜欢

记录自己在厦门两年来的面试经历--完结篇

使用自开发的代理服务器解决 SAP UI5 FileUploader 上传文件时遇到的跨域访问错误试读版

NPM cannot recognize the "NPM" item as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is correct,

NDK series (5): from introduction to practice, JNI explodes the liver and explains everything in detail!

Introduction and advanced level of MySQL (6)

1.3、链表

Golang并发模型之

1.2 queue

什么样的知识付费系统功能,更有利于平台与讲师发展?

npm 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
随机推荐
Ue5 gas learning notes 0.1 case Preview
使用自开发的代理服务器解决 SAP UI5 FileUploader 上传文件时遇到的跨域访问错误试读版
UE5 GAS 学习笔记 1.3属性Attribute
Ue5 gas learning notes 1.5 gameplay effects game effects
DC simulation example of ADS simulation
UE5 GAS 学习笔记 1.10 预测(Prediction)
What if you don't understand the difference between modularity, componentization and plug-in?
UE5 GAS 学习笔记 1.4属性集
Brief introduction to the principle of spectrometer I
Ue5 gas learning notes 1.2 game Tags
MYSQL入门与进阶(八)
腾讯汤道生:开源是产业互联网时代新的生产方式和协作模式
UE5 GAS 学习笔记 1.5 Gameplay Effects游戏效果
MongoDB数据库shell命令执行
MongoDB数据库复制表
Ue5 gas learning notes 1.6 skills gameplay ability
Examples of AC simulation and S-parameter simulation of ADS simulation
2022.7.26 构造函数,面试:new的作用、深拷贝和浅拷贝
Gaode map realizes customized small blue dots, customized point markers, drawing polygon / circular areas, and displaying or hiding customized point markers according to the movement of the map
Multithreading and high concurrency -- source code analysis AQS principle