Python program to read symbols - python

Looking to have python take input from a camera and have it read what it sees.
For example the camera lens sees ...---... and would translate that to SOS.
Trying to find a good pattern to use that would go back to a database and tell the program a location. But I'm first trying to figure out how I could take a camera lens and it would see the pattern and feed what it sees to a program to determine location.
I found this article: count colored dots in image
But it was reading and counting color dots. So similar, but I want to be able to recognize a pattern (bar code, Morse code, ect) and related it back to a location (thinking I will have this in a database of some sort).
Thanks for any input or direction you can give.

Related

Python:How can I find the coordinates of a symbol with number inside (technical drawing)

I am writing a python tool to find specific symbols (e.g. a circle/square with a number inside) on a drawing pdf/screenshot.png
I know from another data source the specific number(s) that should be inside the circle/square.
Using opencv matchTemplate I can find symbols and its coordinates.
One way would be to created all possible symbols (so circles/squares with number 1 to 1000) and save them. Then use opencv to find it on the drawing since I know the number to be found, and thus the filled symbol.
I am sure that the is a smart way to do this. Can somebody guide me into the right direction.
Note: pdfminer will not work since I will not be able to distinguish between measurement numbers and the text coming from the symbol, but I could be wrong here.
I am also trying to solve a similar problem in a coding assignment. The input is a n low poly art illustration.
Once you find the location of the UFO's, you need to crop that part and pass it through a classifier to find the number that UFO contains. The classifier is trained on 5000 images.
I am now going to try the matchTemplate method suggested by you to find the co-ordinates of the UFOs.

Use python to identify elements at screen

I want to start a python project thats identify some elements in screen, like a square's size or all elements in screen with a certain color, and i don't even know from where should i start.
For example, all the top points above certain value at the graph.
Anyone could please give me a north?
If you're looking to interact with elements inside a browser, look at Selenium. If you want to control the desktop itself, look into Sikuli.
In either case, you can use OpenCV to identify elements and do template matching.
Edit: more comments after more details from OP
If you're just looking to identify the peaks in the graph, you can take a screenshot of the display at regular intervals using Sikuli or PyScreenshot and then use template matching in OpenCV (either directly or using Sikuli) to get the coordinates of the peaks in the screenshot. The horizontal line across the graph might throw off some of the template matching, but you can play around with the various parameters to get the results you want.
Check out this tutorial for template matching.

extract text and labels from PDF document

I am trying to detect and extract the "labels" and "dimensions" of a 2D technical drawing which is being saved as PDF using python. I came across a python library call "pytesseract" which has optical character recognition capability. I tried the demo on my image but it fails to detect most of the label/dimensions. Please suggest if there is other way to do it. Thank you**.
** Attached is a sample of the 2D technical drawing I try to detect
** what I am trying to achieve is to able to obtain the coordinate of every dimensions (the 160,120,10 4x45 etc) on the image, and extract the, as well.
About 16 months ago we asked ourselves the same question.
If you want to implement it yourself, I'd suggest the following process:
Extract the Canvas from the sheet
Separate the Cuts
Detect the Measure Regions on each Cut
Detect the individual attributes of the Measure Regions to understand where the Measure Start & End. In your particular example that's relatively easy.
Run the detected Measure Labels through OCR
Associate the Labels to the Measures
Verify your results
Alternatively you can also run it through our API and get the results as JSON.
Here's a quick visualization of the result:
Drawing Read (GT stands for General Tolerances)

OCR and coordinate association on image for each character

I'm working on a project to help my visually impaired friend, a python script will first take a screenshot every second and whatever is on the image will be converted to text, and the character which is nearest to the coordinate of curser, will be the output.
User can move the curser anywhere on screen and nearest alphabet to curser will be the output of program.
Don't worry about the form of output, it will be in form audio. But for the sake of simplicity of question lets assume it's in the form of a single character text.
Every tutorial I could find explained how to use OCR dependencies just to convert all the text to a continuous text file.
For my particular application, each alphabet will be associated with a specific co-ordinate. But I just couldn't find a single resource to learn how to identify the location of converted character on the image.
Please enlighten me how to extract the coordinates of a character from an image.
This is a good project. But I think it is a chicken-and-egg problem. You need to have OCR performed by a capable OCR engine (most don't provide coordinates) and the result will have the text and associated coordinates. Your question "how to extract the coordinates of a character from an image" means perform OCR and get coordinates. If performing zonal OCR, i.e. Not the entire screen, you need to know what zone to OCR, and establishing this zone to make sure it includes all necessary text around your mouse location in that zone is probably the biggest challenge. My company at www.wisetrend.com builds such OCR-specialized projects per case. We'll be glad to help in this non-commercial project if you'd like to work jointly.

Python - detect elements of a region

I have an array made of 1 and 0 (image below), and I am working on a Python script that detects the borders of the central region (the big white blob) and marks all the internal points as 1. How would you do it?
I wrote a piece of code that does repeated connectivity search, but this doesn't seem the way to go - the region changes shape and new areas are added.
as I can't put a comment i put it here.
I had a problem close to yours: I wanted to select several holes and then calculate the area, the roundness...
What I did was to use the java implementation of python (jython) by which I could use a library called imageJ which is dedicated to image processing (all is include in Fiji). Navigating in the library is a bit fastidiuous but it is powerfull one
Here is the wand tool: http://rsbweb.nih.gov/ij/developer/api/ij/gui/Wand.html
Have a look here for "How getting pixels of a ROi" : http://fiji.sc/Introduction_into_Developing_Plugins#ImageJ.27s_API

Categories

Resources