document-scanner | An OpenCV based document scanner | Computer Vision library
kandi X-RAY | document-scanner Summary
kandi X-RAY | document-scanner Summary
A document scanner built using OpenCV + Python. I highly recommend to see my blog post for better understanding: [My sincere thanks to the article and the author here: [which has some really good set of articles on OpenCV and way more informative.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Reshape the values of a matrix .
document-scanner Key Features
document-scanner Examples and Code Snippets
Community Discussions
Trending Discussions on document-scanner
QUESTION
I have an opencv script on document scanner and I want to create a post request that returns the scanned image as a response.
I get the below error when I tried to read the image(using opencv) via post request.
...ANSWER
Answered 2021-Jan-13 at 16:05I was able to get around this by using PIL
library in python
Below is the code snippet on how I was able to read my image from django database using for opencv preprocessing
QUESTION
I am trying to use openCV2 to automatically delineate the contours of churches and cathedrals from static maps.
In a nutshell, I am:
- scraping the building's coordinates from this Wikipedia page.
- creating a map centered on those coordinates using Folium, a Python library.
- saving the map as a jpg image.
- applying openCV2's
findContours
method to delineate the contours of the buildings.
I initially assumed that the cathedrals would be the largest building within a few hundred meters, so I sorted the contours by area following this PyImageSearch tutorial:
...ANSWER
Answered 2020-May-01 at 16:24I used cv2.moments(contour)
as shown in this article to get the center of each contour. Then you can use distance.euclidian
from the scipy.spatial
module to calculate the distance of each contour to the image center.
QUESTION
been trying to find the answer to why everybody converts an image to grayscale before processing?
For example, this website with instructions teaching people how to build a simple scanning program converts photo to greyscale first before passing commands to manipulate the image itself.
In the second example, this thread on stackoverflow shows a person also converts the image to grayscale before extracting text from his image.
Does this process make the image easier to manipulate? Or does it give better results when extracting text? If so, shouldn't a binary image give the best result in the case of extracting text?
...ANSWER
Answered 2020-Jan-15 at 02:10More often than not, grayscale has all the relevant information to complete a particular task. So reducing the image to grayscale greatly simplifies calculations and removes redundancies.
Binary image is great too but it sacrifices too many information for it to be useful in many cases. And most library supports a minimum of 8 bit image processing anyway for a true binary data structure to be useful.
Imagine having to create a program to recognize text on paper. Having a color image doesn't help you to better read the text. The text can be in various color but you can read the text even if its in black and white. You can argue that binary image should also give the same performance and that is true IF there are no noise such as shadow on the paper.
Once there are noise elements exist on the image, you will need more information to separate text from noise and that is when grayscale is useful.
Moreover the most used and reliable information for advanced image processing is the edges and its textures. Both which can be obtained from a grayscale image.
QUESTION
So I am trying to follow guide on how to scan a document in https://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/ exactly on the step 2 process where i am supposed to find the contour and draw it to the image, i got an "Assertion Failed" error on drawContour function
The guide did not have
screenCnt = None
so at first i got Error like screenCnt did not exist
after i add it, got Assertion Failed instead even though i used the same image as the guide and tried another image too
...ANSWER
Answered 2019-Jul-14 at 07:39Try printing all the inputs to the function that you are providing. I guess you may find something wrong. Let me know in the comments below.
QUESTION
Given this image:
I'd like to make it such that it will rotate and stretch to fully fit in the bounding box with no whitespace on the outside of the largest rectangular box. It should also account for worse perspective case, like in the links I list later on.
Basically, while it is not noticeable, the rectangle is rotated a little bit, and I'd like to fix that distortion.
However, I got an error when attempting to retrieve the four points of the contour. I have made sure and utilized contour approximation to isolate and get only relevant looking contours and as you can see in the image it's successful, though I can't use perspective warp on it.
I've already tried the links here:
- How to straighten a rotated rectangle area of an image using opencv in python?
- https://www.pyimagesearch.com/2014/05/05/building-pokedex-python-opencv-perspective-warping-step-5-6/
- https://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/
And followed them, with only minor modifications (like not downscaling the image and then upscaling it) and different input image.
There is a similar error encountered by a reader there in the comments, but the author just said to use contour approximation. I did that but I still receive the same error.
I have already retrieved the contour (which along with its bounding box, is the image illustrated earlier), and used this code to attempt persective warp:
...ANSWER
Answered 2019-Oct-17 at 20:08Try this approach:
- Convert image to grayscale and blur with bilateral filter
- Otsu's threshold
- Find contours
- Perform contour approximation for largest square contour
- Perspective transform and rotate
Result
QUESTION
Since approx. 72h I'm getting The job exceeded the maximum time limit for jobs, and has been terminated.
on TravisCI which seems to be related requesting artifacts from mvnsearch.org, e.g. https://travis-ci.org/document-scanner/document-scanner-aggregator/builds/266942578. I assume it's a remote repository which I'm not using, but some of the project's dependencies are.
mavensearch.org seems to be unreachable or responding very slowly. I don't find any news on their operational status. It's odd that the issues isn't fixed within 72h, so I assume a long-time issue.
The only possible solution I could imagine would be to add the download and installation of a maven proxy to the Travis CI build script and proxy mavensearch.org in a Maven settings.xml
file. Is there any way to avoid this?
It doesn't work to use the mirror
element in ~/.m2/settings.xml
because it references the repository id in referenced POMs which can be those of transitive dependencies and can change if snapshots are used and need to be checked and eventually adjusted after every version change.
ANSWER
Answered 2017-Sep-01 at 19:46A couple of actions may be done:
- The Common Build Problems: My builds are timing out - Travis CI answer provides a couple of solutions. One of them is «to extend the wait time» for the Maven process.
- Enable caching of the Maven dependencies: Caching Dependencies and Directories: Caching directories (Bundler, dependencies): Arbitrary directories - Travis CI.
- Use a repository manager: «act as dedicated proxy server for public Maven repositories».
Additional references:- Nexus example:
- Maven Repositories - Nexus Repository Manager 3 - Sonatype Help. See «Browsing and Searching Maven Repositories» (general information) and «Configuring Apache Maven» (
settings.xml
-related information) sections. - «User manual» for the use case: Using Nexus 3 as Your Repository – Part 1: Maven Artifacts | TheNEXUS.
- Maven Repositories - Nexus Repository Manager 3 - Sonatype Help. See «Browsing and Searching Maven Repositories» (general information) and «Configuring Apache Maven» (
- The general question: How does one mirror a maven repository?.
- Nexus example:
QUESTION
I´m using the cordova-plugin-document-scanner plugin in my ionic 3 iOS App which allows me to take a photo with some additional features. Everything works fine and I get the fileURI in the success callback (file:///...).
After taking a Photo, I´m not able to update the DOM to show the image in my view home.html. I tried also to update a simple text (test), but it also do not work.
I´ve tried it with ngZone and also with ChangeDetectorRef. Both give me:
...ANSWER
Answered 2018-Jun-16 at 09:57I found a working solution:
QUESTION
I'm regularily using Travis CI and noticed multiple issues with forked projects the last weeks when building on Travis which do not occur locally or on the Travis instance of the forked project. I made sure that I used the the same Maven version which imo is all that can be different from the Travis CI environment since both Maven and Java are portable across platforms. Travis runs Ubuntu 12.04 or 14.04 which I do as well (17.04).
In detail I experienced:
- The failure to retrieve a
SNAPSHOT
version which I could retrieve with the same Maven version locally after deleting~/.m2/repository
and moving~/.m2/settings.xml
aside (see Why fails Travis CI to retrieve a SNAPSHOT artifact when retrieval works locally? for details) [ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.5.201505241946:check (default-check) on project commons-numbers-complex: Coverage checks have not been met.
repeatedly which doesn't happen on their master branch (which I added to the aggregator of my project)
I'm not looking for solutions to the issues here, but to any explanation how this could make any sense in order to broaden my understanding of Travis and Maven in a cross-platform environment.
...ANSWER
Answered 2017-Jul-28 at 22:30Have you pinned all plugins you use in Maven? You should first fix your build issues like : [WARNING] 'parent.relativePath' of POM org.apache.commons:commons-numbers-parent:1.0-SNAPSHOT (/home/travis/build/document-scanner/document-scanner-aggregator/commons-numbers/pom.xml) points at richtercloud:document-scanner-aggregator instead of org.apache.commons:commons-parent, please verify your project structure @ org.apache.commons:commons-numbers-parent:1.0-SNAPSHOT, /home/travis/build/document-scanner/document-scanner-aggregator/commons-numbers/pom.xml, line 19, column 11
?
Is there a good reason why you rebuild apache-commons-numbers and not using the released versions of them?
QUESTION
I'm suffering for a Could not find artifact org.apache.commons:commons-numbers-core:jar:1.0-SNAPSHOT
Maven error on Travis CI which I can't explain because I ran the exact same build command locally after deleting ~/.m2/repository
and moving ~/.m2/settings.xml
to a backup location.
The error message is
...ANSWER
Answered 2017-Jul-28 at 00:59Adding
QUESTION
ANSWER
Answered 2017-Mar-14 at 09:30Looks like you'd need to get the rotatedRect
instead of rectangle. Then perform a warpAffine
(http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html?highlight=warpaffine)
Then use getRotationMatrix2D
(http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#getrotationmatrix2d) to get the angle of rotation, rotate the image as such, crop as usual and then rotate back to normal.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install document-scanner
You can use document-scanner like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page