welcome to linkAR technical documentation

previous

Matching Advanced

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 an image and searches for an image or QR code in it.
 * 
 *  @param image to be processed
 */
- (void) processUIImage:(UIImage* )image;
 
/**
 *  Process an image and searches for an image or QR code in it.
 *  Camera output settings should be either kCVPixelFormatType_420YpCbCr8BiPlanarFullRange or kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
 *  @param image to be processed
 */
- (void)processNewCameraFrameYUV:(CVImageBufferRef)imageBuffer;
 
/**
 *  Process an image and searches for an image or QR code in it.
 *  Camera output settings should be kCVPixelFormatType_32BGRA
 *  @param image to be processed
 */
- (void)processNewCameraFrameRGB:(CVImageBufferRef)imageBuffer;

These functions do not return the result, instead the callbacks will be called with the resulting image matched or QR code description if applies.

5.2.- Setting QR areas

5.2.1- Use of built in camera

The cropping area for QR ROIs is defined from the top left corner of the frame in landscape and portrait mode retrospectively for QR\Barcode matching. It corresponds to the UI iOS coordinate system.

However, remember in Quartz core the coordinate system is defined from the bottom left corner of the frame.

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

  /**
 *  Add ROI (Region Of Intrest).
 *  @param roi the Roi to be added. ROI has the CGRect defining the crop rectangle and the QR string representation. 
 *  @return returns false if ROI's rect doesn't fit the image or it crosses other ROI.
 */
- (BOOL) addQrRoi:(Roi*) roi;

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

Example:

    Roi *r1 = [[Roi alloc] initWithRect:CGRectMake(0, 0, 160, 240)];
    Roi *r2 = [[Roi alloc] initWithRect:CGRectMake(0, 240, 160, 240)];
    Roi *r3 = [[Roi alloc] initWithRect:CGRectMake(160, 0, 160, 240)];
    Roi *r4 = [[Roi alloc] initWithRect:CGRectMake(160, 240, 160, 240)];
 
    [_cvView addQrRoi:r1];
    [_cvView addQrRoi:r2];
    [_cvView addQrRoi:r3];
    [_cvView addQrRoi:r4];

The ROI system is the same as the screen size. Then, the previous example will divide the screen size (for iPhone IDIOM (320×480)) in 4 non-overlapped equal ROIs.

5.2.1- Cropping when external data processing is used

As the ROI is not camera dependent, the behavior is the same when initiating the camera outside of the library. Therefore, it is not necessary to implement different behaviors for default camera TRUE/FALSE.

previous