Tizen Native API
|
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_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_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. |
Common functions, structures and enumerations used in Media Vision BarCode submodule.
Required Header
#include <mv_common.h>
Overview
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.
Related Features
This API is related with the following features:
- http://tizen.org/feature/vision.barcode_detection
- http://tizen.org/feature/vision.barcode_generation
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.
Typedef Documentation
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.
- Since :
- 2.4
typedef void* mv_source_h |
The handle to the source.
- Since :
- 2.4
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.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
true
to continue with the next iteration of the loop,
otherwisefalse
to break out of the loop
- Precondition:
- mv_engine_config_foreach_supported_attribute() will invoke this callback
Enumeration Type Documentation
enum mv_colorspace_e |
Enumeration for Media Vision colorspace.
- Since :
- 2.4
- Enumerator:
Enumeration for Media Vision mv_engine_config_h handle attribute type.
- Since :
- 2.4
enum mv_error_e |
Enumeration for Media Vision error.
- Since :
- 2.4
- Enumerator:
Function Documentation
int mv_create_engine_config | ( | mv_engine_config_h * | engine_cfg | ) |
Creates the handle to the configuration of engine.
- Since :
- 2.4
- Remarks:
- Available engine configuration attributes can be get by using mv_engine_config_foreach_supported_attribute(). The attributes can be changed by mv_engine_config_h related setters. Default values are used if the attributes are not changed.
- Parameters:
-
[out] engine_cfg The handle to the engine to be created
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- mv_engine_config_h
- mv_destroy_engine_config()
- mv_engine_config_set_double_attribute()
- mv_engine_config_set_int_attribute()
- mv_engine_config_set_bool_attribute()
- mv_engine_config_set_string_attribute()
- mv_engine_config_get_double_attribute()
- mv_engine_config_get_int_attribute()
- mv_engine_config_get_bool_attribute()
- mv_engine_config_get_string_attribute()
int mv_create_source | ( | mv_source_h * | source | ) |
Creates a source handle.
- Since :
- 2.4
- Remarks:
- You must release source by using mv_destroy_source().
- Parameters:
-
[out] source A new handle to the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- mv_destroy_source()
int mv_destroy_engine_config | ( | mv_engine_config_h | engine_cfg | ) |
Destroys the engine configuration handle and releases all its resources.
- Since :
- 2.4
- Parameters:
-
[in] engine_cfg The handle to the engine configuration to be destroyed
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] source The handle to the source to be destroyed
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_VISION_ERROR_NONE Successful MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- See also:
- mv_create_source()
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.
- Since :
- 2.4
- Remarks:
- If callback is called zero times after mv_engine_config_foreach_supported_attribute() call, then engine configuration is not supported and setting of attributes will cause no effect. In this case for all Media Vision functions which require mv_engine_config_h handle as in parameter this parameter can be set NULL.
-
If callback is called at least once, then attribute names and types obtained in the mv_supported_attribute_cb callback can be changed after mv_engine_config_h handle creation (with mv_create_engine_config() function) by corresponding setters. Although, if attributes aren't changed by setters, then default values will be used.
Changing of attribute values will affect internal functionality provided by concrete library underlying Media Vision API.
- Parameters:
-
[in] callback The iteration callback function [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_VISION_ERROR_NONE Successful MEDIA_VISION_ERROR_NO_DATA Can't determine list of supported attributes MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- See also:
- mv_engine_config_set_double_attribute()
- mv_engine_config_set_int_attribute()
- mv_engine_config_set_bool_attribute()
- mv_engine_config_set_string_attribute()
- mv_engine_config_get_double_attribute()
- mv_engine_config_get_int_attribute()
- mv_engine_config_get_bool_attribute()
- mv_engine_config_get_string_attribute()
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.
- Since :
- 2.4
- Parameters:
-
[in] engine_cfg Engine configuration from which value has to be gotten. If NULL, default attribute value will be returned [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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] engine_cfg Engine configuration from which value has to be gotten. If NULL, default attribute value will be returned [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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] engine_cfg Engine configuration from which value has to be gotten. If NULL, default attribute value will be returned [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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Remarks:
- Function allocates memory required for output value, so it has to be removed by the user himself.
- Parameters:
-
[in] engine_cfg Engine configuration from which value has to be gotten. If NULL, default attribute value will be returned [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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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_bool_attribute | ( | mv_engine_config_h | engine_cfg, |
const char * | name, | ||
bool | value | ||
) |
Sets the boolean attribute to the configuration.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in,out] source The handle to the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_VISION_ERROR_NONE Successful MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- See also:
- mv_source_fill_by_buffer()
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.
- Since :
- 2.4
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Create a source handle by calling mv_create_source()
- See also:
- mv_source_clear()
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.
- Since :
- 2.4
- Parameters:
-
[in,out] source The handle to the source [in] media_packet The handle to the media packet from which will be filled the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Create a source handle by calling mv_create_source()
- See also:
- mv_create_source()
- mv_destroy_source()
int mv_source_get_buffer | ( | mv_source_h | source, |
unsigned char ** | data_buffer, | ||
unsigned int * | buffer_size | ||
) |
Gets buffer of the media source.
- Since :
- 2.4
- Remarks:
- Note that the retrieved buffer will be destroyed when mv_destroy_source() or mv_source_clear() function is called for the source.
- Parameters:
-
[in] source The handle to the source [out] data_buffer The buffer of the source [out] buffer_size The size of buffer
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] source The handle to the source [out] image_colorspace The colorspace of an image in the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] source The handle to the source [out] image_height The height of an image in the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.4
- Parameters:
-
[in] source The handle to the source [out] image_width The width of an image in the source
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_VISION_ERROR_NONE Successful MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported