Responses¶
All requests will be replied to with a JSON or XML string containing the documented variables for each method.
All JSON responses will contain a dictionary with keys while XML will contain elements under the root.
Key |
Description |
---|---|
method |
A string containing the name of the method that was called. |
status |
A string containing one of ok, warn, fail. |
error |
A list of error strings, describing any errors if status is set to warn or fail. |
query_image |
Information about the query image. This will appear for search calls. |
result |
A list of response numbers, strings or response dictionaries. |
stats |
A list of request stats contain timing info and some counters if applicable. All timing stats are in milliseconds. |
result is a list of dictionaries containing multiple keys for a search call:
Key |
Description |
---|---|
filepath |
The collection image’s file path. |
score |
How closely the query image matches the collection image. |
query_overlap_percent |
How much the query image overlaps the collection image, as a percentage. |
target_overlap_percent |
How much the collection image overlaps the query image, as a percentage. |
overlay |
A URL pointing to the overlay for a search. |
Example response to a search request¶
JSON¶
{
"method": "search",
"status": "ok",
"error": [],
"query_image": {
"filepath": "query.jpg"
},
"result": [
{
"score": 100,
"target_overlap_percent": 100,
"match_percent": 100,
"overlay": "overlay/?query=example1.jpg&target=example2.jpg&sc_2=1.00139&tr_2_x=0.0580673&tr_2_y=-0.612057&fd_2_z=1401.39&fd_2_x=400.446&fd_2_y=300.0&rot_1_y=0.349066&rot_1_x=0.0&rot_1_z=0.0&rot_2_z=0.00134855&rot_2_x=0.00343397&rot_2_y=0.35174&fd_1_y=300.0&fd_1_x=400.446&fd_1_z=1400.89",
"query_overlap_percent": 99.99,
"filepath": "example2.jpg"
},
{
"score": 20.20,
"target_overlap_percent": 83.59,
"match_percent": 29.22,
"overlay": "overlay/?query=example1.jpg&target=example3.jpg&sc_2=0.990622&tr_2_x=-139.649&tr_2_y=-103.786&fd_2_z=1171.51&fd_2_x=400.446&fd_2_y=300.0&rot_1_y=0.0&rot_1_x=0.0&rot_1_z=0.0&rot_2_z=-0.00281038&rot_2_x=-0.00213862&rot_2_y=0.00861092&fd_1_y=236.0&fd_1_x=290.786&fd_1_z=1053.57",
"query_overlap_percent": 68.43,
"filepath": "example3.jpg"
}
],
"stats": {
"total_results": 2,
"total_filtered_results": 2,
"total_returned_results": 2
"time_resize": 43.78,
"time_search": 265.11,
"time_total": 310.04
}
}
XML¶
<?xml version="1.0" encoding="utf-8"?>
<data>
<method>search</method>
<status>ok</status>
<error/>
<query_image>
<filepath>query.jpg</filepath>
</query_image>
<result>
<item>
<filepath>example2.jpg</filepath>
<match_percent>100.0</match_percent>
<overlay>overlay/?query=example1.jpg&target=example2.jpg&sc_2=1.00139&tr_2_x=0.0580673&tr_2_y=-0.612057&fd_2_z=1401.39&fd_2_x=400.446&fd_2_y=300.0&rot_1_y=0.349066&rot_1_x=0.0&rot_1_z=0.0&rot_2_z=0.00134855&rot_2_x=0.00343397&rot_2_y=0.35174&fd_1_y=300.0&fd_1_x=400.446&fd_1_z=1400.89</overlay>
<query_overlap_percent>99.99</query_overlap_percent>
<score>100.0</score>
<target_overlap_percent>100.0</target_overlap_percent>
</item>
<item>
<filepath>example3.jpg</filepath>
<match_percent>29.22</match_percent>
<overlay>overlay/?query=example1.jpg&target=example3.jpg&sc_2=0.990622&tr_2_x=-139.649&tr_2_y=-103.786&fd_2_z=1171.51&fd_2_x=400.446&fd_2_y=300.0&rot_1_y=0.0&rot_1_x=0.0&rot_1_z=0.0&rot_2_z=-0.00281038&rot_2_x=-0.00213862&rot_2_y=0.00861092&fd_1_y=236.0&fd_1_x=290.786&fd_1_z=1053.57</overlay>
<query_overlap_percent>68.43</query_overlap_percent>
<score>20.20</score>
<target_overlap_percent>83.59</target_overlap_percent>
</item>
</result>
<stats>
<total_results>2</total_results>
<total_filtered_results>2</total_filtered_results>
<total_returned_results>2</total_returned_results>
<time_resize>43.78</time_resize>
<time_search>265.11</time_search>
<time_total>310.04</time_total>
</stats>
</data>