| Customize Help
| Save Settings

MocrGetResult



Function Map
Synopsis
Get the specified type of result(s) from an OCR result buffer.
Syntax
void MocrGetResult(
MIL_ID ResultOcrId, //in
MIL_INT64 ResultType, //in
void *ResultPtr //out
)
Description

This function retrieves the result(s) of the specified type from an OCR result buffer. The information can be retrieved as a text, a string or a character. A text contains one or more strings. A string contains one or more characters. Results are only available after calling MocrReadString() or MocrVerifyString().

If your target image was associated with a camera calibration context, positional and dimensional results are, by default, returned with respect to the relative coordinate system of the image. Otherwise, these results are returned in pixels, relative to the top-left pixel in the target image.

If your target image was associated with a camera calibration context but you want to retrieve positional and dimensional results in pixel units, use MocrControl() with the M_RESULT_OUTPUT_UNITS control type set to M_PIXEL. However, note that if you set M_RESULT_OUTPUT_UNITS to M_WORLD without specifying a calibrated image in which to calculate the results, MocrGetResult() will generate an error.

Note that, by default, the first string found is returned as a result. To get the result for a specific string or for all strings from a result buffer, use MocrControl() with M_SELECT_STRING.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ResultOcrId

Specifies the identifier of the OCR result buffer from which to retrieve results.

ResultType

Specifies the type of result(s) to retrieve. The following values are available to retrieve results from a read or a verify operation, unless otherwise specified.

See the Parameter associations section for possible values that can be specified.

ResultPtr
Accepts the address of one of the following (see the Parameter associations section for specifics on which is expected):
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ]
  • array of type MIL_FLOAT [optionally, in C++: a reference to a std::vector<MIL_FLOAT> ]
  • array of type MIL_INT [optionally, in C++: a reference to a std::vector<MIL_INT> ]
  • array of type MIL_INT16 [optionally, in C++: a reference to a std::vector<MIL_INT16> ]
  • array of type MIL_INT32 [optionally, in C++: a reference to a std::vector<MIL_INT32> ]
  • array of type MIL_INT64 [optionally, in C++: a reference to a std::vector<MIL_INT64> ]
  • array of type MIL_TEXT_CHAR [optionally, in C++: a reference to a MIL_STRING]
  • MIL_DOUBLE
  • MIL_FLOAT
  • MIL_INT
  • MIL_INT16
  • MIL_INT32
  • MIL_INT64
  • MIL_TEXT_CHAR

Specifies the address in which to write the results. Each line of text found within the target image is read as a separate string. If there is only one line of text, there is only one string. Only the results from the first string or selected strings (MocrControl() with M_SELECT_STRING) are obtained.

See the Parameter associations section for possible values that can be returned.

The tables below list possible values for the ResultType parameter and possible values returned to the ResultPtr parameter.

To retrieve a result for all strings, the ResultType parameter can be set to one of the following:

function map For all strings
Click to summarizeResultType Description
ResultPtr
- Possible values returned
Click to summarize M_NB_STRING +

Retrieves the number of strings read by MocrReadString().

If no strings are found, 0 is returned.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE MORE
Click to summarize M_TEXT +

Retrieves the entire text. This includes all available strings, their separators, and the terminating null character ("\0").

Note that a string separator is inserted between the different strings when getting all strings simultaneously. The actual string separator can be controlled using MocrControl() with M_TEXT_STRING_SEPARATOR. Refer to M_STRING to retrieve the strings without separators.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_TEXT_CHAR [optionally, in C++: MIL_STRING ] MORE
Click to summarize M_TEXT_SCORE +

Retrieves the match score for the entire text as determined during the read/verify operation.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE
Click to summarize M_THRESHOLD +

Retrieves the value used to binarize the target image. Note that this is available only when using an M_GENERAL OCR font context, or when using an M_CONSTRAINED OCR font context if your target image has multiple lines, or its string angle is not 0.0°.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE

The following values are available to retrieve one or more strings, unless otherwise specified. To specify the number of strings to retrieve, use MocrControl() with M_SELECT_STRING. To retrieve a result for a string or all strings, the ResultType parameter can be set to one of the following:

