函数CreateTemplate
函数功能
创建灰度模板
C++形式
LIntExport void CreateTemplate(
const HObject& Template,
const HTuple& FirstError,
const HTuple& NumLevel,
const HTuple& Optimize,
const HTuple& GrayValues,
HTuple* TemplateID);
//参数1:模板
//参数2:尚未使用,默认255
//参数3:金字塔层数,默认4
//参数4:是否优化,默认"sort",参考值"none","sort"
//参数5:增强原始灰度值,默认"original"
//参数6:输出模板ID
//参数5
//"original",原始
//"normalized",归一化
//"gradient",
//"sobel",
C#形式
public static void CreateTemplate(
HObject template,
HTuple firstError,
HTuple numLevel,
HTuple optimize,
HTuple grayValues,
out HTuple templateID);
函数BestMatch
函数功能
快速灰度模板匹配
C++形式
LIntExport void BestMatch(
const HObject& Image,
const HTuple& TemplateID,
const HTuple& MaxError,
const HTuple& SubPixel,
HTuple* Row,
HTuple* Column,
HTuple* Error);
//参数1:输入查找图像
//参数2:模板ID
//参数3:输入与模板两者之间最大灰度值偏差,默认20,参考值>=0 && <=255
//参数4:是否通过亚像素来精确定位,默认"false",参考值"false","true"
//参数5:输出匹配原点坐标Row
//参数6:输出匹配原点坐标Column
//参数7:输出输入与模板之间匹配平均灰度偏差值
C#形式
public static void BestMatch(
HObject image,
HTuple templateID,
HTuple maxError,
HTuple subPixel,
out HTuple row,
out HTuple column,
out HTuple error);
附注
用于灰度匹配
灰度匹配就是原图像和一个模板图像的距离匹配,如果差在阈值内就算匹配成功