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"
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!
I have an AVPlayerViewController that shows multiple short mp4 videoclips one after the other.
My only problem is: when i add new url's to my json file, i would need to close the app and open it to see the new video i added.
Is there a way that the parsedurl can be refreshed/reloaded perhaps every 10 minutes? In this case when new url's are added to the json file it will pull that information and add the new video to the end of the array, without having to close the app every time.
I was thinking of using the timer.scheduledTimer, is that possible? If so, how? And what is a better way to fix this?
EDIT:
Apparently my question is not very clear (my apologies).
I have this url:
let parseURL = "http://192.168.64.2/Project/test123.json"
The test123.json file contains:
"videos": [
{
"url" : "(Any video url)"
},
{
"url" : "(Any video url)"
}
Now, my app now shows 2 video's. If I add a 3rd url, I need to restart the simulator in order to see the 3rd video.
I want to reload/refresh the url every 10 minutes so that when changes happen in my test123.json it will be visible in the simulator without having to restart the simulator. (hope this makes everything a bit more clear)
If you really want to refresh every 10 minutes, then use timer.scheduledTimer. But a better approach would be to use silent push notifications so your server can tell your app when new content is available.
I am calling Wikipedia opensearch API. The API url is correct you can open it in browser and can get right result. But when I am requesting by this same url,it gives not result,expected result is in JSON format.I am using RESTAPI for sending request. I have observed that if I use any other API for e.g http://ipinfo.io/json ,I get proper output in JSON. But my code is doing nothing for https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=ToBeSearchedText. Here is the code:
$(document).ready(function() {
//when the <submit> button is clicked
$("button").click(function() {
var xhr = new XMLHttpRequest();
var bla = $("#searchitem").val(); //it will store the search query text
var url = "https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=" + bla;
xhr.open("GET", url, false); //making a GET request
xhr.send();
var data = xhr.response; //response is stored in data
$(".message").html(data); //this is doing nothing,if I try another url like http://ipinfo.io/json,the code works perfectly. Why it is not working for Wikipedia API?
});
});
The output is in following form if I am able to get it,Red here is the search term returning a list of Wikipedia articles containing this term:
[
"Red",
[
"Red",
"Redback spider",
"Red panda",
"Redshift",
"Red Dwarf",
"Red Hot Chili Peppers discography",
"Red Star Belgrade",
"Red hair",
"Red Skull",
"Reddit"
],
[
"Red is the color at the longer-wavelengths end of the spectrum of visible light next to orange, at the opposite end from violet.",
"The redback spider (Latrodectus hasseltii) is a species of venomous spider indigenous to Australia. It is a member of the cosmopolitan genus Latrodectus, the widow spiders.",
"The red panda' (Ailurus fulgens), also called the lesser panda, 'the red bear-cat, and the red cat-bear, is a mammal native to the eastern Himalayas and southwestern China.",
"In physics, redshift happens when light or other electromagnetic radiation from an object is increased in wavelength, or shifted to the red end of the spectrum.",
"Red Dwarf is a British comedy franchise which primarily comprises ten series (the ninth being a mini-series) of a television science fiction sitcom that aired on BBC Two between 1988 and 1993 and from 1997 to 1999, and on Dave in 2009 and 2012, gaining a cult following.",
"The American rock band Red Hot Chili Peppers since 1984 has released eleven studio albums, three live albums, twelve compilation albums, eight video albums, five extended plays, forty-three singles, and forty-five music videos.",
"Fudbalski klub Crvena Zvezda (Serbian Cyrillic: Фудбалски клуб Црвена Звезда, IPA: [t͡sř̩ʋenaː zʋěːzda]), commonly known in English as Red Star Belgrade (Serbian: Црвена Звезда Београд / Crvena Zvezda Beograd) or simply Red Star, is a Serbian professional football club based in Belgrade, the major part of the Red Star Sports Society.",
"Red hair occurs naturally in 1–2% of the human population. It occurs more frequently (2–6%) in people of northern or western European ancestry, and less frequently in other populations.",
"The Red Skull (Johann Schmidt) is a fictional supervillain appearing in American comic books published by Marvel Comics.",
"Reddit (/ˈrɛdɪt/) is an entertainment, social news networking service, and news website. Reddit's registered community members can submit content, such as text posts or direct links."
],
[
"https://en.wikipedia.org/wiki/Red",
"https://en.wikipedia.org/wiki/Redback_spider",
"https://en.wikipedia.org/wiki/Red_panda",
"https://en.wikipedia.org/wiki/Redshift",
"https://en.wikipedia.org/wiki/Red_Dwarf",
"https://en.wikipedia.org/wiki/Red_Hot_Chili_Peppers_discography",
"https://en.wikipedia.org/wiki/Red_Star_Belgrade",
"https://en.wikipedia.org/wiki/Red_hair",
"https://en.wikipedia.org/wiki/Red_Skull",
"https://en.wikipedia.org/wiki/Reddit"
]
]
But the problem is I am not getting it,I tried to check the status by console.log(xhr.status); ,it did nothing. That means no data is being returned. Please correct my code and help me understand what am I doing wrong?
Here is the link to my Codepen http://codepen.io/meow414/pen/kXxzzR
the reason why you don't see any response loaded is because of same-origin-policy enforced by browser. you are trying to make an https get request while you are currently on http page. the other request works fine because it is an http request.
see this for more info.
while you are there - since you are using jquery - you don't have to rely on xmlhttprequest native object. you can use jquery.get() for GET requests or $.ajax() which supports all HTTP verbs.
hope that helps!
https://www.mediawiki.org/wiki/Manual:CORS
This is specific to using CORS with the mediawiki. For searches that are performed anonymously include &origin=* within the url.
https://en.wikipedia.org/w/api.php?action=opensearch&format=json&origin=*&search=
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"
},