function map For retrieving one or more strings
Click to summarize
ResultType
Description
ResultPtr
- Possible values returned
Click to summarize M_STRING +

Retrieves the null-terminated string(s) found during the read/verify operation. By default, any unrecognized character in the string will be replaced by the most-likely character, even if the match score for that character is lower than the specified character acceptance level (MocrControl() with M_CHAR_ACCEPTANCE). You can replace all unrecognized characters in the string with an invalid character symbol by calling MocrControl() with M_CHAR_INVALID.

Note that no string separator is inserted between the different strings when getting all strings simultaneously. Refer to M_TEXT to retrieve the strings with separators.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_TEXT_CHAR MORE
Click to summarize M_STRING_ANGLE +

Retrieves the search angle of the string(s), in degrees, relative to the output coordinate system specified using MocrControl() with M_RESULT_OUTPUT_UNITS. For multiple strings, the search angle of each string is returned. Note that all strings are searched for at the same angle, so all returned values will be equivalent.

An angle interpreted with respect to the pixel coordinate system is always measured counter-clockwise. For information on the angle's direction of rotation when interpreting the angle with respect to the relative coordinate system, see the Angle convention in MIL subsection of the Working with real-world units section of Chapter 26: Calibrating your camera setup.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE  |  array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_STRING_CHAR_NUMBER +

Retrieves the number of characters in the string(s) found during the read/verify operation, not including the terminating null character ("\0") itself; this means it returns the number of characters with results. For multiple strings, the length of each null-terminated string, not including the terminating null character ("\0") itself, is returned.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE  |  array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_STRING_SCORE +

Retrieves the score calculated during the read/verify operation for the entire string(s). For multiple strings, the calculated score for each string is returned.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE  |  array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_STRING_VALID_FLAG +

Retrieves the result of the read/verify operation as a flag that denotes the validity of the string(s). The flag's validity status is determined by comparing the string's read score with the string's acceptance level (MocrControl() with M_STRING_ACCEPTANCE). For multiple strings, a validity flag for each string is returned.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE  |  array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_FALSE

Specifies that the string's score is below the string acceptance level.

Click to summarize M_TRUE

Specifies that the string's score is above the string acceptance level.

Combination value for M_STRING; M_TEXT.

You can add the following value to the above-mentioned values to get the string length (including the terminating null character).

function map For retrieving the string length (including the terminating null character).
Click to summarizeResultType Description
ResultPtr
- Possible values returned
Click to summarize M_STRING_SIZE +

Retrieves the length of one or more strings, including the terminating null character ("\0"). In the case of M_TEXT, it also includes string separators. This combination constant is useful to establish the required array size to retrieve the string.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE MORE
Combination value for M_STRING_CHAR_NUMBER; M_STRING_SIZE.

You can add the following value to the above-mentioned values to specify whether to get the total number of characters for all strings, instead of one value per string.

function map For specifying to get the total number of characters for all strings
Click to summarize
ResultType
Description
ResultPtr
- Possible values returned
Click to summarize M_SUM

Specifies to return the total number of characters for all strings, instead of one value per string. Note that the terminating null character ("\0") is ignored by this combination constant.

Note that this value cannot be combined with M_TEXT.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE MORE

The following values are available to retrieve the results for individual characters in one or more strings, unless otherwise specified. To specify the number of strings to retrieve, use MocrControl() with M_SELECT_STRING. To retrieve a result for the individual characters of one or more strings, the ResultType parameter can be set to one of the following:

function map For individual characters
Click to summarize
ResultType
Description
ResultPtr
- Possible values returned
Click to summarize M_CHAR_POSITION_X +

Retrieves the X-position of each individual character in the string or strings.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_POSITION_Y +

Retrieves the Y-position of each individual character in the string or strings.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_SCORE +

Retrieves the match score of each individual character within the string or strings.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_SIZE_X +

Retrieves the cell width of each character within the string or strings.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_SIZE_Y +

Retrieves the cell height of each character within the string or strings.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_SPACING +

