Tizen Native API
5.5
|
Common functions and enumerations used in Media Vision Face, Media Vision Image, Media Vision Surveillance and Media Vision BarCode submodules.
#include <mv_common.h>
Media Vision Common provides a set of functions that are used in Media Vision API to correctly prepare and use included modules. mv_source_h is the handler that has to be created to keep information on image or video frame data as row buffer. It can be created based on the media data stored in memory or using the media_packet_h handler. mv_source_h supported by the set of getters which allow to retrieve such image parameters as its size or colorspace (see mv_colorspace_e enumeration). The handler is usually used as parameter for functions performing computer vision tasks on the image data.
mv_engine_config_h is the handler which provides dictionary functionality. It means that it is possible to set (key, value) pairs to the mv_engine_config_h handlers and use them to transfer these values to the engine part underlying Media Vision API. Information on which attributes can be set is provided together with particular engines.
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | mv_create_source (mv_source_h *source) |
Creates a source handle. | |
int | mv_destroy_source (mv_source_h source) |
Destroys the source handle and releases all its resources. | |
int | mv_source_fill_by_media_packet (mv_source_h source, media_packet_h media_packet) |
Fills the media source based on the media packet. | |
int | mv_source_fill_by_buffer (mv_source_h source, unsigned char *data_buffer, unsigned int buffer_size, unsigned int image_width, unsigned int image_height, mv_colorspace_e image_colorspace) |
Fills the media source based on the buffer and metadata. | |
int | mv_source_clear (mv_source_h source) |
Clears the buffer of the media source. | |
int | mv_source_get_buffer (mv_source_h source, unsigned char **data_buffer, unsigned int *buffer_size) |
Gets buffer of the media source. | |
int | mv_source_get_height (mv_source_h source, unsigned int *image_height) |
Gets height of the media source. | |
int | mv_source_get_width (mv_source_h source, unsigned int *image_width) |
Gets width of the media source. | |
int | mv_source_get_colorspace (mv_source_h source, mv_colorspace_e *image_colorspace) |
Gets colorspace of the media source. | |
int | mv_create_engine_config (mv_engine_config_h *engine_cfg) |
Creates the handle to the configuration of engine. | |
int | mv_destroy_engine_config (mv_engine_config_h engine_cfg) |
Destroys the engine configuration handle and releases all its resources. | |
int | mv_engine_config_set_double_attribute (mv_engine_config_h engine_cfg, const char *name, double value) |
Sets the double attribute to the configuration. | |
int | mv_engine_config_set_int_attribute (mv_engine_config_h engine_cfg, const char *name, int value) |
Sets the integer attribute to the configuration. | |
int | mv_engine_config_set_bool_attribute (mv_engine_config_h engine_cfg, const char *name, bool value) |
Sets the boolean attribute to the configuration. | |
int | mv_engine_config_set_string_attribute (mv_engine_config_h engine_cfg, const char *name, const char *value) |
Sets the string attribute to the configuration. | |
int | mv_engine_config_set_array_string_attribute (mv_engine_config_h engine_cfg, const char *name, const char **values, unsigned int size) |
Sets the array of string attribute to the configuration. | |
int | mv_engine_config_get_double_attribute (mv_engine_config_h engine_cfg, const char *name, double *value) |
Gets the double attribute from the configuration dictionary. | |
int | mv_engine_config_get_int_attribute (mv_engine_config_h engine_cfg, const char *name, int *value) |
Gets the integer attribute from the configuration dictionary. | |
int | mv_engine_config_get_bool_attribute (mv_engine_config_h engine_cfg, const char *name, bool *value) |
Gets the boolean attribute from the configuration dictionary. | |
int | mv_engine_config_get_string_attribute (mv_engine_config_h engine_cfg, const char *name, char **value) |
Gets the string attribute from the configuration dictionary. | |
int | mv_engine_config_get_array_string_attribute (mv_engine_config_h engine_cfg, const char *name, char ***values, int *size) |
Gets the array of string attribute from the configuration dictionary. | |
int | mv_engine_config_foreach_supported_attribute (mv_supported_attribute_cb callback, void *user_data) |
Traverses the list of supported attribute names and types. | |
Typedefs | |
typedef void * | mv_engine_config_h |
The handle to the Media Vision API engine algorithms configuration. | |
typedef void * | mv_source_h |
The handle to the source. | |
typedef bool(* | mv_supported_attribute_cb )(mv_config_attribute_type_e attribute_type, const char *attribute_name, void *user_data) |
Called to get information (type and name) once for each supported attribute. |
typedef void* mv_engine_config_h |
The handle to the Media Vision API engine algorithms configuration.
Configuration is a dictionary consists of key and value pairs to collect engine-specific settings and allow Media Vision module to access them internally. Engine configuration provides developer by the possibility to make computer vision algorithms work better in particular conditions of API usage. To create engine configuration handle mv_create_engine_config() function has to be used. When configuration is not needed any more, it is required to destroy it and release resources by mv_destroy_engine_config() function.
typedef void* mv_source_h |
The handle to the source.
typedef bool(* mv_supported_attribute_cb)(mv_config_attribute_type_e attribute_type, const char *attribute_name, void *user_data) |
Called to get information (type and name) once for each supported attribute.
[in] | attribute_type | The supported attribute type |
[in] | attribute_name | The supported attribute name |
[in] | user_data | The user data passed from the mv_engine_config_foreach_supported_attribute() function |
true
to continue with the next iteration of the loop, false
to break out of the loopenum mv_colorspace_e |
Enumeration for Media Vision colorspace.
Enumeration for Media Vision mv_engine_config_h handle attribute type.
enum mv_error_e |
Enumeration for Media Vision error.
int mv_create_engine_config | ( | mv_engine_config_h * | engine_cfg | ) |
Creates the handle to the configuration of engine.
[out] | engine_cfg | The handle to the engine to be created |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_create_source | ( | mv_source_h * | source | ) |
Creates a source handle.
[out] | source | A new handle to the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_destroy_engine_config | ( | mv_engine_config_h | engine_cfg | ) |
Destroys the engine configuration handle and releases all its resources.
[in] | engine_cfg | The handle to the engine configuration to be destroyed |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_destroy_source | ( | mv_source_h | source | ) |
Destroys the source handle and releases all its resources.
[in] | source | The handle to the source to be destroyed |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_foreach_supported_attribute | ( | mv_supported_attribute_cb | callback, |
void * | user_data | ||
) |
Traverses the list of supported attribute names and types.
Using this function names of supported attributes can be obtained. Names of the attributes can be used with mv_engine_config_h related getters and setters to get/set appropriate attribute values.
[in] | callback | The iteration callback function |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_NO_DATA | Can't determine list of supported attributes |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_get_array_string_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
char *** | values, | ||
int * | size | ||
) |
Gets the array of string attribute from the configuration dictionary.
[in] | engine_cfg | Engine configuration from which values should be obtained. |
[in] | name | String key of the attribute which will be used for getting the values from the configuration dictionary |
[out] | values | The attribute to be filled with the array of string value from dictionary |
[out] | size | The number of elements in values |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
int mv_engine_config_get_bool_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
bool * | value | ||
) |
Gets the boolean attribute from the configuration dictionary.
[in] | engine_cfg | Engine configuration from which value has to be gotten |
[in] | name | String key of the attribute will be used for getting the value from the configuration dictionary |
[out] | value | The attribute to be filled with boolean value from dictionary |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_get_double_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
double * | value | ||
) |
Gets the double attribute from the configuration dictionary.
[in] | engine_cfg | Engine configuration from which value has to be gotten |
[in] | name | String key of the attribute will be used for getting the value from the configuration dictionary |
[out] | value | The attribute to be filled with double value from dictionary |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_get_int_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
int * | value | ||
) |
Gets the integer attribute from the configuration dictionary.
[in] | engine_cfg | Engine configuration from which value has to be gotten |
[in] | name | String key of the attribute will be used for getting the value from the configuration dictionary |
[out] | value | The attribute to be filled with integer value from dictionary |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_get_string_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
char ** | value | ||
) |
Gets the string attribute from the configuration dictionary.
[in] | engine_cfg | Engine configuration from which value has to be gotten |
[in] | name | String key of the attribute will be used for getting the value from the configuration dictionary |
[out] | value | The attribute to be filled with string value from dictionary |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_set_array_string_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
const char ** | values, | ||
unsigned int | size | ||
) |
Sets the array of string attribute to the configuration.
[in] | engine_cfg | Engine configuration for which values have to be set |
[in] | name | String key of the attribute will be used for storing the values into configuration dictionary |
[in] | values | The string values of the attribute |
[in] | size | The number of string values |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
int mv_engine_config_set_bool_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
bool | value | ||
) |
Sets the boolean attribute to the configuration.
[in] | engine_cfg | Engine configuration for which value has to be set |
[in] | name | String key of the attribute will be used for storing the value into configuration dictionary |
[in] | value | The boolean value of the attribute |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_set_double_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
double | value | ||
) |
Sets the double attribute to the configuration.
[in] | engine_cfg | Engine configuration for which value has to be set |
[in] | name | String key of the attribute will be used for storing the value into configuration dictionary |
[in] | value | The double value of the attribute |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_set_int_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
int | value | ||
) |
Sets the integer attribute to the configuration.
[in] | engine_cfg | Engine configuration for which value has to be set |
[in] | name | String key of the attribute will be used for storing the value into configuration dictionary |
[in] | value | The integer value of the attribute |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_engine_config_set_string_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
const char * | value | ||
) |
Sets the string attribute to the configuration.
[in] | engine_cfg | Engine configuration for which value has to be set |
[in] | name | String key of the attribute will be used for storing the value into configuration dictionary |
[in] | value | The string value of the attribute |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE | Attribute key isn't available |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_clear | ( | mv_source_h | source | ) |
Clears the buffer of the media source.
[in,out] | source | The handle to the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_fill_by_buffer | ( | mv_source_h | source, |
unsigned char * | data_buffer, | ||
unsigned int | buffer_size, | ||
unsigned int | image_width, | ||
unsigned int | image_height, | ||
mv_colorspace_e | image_colorspace | ||
) |
Fills the media source based on the buffer and metadata.
[in,out] | source | The handle to the source |
[in] | data_buffer | The buffer of image data |
[in] | buffer_size | The buffer size |
[in] | image_width | The width of image data |
[in] | image_height | The height of image data |
[in] | image_colorspace | The image colorspace |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_fill_by_media_packet | ( | mv_source_h | source, |
media_packet_h | media_packet | ||
) |
Fills the media source based on the media packet.
[in,out] | source | The handle to the source |
[in] | media_packet | The handle to the media packet from which will be filled the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_INVALID_OPERATION | Invalid operation |
MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
MEDIA_VISION_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_get_buffer | ( | mv_source_h | source, |
unsigned char ** | data_buffer, | ||
unsigned int * | buffer_size | ||
) |
Gets buffer of the media source.
[in] | source | The handle to the source |
[out] | data_buffer | The buffer of the source |
[out] | buffer_size | The size of buffer |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_get_colorspace | ( | mv_source_h | source, |
mv_colorspace_e * | image_colorspace | ||
) |
Gets colorspace of the media source.
[in] | source | The handle to the source |
[out] | image_colorspace | The colorspace of an image in the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_get_height | ( | mv_source_h | source, |
unsigned int * | image_height | ||
) |
Gets height of the media source.
[in] | source | The handle to the source |
[out] | image_height | The height of an image in the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |
int mv_source_get_width | ( | mv_source_h | source, |
unsigned int * | image_width | ||
) |
Gets width of the media source.
[in] | source | The handle to the source |
[out] | image_width | The width of an image in the source |
0
on success, otherwise a negative error value MEDIA_VISION_ERROR_NONE | Successful |
MEDIA_VISION_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_VISION_ERROR_NOT_SUPPORTED | Not supported |