How to read one column texts with Google Cloud Vision API - ocr

I have the next document image
When I try to convert the image to text, the result is the next:
Top Text
Ref: Rad: Dte: Ddo:
Ejecutivo 76520400300 Banco de Bogotá Luz Adriana
Botton Text
The problem is Google API recongnize it like two columns so, How can I config the Google API in order to obtain one column text?
My goal is obtain:
Top Text
Ref:Ejecutivo Rad: 76520400300 Dte: Banco de Bogotá Ddo:Luz Adriana
Botton Text

Google team member responded that Document AI works better than Cloud Vision as per the update on the issue

Cloud Vision API doesn't have a specific request property to specify the format used to read or sort the file's data. Instead, I think that the available workaround is to use the BoundingPoly and Vertex response properties, that display the coordinates related to each word contained in the image, in order to process the vertices data within your code logic and define the text that need to be grouped by columns and rows. You can take a look on this link which includes some response examples that include these properties.
In case this feature doesn't cover your current needs, you can use the Send Feedback button, located at the lower left and upper right corners of the service public documentation, as well as take a look the Issue Tracker tool in order to raise a Vision API feature request and notify to Google about this desired functionality.

Related

Setting image detection area in Google Cloud Vision API OCR

I have used Google Cloud Vision API for document text detection, but I could not figure out if it lets us define a particular area of image from which to extract text.
For example if my image has 3 columns of text and I want to provide top-left coordinates, width and height of a particular column on which I want to perform OCR. Is it possible?
Also is there any other way to not get jumbled up text when we have 3 columns of text in image?
Currently, It is not possible to define a particular area of image from which to extract text. There is no available parameter for that in the image context in neither the REST or gRPC APIs. A Possible workaround is to crop your image and send only the text you want to transcript. If you want to try to automate this process, perhaps the object localization or the crop hints features may be of use.
Regarding the jumbled up text, you may be able to locate each block or paragraph in the Json response.
You can builder your own wrapper class around the Detector class. Then re-build the bitmap in the frame object that gets fed into the detect method.

Google Maps URL with pushpin and satellite basemap

Background Information
I can form a simple valid Google Maps URL that has a pushpin on a coordinate like so using the query parameter:
https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
Direct link
Similarly, I can form a URL with a satellite image of the same location using the center and basemap parameters:
https://www.google.com/maps/#?api=1&map_action=map&center=47.5951518,-122.3316393&zoom=17&basemap=satellite
Direct link
Desired End Result
What I'd like to have is a satellite image like in the second URL with a pushpin. The result of this can be seen by using the first URL and pressing the 'Satellite' button on the bottom left of the map. From what I can tell, the basemap and query parameters may not be used together like below, but I'd love to be proven wrong.
https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393&basemap=satellite
Desired end result:
Direct link
I need to be able to construct the URL with a dynamic set of coordinates. I haven't found a way to manipulate the parameters in order to accomplish this.
Note: the final URL I included is an "unpacked" URL generated by Google Maps and not constructed by hand. I haven't found a way to manipulate it the way I want, and even if I could, I'm sure it's not the correct way to solve this problem.
You are right in that this can't be done with the new Google Maps APIs. The "Search" URL scheme allows pinning but no satellite view, whilst the "Display a map" scheme allows satellite views but no pinning.
However, it is possible get both pinning and satellite views by using this old, no-official-documentation, scheme:
http://maps.google.com/maps?t=k&q=loc:47.5951518+-122.3316393
The t parameter used to work with a number of different values but only two seem to currently still work:
t=m - Normal map view
t=k - Satellite view
Note that unofficial documentation for the other parameters can be found here. Some of these may also still work.
For anyone still looking for a solution in 2022, you can use the following undocumented URL scheme:
https://www.google.com/maps/place/{lat},{lng}/#{lat},{lng}/data=!3m1!1e3
This is the best solution I could find that mimic the plan-limited query URL scheme:
https://www.google.com/maps/search/?api=1&query={lat},{lon}

How to get place description from Google Places API