Retrieves the spacing between each pair of characters in the selected string,or strings. Note that the spacing of the last character in each string is M_NULL.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_CHAR_VALID_FLAG +

Retrieves the result of the read/verify operation as flags that denote the validity of each character within the string or strings. Each flag's validity status is determined by comparing the character's read score with the character's acceptance level (MocrControl() with M_CHAR_ACCEPTANCE).

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ] MORE
Click to summarize M_FALSE

Specifies that the character's score is below the character acceptance level.

Click to summarize M_TRUE

Specifies that the character's score is above the character acceptance level.

Combination value for the values listed in For retrieving one or more strings; the values listed in For individual characters; and for the following values: M_STRING; M_TEXT.

You can add the following value to the above-mentioned values to determine the required array size (number of elements) to store the returned values.

function map For determining the required array size (number of elements) to store the returned values
Click to summarizeResultType combination value Description
ResultPtr
- Possible values returned
Click to summarize M_NB_ELEMENTS

Retrieves the required array size (number of elements) to store the returned values.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_DOUBLE MORE
Combination values for the values listed in For individual characters; and for the following values: M_NB_STRING; M_STRING_ANGLE; M_STRING_SCORE; M_STRING_SIZE; M_STRING_VALID_FLAG; M_TEXT_SCORE; M_THRESHOLD.

You can add one of the following values to the above-mentioned values to cast the requested results to a required data type.

Note: In C++, when using a standard vector (std::vector) instead of an array, the values listed in this combination table must not be used. If you need to use a specific data type, instantiate the vector with the necessary data type.

function map For specifying the data type
Click to summarizeResultType Description
ResultPtr
- Possible values returned
Click to summarize M_TYPE_MIL_DOUBLE

Casts the requested results to a MIL_DOUBLE.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_DOUBLE [optionally, in C++: a reference to a std::vector<MIL_DOUBLE> ]  |  address of a MIL_DOUBLE MORE
Click to summarize M_TYPE_MIL_FLOAT

Casts the requested results to a MIL_FLOAT.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_FLOAT [optionally, in C++: a reference to a std::vector<MIL_FLOAT> ]  |  address of a MIL_FLOAT MORE
Click to summarize M_TYPE_MIL_INT

Casts the requested results to a MIL_INT.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_INT [optionally, in C++: a reference to a std::vector<MIL_INT> ]  |  address of a MIL_INT MORE
Click to summarize M_TYPE_MIL_INT16

Casts the requested results to a MIL_INT16.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_INT16 [optionally, in C++: a reference to a std::vector<MIL_INT16> ]  |  address of a MIL_INT16 MORE
Click to summarize M_TYPE_MIL_INT32

Casts the requested results to a MIL_INT32.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_INT32 [optionally, in C++: a reference to a std::vector<MIL_INT32> ]  |  address of a MIL_INT32 MORE
Click to summarize M_TYPE_MIL_INT64

Casts the requested results to a MIL_INT64.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: array of type MIL_INT64 [optionally, in C++: a reference to a std::vector<MIL_INT64> ]  |  address of a MIL_INT64 MORE
Click to summarize M_TYPE_TEXT_CHAR

Cast the requested results to a MIL_TEXT_CHAR.

(summarize)
Expand data type infoCollapse data type info ResultPtr extra info
Data type info: Data type: address of a MIL_TEXT_CHAR  |  array of type MIL_TEXT_CHAR MORE
Compilation information
Header Include mil.h.
Library Use mil.lib; milocr.lib.
DLL Requires mil.dll; milocr.dll.
NB STRING TEXT TEXT SCORE THRESHOLD STRING STRING ANGLE STRING CHAR NUMBER STRING SCORE STRING VALID FLAG FALSE TRUE STRING SIZE SUM CHAR POSITION X CHAR POSITION Y CHAR SCORE CHAR SIZE X CHAR SIZE Y CHAR SPACING CHAR VALID FLAG FALSE TRUE NB ELEMENTS TYPE MIL DOUBLE TYPE MIL FLOAT TYPE MIL INT TYPE MIL INT16 TYPE MIL INT32 TYPE MIL INT64 TYPE TEXT CHAR STRING CHAR NUMBER