Recognize vertical text using google cloud vision - ocr

I'm trying to recognize vertical text using google cloud vision. Image example:
I use Try This API on https://cloud.google.com/vision/docs/ocr to test the engine.
Request body:
{
"requests": [
{
"features": [
{
"type": "DOCUMENT_TEXT_DETECTION"
}
],
"image": {
"source": {
"imageUri": "https://i.stack.imgur.com/3wwYp.jpg"
}
}
}
]
}
The result is
{
"responses": [
{}
]
}
Am I missing something? Thank you.

You can try to set "model": "builtin/latest" as per the documentation, that will give you some results. I believe recognising vertical text is something that is being worked on now, so you should not expect 100% accuracy at this moment.
Another issue is that single character detection is currently not supported by the Vision API.There is a feature request submitted with regard to character recognition here. Please star it so that you could receive updates about this feature request and do not hesitate to add additional comments to provide details of the desired implementation.
You can also have a look at this post, where people discuss vertical text recognition.
I have tried my first suggestion with your image, and for some reason A is not recognised, perhaps the Vision API sees it as "being separate" from the rest of the letters, which form a sequence, and is not being recognised since it is treated as a single character in that case.

You may want to try another feature. For example
"type": "TEXT_DETECTION"

Related

YouTube API - find channels with names containing spaces

I'm using the YouTube API to show information about different YouTube channels.
I want to find YouTube users by username search, here's the link to the API.
https://developers.google.com/youtube/v3/docs/channels/list
When looking up channels like PewDiePie everything works.
My problem is with YouTube names with a space in the middle. When I for example look up "David Dobrik", I get no search results. Anyone knows how I get the info about channels with space-names?
I know you can find the channels with their YouTube channel ID, but that's not what I want.
What I get when looking up channels with spaces:
{
"kind": "youtube#channelListResponse",
"etag": "\"Dn5xIderbhAnUk5TAW0qkFFir0M/fuSRoUc6R_qYNmJ5jD-Izxd1Nsc\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": []
}

Rendering to another html page [duplicate]

This question already has answers here:
How can I display a JavaScript object?
(40 answers)
Closed 7 years ago.
I have an object of objects and I want to iterate through the objects and show them in the browser; I have the following code, but it just shows me [object Object][object Object][object Object]; how can I show the actual objects?
my my_obj looks like:
{
"User": {
"description": "A user."
},
"Media": {
"description": "A media ."
}
}
var output = "";
for (var key in my_obj) {
output += my_obj[key];
}
response.send(output);
Thanks
It looks like this question is essentially a duplicate of yours.
The accepted answer for that question uses the console object to print the contents of the object to the JavaScript debugging console in the browser's developer tools (usually accessible with F12). You can typically interact with the object, expanding and collapsing its properties, in the logged output in the console.
console.log(my_obj);
However, this doesn't provide an easy way to print the contents of the object to the webpage. For that, you can follow the above-linked question's highest-voted answer, which uses the JSON object, specifically it's stringify method.
var my_obj_str = JSON.stringify(my_obj);
This method returns a stringified version of your object (i.e. it will appear like an object literal), which can then either be logged to the console like above (although it would be a string, not an interactive object!), or put into the webpage in whatever manner you like putting strings into webpage content.
You might need to use JSON.stringify() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

Hangouts Chat Bot image card not refreshing

I am building a bot for Hangouts Chat. My bot will display a random image from a free image api. The api's URL is the same URL on each call but will get a new image. Unfortunately, my bot will not update the image. It just repost the same image on each call. I am using Google's App Script to deploy the bot. My image code is as follows:
function buildImageCard(url) {
return {
cards: [
{
sections: [
{
widgets: [
{
image: {
imageUrl: url
}
}
]
}
]
}
]
};
}
The random image shows up just like it should. The only issue is when I wan to call it again, it shows the same image. I can't seem to find a way to refresh the card. I have seen this method:
actionResponse: {type: shouldUpdate ? 'UPDATE_MESSAGE' : 'NEW_MESSAGE'},
Then pass shouldUpdate to buildImageCard. Although, nothing happens if shouldUpdate is true. What am I missing?
It seems that the problem is related with cache. Hangouts Chat is caching images so it doesn't need to download them everytime. You can try it by clearing the browser cache and updating the card with the chatbot. You should see the new image.
One thing you can do is to include a cachebreaker at the end of the url:
widgets: [
{
image: {
imageUrl: url + new Date().getTime()
}
}
]
As it's suggested here.
Also, in the same post, someone commented that this is not a good practice "as it will swamp caches (both local and upstream)". And they recommend a better solution, but in this case we cannot control Cache-Control headers.
I don't know how Hangouts Chat is managing the cache, but I guess they are taking care of it in case a bot uploads tons of different images. For example, in your case, it would be the same if you generate a new URL everytime you want to update it in the card, so I believe the cachebreaker could work for you.
I hope it helps!

Add new column in responses(Swagger-ui)

I am using Swagger-ui for the api documentation, when i come to responses i want to add a new column of any name in every response, screen shot is attached, highlighted text is ok, i want to add a new column at place of the circle.
My response JSON is
"responses" : {
"400" : {
"description" : "Invalid ID Supplied"
},
"404" : {
"description" : "Order not found"
}
}
how to add new column in it?
Is there any way type of Intellisense provided for Swagger-ui JSON?
You can extend the API Response objects coming off of your API endpoints only as far as the specification goes. In order to display that in the UI, though, you would have to fork the UI project and do as you please. Currently the UI does not seem to be extensible at that point (look for the table headers in the file).

How are Box API Mini object types defined?

I did a ctrl-f for "mini" through the entire Box API documentation, and couldn't find out where the mini types were defined. So, how are the mini object types defined? What fields do they contain?
Great question. We don't specifically document what makes up a "mini" format of each object. Sounds like a great improvement for us in our docs.
As it stands now, the only way to know is to look at the examples. The mini always contains the id of the object, the type of the object, a convenient displayable name, then depending on the object, possible an extra field or two.
{
"type": "user",
"id": "17738362",
"name": "sean rose",
"login": "sean#box.com"
},