Query images are those sent to the system to search for matches inside a collection.
If you are using one of our SDKs, or libraries, you do not need to worry about the quality of query images. Our SDKs take care of capturing and sending images that give very good recognition results while keeping short round-trip times (e.g. <1s on Wi-Fi or 4G). However, if you are building an app without using one of the above-mentioned SDKs, you can read below how to find the best balance between the quality of the query images and their file sizes.
In all cases, you should read about the recognition of small objects.
For most mobile app use cases, we recommend sending JPEGs with a compression quality of 75% (libjpeg quality measure) and image dimensions of 320 x 240 pixels. Such pictures require sending of just 10-15KB.
You can learn how to adapt the above settings to your specific use-case by reading the sections below.
For most use cases we recommend that shorter edges of query images have 240 pixels. In fact, the default image size for our SDKs is 320×240.
In special cases, e.g. need to recognize objects that do not cover most of the scene (i.e. small or captured in a distance), you may improve the results by sending larger query images. In any case, we do not recommend sending images larger than 640×480 pixels.
On the other hand, for networks with extremely low bandwidth, you may send images as small as 192 x 144 pixels and still get acceptable results. In such cases, the JPEG compression quality may need to be increased from the typically recommended 75% (see section Formats and Compression). This will work quite well for queries depicting large (or close) objects.
Formats and compression
We recommend JPEG format with a compression quality of 75% (libjpeg quality measure) in order to limit bandwidth requirements and keep round-trip times short. We also support PNG format (without transparency).
The general rule is that lower resolution images require higher compression quality. In other words, lower compression levels than the above are acceptable only for query images larger than 320×240.
Note that here we measure the JPEG compression quality according to libjpeg. Other compressors may require different values, e.g. to obtain equivalent quality in iOS we use function UIImageJPEGRepresentation with compressionQuality=0.5.
Color vs. grayscale
The bandwidth usage can be reduced even further by sending gray-scale images.
However, this is a good idea only on platforms where such conversion is fast, e.g. on older mobile devices the time needed to perform color to gray-scale conversion may be comparable to the round-trip time saved by sending the smaller image over 3G.
Moreover, before implementing the conversion, make sure that your JPEG compressor is capable of producing JPEG images with only luminance component, as opposed to the usual three color components (e.g. YUV). Otherwise, you will not see any reduction in file sizes.