ReadSingleDataCode
Reads a single data code (1D or 2D) in the input image.
Applications:The main tool for reading both linear and matrix codes (Data Matrix, QR Code), including DPM.
Syntax
C++
C#
Python
def ReadSingleDataCode( state: ReadDataCodes_State, inImage: Image, inDpmParams: DpmParams, /, *, inRoi: Rectangle2D | None = None, inRoiAlignment: CoordinateSystem2D | None = None, inMatrixSymbologies: MatrixSymbologies | None = None, inLinearSymbologies: LinearSymbologies | None = None, inDetectorParams: DataCodeDetectorParams = DataCodeDetectorParams(Polarity.Any, 10, DatacodeDetectionMethod.FinderEdges, DatacodePyramidStrategy.Precise, DatacodeDecodeStrategy.Precise, DatacodeFinderTradeoff.Balanced, True, DatacodePerspectiveLevel.Low, DatacodeDistortionLevel.Low, True, 30.0, None, False), inMatrixCodeParams: MatrixCodeParams = MatrixCodeParams(8, 72, 8, 72, 3.5, 24.0, True, True, False, True, 4.0), inLinearCodeParams: LinearCodeParams = LinearCodeParams(0.9, 6.0, 4, None, True, True, None, False, 0.25), inComputeScores: bool = False, outAlignedRoi: Rectangle2D | None = None ) -> ( outDataCode: DataCode | None, outCandidates: list[Path], outNoReads: list[DataCode] )
Parameters
| Name | Type | Default | Description | |
|---|---|---|---|---|
![]() |
ioState | ReadDataCodes_State | ||
![]() |
inImage | Image | Input image | |
![]() |
inRoi | Rectangle2D | None | None | Region of interest |
![]() |
inRoiAlignment | CoordinateSystem2D | None | None | Coordinate system for the region of interest |
![]() |
inMatrixSymbologies | MatrixSymbologies | None | None | Specifies which matrix symbologies the filter should try to read |
![]() |
inLinearSymbologies | LinearSymbologies | None | None | Specifies which linear symbologies the filter should try to read |
![]() |
inDetectorParams | DataCodeDetectorParams | DataCodeDetectorParams(Polarity.Any, 10, DatacodeDetectionMethod.FinderEdges, DatacodePyramidStrategy.Precise, DatacodeDecodeStrategy.Precise, DatacodeFinderTradeoff.Balanced, True, DatacodePerspectiveLevel.Low, DatacodeDistortionLevel.Low, True, 30.0, None, False) | Parameters of the code detection algorithm, common for linear and matrix codes |
![]() |
inMatrixCodeParams | MatrixCodeParams | MatrixCodeParams(8, 72, 8, 72, 3.5, 24.0, True, True, False, True, 4.0) | Parameters specific to matrix (2D) codes |
![]() |
inDpmParams | DpmParams | Parameters specific to direct part marking codes | |
![]() |
inLinearCodeParams | LinearCodeParams | LinearCodeParams(0.9, 6.0, 4, None, True, True, None, False, 0.25) | Parameters specific to linear (1D) codes |
![]() |
inComputeScores | bool | False | Enables computing of confidence scores (slower) |
![]() |
outDataCode | DataCode | None | A code that has been correctly detected and decoded | |
![]() |
outCandidates | list[Path] | Diagnostic information about detection results | |
![]() |
outAlignedRoi | Rectangle2D | None | None | Input ROI after transformation (in the image coordinates) |
![]() |
outNoReads | list[DataCode] | List of codes that have been detected but not decoded |



