MIL_ID ImageBufId, | //in |
MIL_INT SizeOfCodeTypeArray, | //in |
const MIL_INT *CodeTypeArrayPtr, | //in |
MIL_INT NumCodesToDetect, | //in |
MIL_INT64 TimeoutValue, | //in |
MIL_INT64 ControlFlag, | //in |
MIL_ID DetectResultCodeId | //in |
This function detects code occurrences of most 1D code types in a specified image. It detects their code type and encoding scheme; it also establishes their position with high accuracy. You can automatically add a code model for each detected code type to a code context, using McodeModel() with M_RESET_FROM_DETECTED_RESULTS. Alternatively, you can use the detected code type and encoding scheme information to manually set up your code models with an appropriate code type and encoding scheme for the code occurrences in your images.
You can retrieve results using McodeGetResult(). Retrieve the code type and encoding scheme with M_CODE_TYPE and M_ENCODING, respectively. Prior to retrieving other results, you should ensure that McodeDetect() was successful by verifying that M_STATUS returns M_STATUS_DETECT_OK.
Some code types are a subset of another. If a code occurrence has only the common features of these code types, McodeDetect() cannot distinguish if the code occurrence is of one type or the other at decode-time. In these cases, McodeDetect() reports the following:
When the following code types cannot be differentiated |
Code type reported |
You can remove this ambiguity by restricting the possible code types with CodeTypeArrayPtr. Another reason to restrict the possible code types is if you are not interested in detecting certain code types; this will accelerate the McodeDetect() operation.
Note that this function does not detect postal, GS1 Databar, Pharmacode, 2D, or composite code types. For the list of code types supported by McodeDetect(), use McodeInquire() with M_SUPPORTED_CODE_TYPES_DETECT.
This function tries to detect the specified number of code occurrences. If it detects more than the specified number of code occurrences in the specified image, the function only stores the results of those with the best quality. If it detects less than the specified number, McodeGetResult() with M_STATUS returns M_STATUS_DETECT_FAILED.
Specifies the identifier of an image buffer that contains the code occurrences to detect. The image buffer must be an 8-bit unsigned 1-band buffer.
This image buffer can only have a rectangular region of interest (ROI) defined using MbufSetRegion() (with or without rotation). The region must be defined in vector format from a 2D graphics list (M_VECTOR or M_VECTOR_AND_RASTER). An error will be generated if the ROI is only in raster format (M_RASTER) or a non-rectangular shape.
Specifies the size of the array passed to CodeTypeArrayPtr.
When using a standard vector (std::vector) overload function in C++, you can pass M_DEFAULT to this parameter and MIL will automatically determine the size based on the number of items in the vector passed to the CodeTypeArrayPtr parameter.
For specifying the size of the code type
array
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies the default value; the default value is 0. |
||||||||||||||||||||||||||||||||||||||
Value = 0 |
Specifies that an array is not passed to CodeTypeArrayPtr. McodeDetect() will search for all code types supported by it. This value is only applicable when CodeTypeArrayPtr is set to M_NULL. (summarize)Specifies that an array is not passed to CodeTypeArrayPtr. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value > 0 |
Specifies the size of the array. |
Specifies the address of an array listing the possible code types to detect in the image. Instead of passing an array with M_SUPPORTED_CODE_TYPES_DETECT, you can set this parameter to M_NULL and set SizeOfCodeTypeArray to 0.
If an array is passed to CodeTypeArrayPtr, it can contain one or more of the following values to specify which code types to look for:
For specifying the code types to detect
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_BC412 |
Specifies a BC412 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODABAR |
Specifies a Codabar code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE39 |
Specifies a Code 39 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE93 |
Specifies a Code 93 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE128 |
Specifies a Code 128 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN8 |
Specifies an EAN 8 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN13 |
Specifies an EAN 13 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN14 |
Specifies an EAN 14 code type. |
||||||||||||||||||||||||||||||||||||||
M_GS1_128 |
Specifies a GS1-128 code type. |
||||||||||||||||||||||||||||||||||||||
M_INDUSTRIAL25 |
Specifies an Industrial 2 of 5 (standard 2 of 5) code type. |
||||||||||||||||||||||||||||||||||||||
M_INTERLEAVED25 |
Specifies an Interleaved 2 of 5 (ITF-14) code type. INFO |
||||||||||||||||||||||||||||||||||||||
M_SUPPORTED_CODE_TYPES_DETECT |
Specifies all 1D code types supported by this function. |
||||||||||||||||||||||||||||||||||||||
M_UPC_A |
Specifies a UPC-A code type. |
||||||||||||||||||||||||||||||||||||||
M_UPC_E |
Specifies a UPC-E code type. |
Specifies the total number of code occurrences to detect in the image, regardless of their code type.
For specifying the number of code occurrences to
detect
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies the default value; the default value is 1. |
||||||||||||||||||||||||||||||||||||||
Value >= 1 |
Specifies the number of code occurrences to detect. |
Specifies the code detect result buffer in which to write the results. The result buffer must have been allocated using McodeAllocResult() with M_CODE_DETECT_RESULT.
Header | Include mil.h. |
Library | Use mil.lib; milcode.lib. |
DLL | Requires mil.dll; milcode.dll. |