In this article, we explain how to count successful Cloud Recognition matches. To get the accurate number of recos (recognitions), it is important to first understand the functionality of Cloud Recognition and the API tools at your disposal.
Engine SDK Cloud Reco functionality
When the Cloud Recognition API is used, an Image Recognition Query is executed to find a matching image within the Cloud database. If a match is found, it is counted as a reco.
More information can be found on How to Perform an Image Recognition Query.
In detail, during the runtime of your app, while the Cloud Reco service is running and the Device Camera is enabled, each camera frame is analyzed for two properties:
- A "scene change", which determines if the content of the camera's field of view has changed,
- Frame quality, which determines if an incoming camera frame is in-focus, exhibits no blurring and has sufficient lighting for recognition.
If both conditions are met, then the web API service will trigger a query to the Cloud database. If there is a match, then this is triggered as a reco, which in-turn increments the reco count.
NOTE: Unsuccessful queries are not counted against the quota!
View Counted Cloud Reco Queries
There are two ways to get the reco count for a cloud database:
- Through the Target Manager on the Vuforia Engine Developer Portal. Cloud Reco counts are displayed with the list of targets in your Cloud Database, providing a discrete count for each target.
- Also view the overall usage of your Cloud Database in percentage from the License Manager by entering the license key and switching to the Usage tab.
- Through the Vuforia Web Services API, you can execute a request to get the summary reports about a target. See How to Retrieve a Target Summary Report for details.
Troubleshooting discrepant Reco Counts
Inherent network latency can introduce race conditions in which more than one Cloud Recognition event would be logged at the portal. The following is one possible scenario of such an occurrence:
- A user points their camera at a target that is present in the Cloud database. Once requirements are met for scene change and frame quality, a query is sent to the Cloud Reco service.
- Before the first query response is received by the client, the user moves the device slightly (with the same target still in the camera’s view), and triggers a second query being sent to the Cloud Reco service due to a “scene change”.
- The initial query is processed by the Cloud Reco service, and the service returns a successful reco result. The client handles this query response before the second response is received.
- The second query response arrives at the client, but the first query has already been processed for this target. Thus, the client discards the second result as a duplicate response.
In the above example, both queries will be counted as successful recos towards the Cloud Database’s quota.
To limit such duplicities, the SDK Cloud Reco service should be stopped after a successful reco response is received by the client (See the section on Continuous Queries). This will help to better control when queries are triggered. A UX element can also be introduced at application level if it is desired to allow the user to manually trigger another query.
To start and stop the Cloud Recognition Search, see How to Use Cloud Recognition in Native
Another likely cause of different counts between app and the server may be due to a continuously running
vuCloudImageTargetObserverRegisterHandlers. Stop the
vuEngineRegisterStateHandler() when a successful handler is reported by the callbacks.
Unregister the handler by setting it to null once a Cloud Image Target has been recognized to prevent further cloud queries on a target that is already being tracked. Setting the function to null will not affect the tracking of a target that is activated and tracked. That target is also cached locally and moving away from the target and coming back to it will work without any additional cloud query as long as you do not destroy the
NOTE: Best practices for querying and stopping the
CloudRecoBehaviour are demonstrated in our Core Samples.