Tizen Native API  8.0
Media Vision Roi tracker

Tracking Region of interest inside image.

Required Header

#include <mv_roi_tracker.h>

Overview

Media Vision Roi tracker contains mv_roi_tracker_h handle to perform roi tracking. Roi Tracker handle should be created with mv_roi_tracker_create() and destroyed with mv_roi_tracker_destroy(). After creation, mv_inference_h should be set by calling mv_roi_tracker_set_coordinate() which sets coordinates of roi. After setting coordinates, mv_roi_tracker_set_tracker_type() could be called optionally in case of setting other tracker type. It is set to MV_ROI_TRACKER_TYPE_BALANCE as default. After setting tracker type, mv_roi_tracker_perform() has to be called to tracking roi of images on mv_source_h, and it sets newly generated coordinates to result parameter.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/vision.roi_tracking

It is recommended to use features in your application for reliability.
You can check if the device supports the related features for this API by using System Information, and control your application's actions accordingly.
To ensure your application is only running on devices with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on using features in your application can be found in Feature Element.

Functions

int mv_roi_tracker_create (mv_roi_tracker_h *handle)
 Creates tracker handle.
int mv_roi_tracker_destroy (mv_roi_tracker_h handle)
 Destroys tracker handle and release all its resources.
int mv_roi_tracker_configure (mv_roi_tracker_h handle, mv_engine_config_h engine_config)
 Configures the attributes of the roi tracker.
int mv_roi_tracker_prepare (mv_roi_tracker_h handle, int x, int y, int width, int height)
 Prepares roi tracker.
int mv_roi_tracker_perform (mv_roi_tracker_h handle, mv_source_h source, mv_roi_tracker_tracked_cb tracked_cb, void *user_data)
 Tracks with a given tracker on the source.

Typedefs

typedef void(* mv_roi_tracker_tracked_cb )(mv_source_h source, mv_rectangle_s roi, void *user_data)
 Called when roi in source are detected.
typedef void * mv_roi_tracker_h
 The ROI tracker handle.

Defines

#define MV_ROI_TRACKER_TYPE   "MV_ROI_TRACKER_TYPE"
 Defines MV_ROI_TRACKER_TYPE to set the type used for tracker type attribute of the engine configuration.

Define Documentation

#define MV_ROI_TRACKER_TYPE   "MV_ROI_TRACKER_TYPE"

Defines MV_ROI_TRACKER_TYPE to set the type used for tracker type attribute of the engine configuration.

Switches between SPEED, BALANCED, or ACCURACY
MV_ROI_TRACKER_TYPE_ACCURACY,
MV_ROI_TRACKER_TYPE_BALANCE,
MV_ROI_TRACKER_TYPE_SPEED.

The default type is MV_ROI_TRACKER_TYPE_BALANCE.

Since :
7.0
See also:
mv_engine_config_set_int_attribute()
mv_engine_config_get_int_attribute()

Typedef Documentation

typedef void* mv_roi_tracker_h

The ROI tracker handle.

Since :
7.0
typedef void(* mv_roi_tracker_tracked_cb)(mv_source_h source, mv_rectangle_s roi, void *user_data)

Called when roi in source are detected.

This type callback is invoked each time when mv_roi_tracker_perform() is called to provide the results of the tracked roi.

Since :
7.0
Remarks:
The roi should not be released by app. They can be used only in the callback.
Parameters:
[in]sourceThe handle to the source of the media where roi tracker were performed. source is the same object for which mv_roi_tracker_perform() was called. It should be released by calling mv_destroy_source() when it's not needed anymore.
[in]roiRoi of the tracked result.
[in]user_dataThe user data passed from callback invoking code
See also:
mv_roi_tracker_perform()

Enumeration Type Documentation

Enumeration for ROI tracker type.

Since :
7.0
Enumerator:
MV_ROI_TRACKER_TYPE_NONE 

None

MV_ROI_TRACKER_TYPE_ACCURACY 

Tracker type focused on accuracy

MV_ROI_TRACKER_TYPE_BALANCE 

Tracker type focused on balance

MV_ROI_TRACKER_TYPE_SPEED 

Tracker type focused on speed


Function Documentation

int mv_roi_tracker_configure ( mv_roi_tracker_h  handle,
mv_engine_config_h  engine_config 
)

Configures the attributes of the roi tracker.

Use this function to configure the attributes of the roi tracker which is set to engine_config.

Since :
7.0
Parameters:
[in]handleThe handle to the roi tracker
[in]engine_configThe handle to the configuration of engine.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_VISION_ERROR_NONESuccessful
MEDIA_VISION_ERROR_NOT_SUPPORTEDNot supported
MEDIA_VISION_ERROR_INVALID_PARAMETERInvalid parameter in engine_config

Creates tracker handle.

Use this function to create a tracker handle.

Since :
7.0
Remarks:
The handle should be released using mv_roi_tracker_destroy().
Parameters:
[out]handleThe handle to the tracker to be created
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_VISION_ERROR_NONESuccessful
MEDIA_VISION_ERROR_NOT_SUPPORTEDNot supported
MEDIA_VISION_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_VISION_ERROR_OUT_OF_MEMORYOut of memory
See also:
mv_roi_tracker_destroy()

Destroys tracker handle and release all its resources.

Since :
7.0
Parameters:
[in]handleThe handle to the tracker object to be destroyed
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_VISION_ERROR_NONESuccessful
MEDIA_VISION_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
Create tracker handle by using mv_roi_tracker_create()
int mv_roi_tracker_perform ( mv_roi_tracker_h  handle,
mv_source_h  source,
mv_roi_tracker_tracked_cb  tracked_cb,
void *  user_data 
)

Tracks with a given tracker on the source.

Use this function to track with a given source and ROI information which is set to 'mv_roi_tracker_prepare()'. This function returns a proper ROI coordinates of the tracked region inside given source.

Since :
7.0
Parameters:
[in]handleThe handle to the tracker object.
[in]sourceThe handle to the source of the media.
[in]tracked_cbThe callback which will receive the tracked results.
[in]user_dataThe user data passed from the code where mv_roi_tracker_perform() is invoked. This data will be accessible in tracked_cb callback.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_VISION_ERROR_NONESuccessful
MEDIA_VISION_ERROR_NOT_SUPPORTEDNot supported
MEDIA_VISION_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_VISION_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_VISION_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMATSource colorspace isn't supported
Precondition:
Create a new tracker handle by calling mv_roi_tracker_create()
int mv_roi_tracker_prepare ( mv_roi_tracker_h  handle,
int  x,
int  y,
int  width,
int  height 
)

Prepares roi tracker.

Use this function to prepare roi tracker based on the configuration. ROI related variables are used when 'mv_roi_tracker_perform()' is executed.

Since :
7.0
Parameters:
[in]handleThe handle to the roi tracker
[in]xThe x coordinate to set ROI to be tracked
[in]yThe y coordinate to set ROI to be tracked
[in]widthThe width to set ROI to be tracked
[in]heightThe height to set ROI to be tracked
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_VISION_ERROR_NONESuccessful
MEDIA_VISION_ERROR_NOT_SUPPORTEDNot supported
MEDIA_VISION_ERROR_INVALID_PARAMETERInvalid parameter