vsPlugin Class Reference

Inherits from UIViewController
Declared in vsPlugin.h

Overview

Visual Search Plugin:
This plugin analyzes the input video feed frames looking for matches within the images pools previously inserted. When there is a positive match, the image information will be returned.
This plugin supports QR, bar code and regular image recognition.

Add Images

– insertImage:

Add an image to the system. The system will generate an automatic unique id.

- (NSInteger)insertImage:(UIImage *)image

Parameters

image

The image to be added to the system.

Return Value

Image unique identifier, -1 if image is not added to the system (i.e. does not have enough features ).

Declared In

vsPlugin.h

– insertImageFromURL:

Add image to the system directly from URL. The system will generate an automatic unique id.

- (NSInteger)insertImageFromURL:(NSURL *)imageUrl

Parameters

imageUrl

URL that holds the image to be added to the system.

Return Value

Image unique identifier, -1 if image is not added to the system (i.e. does not have enough features or has not been downloaded properly).

Declared In

vsPlugin.h

– insertImage:withId:

Add image to the system. The user specifies the image unique id.

- (BOOL)insertImage:(UIImage *)image withId:(NSInteger)uId

Parameters

image

The image to be added to the system.

uId

The image identifier defined by the user. Must be unique.

Return Value

YES if the image has been successfully inserted, NO otherwise (i.e. does not have enough features or the id is not unique).

Declared In

vsPlugin.h

– insertImageFromURL:withId:

Add image to the system directly from URL. The user specifies the image unique id.

- (BOOL)insertImageFromURL:(NSURL *)imageUrl withId:(NSInteger)uId

Parameters

imageUrl

URL that holds the image to be added to the system.

uId

The image identifier defined by the user. Must be unique.

Return Value

YES if the image has been successfully inserted, NO otherwise (i.e. does not have enough features, has not been downloaded properly or the id is not unique).

Declared In

vsPlugin.h

Remove Images

– deleteImage:

Delete an image from the system.

- (BOOL)deleteImage:(NSInteger)uId

Parameters

uId

Image unique id.

Return Value

YES if the image has been properly deleted, NO otherwise.

Declared In

vsPlugin.h

– deleteAllImages

Remove all the images from the system.

- (BOOL)deleteAllImages

Return Value

YES if all images are properly deleted, NO otherwise.

Declared In

vsPlugin.h

Process Images / Frames

– processUIImage:saveImageToPhotoAlbum:

Process an UIImage and look for positive matches against any image added to the system or scanned QR / bar codes.

- (void)processUIImage:(UIImage *)image saveImageToPhotoAlbum:(BOOL)saveImageToPhotoAlbum

Parameters

image

Input image to be analysed.

saveImageToPhotoAlbum

Save Image to the device photo album after resize and crop. Set to YES this flag in order to check out the frame is being sent to the recognition process.

Declared In

vsPlugin.h

– processYUVFrame:saveImageToPhotoAlbum:

Process an image buffer and look for positive matches against any image added to the system or scanned QR / bar codes. Camera output settings should be either kCVPixelFormatType_420YpCbCr8BiPlanarFullRange or kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange

- (void)processYUVFrame:(CVImageBufferRef)imageBuffer saveImageToPhotoAlbum:(BOOL)saveImageToPhotoAlbum

Parameters

imageBuffer

Image buffer input to be analysed.

saveImageToPhotoAlbum

Save image to the device photo album after resize and crop. Set to YES this flag in order to check out the frame is being sent to the recognition process.

Declared In

vsPlugin.h

– processRGBFrame:saveImageToPhotoAlbum:

Process an image buffer and look for positive matches against any image added to the system or scanned QR / bar codes. Camera output settings should be kCVPixelFormatType_32BGRA

- (void)processRGBFrame:(CVImageBufferRef)imageBuffer saveImageToPhotoAlbum:(BOOL)saveImageToPhotoAlbum

Parameters

imageBuffer

Image buffer input to be analysed.

saveImageToPhotoAlbum

Save image to the device photo album after resize and crop. Set to YES this flag in order to check out the frame is being sent to the recognition process.

Declared In

vsPlugin.h

Init and Config Params

– initWithKey:setDebug:

Init the visual search plugin

- (id)initWithKey:(NSString *)key setDebug:(BOOL)isDebug

Parameters

key

License Key

isDebug

Activate debug logs.

Declared In

vsPlugin.h

– setSearchMode:

Set the engine search mode: look for regular images, look for QR / bar codes or look for all.

- (void)setSearchMode:(search_mode)smode

Parameters

smode

Search_image (Look for regular images)
Search_QRcodes (Look for QR / bar code)
Search_all (Both image and QR / bar code matching. (default option)).

Declared In

vsPlugin.h

– setMatchingThreshold:

The images added to the system receive a score between 0 and 10 indicating how “rich” the image is (number of good features for matching). The closer to 10, the easier it is to match the image and more difficult is to get a false positive. Setting this param, the user decides the minimum quality of their pool of images.

- (void)setMatchingThreshold:(NSInteger)score

Parameters

score

Score between (0-10). 0 - almost any image will be inserted, 10 - only the most feature-rich images will be inserted. default threshold value is 5

Declared In

vsPlugin.h

– getImageScore:

Get the image quality.

- (NSInteger)getImageScore:(UIImage *)image

Parameters

image

Input image to be analyzed.

Return Value

Quality score.

Declared In

vsPlugin.h

QR / BAR Codes

– addQRRect:

Add a target rect or region of interest to look for QR / bar codes. If you define several rects, you will be able to read several QR / bar codes at a time.

- (BOOL)addQRRect:(Roi *)frame

Parameters

frame

The target region of interest.

Return Value

YES if target rect successfully defined, NO otherwise (i.e. rect does not fit in the image or it overlaps other already defined rect).

Declared In

vsPlugin.h

– clearAllQRRects

Remove all target rects.

- (void)clearAllQRRects

Declared In

vsPlugin.h

Motion Filter

– initMotionDetectionWithThreshold:enableDebugLog:

Enable Motion Detection filter: the engine will not search if the device is moving. This option makes it more difficult to get false positives.

- (void)initMotionDetectionWithThreshold:(NSInteger)threshold enableDebugLog:(BOOL)debugLog

Parameters

threshold

(0,10). 0 - very sensitive, 10 less sensitive. (Default value 5)

debugLog

Display a log message when the device is considered to be moving. This flag will let you decide what threshold to set according to your expectations.

Declared In

vsPlugin.h

– removeMotionDetection

Disable Motion Detection filter.

- (void)removeMotionDetection

Declared In

vsPlugin.h

Properties

  )

Crop rect: The system will crop the input image / frame and perform the search over that cropped area. The origin (0, 0) is considered the top-left screen corner. Default (0 ,0 ,0 ,0) No cropping.

@property (assign, nonatomic) CGRect imageCropRect vs_AVAILABLE ( vs_V_0_1_1 )

Declared In

vsPlugin.h