Google Custom Search API for square images - google-api

I'm looking for a way to specify that the images returned by the Google Custom Search API have a square format.
I've tried tbs=iar:s (because I've read Using the Custom Search API (REST JSON) to search for square images), but it doesn't work.
Have you an idea please ?

The problem is that tbs query parameter only applies to a regular image search on Google. For example, if you wanted to search for cat pictures with a square aspect ratio, you could do a search like this:
http://images.google.com/?q=cat&tbs=iar:s
But the Custom Search API uses a completely different set of parameters. The full list of supported parameters is shown in the REST documentation.
Some of the tbs queries do have equivalents. For example:
tbs=ic:gray translates to imgColorType=gray
tbs=isz:m translates to imgSize=medium
tbs=itp:clipart translates to imgType=clipart
But sadly there appears to be no equivalent for the iar aspect ratio filter. I tried guessing a few queries (things like imgAspectRatio=square) in case there was an undocumented parameter, but didn't have any luck with that.
The best alternative I could suggest is using imgSize=icon. This tends to return images that have a square aspect ratio, but with the unfortunate side effect that the images also tend to be rather small (the largest size I've seen returned is 256x256). Depending on your needs though, this may be good enough.
I apologise if this isn't particularly useful to you. I'm not just trying to grab the bounty on this question, so feel free not to vote this answer up. I just wanted to let you know what I had found in case it was of some help.

You can simply use both tbs=isz:l,iar:s that way it will return only large images with same aspect ration.

Related

Information Retrieval Get place name by image

I am starting the development of a software in which through an image of a touristic spot (for example: San Peter Basilica, the Colosseum, etc.) I should retrieve which is the name of the spot (plus its related information). In addition to the image I will have with me the picture coordinates (embedded as metadata). I know I can support me with Google Images API using reverse search in which I give my image as an input, and I will have as a response a big set of images.
However, my advice request for you, is that now having all the similar images, which approach can I make in order to retrieve the correct place name which is in the photo.
A second approach that I am managing is to construct my own dataset in my database, and do my own heuristic (filtering images by their location and then to make the comparation over the resulting subset after having done that filtering). Suggestions and advices are heard, and thanks in advance.
An idea is to use the captions of the images (if available) as a query, retrieve a list of candidates and make use of a structured knowledge base to deduce the location name.
The situation is lot trickier if there're no captions associated with the images, in which case, you may use the fc7 layer output of a pre-trained convolutional net and query into the ImageNet to retrieve a ranked list of related images. Since those images have captions, you could again use them to get the location name.

Is there an OSM XAPI tag/value list?

I'm new to OSM querying, but would like to query vector data for a large area. Thus I need to limit the results I would like to get by tagging the request.
http://www.informationfreeway.org/api/0.6/way[tag=value][bbox=x,y,z,j]
I'd like to filter for specific tag/values when querying for a way. Though I don't know which tags/values exist. Is there a list listing the most common of them?
You are approaching your problem from the wrong direction. The number of different tags is almost unlimited. According to taginfo there are currently 75 380 856 different tags. I'm pretty sure you are not interested in most of them. Likewise you are probably not even interested in many of the most common tags.
What data do you want to query?
The OSM wiki should be your starting point for generating a list of tags you are interested in. For a generic overview take a look at the map features. Are you interested in streets? Then visit at the highway key. Routing? Then take a look at the routing wiki page.
Always remember that these lists aren't complete. People can use any tag they like (but should use well-established tags whenever possible of course).
Also consider using Overpass API instead of XAPI. Overpass API is much more powerful.

How to change a dataset of images to train-images-idx3-ubyte format

I have 10000 images. I want to convert them to a format like 'train-images-idx3-ubyte'. This format comes from here. I want them to use the deep learning methods described here
I appreciate any help
Take a look at how these files are loaded here.
The use of numpy.fromfile indicates that the data are simply saved as raw bytes of a specific dtype. You can achieve this using numpy.tofile.
However, make sure that this is really what you want to do. If you want to use certain networks on other images, these images will likely need to be of exactly the same size. It is worth digging further into the tutorials - after a while the transposition to other datasets will become easier.

Can Groups be used to emulate the "class" or "struct" data structures from other languages

Is there a data structure within LiveCode that can be used as a "holder" for associated data, letting me handle it collectively? I come from a Java / Javascript / C background so I am looking for a Class or Struct sort of data structure.
I've found examples of Groups, which seem to have some of this functionality, but it feels a bit like I'm bending the language to meet my needs.
As a specific example, suppose I had an image field on my screen that would randomly display an image and, when pressed, play an associated sound clip. I'd expect to create a list of "structures" that contained the path to the image and the path to the associated sound clip, and use that data to populate the image field and to decide what sound clip to play.
Would a Group be the correct structure to use in this case? Or am I approaching this in a way that isn't really fitting with the way LiveCode works?
It takes a little getting used to, but the xTalk world is much simpler and more open than any ordinary procedural language. So much of what you once had to manage is no longer required.
So when splash21 said that you could store all your image and sound references in a custom property, he was really saying that the LiveCode environment contains intrinsic, high level functionality that makes these sorts of things instantly accessible, and the only thing required of you is to call for them, and they simply work.
The only way to appreciate this is to make a few simple programs, to really see what is possible. Make your application. Everything you mentioned can be accomplished with perhaps a dozen lines of code in a single handler. I recommend that you join the LiveCode use list and forums. The community is vibrant and eager to help, frequently with full blown solutions to specific problems, but more importantly, as guides and mentors to new users
Craig Newman
Arrays in LiveCode are actually associative arrays (like hash maps). A key is associated with a value. The value might be as well an array.
Chapter 5.5.7 of the User's Guide says
Array elements may contain nested or sub-elements, making them multi-dimensional.
This type of array is ideal for processing hierarchical data structures such as trees or
XML. To access a sub-element, simply declare it using an additional set of square
brackets.
put "ABC" into myVariable["myKeyName"][“aChildElement”]
see also
How to store pictures in a stack?
Dave- I'm hoping to get a struct-like container implemented in the near future. Meanwhile you can, as splash21 mentioned, use custom properties (or better yet, custom property sets) to do what you want. This will give you a pseudo-struct for each object and you can implement the file and sound specifications into the properties. And if you use that in conjunction with a behavior object you'll end up very close to a real inheritable class formation.

How to find out what an Image is about

Is there a way to understand what an image is about? I mean, if I scann a picture, how can I tell that the picture is about a spesific object? I am thinking that if I have some shape in mind, say the shape - pattern of a spesific object that meets its requirements against the object I am searhcing for, then it must be what I am looking for. Anyway I am thinking of an algorithm to scann a picture database and figure out the pictures I am actually looking for,Is there a known way to accomplish such operation?.
If I am reading your question correctly...
This is a very daunting task even for full-fledged corporations like Google, though they are attempting to create something along these lines.
Take a look at Google Goggles for Android if you'd like to see how this sort of system behaves. You'll also notice that it requires very specific circumstances to be even slightly reliable, but the base technology is there.

Resources