I am trying to use the Google places API to get information on certain places. I have an
example from Google search:
here of what I am trying to find. I thought that the "types" field of the Places API text search would contain it, but this text appears to be different and not within the provided list of options. If anyone can provide some info on where this comes from and how to obtain it, it would be much appreciated. Thanks
Currently you cannot obtain this data via Places API. There is a feature request in Google issue tracker to make the detailed business type available in Places API, however Google doesn't expose any ETA:
https://issuetracker.google.com/issues/35822953
Feel free to star this feature request to express your interest and subscribe to notification from Google.
According to Google Places SDK to Android:
Since September 24, 2015 we have:
This release adds three new methods to AutocompletePrediction, giving you easy access to the primary and secondary parts of the place description as well as the full text of the description. This is useful, for example, when you want to display a short title followed by further detail about the place. See the sample code on GitHub. The new methods are as follows:
getFullText(CharacterStyle matchStyle) returns the full text of a place description. This is a combination of the primary and secondary text. Example: "Eiffel Tower, Avenue Anatole France, Paris, France".
This method is equivalent to the existing getDescription() method. In addition, it lets you highlight the sections of the description that match the search with a style of your choice, using CharacterStyle. The CharacterStyle parameter is optional. Set it to null if you don't need any highlighting.
getPrimaryText(CharacterStyle matchStyle) returns the main text describing a place. This is usually the name of the place. Examples: "Eiffel Tower", and "123 Pitt Street".
getSecondaryText(CharacterStyle matchStyle) returns the subsidiary text of a place description. This is useful, for example, as a second line when showing autocomplete predictions. Examples: "Avenue Anatole France, Paris, France", and "Sydney, New South Wales".
Accompanying the above improvement, the following methods on AutocompletePrediction, are now deprecated:
getDescription() is now deprecated.
Please use getFullText(), getPrimaryText(), and/or getSecondaryText() to retrieve the full or partial description, getMatchedSubstrings() is now deprecated. Please use getFullText() to format matches more easily.

Route navigation info from Google Maps API

I am currently able to use the Google Maps API to get a route from point A to point B by using the google.maps.DirectionsService. But one thing I cannot seem to get is the actual navigation information (like the one you get when you are on the navigation mode in your cell phone).
Is there any way to get data for things like "turn right in 500 feet on 5th Avenue" ?
Thank you
you may print these instructions by defining the panel-option of the DirectionsRenderer(expects to be a HTML-element where to print the instructions).
Demo: https://developers.google.com/maps/documentation/javascript/examples/directions-panel
To get single instructions you must iterate over the steps of a route and access the instructions-property.

What is a good API to use to determine the address of a place based on its name?

I need to get the specific address (or lat/long coordinates) of a place based on that place's name.
Specifically, I need to determine the location of supermarkets in a given area so that I can use those locations as 'markers' in my implementation of google maps static maps api.
Using the following, I can if you input a specific location in the area that currently says "INSERT_LOCATION_HERE", then you will get a google map of the specified area with markers at the locations.:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|INSERT_LOCATION_HERE&sensor=false
For example (the marker indicates the local Wegmans store based on its address:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|500%20So.%20Meadow%20Street&sensor=false
If anyone knows how to do this without using google maps places api, that would be extremely helpful!
If you want to get the name as a string intead of an image, you can do it with a little help for Google. That'll match nicely with the static map that you're using.
Let's say you want to search for "Den Haag"...
Construct a URL like this, and parse the result:
http://maps.google.com/maps/geo?q=den%20haag
You can also specify the output format:
http://maps.google.com/maps/geo?q=den%20haag&output=xml
http://maps.google.com/maps/geo?q=den%20haag&output=csv
http://maps.google.com/maps/geo?q=den%20haag&output=json
You can also provide coordinates instead of a name, and get a full name+coordinates in return:
http://maps.google.com/maps/geo?q=52.0467315,4.3796239&output=json
For some reason the links don't work when you click them from this page. I guess google doesn't accept a referrer in the request, so just copy and paste the links... That works.