public class VSAumentia
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
IMAGE_MATCHER_MODE
Search only for images.
|
static int |
IMAGE_QR_MATCHER_MODE
Search for images and QR / bar codes simultaneously.
|
static int |
MOTION_DETECTION_ENGINE
Enable the motion detection engine
|
static int |
QR_MATCHER_MODE
Search only for QR / bar codes.
|
static int |
SCREEN_ORIENTATION_LANDSCAPE
Landscape screen orientation
|
static int |
SCREEN_ORIENTATION_PORTRAIT
Portrait screen orientation
|
static int |
VISUAL_SEARCH_ENGINE
Enable the visual search engine
|
Constructor and Description |
---|
VSAumentia() |
Modifier and Type | Method and Description |
---|---|
int |
addButtonWithRect(Rect rect)
Add Virtual Button.
|
boolean |
addButtonWithRect(Rect rect,
int uId)
Add Virtual Button with unique Id.
|
boolean |
clearButtons()
Remove all virtual buttons.
|
boolean |
deleteImage(int id)
Remove image from matching pool
|
void |
enableFilter(boolean enableFilter)
Enable filter.
|
int |
getCameraPreviewHeight()
Get camera preview height
|
int |
getCameraPreviewWidth()
Get camera preview width
|
FrameLayout |
getCameraViewInstance()
Get camera instance
|
int |
getInactivePeriod()
Get number of frames the virtual buttons will remain inactive after one is triggered.
|
static VSAumentia |
getmInstance()
VSAumentia singleton
|
void |
init(Activity context,
java.lang.String api_key,
int engineType)
VSAumentia init
Call this init method if you want to use your own camera.
|
void |
init(Activity context,
java.lang.String api_key,
int orientationMode,
int screenWidth,
int screenHeight,
boolean doAutoFocus,
int previewFormat,
FrameLayout parentLayout,
int engineType)
VSAumentia init method
Call this init method to use the build it camera.
|
int |
insertImage(Bitmap bitmap)
Add image from bitmap to the matching pool
|
boolean |
insertImage(Bitmap bitmap,
int uniqueId)
Add image from bitmap to the matching pool
|
int |
insertImage(int resourceId)
Add image from local resources to the matching pool
|
boolean |
insertImage(int resourceId,
int uniqueId)
Add image from local resources, with custom id, to the matching pool
|
boolean |
isRunning()
Check if the engine is running.
|
boolean |
isSaveMotionFrameToSD()
Get if the "save frames" flag is enabled.
|
void |
processFrame(byte[] YUVdata,
int width,
int height)
Process YUV frame
Use this method to analyze frames from your own camera. |
void |
processFrame(int[] RGBdata,
int width,
int height)
Process RGB frame
Use this method to analyze frames from your own camera. |
void |
processRGBFrame(int[] RGBdata,
int width,
int height) |
void |
processYUVFrame(byte[] YUVdata,
int width,
int height) |
void |
release()
Release engine
|
void |
releaseResources()
Clear the image matching pool
|
boolean |
removeButtonWithId(int id)
Remove Virtual Button with unique Id.
|
void |
setImageRecognitionCallback(OnImageMatched imageMatched)
Set image recognition callback.
|
void |
setInactivePeriod(int period)
Set number of frames the virtual buttons will remain inactive after one is triggered.
|
void |
setMatchingType(int matcherMode)
Set matching mode
Available modes: IMAGE_MATCHER_MODE QR_MATCHER_MODE IMAGE_QR_MATCHER_MODE |
void |
setMotionDetectionCallback(OnMotionDetected motionCallback)
Set motion detection callback.
|
void |
setQRRecognitionCallback(OnQRScanned qrCallback)
Set QR / Bar code recognition callback.
|
void |
setRecognitionThreshold(int threshold)
Set minimum score for the image to be inserted into the matching pool
|
void |
setSaveMotionFrameToSD(boolean saveMotionFrameToSD)
Set to true to save the analysed frames for debug purpose.
|
void |
start()
Start matching process
Use this function only if your are using the built in camera |
void |
stop()
Stops matching process
Use this function only if your are using the built in camera |
public static final int VISUAL_SEARCH_ENGINE
public static final int MOTION_DETECTION_ENGINE
public static final int IMAGE_MATCHER_MODE
public static final int QR_MATCHER_MODE
public static final int IMAGE_QR_MATCHER_MODE
public static final int SCREEN_ORIENTATION_PORTRAIT
public static final int SCREEN_ORIENTATION_LANDSCAPE
public static VSAumentia getmInstance()
public void init(Activity context, java.lang.String api_key, int orientationMode, int screenWidth, int screenHeight, boolean doAutoFocus, int previewFormat, FrameLayout parentLayout, int engineType)
context
- Parent activityapi_key
- App API KEYorientationMode
- Application orientation modescreenWidth
- Screen widthscreenHeight
- Screen heightdoAutoFocus
- Enable or disable camera auto focus. By default enabled.previewFormat
- ImageFormat.NV21
or PixelFormat.RGBA_8888
parentLayout
- Parent layout where to place the cameraengineType
- Engine type: VISUAL_SEARCH_ENGINE or MOTION_DETECTION_ENGINEpublic void init(Activity context, java.lang.String api_key, int engineType)
context
- Parent activityapi_key
- App API KEYengineType
- Engine type: VISUAL_SEARCH_ENGINE or MOTION_DETECTION_ENGINEpublic void release()
public void setImageRecognitionCallback(OnImageMatched imageMatched)
imageMatched
- Image matched callbackpublic void setQRRecognitionCallback(OnQRScanned qrCallback)
qrCallback
- QR recognition callbackpublic void enableFilter(boolean enableFilter)
enableFilter
- true to enable the filter, false otherwisepublic int insertImage(int resourceId)
resourceId
- Resource Idpublic boolean insertImage(int resourceId, int uniqueId)
resourceId
- Resource IduniqueId
- Custom unique id. public int insertImage(Bitmap bitmap)
bitmap
- Image bitmappublic boolean insertImage(Bitmap bitmap, int uniqueId)
bitmap
- Image bitmapuniqueId
- Custom unique id. public boolean deleteImage(int id)
id
- Image id to be removedpublic void processFrame(byte[] YUVdata, int width, int height)
OnImageMatched
and OnQRScanned
YUVdata
- Byte array containing the frame in YUV formatwidth
- Frame widthheight
- Frame heightpublic void processFrame(int[] RGBdata, int width, int height)
OnImageMatched
and OnQRScanned
RGBdata
- Byte array containing the frame in RGB formatwidth
- Frame widthheight
- Frame heightpublic void releaseResources()
public void setRecognitionThreshold(int threshold)
threshold
- Minimum image scorepublic void setMatchingType(int matcherMode)
matcherMode
- Matcher modepublic void start()
public void stop()
public boolean isRunning()
public int getCameraPreviewHeight()
public int getCameraPreviewWidth()
public FrameLayout getCameraViewInstance()
public boolean addButtonWithRect(Rect rect, int uId)
rect
- Rectangle values are represented in percentage (values from 0 to 100). uId
- Unique button Id.public int addButtonWithRect(Rect rect)
rect
- Rectangle values are represented in percentage (values from 0 to 100). public boolean removeButtonWithId(int id)
id
- Unique button Id.public boolean clearButtons()
public void setInactivePeriod(int period)
period
- Number of frames.public int getInactivePeriod()
public void setMotionDetectionCallback(OnMotionDetected motionCallback)
motionCallback
- Motion detection callbackpublic boolean isSaveMotionFrameToSD()
public void setSaveMotionFrameToSD(boolean saveMotionFrameToSD)
saveMotionFrameToSD
- Whether to save or not the analysed frames.public void processRGBFrame(int[] RGBdata, int width, int height)
public void processYUVFrame(byte[] YUVdata, int width, int height)