added tutorial for text skewness correction#16170
Conversation
|
This patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly). So, please:
Note: no needs to re-open PR, apply changes "inplace". |
asmorkalov
left a comment
There was a problem hiding this comment.
@themechanicalcoder thanks for the example code. OpenCV repository already contains image with rotated text opencv/samples/data/imageTextR.png. Could you set it as default path to image. Ready to use example with example input makes things simpler.
2b6b1d9 to
da90b8a
Compare
da90b8a to
d6647d6
Compare
|
@themechanicalcoder I helped you with the PR rebase and pushed changes to your branch. Please remove or rename your local git branch and fetch |
|
@themechanicalcoder Please adjust C++ code to general OpenCV coding guidelines: https://github.com/opencv/opencv/wiki/Coding_Style_Guide#code-layout
|
|
@asmorkalov done |
|
@themechanicalcoder Please cover remaining comments and squeeze commits in the branch to merge it as single change. |
e0b7557 to
cbd5847
Compare
|
@themechanicalcoder Please fix formatting issues to unblock PR merge. |
|
@themechanicalcoder Friendly reminder. There are pending review notes in the PR. |
@asmorkalov which ones? I think I have applied all the suggestions that have come on this PR |
|
I see my comments with pending status above in the thread. Let me highlight them. |
|
@asmorkalov I went through all the comments and found that this one was the only one that I had missed |
|
@themechanicalcoder I squashed commits in your branch and fixed bug in C++ code. |
7563acf to
a6359e4
Compare
|
👍 @alalek please take a look and merge. Both Python and C++ versions has been tested with Ubuntu 18.04. |
|
|
||
| def main(): | ||
| import sys | ||
| import argparse |
There was a problem hiding this comment.
It's better to move it on top to have all imports in one place.
| Mat thresh; | ||
| threshold(gray, thresh, 0, 255, THRESH_BINARY | THRESH_OTSU); | ||
|
|
||
| vector<Point2f>coords; |
There was a problem hiding this comment.
space is missing after type.
| Mat gray; | ||
| cvtColor(image, gray, COLOR_BGR2GRAY ); | ||
|
|
||
|
|
There was a problem hiding this comment.
Extra line is not required here
| # otherwise, just take the inverse of the angle to make | ||
| # it positive | ||
| else: | ||
| angle = -angle |
There was a problem hiding this comment.
Empty lines inside and after if statement are not consistent, it confuses reader.
This pull request changes
Given an image containing a rotated block of text at an unknown angle in an image, it corrects the text skew by
Before
After