welcome to linkAR technical documentation

next previous

Initiating ImageTracker:

In TrackingViewController.h we have:

#import <UIKit/UIKit.h>
#import <CVSDK/ImageMatcher.h>
#import <CVSDK/ImageTracker.h>
@interface TrackingViewController : UIViewController<matcherProtocol, trackerProtocol,ImagesTableViewControllerProtocol>

In the ViewController.m we have:

@interface TrackingViewController ()
    ImageTracker* _tracker;
    IBOutlet UIView *_trackingView;

The API_KEY is only valid for the sample package: arlab.ARDoodle.

- (void)viewDidLoad
   if (_tracker == nil) {
      //1.- Create an instance of the ImageMatcher object.
       _tracker = [[ImageTracker alloc] initWithAppKey:@"P92T0rYQY74lBPAjVNs/" useDefaultCamera:YES];
      //2.- Set the frame of the ImageTracker instance.
      [_tracker.view setFrame:self.view.frame];
      //3.- Set the type of the matching.
      [_tracker setMatchMode:matcher_mode_Image];
      //4.- Set minimum image quality threshold ,for image to be accepted to the image pool.
      [_tracker setImagePoolMinimumRating:2];
      //5.- Enable median filter, witch help to reduce noise and mismatches in IMAGE matching. (Optional)
      [_tracker setEnableMedianFilter:YES];
      [_tracker setTrackingType:tracking_type_1];
      //6.- Set the tracking and matcher delegate
      _tracker.trackingDelegate = self;
      _tracker.matcherDelegate = self;
      //7.- Add camera view instance to the matcher view.        
      [_trackingView addSubview:_tracker.view];
      [_trackingView sendSubviewToBack:_tracker.view];
      [_tracker.view setFrame:_trackingView.frame];
      [self loadImagesFromDocuments];

1-Initiates the Matcher.
2-We indicate the exact width and height that we want fo our macher view.
3-As we do not want QR recognition, we set only Image Matcher.
4-We would like to accept all images, so we set the image quality to its low.
5-In this case, we use the default camera, then the median filter is recommended.
6-We add the camera view instance to the view.
7-We set self as tracking and matcher delegate.

The functions “start” and “stop” of the library are crucial:

    [_tracker start];
-(void) viewWillDisappear:(BOOL)animated{
    [_tracker stop];

next previous