welcome to linkAR technical documentation

next previous

Matching Results


In order to accept matching results, 3 callbacks are used. One callback for image recognition and one for the QR/BarCode codes recognition, the last one is for multiple QR/BarCode codes recognition.
Each of the callbacks must be implemented by the user.

To add the callbacks to your activity let the activity implement ARmatcherImageCallBack interface and the ARmatcherQRCallBack interface.

public class HelloMatcherlibActivity extends Activity implements ARmatcherImageCallBack, ARmatcherQRCallBack  {

4.1.- Implementation of image matching Callback


This callback is used to receive image recognition results. It receives an id of the image that was successfully matched or -1 otherwise:

  /**Callback that will accept all IMAGE recognition results */
  public void onImageRecognitionResult(int res) {
    if (res != -1) {
      // Found images with certain id
       Log.i("HELLO", "Image Recognized:"+res);				
    } 
    else {				
      //Nothing was found
    }		
  }

4.2.- Implementation of QR/BarCode recognition Callback


This callback is used to receive QR codes and BarCode codes recognition results. It receives a string of matched code or nothing otherwise:

  /**Callback that will accept all QR codes recognition results */
  public void onSingleQRrecognitionResult(String res) {		
    //Result returned in a String representation
    Log.i(TAG, "QR Recognized:"+res);
  }

4.3.- Implementation of Multiple QR/BarCode recognition Callback


This callback is used to receive QR codes and BarCode codes recognition results from multiple regions scanned. It receives an Array of ROI's (Regions of interest). Each region represents a certain scan area (rectangle) that user should define before the matching begins.

The callback returns results of all the ROI's each time any change occurs atleast in one ROI.

  /**Callback that will accept Multiple QR codes recognition results */
  public void onMultipleQRrecognitionResult(ArrayList<ROI> roiList) {
 
    /**Result of the first scan region. **/
    // String result = roiList.get(0).foundResult;
    // Result of all regions
    int i = 0;
    for(i=0; i<roiList.size(); i++){
      Log.i("HELLO", "Multiple QR Recognized:"+roiList.get(i).foundResult );
    }    
  }


Note: When you run the sample show the debug area for see the result of the matches
next previous