Tizen Native API
|
Functions | |
int | mv_barcode_detect (mv_source_h source, mv_engine_config_h engine_cfg, mv_rectangle_s roi, mv_barcode_detected_cb detect_cb, void *user_data) |
Detects barcode(s) on source and reads message from it. | |
int | mv_barcode_generate_source (mv_engine_config_h engine_cfg, const char *message, mv_barcode_type_e type, mv_barcode_qr_mode_e qr_enc_mode, mv_barcode_qr_ecc_e qr_ecc, int qr_version, mv_source_h image) |
Generates mv_source_h with barcode image. | |
int | mv_barcode_generate_image (mv_engine_config_h engine_cfg, const char *message, int image_width, int image_height, mv_barcode_type_e type, mv_barcode_qr_mode_e qr_enc_mode, mv_barcode_qr_ecc_e qr_ecc, int qr_version, const char *image_path, mv_barcode_image_format_e image_format) |
Generates image file with barcode. | |
Typedefs | |
typedef void(* | mv_barcode_detected_cb )(mv_source_h source, mv_engine_config_h engine_cfg, const mv_quadrangle_s *barcode_locations, const char *messages[], const mv_barcode_type_e *types, int number_of_barcodes, void *user_data) |
Called when barcode detection is completed. | |
Defines | |
#define | MV_BARCODE_DETECT_ATTR_TARGET "MV_BARCODE_DETECT_ATTR_TARGET" |
Define MV_BARCODE_DETECT_ATTR_TARGET to set target attribute of the engine configuration. | |
#define | MV_BARCODE_GENERATE_ATTR_TEXT "MV_BARCODE_GENERATE_ATTR_TEXT" |
Define MV_BARCODE_GENERATE_ATTR_TEXT to set text attribute of the engine configuration. |
Barcode module consists of barcode detection and barcode generation submodules.
Required Header
#include <mv_barcode.h>
Overview
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.
Media Vision BarCode contains two submodules:
* Detection submodule, * Generation submodule.
Detection submodule can be used for detecting barcodes on image sources, reading encoded messages, getting barcode types.
This module contains mv_barcode_detect() function and mv_barcode_detected_cb callback. mv_barcode_detect() function can be called for the image determined by mv_source_h handler to detect barcodes. If barcodes were detected, then mv_barcode_detected_cb callback is called. Each detected barcode type, message and location can be processed by this callback. mv_barcode_detect() supports ROI (rectangular region of interest) specification to allow barcode detection only for the region on the image.
Generation submodule can be used for generating the barcodes and QR codes. Different encoding types (see mv_barcode_qr_mode_e), error correction codes (see mv_barcode_qr_ecc_e) and code versions are supported for QRCodes. submodule contains mv_barcode_generate_source() function to generate handler to the buffer with row image of barcode, and mv_barcode_generate_image() function to generate image file with barcode. Both functions support the set of parameters which allow API user to configure output barcode. QR codes as well as Barcodes are supported (see mv_barcode_type_e enumeration for full list of supported barcodes). For QR codes it is possible to specify error correction code and encoding mode (see mv_barcode_qr_mode_e). Generation to file supports several formats (see mv_barcode_image_format_e).
Define Documentation
#define MV_BARCODE_DETECT_ATTR_TARGET "MV_BARCODE_DETECT_ATTR_TARGET" |
Define MV_BARCODE_DETECT_ATTR_TARGET to set target attribute of the engine configuration.
- Since :
- 2.4
- See also:
- mv_barcode_detect_attr_target_e Target: 0-all, 1-1D, 2-2D
#define MV_BARCODE_GENERATE_ATTR_TEXT "MV_BARCODE_GENERATE_ATTR_TEXT" |
Define MV_BARCODE_GENERATE_ATTR_TEXT to set text attribute of the engine configuration.
- Since :
- 2.4
- Remarks:
- This attribute is only available for 1D barcode generation
- See also:
- mv_barcode_generate_attr_text_e Text: 0-invisible, 1-visible
Typedef Documentation
typedef void(* mv_barcode_detected_cb)(mv_source_h source, mv_engine_config_h engine_cfg, const mv_quadrangle_s *barcode_locations, const char *messages[], const mv_barcode_type_e *types, int number_of_barcodes, void *user_data) |
Called when barcode detection is completed.
If no barcode is detected then the method will be called, barcodes and states will be equal to NULL, and number_of_barcodes - 0.
- Since :
- 2.4
- Parameters:
-
[in] source The handle to the media source [in] engine_cfg The handle to the configuration of the engine [in] barcode_locations The quadrangle locations of detected barcodes [in] messages The decoded messages of barcodes [in] types The types of detected barcodes [in] number_of_barcodes The number of detected barcodes [in] user_data The user data passed from the mv_barcode_detect() function
- Precondition:
- mv_barcode_detect() invokes this callback
- See also:
- mv_barcode_detect()
Enumeration Type Documentation
Enumeration for supported image formats for the barcode generating.
- Since :
- 2.4
enum mv_barcode_qr_ecc_e |
Enumeration for supported QR code error correction level.
- Since :
- 2.4
- Remarks:
- This is unavailable for 1D barcodes
enum mv_barcode_qr_mode_e |
Enumeration for supported QR code encoding mode.
- Since :
- 2.4
- Remarks:
- This is unavailable for 1D barcodes
enum mv_barcode_type_e |
Enumeration for supported barcode types.
QR codes (versions 1 to 40) and set of 1D barcodes are supported
- Since :
- 2.4
- Enumerator:
Function Documentation
int mv_barcode_detect | ( | mv_source_h | source, |
mv_engine_config_h | engine_cfg, | ||
mv_rectangle_s | roi, | ||
mv_barcode_detected_cb | detect_cb, | ||
void * | user_data | ||
) |
Detects barcode(s) on source and reads message from it.
- Since :
- 2.4
- Parameters:
-
[in] source The media source handle [in] engine_cfg The handle to the configuration of the engine [in] roi Region of interest - rectangular area on the source which will be used for barcode detection Note that roi should be inside area on the source. [in] detect_cb The callback for result handling [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_INVALID_PARAMETER Invalid parameter MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format MEDIA_VISION_ERROR_INTERNAL Internal error
- Precondition:
- Create a source handle by calling mv_create_source()
- Create an engine configuration handle by calling mv_create_engine_config(), otherwise use NULL
- See also:
- mv_barcode_detected_cb()
int mv_barcode_generate_image | ( | mv_engine_config_h | engine_cfg, |
const char * | message, | ||
int | image_width, | ||
int | image_height, | ||
mv_barcode_type_e | type, | ||
mv_barcode_qr_mode_e | qr_enc_mode, | ||
mv_barcode_qr_ecc_e | qr_ecc, | ||
int | qr_version, | ||
const char * | image_path, | ||
mv_barcode_image_format_e | image_format | ||
) |
Generates image file with barcode.
Pay attention that for EAN-8 and EAN-13 barcode types the barcode type may be selected automatically and this selection depends on the input message length. Also for QR codes the version may be selected as minimum required to generate QR code with the input message length.
- Since :
- 2.4
- Remarks:
- If the text attribute of engine configuration is set to MV_BARCODE_GENERATE_ATTR_TEXT_VISIBLE, MEDIA_VISION_ERROR_INVALID_OPERATION will be return when type is MV_BARCODE_QR
-
The mediastorage privilege http://tizen.org/privilege/mediastorage is needed
if image_path is relevant to media storage.
The externalstorage privilege http://tizen.org/privilege/externalstorage is needed
if image_path is relevant to external storage.
- Parameters:
-
[in] engine_cfg The handle to the configuration of the engine [in] message The message to be encoded in the barcode [in] image_width The width of the generated image [in] image_height The height of the generated image [in] type Type of the barcode to be generated [in] qr_enc_mode Encoding mode for the message (only for QR codes; for 1D barcodes set this parameter to MV_BARCODE_QR_MODE_UNAVAILABLE) [in] qr_ecc Error correction level (only for QR codes; for 1D barcodes set this parameter to MV_BARCODE_QR_ECC_UNAVAILABLE) [in] qr_version QR code version (for 1D barcodes set this parameter to 0) [in] image_path The path to the file that has to be generated [in] image_format The format of the output image
- 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_MSG_TOO_LONG Too long or short message MEDIA_VISION_ERROR_PERMISSION_DENIED Permission denied MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported MEDIA_VISION_ERROR_INVALID_DATA Invalid data MEDIA_VISION_ERROR_INTERNAL Internal error MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Create an engine configuration handle by calling mv_create_engine_config(), otherwise use NULL
- See also:
- mv_barcode_generate_source()
int mv_barcode_generate_source | ( | mv_engine_config_h | engine_cfg, |
const char * | message, | ||
mv_barcode_type_e | type, | ||
mv_barcode_qr_mode_e | qr_enc_mode, | ||
mv_barcode_qr_ecc_e | qr_ecc, | ||
int | qr_version, | ||
mv_source_h | image | ||
) |
Generates mv_source_h with barcode image.
Pay attention that for EAN-8 and EAN-13 barcode types the barcode type may be selected automatically and this selection depends on the input message length. Also for QR codes the version may be selected as minimum required to generate QR code with the input message length.
- Since :
- 2.4
- Remarks:
- If the text attribute of engine configuration is set to MV_BARCODE_GENERATE_ATTR_TEXT_VISIBLE, MEDIA_VISION_ERROR_INVALID_OPERATION will be return when type is MV_BARCODE_QR
- Parameters:
-
[in] engine_cfg The handle to the configuration of the engine [in] message The message to be encoded in the barcode [in] type Type of the barcode to be generated [in] qr_enc_mode Encoding mode for the message (only for QR codes; for 1D barcodes set this parameter to MV_BARCODE_QR_MODE_UNAVAILABLE) [in] qr_ecc Error correction level (only for QR codes; for 1D barcodes set this parameter to MV_BARCODE_QR_ECC_UNAVAILABLE) [in] qr_version QR code version (for 1D barcodes set this parameter to 0) [in,out] image The media source handle which will be used to fill by the buffer with generated image
- 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_MSG_TOO_LONG Too long or short message MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported MEDIA_VISION_ERROR_INVALID_DATA Invalid data MEDIA_VISION_ERROR_INTERNAL Internal error MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Create an engine configuration handle by calling mv_create_engine_config(), otherwise use NULL
- See also:
- mv_barcode_generate_image()