welcome to linkAR technical documentation

previous

Match Advanced

The library let users to use the library advanced api for customizing their applications and the use of the library.

5.1.- Use of library for image processing from external sources

The following functions allow users to implement their own camera or any other data source and procces the data frames.

   /**
   * Process YUV frame and return a matching result <br><br> 
   *  
   * <b>Image Matching</b> result is returned in  {@link ImageRecognitionResult} callback <br>
   * <b>QR Matching</b> result is returned in  {@link QRRecognitionResult} callback<br>
   * <b>QR ROI Matching</b> result is returned in  {@link QRROIsRecognitionResult} callback
   * 
   * @param Data image frame data in YUV representation
   * @param width frame width
   * @param height frame height
   * 
   */
   public void processFrame(byte[] YUVdata, int width, int height)       
 
   /** 
   * Process RGB frame and return a matching result <br><br>	 
   * 
   * <b>Image Matching</b> result is returned in  {@link ImageRecognitionResult} callback <br>
   * <b>QR Matching</b> result is returned in  {@link QRRecognitionResult} callback<br>
   * <b>QR ROI Matching</b> result is returned in  {@link QRROIsRecognitionResult} callback
   * 
   * @param Data image frame data in RGB representation (Pixels)
   * @param width frame width
   * @param height frame height
   * 
   */
   public void processFrame(int[] RGBdata, int width, int height)

5.2.- Cropping the images

The library support image (Data frame) cropping (Defenition scan areas as a part of the frame).

5.2.1- Cropping with use of build in camera

The cropping is defined from the top left corner of the frame in landscape and portrait mode retrospectively for both image and QR\Barcode matching.

When Portrait mode used:

  ARmatcher.SCREEN_ORIENTATION_PORTRAIT

The cropping is defined by:

When Landscape mode used:

  ARmatcher.SCREEN_ORIENTATION_LANDSCAPE

The cropping is defined by:

In order to set a croping area for image matching use:

  /**
  * Set crop rectangle for image matching
  * 
  * 
  * @param xCrop x start cropping point
  * @param yCrop y start cropping point
  * @param widthCrop cropping width
  * @param heightCrop cropping height
  */	
  public void setImageMatcherCrop(int xCrop, int yCrop, int widthCrop, int heightCrop)
 

In order to set a croping area QR\Barcode Matching use:

  /**
  * Add custom Scan region (ROI) to the scanning process
  * 
  * 
  * @param customROI ROI object
  * @return <b>"true"</b> if the scan region is valid and successfully added, <b>"false"</b> otherwise
  */
  public boolean addRoi(ROI scanRoi)

For QR\Barcode matching The library support from 1- 4 matching areas simulteniosly

Example:

    ROI r = new ROI(0, 0, 200, 400); 
    aRmatcher.addRoi(r);
 
    r = new ROI(200, 0, 200, 400); 
    aRmatcher.addRoi(r);

To find the correct maximum values for cropping borders assigned by the library ,use the folowing functions:

  /**
  *Get true height of the matching preview (Needed for cropping)
  * 
  * 
  * @return preview height
  */
  public int getTrueMatcherViewHeight()
  {
    if(orientationMode == SCREEN_ORIENTATION_PORTRAIT)
    {
      return camerawidth;
    }
    else
    {
      return cameraheight;
     }
   }
 
  /**
  *Get true width of the matching preview (Needed for cropping)
  * 
  * 		 
  * @return preview width
  */
  public int getTrueMatcherViewWidth()
  {
    if(orientationMode == SCREEN_ORIENTATION_PORTRAIT)
    {
      return cameraheight; 
    }
    else
    {
      return camerawidth;
    } 
  }

5.2.1- Cropping when external data proccesing is used

The cropping is defined from the top left corner of the frame for both image and QR\Barcode matching.

Besouse of use of external data frames the cropping borders are unknown therefore needed to be provided.

In order to set a croping area for image matching use:

  /**
  * Set crop rectangle for image matching in case when external image source is used
  * 
  * 
  * @param xCrop x start cropping point
  * @param yCrop y start cropping point
  * @param widthCrop cropping width
  * @param heightCrop cropping height
  * @param matched_FrameWidth external frame width
  * @param matched_FrameHeight  external frame height
  */	
  public synchronized void  setImageMatcherCrop(int xCrop, int yCrop, int widthCrop, int heightCrop,int matched_FrameWidth,int matched_FrameHeight)

In order to set a croping area QR\Barcode Matching use:

  /**
  * Add custom Scan region (ROI) to the scanning process
  * The regions of interest (ROIs) are applied only to matching QR\Barcode codes.
  * 
  * @param customROI ROI object
  * @param matched_FrameWidth external frame width
  * @param matched_FrameHeight  external frame height
  * 
  * @return <b>"true"</b> if the scan region is valid and successfully added, <b>"false"</b> otherwise
  */
  public boolean addRoi(ROI scanRoi,int matched_FrameWidth,int matched_FrameHeight)

For QR\Barcode matching The library support from 1- 4 matching areas simulteniosly

previous