视觉系统设计实例halcon-winform-12.条码、二维码识别
条码识别是视觉中比较常见的场景。halcon中提供了对条形码和二维码的识别算子。
HOperatorSet.FindBarCode --------------条形码识别
HOperatorSet.FindDataCode2d---------------二维码识别
一、halcon实际应用-条形码
HTuple modelID = null;// 条码识别句柄
HTuple codetype = "Code 128";
HOperatorSet.CreateBarCodeModel(new HTuple(), new HTuple(), out modelID);
HObject region;
HTuple strtmp;
HOperatorSet.FindBarCode(image, out region, modelID, codetype, out strtmp);
二、halcon实际应用-二维码
HTuple modelID = null;
HOperatorSet.CreateDataCode2dModel("QR Code", new HTuple(), new HTuple(), out modelID);
HObject xlds;
HTuple strtmp, resultHandles;
HOperatorSet.FindDataCode2d(image,
out xlds,
modelID,
"stop_after_result_num",toolPar.InputPar.FindCodeNum ,
out resultHandles,
out strtmp);
效果图如下: