Reputation: 33
I noticed that the Google Chrome Extension Cloud Vision returns labels or web detection with a limit of 5 labels/URLs. See the background.js file in Google Cloud Vision Chrome Extension
How could I increase the limit?
I have tried to add max_result: 100
or limit:100
and it did not work.
var detect = function(type, b64data, cb) {
var url = 'https://vision.googleapis.com/v1/images:annotate?key='+API_KEY;
var data = {
requests: [{
image: {content: b64data},
features: [{'type':type}],
max_result: 100
}]
}
http('POST', url, JSON.stringify(data), cb);
};
Upvotes: 1
Views: 516
Reputation: 33306
As can be seen in the documentation for images:annotate the format for the requests
JSON is:
{
"image": {
object(Image)
},
"features": [
{
object(Feature)
}
],
"imageContext": {
object(ImageContext)
},
}
If you want to change the maximum number of results, then that is in the Object within the features
Array:
{
"type": enum(Type),
"maxResults": number,
}
As you can see, it's maxResults
. In addition, you added it in the wrong Object.
Your requests
would be:
var data = {
requests: [{
image: {content: b64data},
features: [{
type: type,
maxResults: 100
}]
}]
};
However, the API documentation does not specify that there is a default of 5 results provided. Thus, the API may already be returning more that five results. If so, you will need to look elsewhere in the Cloud Vision extension to find what is really limiting it to 5 results.
Upvotes: 1