How to Read DPM Codes
What is DPM (Direct Part Marking)?
It is the process of creating permanent markings on the surface of a part to help identify it. DPM Codes are used widely in industrial part tracking, from electronics manufacturing to automotive assembly. Atypical from general scenarios, DPM Codes present more challenges, including light reflection interference from the surface the code is printed on, low contrast, and complex background texture. For reference, here are two sample images of DPM codes:
Particular Parameter Required
Dynamsoft Barcode Reader (DBR) provides a parameter, DPMCodeReadingModes
, to control how to decode DPM codes. To enable the DPM feature, simply set a DPMCRM_GENERAL
mode to this parameter.
Sample Code
Below is an example illustrating how to configure the parameter DPMCodeReadingModes
to read DPM code.
-
update parameter
DPMCodeReadingModes
in your JSON template{ "CaptureVisionTemplates": [ { "Name" : "CV_0", "ImageROIProcessingNameArray": ["TA_0" ] } ], "TargetROIDefOptions" : [ { "Name" : "TA_0", "TaskSettingNameArray": [ "BR_0" ] } ], "BarcodeReaderTaskSettingOptions": [ { "Name" : "BR_0", "DPMCodeReadingModes": [ { "Mode": "DPMCRM_GENERAL" } ] } ] }
-
apply settings by calling method
InitSettingsFromFile
- C++
- Android
- Objective-C
- Swift
char szErrorMsg[256] = {0}; CCaptureVisionRouter* cvr = new CCaptureVisionRouter; cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); // more process here
try { // `cvr` is an instance of `CaptureVisionRouter`. cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); } catch (CaptureVisionRouterException e) { e.printStackTrace(); }
NSError *error; // `cvr` is an instance of `DSCaptureVisionRouter`. [self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error];
do{ //`cvr` is an instance of `CaptureVisionRouter`. try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") }catch{ // Add code to do when error occurs. }