[go: up one dir, main page]

CN108256565A - A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio - Google Patents

A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio Download PDF

Info

Publication number
CN108256565A
CN108256565A CN201810022316.9A CN201810022316A CN108256565A CN 108256565 A CN108256565 A CN 108256565A CN 201810022316 A CN201810022316 A CN 201810022316A CN 108256565 A CN108256565 A CN 108256565A
Authority
CN
China
Prior art keywords
matching
starting point
value
recognized
dissimilarity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810022316.9A
Other languages
Chinese (zh)
Inventor
汤晖
吴泽龙
陈新
高健
贺云波
杜雪
陈桪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201810022316.9A priority Critical patent/CN108256565A/en
Publication of CN108256565A publication Critical patent/CN108256565A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/754Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries involving a deformation of the sample pattern or of the reference pattern; Elastic matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/759Region-based matching

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种基于交叉熵相异度的自适应模版匹配方法,包括:确定待识别图像的匹配起始点的坐标有效范围和坐标初始值;在坐标有效范围内,逐次按照预设平移方向和平移量调整匹配起始点,并进行相异度计算,获取各个匹配起始点所对应的相异度值;确定所有相异度值中的极小值;根据各个极小值分别对应的匹配起始点的坐标确定待识别图像中匹配目标的位置;其中,平移量与各个匹配起始点所对应的相异度值具有相同的增减性。本申请根据交叉熵相异度自适应调整平移量,可在保障匹配精度的同时有效地提高匹配速度。本申请还公开了一种基于交叉熵相异度的自适应模版匹配装置、设备及计算机可读存储介质,也具有上述有益效果。

The present application discloses an adaptive template matching method based on cross-entropy dissimilarity, which includes: determining the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized; within the effective range of coordinates, successively follow the preset translation direction Adjust the matching starting point with the translation amount, and calculate the dissimilarity to obtain the corresponding dissimilarity value of each matching starting point; determine the minimum value of all dissimilarity values; according to the matching starting point corresponding to each minimum value The coordinates of the starting point determine the position of the matching target in the image to be recognized; wherein, the translation amount has the same increase or decrease as the dissimilarity value corresponding to each matching starting point. The present application adaptively adjusts the translation amount according to the cross-entropy dissimilarity, which can effectively improve the matching speed while ensuring the matching accuracy. The present application also discloses an adaptive template matching device, equipment and computer-readable storage medium based on cross-entropy dissimilarity, which also have the above beneficial effects.

Description

一种基于交叉熵相异度的自适应模版匹配方法及装置A self-adaptive template matching method and device based on cross-entropy dissimilarity

技术领域technical field

本申请涉及图像识别技术领域,特别涉及一种基于交叉熵相异度的自适应模版匹配方法、装置、设备及计算机可读存储介质。The present application relates to the technical field of image recognition, and in particular to an adaptive template matching method, device, equipment and computer-readable storage medium based on cross-entropy dissimilarity.

背景技术Background technique

由于模板匹配是图像识别中最具代表性、最常用的方法之一,因此,如何有效地改善模板匹配算法的性能对于待识别图像中是否存在匹配目标的研究具有重要意义。Since template matching is one of the most representative and commonly used methods in image recognition, how to effectively improve the performance of template matching algorithms is of great significance for the study of whether there is a matching target in the image to be recognized.

模板匹配的算法思想是依次从待识别图像中移动选取与匹配目标的模板图像形状、大小一致的局部区域,以便与模板图像进行匹配比较,计算两者之间的相异度或者相似度,进而对该局部区域中是否存在匹配目标进行判断。The algorithm idea of template matching is to sequentially move and select the local area with the same shape and size as the template image of the matching target from the image to be recognized, so as to match and compare with the template image, calculate the degree of difference or similarity between the two, and then determine the Whether there is a matching target in the local area is judged.

模板匹配过程中控制局部区域的平移的标准主要是:在经过多次平移后能够尽量覆盖待识别图像的所有像素点。现有技术中一般通过增加局部区域每次平移的像素个数来提高匹配速度,但是,如果全局性地盲目提增加平移的像素个数会使得对匹配目标的定位精度下降。故而,现有技术中的匹配速度和匹配精度往往是一对不可调和的矛盾。The main criterion for controlling the translation of the local area during the template matching process is to cover all the pixels of the image to be recognized as much as possible after multiple translations. In the prior art, the matching speed is generally increased by increasing the number of pixels translated each time in the local area. However, if the number of pixels translated is increased blindly globally, the positioning accuracy of the matching target will be reduced. Therefore, the matching speed and matching accuracy in the prior art are often a pair of irreconcilable contradictions.

由此可见,采用何种自适应模板匹配方法,以便同时解决模板匹配过程中的速度问题和精度问题,是本领域技术人员所亟待解决的技术问题。It can be seen that what kind of adaptive template matching method to use so as to simultaneously solve the speed problem and the precision problem in the template matching process is a technical problem to be solved urgently by those skilled in the art.

发明内容Contents of the invention

本申请的目的在于提供一种基于交叉熵相异度的自适应模版匹配方法、装置、设备及计算机可读存储介质,以便在保障匹配精度的同时有效地提高匹配速度。The purpose of the present application is to provide an adaptive template matching method, device, equipment and computer-readable storage medium based on cross-entropy dissimilarity, so as to effectively improve the matching speed while ensuring the matching accuracy.

为解决上述技术问题,本申请提供一种基于交叉熵相异度的自适应模版匹配方法,包括:In order to solve the above technical problems, this application provides an adaptive template matching method based on cross-entropy dissimilarity, including:

确定待识别图像的匹配起始点的坐标有效范围和坐标初始值;Determine the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized;

在所述坐标有效范围内,逐次按照预设平移方向和平移量调整所述匹配起始点的坐标,并与匹配目标的模板图像进行相异度计算,以便获取各个匹配起始点所对应的相异度值;Within the effective range of the coordinates, adjust the coordinates of the matching starting point successively according to the preset translation direction and translation amount, and perform difference calculation with the template image of the matching target, so as to obtain the corresponding difference of each matching starting point degree value;

确定所有所述相异度值中的极小值;determining a minimum value among all said dissimilarity values;

根据各个所述极小值分别对应的匹配起始点的坐标确定所述待识别图像中匹配目标的位置;determining the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each of the minimum values;

其中,各个所述平移量与各个匹配起始点所对应的所述相异度值具有相同的增减性;所述相异度的计算表达式为:Wherein, each of the translation amounts has the same increase or decrease as the dissimilarity value corresponding to each matching starting point; the calculation expression of the dissimilarity is:

其中,所述模板图像的像素大小为a×b;p(i,j)为所述模板图像在点坐标(i,j)处的灰度值;a、b、i和j均为正整数,且1≤i≤a,1≤j≤b;(x,y)为所述待识别图像的所述匹配起始点的坐标;q(x+i,y+j)为所述待识别图像在点坐标(x+i,y+j)处的灰度值;f(x,y)为与所述匹配起始点(x,y)对应的所述相异度值。Wherein, the pixel size of the template image is a×b; p(i, j) is the gray value of the template image at point coordinates (i, j); a, b, i and j are all positive integers , and 1≤i≤a, 1≤j≤b; (x, y) is the coordinate of the matching starting point of the image to be recognized; q(x+i, y+j) is the image to be recognized Gray value at point coordinates (x+i, y+j); f(x, y) is the dissimilarity value corresponding to the matching starting point (x, y).

可选地,所述预设平移方向为列向平移。Optionally, the preset translation direction is column translation.

可选地,所述平移量的计算表达式为:Optionally, the calculation expression of the translation amount is:

其中,h为所述平移量,且为正整数;δ为含有所述匹配目标的多个样本图像与所述模板图像进行匹配所得到的相异度值的均值;c为预设系数,c≥1;[t]为取t的整数部分。Wherein, h is the translation amount, and is a positive integer; δ is the mean value of the dissimilarity values obtained by matching a plurality of sample images containing the matching target with the template image; c is a preset coefficient, c ≥1; [t] is the integer part of t.

可选地,所述根据各个所述极小值分别对应的匹配起始点的坐标确定所述待识别图像中匹配目标的位置包括:Optionally, the determining the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each of the minimum values includes:

判断相邻两个所述极小值所对应的匹配起始点之间的距离是否低于预设距离阈值;judging whether the distance between the matching starting points corresponding to two adjacent minimum values is lower than a preset distance threshold;

若是,则判定所述待识别图像在所述相邻两个极小值中的较小值所对应的匹配起始点处存在一个所述匹配目标;If so, it is determined that the image to be recognized has a matching target at the matching starting point corresponding to the smaller value of the two adjacent minimum values;

若否,则判定所述待识别图像在所述相邻两个极小值各自对应的匹配起始点处分别存在一个所述匹配目标。If not, it is determined that there is one matching target in the image to be recognized at the matching starting points respectively corresponding to the two adjacent minimum values.

可选地,所述预设距离阈值包括预设横向距离阈值和预设纵向距离阈值;Optionally, the preset distance threshold includes a preset lateral distance threshold and a preset longitudinal distance threshold;

所述判断相邻两个极小值所对应的匹配起始点之间的距离是否低于预设距离阈值包括:The judging whether the distance between the matching starting points corresponding to two adjacent minimum values is lower than the preset distance threshold includes:

判断是否所述相邻两个极小值所对应的匹配起始点之间的横向距离低于所述预设横向距离阈值,或者所述相邻两个极小值所对应的匹配起始点之间的纵向距离低于所述预设纵向距离阈值。Judging whether the lateral distance between the matching starting points corresponding to the two adjacent minimum values is lower than the preset lateral distance threshold, or the distance between the matching starting points corresponding to the two adjacent minimum values The longitudinal distance is lower than the preset longitudinal distance threshold.

本申请还提供了一种基于交叉熵相异度的自适应模版匹配装置,包括:The present application also provides an adaptive template matching device based on cross-entropy dissimilarity, including:

第一确定模块:用于确定待识别图像的匹配起始点的坐标有效范围和坐标初始值;The first determining module: used to determine the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized;

匹配模块:用于在所述坐标有效范围内,逐次按照预设平移方向和平移量调整所述匹配起始点的坐标,并与匹配目标的模板图像进行相异度计算,以便获取各个匹配起始点所对应的相异度值;Matching module: used to adjust the coordinates of the matching starting point successively according to the preset translation direction and translation amount within the effective range of the coordinates, and perform dissimilarity calculation with the template image of the matching target, so as to obtain each matching starting point The corresponding dissimilarity value;

第二确定模块:用于确定所有所述相异度值中的极小值;并根据各个所述极小值分别对应的匹配起始点的坐标确定所述待识别图像中匹配目标的位置;The second determining module: used to determine the minimum value among all the dissimilarity values; and determine the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each of the minimum values;

其中,各个所述平移量与各个匹配起始点所对应的所述相异度值具有相同的增减性;所述相异度的计算表达式为:Wherein, each of the translation amounts has the same increase or decrease as the dissimilarity value corresponding to each matching starting point; the calculation expression of the dissimilarity is:

其中,所述模板图像的像素大小为a×b;p(i,j)为所述模板图像在点坐标(i,j)处的灰度值;a、b、i和j均为正整数,且1≤i≤a,1≤j≤b;(x,y)为所述待识别图像的所述匹配起始点的坐标;q(x+i,y+j)为所述待识别图像在点坐标(x+i,y+j)处的灰度值;f(x,y)为与所述匹配起始点(x,y)对应的所述相异度值。Wherein, the pixel size of the template image is a×b; p(i, j) is the gray value of the template image at point coordinates (i, j); a, b, i and j are all positive integers , and 1≤i≤a, 1≤j≤b; (x, y) is the coordinate of the matching starting point of the image to be recognized; q(x+i, y+j) is the image to be recognized Gray value at point coordinates (x+i, y+j); f(x, y) is the dissimilarity value corresponding to the matching starting point (x, y).

可选地,所述预设平移方向为列向平移。Optionally, the preset translation direction is column translation.

可选地,所述平移量的计算表达式为:Optionally, the calculation expression of the translation amount is:

其中,h为所述平移量,且为正整数;δ为含有所述匹配目标的多个样本图像与所述模板图像进行匹配所得到的相异度值的均值;c为预设系数,c≥1;[t]为取t的整数部分。Wherein, h is the translation amount, and is a positive integer; δ is the mean value of the dissimilarity values obtained by matching a plurality of sample images containing the matching target with the template image; c is a preset coefficient, c ≥1; [t] is the integer part of t.

本申请还提供了一种基于距离度量相异度的自适应模版匹配设备,包括:The present application also provides an adaptive template matching device based on distance measure dissimilarity, including:

存储器:用于存储计算机指令;memory: used to store computer instructions;

处理器:用于执行所述计算机指令以实现如上所述的任一种基于距离度量相异度的自适应模版匹配方法的步骤。Processor: for executing the computer instructions to implement the steps of any adaptive template matching method based on distance measure dissimilarity as described above.

本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的任一种基于距离度量相异度的自适应模版匹配方法的步骤。The present application also provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the distance-based dissimilarity measures described above can be realized. Steps of an adaptive template matching method.

本申请所提供的基于交叉熵相异度的自适应模版匹配方法包括:确定待识别图像的匹配起始点的坐标有效范围和坐标初始值;在所述坐标有效范围内,逐次按照预设平移方向和平移量调整所述匹配起始点的坐标,并与匹配目标的模板图像进行相异度计算,以便获取各个匹配起始点所对应的相异度值;确定所有所述相异度值中的极小值;根据各个所述极小值分别对应的匹配起始点的坐标确定所述待识别图像中匹配目标的位置;其中,各个所述平移量与各个匹配起始点所对应的所述相异度值具有相同的增减性;所述相异度的计算表达式为:The adaptive template matching method based on cross-entropy dissimilarity provided by the present application includes: determining the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized; within the effective range of the coordinates, successively follow the preset translation direction Adjust the coordinates of the matching starting point and the translation amount, and perform dissimilarity calculation with the template image of the matching target, so as to obtain the corresponding dissimilarity value of each matching starting point; determine the extreme value of all the dissimilarity values A small value; determine the position of the matching target in the image to be recognized according to the coordinates of the matching starting points corresponding to each of the minimum values; wherein, each of the translation amounts and the corresponding degree of difference of each matching starting point The values have the same increase and decrease; the calculation expression of the dissimilarity is:

其中,所述模板图像的像素大小为a×b;p(i,j)为所述模板图像在点坐标(i,j)处的灰度值;a、b、i和j均为正整数,且1≤i≤a,1≤j≤b;(x,y)为所述待识别图像的所述匹配起始点的坐标;q(x+i,y+j)为所述待识别图像在点坐标(x+i,y+j)处的灰度值;f(x,y)为与所述匹配起始点(x,y)对应的所述相异度值。Wherein, the pixel size of the template image is a×b; p(i, j) is the gray value of the template image at point coordinates (i, j); a, b, i and j are all positive integers , and 1≤i≤a, 1≤j≤b; (x, y) is the coordinate of the matching starting point of the image to be recognized; q(x+i, y+j) is the image to be recognized Gray value at point coordinates (x+i, y+j); f(x, y) is the dissimilarity value corresponding to the matching starting point (x, y).

可见,相比于现有技术,本申请所提供的基于交叉熵相异度的自适应模版匹配方法中,采用了简洁而有效的交叉熵相异度来评判待识别图像的局部区域与模板图像的匹配程度,进而根据相异度值的大小来自适应调整对局部区域的匹配起始点进行平移时的平移量,以便在相异度值高的区域增大平移量,而在相异度值低的区域减小平移量,由此可在保障匹配精度的同时有效地提高匹配速度。本申请所提供的基于交叉熵相异度的自适应模版匹配装置、设备及计算机可读存储介质可以实现上述基于交叉熵相异度的自适应模版匹配方法,同样具有上述有益效果。It can be seen that, compared with the prior art, in the self-adaptive template matching method based on cross-entropy dissimilarity provided by the present application, a simple and effective cross-entropy dissimilarity is used to judge the local area of the image to be recognized and the template image Then, according to the size of the dissimilarity value, the translation amount is adaptively adjusted when the matching starting point of the local area is translated, so that the translation amount can be increased in the area with high dissimilarity value, and the translation amount can be increased in the area with low dissimilarity value The area of the algorithm reduces the amount of translation, thereby effectively improving the matching speed while ensuring the matching accuracy. The cross-entropy dissimilarity-based adaptive template matching device, equipment, and computer-readable storage medium provided by the present application can realize the above-mentioned adaptive template matching method based on cross-entropy dissimilarity, and also have the above-mentioned beneficial effects.

附图说明Description of drawings

为了更清楚地说明现有技术和本申请实施例中的技术方案,下面将对现有技术和本申请实施例描述中需要使用的附图作简要的介绍。当然,下面有关本申请实施例的附图描述的仅仅是本申请中的一部分实施例,对于本领域普通技术人员来说,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图,所获得的其他附图也属于本申请的保护范围。In order to illustrate the prior art and the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings that need to be used in the description of the prior art and the embodiments of the present application. Of course, the following drawings related to the embodiments of the application describe only a part of the embodiments of the application, and those of ordinary skill in the art can obtain other The accompanying drawings, and other obtained drawings also belong to the protection scope of the present application.

图1为本申请实施例所提供的一种基于交叉熵相异度的自适应模版匹配方法的流程图;FIG. 1 is a flow chart of an adaptive template matching method based on cross-entropy dissimilarity provided by an embodiment of the present application;

图2为本申请实施例所提供的一种基于交叉熵相异度的自适应模版匹配装置的结构框图。FIG. 2 is a structural block diagram of an adaptive template matching device based on cross-entropy dissimilarity provided by an embodiment of the present application.

具体实施方式Detailed ways

本申请的核心在于提供一种基于交叉熵相异度的自适应模版匹配方法、装置、设备及计算机可读存储介质,以便在保障匹配精度的同时有效地提高匹配速度。The core of the present application is to provide an adaptive template matching method, device, equipment and computer-readable storage medium based on cross-entropy dissimilarity, so as to effectively improve the matching speed while ensuring the matching accuracy.

为了对本申请实施例中的技术方案进行更加清楚、完整地描述,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行介绍。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Apparently, the described embodiments are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

请参考图1,图1为本申请实施例所提供的一种基于交叉熵相异度的自适应模版匹配方法的流程图,主要包括以下步骤:Please refer to FIG. 1. FIG. 1 is a flow chart of an adaptive template matching method based on cross-entropy dissimilarity provided by the embodiment of the present application, which mainly includes the following steps:

步骤1:确定待识别图像的匹配起始点的坐标有效范围和坐标初始值。Step 1: Determine the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized.

具体地,当选定了局部区域后进行相异度计算时,具体是从该局部区域的匹配起始点处开始,在该局部区域内以1个像素为单位进行遍历,根据局部区域内的所有像素点的灰度值与模板图像的像素点的灰度值进行相异度计算。在进行模板匹配时,为了依次将从待识别图像中选取的局部区域与模板图像的各个像素点依次进行比较,需要分别为待识别图像和模板图像设定原点和统一的坐标轴方向。一般地,可将待识别图像和模板图像的左上顶点分别设为各自的原点,继而将水平向右和竖直向下分别设为横坐标方向和纵坐标方向。由于局部区域涵盖了多个像素点,所以一般可以用匹配起始点来衡量局部区域的位置。类似地,一般会将该局部区域的左上顶点的像素点作为其匹配起始点。Specifically, when the dissimilarity calculation is performed after a local area is selected, starting from the matching starting point of the local area, traversal is performed in the local area in units of 1 pixel, and according to all The difference between the gray value of the pixel and the gray value of the pixel of the template image is calculated. When performing template matching, in order to sequentially compare the local area selected from the image to be recognized with each pixel of the template image, it is necessary to set the origin and a unified coordinate axis direction for the image to be recognized and the template image respectively. Generally, the upper left vertices of the image to be recognized and the template image can be set as their respective origins, and then the horizontal to the right and vertical downward can be set to the abscissa direction and the ordinate direction respectively. Since the local area covers multiple pixel points, the matching starting point can generally be used to measure the position of the local area. Similarly, generally, the pixel point of the upper left vertex of the local area is used as the matching start point.

匹配起始点的坐标就代表了相应局部区域的范围,即当模板图像的像素大小为a×b、待识别图像的匹配起始点的坐标为(x,y)时,该匹配起始点对应的局部区域即为以像素点(x,y)为左上顶点、纵长为a而横长为b的区域。并且,为避免局部区域超出待识别图像的范围,匹配起始点的坐标应当有一个坐标有效范围。使得匹配起始点在该坐标有效范围内进行平移时,既不会令对应的局部区域超出待识别图像范围,又可以在经过沿预设平移方向进行多次平移后实现覆盖待识别图像。The coordinates of the matching starting point represent the range of the corresponding local area, that is, when the pixel size of the template image is a×b and the coordinates of the matching starting point of the image to be recognized are (x, y), the local area corresponding to the matching starting point The area is the area with the pixel point (x, y) as the upper left vertex, the vertical length is a, and the horizontal length is b. Moreover, in order to prevent the local area from exceeding the scope of the image to be recognized, the coordinates of the matching starting point should have a valid range of coordinates. When the matching starting point is translated within the effective range of the coordinates, the corresponding local area will not exceed the range of the image to be identified, and the image to be identified can be covered after multiple translations along the preset translation direction.

例如,若待识别图像的像素大小为A×B,则为避免局部区域超出待识别图像的范围,可令匹配起始点在待识别图像中(A-a)×(B-b)的坐标有效范围内进行有序平移;而对应的坐标起始点的坐标初始值为(1,1)。For example, if the pixel size of the image to be recognized is A×B, in order to prevent the local area from exceeding the range of the image to be recognized, the matching starting point can be made within the effective range of the coordinates of (A-a)×(B-b) in the image to be recognized. order translation; and the initial coordinates of the corresponding coordinate starting point are (1,1).

步骤2:在坐标有效范围内,逐次按照预设平移方向和平移量调整匹配起始点的坐标,并根据公式Step 2: Within the valid range of coordinates, adjust the coordinates of the matching starting point successively according to the preset translation direction and translation amount, and according to the formula

与匹配目标的模板图像进行相异度计算,以便获取各个匹配起始点所对应的相异度,各个平移量与各个匹配起始点所对应的相异度值具有相同的增减性。 Calculate the dissimilarity with the template image of the matching target to obtain the dissimilarity corresponding to each matching starting point, and each translation amount has the same increase or decrease as the dissimilarity value corresponding to each matching starting point.

其中,模板图像的像素大小为a×b;p(i,j)为模板图像在点坐标(i,j)处的灰度值;a、b、i和j均为正整数,且1≤i≤a,1≤j≤b;(x,y)为待识别图像的匹配起始点的坐标;q(x+i,y+j)为待识别图像在点坐标(x+i,y+j)处的灰度值;f(x,y)为与匹配起始点(x,y)对应的相异度值。Among them, the pixel size of the template image is a×b; p(i, j) is the gray value of the template image at point coordinates (i, j); a, b, i and j are all positive integers, and 1≤ i≤a, 1≤j≤b; (x, y) is the coordinate of the matching starting point of the image to be recognized; q(x+i, y+j) is the point coordinate of the image to be recognized at (x+i, y+ The gray value at j); f(x, y) is the dissimilarity value corresponding to the matching starting point (x, y).

本申请实施例所提供的自适应模板匹配算法是基于交叉熵计算相异度的。交叉熵是Shannon信息论中一个重要概念,主要用于度量两个概率分布间的差异性信息,在特征工程中,可以用来衡量两个随机变量之间的差异性。基于交叉熵进行计算的相异度,不仅简洁而且有效,尤其适合于像素灰度值的交叉熵特性显著的图像识别应用场合。The adaptive template matching algorithm provided by the embodiment of the present application calculates the degree of dissimilarity based on cross entropy. Cross-entropy is an important concept in Shannon's information theory. It is mainly used to measure the difference information between two probability distributions. In feature engineering, it can be used to measure the difference between two random variables. The dissimilarity calculated based on cross-entropy is not only simple but also effective, and is especially suitable for image recognition applications with significant cross-entropy characteristics of pixel gray values.

具体地,预设平移方向可由本领域技术人员根据实际应用情况自行选择并设置。例如,以左上顶点为坐标原点时,可令匹配起始点从坐标起始点处逐行地行向平移,也可以逐列地列向平移。列向平移是指将匹配起始点在列内从上向下(以左上顶点为原点时)进行平移,当平移到该列的底部时再换到下一列的顶部继续向下平移;行向平移具体是指将匹配起始点在行内从左向右(以左上顶点为原点时)进行平移,当平移到该列的右端时再换到下一行继续向右平移。则当匹配起始点在(A-a)×(B-b)的坐标有效范围内平移结束之后,再次对其进行平移后的坐标必然会落在该坐标有效范围之外,因此,具体可将匹配起始点的坐标不在该坐标有效范围之内作为预设终止条件。Specifically, the preset translation direction can be selected and set by those skilled in the art according to actual application conditions. For example, when the upper left vertex is taken as the coordinate origin, the matching start point can be shifted row by row from the coordinate start point, or it can be shifted column by column. Column-to-column translation means to translate the matching starting point in the column from top to bottom (with the upper left vertex as the origin), and when it reaches the bottom of the column, switch to the top of the next column and continue to pan down; row-to-row translation Specifically, it means that the matching starting point is translated from left to right in the row (when the upper left vertex is used as the origin), and when the translation reaches the right end of the column, then switch to the next row and continue to translate to the right. Then when the matching start point is translated within the effective range of coordinates of (A-a)×(B-b), the coordinates after it is translated again must fall outside the valid range of the coordinates. Therefore, the matching starting point can be specifically The coordinate is not within the valid range of the coordinate as the default termination condition.

此外,匹配起始点的平移量具体是与相异度值的大小是同增减性自适应的。在当前匹配起始点所对应的相异度值较大时,说明此时选取的局部区域与模板图像相差较大,存在匹配目标的可能性较低,因此,可以适当地提高每次进行平移时的平移量,以便适当地提高匹配速度。而在当前匹配起始点所对应的相异度值较小时,说明此时选取的局部区域与模板图像相差不大,存起匹配目标的可能性较高,因此,可以适当地减少每次进行平移时的平移量,以便保障对匹配目标的识别精度。In addition, the translation amount of the matching starting point is specifically adaptive to the same increase or decrease as the value of the dissimilarity. When the dissimilarity value corresponding to the current matching starting point is large, it means that the local area selected at this time has a large difference from the template image, and the possibility of matching the target is low. The amount of translation in order to increase the matching speed appropriately. When the dissimilarity value corresponding to the current matching starting point is small, it means that the local area selected at this time is not much different from the template image, and the possibility of saving the matching target is high. Therefore, each translation can be appropriately reduced In order to ensure the recognition accuracy of matching targets.

步骤3:确定所有相异度值中的极小值。Step 3: Determine the minimum value among all dissimilarity values.

步骤4:根据各个极小值分别对应的匹配起始点的坐标确定待识别图像中匹配目标的位置。Step 4: Determine the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each minimum value.

具体地,当经过步骤3判定满足预设终止条件之后,即可根据历史存储的各个相异度值来确定待识别图像中匹配目标的位置。本申请实施例具体是基于极小值来判定匹配目标的位置的:根据极小值的物理含义可知,待识别图像很可能在极小值所对应的匹配起始点处或者之间的区域处存在着匹配目标。Specifically, after step 3 determines that the preset termination condition is met, the position of the matching target in the image to be recognized can be determined according to the historically stored dissimilarity values. The embodiment of the present application specifically determines the position of the matching target based on the minimum value: according to the physical meaning of the minimum value, the image to be recognized is likely to exist at the matching start point corresponding to the minimum value or in the area between to match the target.

可见,本申请实施例所提供的基于交叉熵相异度的自适应模版匹配方法中,采用了简洁而有效的交叉熵相异度来评判待识别图像的局部区域与模板图像的匹配程度,进而根据相异度值的大小来自适应调整对局部区域的匹配起始点进行平移时的平移量,以便在相异度值高的区域增大平移量,而在相异度值低的区域减小平移量,由此可在保障匹配精度的同时有效地提高匹配速度。It can be seen that in the self-adaptive template matching method based on cross-entropy dissimilarity provided by the embodiment of the present application, a simple and effective cross-entropy dissimilarity is used to judge the degree of matching between the local area of the image to be recognized and the template image, and then Adaptively adjust the translation amount when translating the matching starting point of the local area according to the size of the dissimilarity value, so that the translation amount is increased in the area with a high dissimilarity value, and the translation is decreased in an area with a low dissimilarity value Therefore, the matching speed can be effectively improved while ensuring the matching accuracy.

本申请所提供的基于交叉熵相异度的自适应模版匹配方法,在上述实施例的基础上:The adaptive template matching method based on cross-entropy dissimilarity provided by this application, on the basis of the above-mentioned embodiments:

作为一种优选实施例,预设平移方向为列向平移。As a preferred embodiment, the preset translation direction is column translation.

具体地,一般可选择计算机领域内所习惯采用的列向的平移方式来对匹配起始点进行更新。当然,本领域内技术人员也可以采用其他方式,本申请实施例对此并不进行限定。Specifically, the column-oriented translation method commonly used in the computer field can generally be selected to update the matching starting point. Certainly, those skilled in the art may also adopt other manners, which are not limited in this embodiment of the present application.

作为一种优选实施例,平移量的计算表达式为:As a preferred embodiment, the calculation expression of translation amount is:

其中,h为平移量,且为正整数;δ为含有匹配目标的多个样本图像与模板图像进行匹配所得到的相异度值的均值;c为预设系数,c≥1;[t]为取t的整数部分。Among them, h is the translation amount, and it is a positive integer; δ is the average value of the dissimilarity value obtained by matching multiple sample images containing matching targets with the template image; c is the preset coefficient, c≥1; [t] is to take the integer part of t.

如前所述,具体可采用列向的平移方式。具体地,可令平移量h随着相异度值f(x,y)与δ的比值而正比例变化,比例系数即预设系数c可由本领域技术人员预先设定。由于一般应至少平移一个像素点,所以c应当至少大于或等于1。δ表征了含有匹配目标的样本图像与模板图像的匹配结果的一般平均水平,其中,所说的样本图像为随机选取的含有该匹配目标的图像。As mentioned above, specifically, a column-wise translation method can be used. Specifically, the translation amount h can be made to change proportionally with the ratio of the dissimilarity value f(x, y) to δ, and the proportional coefficient, ie, the preset coefficient c, can be preset by those skilled in the art. Since generally at least one pixel point should be translated, c should be at least greater than or equal to 1. δ represents the general average level of the matching results between the sample image containing the matching object and the template image, wherein the sample image is an image containing the matching object randomly selected.

当然,本领域技术人员也可以采用其他方式来计算平移量h,本申请对此并不进行限定。Certainly, those skilled in the art may also use other methods to calculate the translation amount h, which is not limited in the present application.

当采用列向的平移方式时,可以对每次更新后的平移量h进行大小限定,以防止该平移量h过大而跳过部分含有匹配目标的区域,影响匹配精度。具体地,可将平移量h设置为不大于模板图像的纵长a,即1≤h≤a。在确保平移量h大小时,具体可采用饱和函数进行处理。When the column-oriented translation method is used, the translation amount h after each update can be limited in size to prevent the translation amount h from being too large and skipping some regions containing the matching target, which affects the matching accuracy. Specifically, the translation amount h can be set to be not greater than the vertical length a of the template image, that is, 1≤h≤a. When ensuring the magnitude of the translation amount h, specifically, a saturation function can be used for processing.

作为一种优选实施例,根据各个极小值分别对应的匹配起始点的坐标确定待识别图像中匹配目标的位置包括:As a preferred embodiment, determining the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each minimum value includes:

判断相邻两个极小值所对应的匹配起始点之间的距离是否低于预设距离阈值;Judging whether the distance between the matching starting points corresponding to two adjacent minimum values is lower than the preset distance threshold;

若是,则判定待识别图像在相邻两个极小值中的较小值所对应的匹配起始点处存在一个匹配目标;If so, it is determined that there is a matching target at the matching starting point corresponding to the smaller value of the adjacent two minimum values in the image to be recognized;

若否,则判定待识别图像在相邻两个极小值各自对应的匹配起始点处分别存在一个匹配目标。If not, it is determined that there is a matching target in the image to be recognized at the matching start points corresponding to the two adjacent minimum values respectively.

具体地,本申请实施例所提供的基于交叉熵相异度的自适应模版匹配方法在根据各个相异度值进行匹配目标的确定时,具体是基于极小值来判定的。为了区分待识别图像究竟是在某个极小值所对应的匹配起始点处(局部区域处)、还是在多个极小值所对应的匹配起始点之间的区域处存在匹配目标,本申请实施例对相邻两个极小值所对应的匹配起始点之间的距离进行了判断。Specifically, in the adaptive template matching method based on cross-entropy dissimilarity provided in the embodiment of the present application, when determining the matching target according to each dissimilarity value, the determination is specifically based on the minimum value. In order to distinguish whether the image to be recognized has a matching target at the matching starting point (local area) corresponding to a certain minimum value, or in the area between matching starting points corresponding to multiple minimum values, the present application In this embodiment, the distance between matching starting points corresponding to two adjacent minimum values is judged.

若该距离小于预设距离阈值,则说明这两个匹配起始点相距很近,应当是属于上述第二种情况。而这两个极小值所共同描述的这个匹配目标的具体位置,可由这两个相邻极小值中的较小值来确定,即该较小值对应的匹配起始点处存在着匹配目标。假设该较小值对应的匹配起始点坐标为(x1,y1),则匹配目标的中心的位置坐标即可被认为是(x1+a/2,y1+b/2)。If the distance is less than the preset distance threshold, it means that the two matching starting points are very close to each other, which should belong to the above-mentioned second situation. The specific position of the matching target described by these two minimum values can be determined by the smaller value of the two adjacent minimum values, that is, there is a matching target at the matching starting point corresponding to the smaller value . Assuming that the coordinates of the matching start point corresponding to the smaller value are (x1, y1), the position coordinates of the center of the matching target can be regarded as (x1+a/2, y1+b/2).

若该相邻两个极小值所对应的匹配起始点之间的距离不小于预设距离阈值,则说明这两个匹配起始点相距较远,应当是属于上述第一种情况。因此可判定待识别图像在两个极小值所对应的匹配起始点处分别存在一个匹配目标。If the distance between the matching starting points corresponding to the two adjacent minimum values is not less than the preset distance threshold, it means that the two matching starting points are far apart, which should belong to the first case above. Therefore, it can be determined that there is a matching target at the matching start points corresponding to the two minimum values in the image to be recognized.

作为一种优选实施例,预设距离阈值包括预设横向距离阈值和预设纵向距离阈值;As a preferred embodiment, the preset distance threshold includes a preset horizontal distance threshold and a preset longitudinal distance threshold;

判断相邻两个极小值所对应的匹配起始点之间的距离是否低于预设距离阈值包括:Judging whether the distance between the matching start points corresponding to two adjacent minimum values is lower than the preset distance threshold includes:

判断是否相邻两个极小值所对应的匹配起始点之间的横向距离低于预设横向距离阈值,或者相邻两个极小值所对应的匹配起始点之间的纵向距离低于预设纵向距离阈值。Judging whether the horizontal distance between the matching start points corresponding to two adjacent minimum values is lower than the preset horizontal distance threshold, or whether the vertical distance between the matching starting points corresponding to two adjacent minimum values is lower than the preset Set the vertical distance threshold.

具体地,本申请实施例所采用的预设距离阈值包括两个:预设横向距离阈值和预设纵向距离阈值,分别用于评判两个极小值对应匹配起始点的横向距离和纵向距离。并且,具体地,该预设横向距离阈值和预设纵向距离阈值可分别设置为模板图像的横长b和纵长a。当然,本领域技术人员还可以自行选择并设置其他阈值,本申请实施例对此均不进行限定。Specifically, the preset distance thresholds used in the embodiment of the present application include two preset horizontal distance thresholds and preset vertical distance thresholds, which are respectively used to judge the horizontal distance and vertical distance corresponding to the matching starting point of two minimum values. And, specifically, the preset horizontal distance threshold and the preset vertical distance threshold may be respectively set as the horizontal length b and the vertical length a of the template image. Certainly, those skilled in the art may also select and set other thresholds by themselves, which is not limited in the embodiments of the present application.

下面对本申请实施例所提供的基于交叉熵相异度的自适应模版匹配装置进行介绍。The following is an introduction to the adaptive template matching device based on the cross-entropy dissimilarity provided by the embodiment of the present application.

请参阅图2,图2为本申请所提供的一种基于交叉熵相异度的自适应模版匹配装置的结构框图;包括第一确定模块1、匹配模块2和第二确定模块3;Please refer to FIG. 2. FIG. 2 is a structural block diagram of an adaptive template matching device based on cross-entropy dissimilarity provided by the present application; it includes a first determination module 1, a matching module 2 and a second determination module 3;

第一确定模块1用于确定待识别图像的匹配起始点的坐标有效范围和坐标初始值;The first determination module 1 is used to determine the effective range of coordinates and the initial value of the coordinates of the matching starting point of the image to be recognized;

匹配模块2用于在坐标有效范围内,逐次按照预设平移方向和平移量调整匹配起始点的坐标,并与匹配目标的模板图像进行相异度计算,以便获取各个匹配起始点所对应的相异度值;The matching module 2 is used to adjust the coordinates of the matching starting point successively according to the preset translation direction and translation amount within the effective range of the coordinates, and perform difference calculation with the template image of the matching target, so as to obtain the corresponding matching starting point. Differential value;

第二确定模块3用于确定所有相异度值中的极小值;并根据各个极小值分别对应的匹配起始点的坐标确定待识别图像中匹配目标的位置;The second determination module 3 is used to determine the minimum value in all dissimilarity values; and determine the position of the matching target in the image to be recognized according to the coordinates of the matching starting point corresponding to each minimum value;

其中,各个平移量与各个匹配起始点所对应的相异度值具有相同的增减性;相异度的计算表达式为:Among them, each translation amount has the same increase or decrease as the dissimilarity value corresponding to each matching starting point; the calculation expression of the dissimilarity is:

其中,模板图像的像素大小为a×b;p(i,j)为模板图像在点坐标(i,j)处的灰度值;a、b、i和j均为正整数,且1≤i≤a,1≤j≤b;(x,y)为待识别图像的匹配起始点的坐标;q(x+i,y+j)为待识别图像在点坐标(x+i,y+j)处的灰度值;f(x,y)为与匹配起始点(x,y)对应的相异度值。Among them, the pixel size of the template image is a×b; p(i, j) is the gray value of the template image at point coordinates (i, j); a, b, i and j are all positive integers, and 1≤ i≤a, 1≤j≤b; (x, y) is the coordinate of the matching starting point of the image to be recognized; q(x+i, y+j) is the point coordinate of the image to be recognized at (x+i, y+ The gray value at j); f(x, y) is the dissimilarity value corresponding to the matching starting point (x, y).

可见,本申请所提供的基于交叉熵相异度的自适应模版匹配装置,采用了简洁而有效的交叉熵相异度来评判待识别图像的局部区域与模板图像的匹配程度,进而根据相异度值的大小来自适应调整对局部区域的匹配起始点进行平移时的平移量,以便在相异度值高的区域增大平移量,而在相异度值低的区域减小平移量,由此可在保障匹配精度的同时有效地提高匹配速度。It can be seen that the self-adaptive template matching device based on cross-entropy dissimilarity provided by the present application uses simple and effective cross-entropy dissimilarity to judge the degree of matching between the local area of the image to be recognized and the template image, and then according to the dissimilarity The size of the degree value is adapted to adjust the translation amount when the matching starting point of the local area is translated, so that the translation amount is increased in the area with a high dissimilarity value, and the translation amount is decreased in the area with a low dissimilarity value. This can effectively improve the matching speed while ensuring the matching accuracy.

本申请所提供的基于交叉熵相异度的自适应模版匹配装置,在上述实施例的基础上:The adaptive template matching device based on cross-entropy dissimilarity provided by this application, on the basis of the above-mentioned embodiments:

作为一种优选实施例,预设平移方向为列向平移。As a preferred embodiment, the preset translation direction is column translation.

作为一种优选实施例,平移量的计算表达式为:As a preferred embodiment, the calculation expression of translation amount is:

其中,h为平移量,且为正整数;δ为含有匹配目标的多个样本图像与模板图像进行匹配所得到的相异度值的均值;c为预设系数,c≥1;[t]为取t的整数部分。Among them, h is the translation amount, and it is a positive integer; δ is the average value of the dissimilarity value obtained by matching multiple sample images containing matching targets with the template image; c is the preset coefficient, c≥1; [t] is to take the integer part of t.

本申请还提供了一种基于距离度量相异度的自适应模版匹配设备,包括:The present application also provides an adaptive template matching device based on distance measure dissimilarity, including:

存储器:用于存储计算机指令;memory: used to store computer instructions;

处理器:用于执行所述计算机指令以实现以上所介绍的任一种基于距离度量相异度的自适应模版匹配方法的步骤。Processor: used to execute the computer instructions to implement the steps of any one of the above-mentioned adaptive template matching methods based on distance measure dissimilarity.

本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现以上所介绍的任一种基于距离度量相异度的自适应模版匹配方法的步骤。The present application also provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the above-mentioned methods based on distance measure dissimilarity can be realized. Steps of an adaptive template matching method.

本申请所提供的基于距离度量相异度的自适应模版匹配装置、设备及计算机可读存储介质的具体实施方式与上文所描述的基于距离度量相异度的自适应模版匹配方法可相互对应参照,这里就不再赘述。The specific implementations of the adaptive template matching device, device, and computer-readable storage medium based on distance measure dissimilarity provided in this application may correspond to the above-described adaptive template matching method based on distance measure dissimilarity For reference, I won’t go into details here.

本申请所提供的基于交叉熵相异度的自适应模版匹配装置、设备及计算机可读存储介质的具体实施方式与上文所描述的基于交叉熵相异度的自适应模版匹配方法可相互对应参照这里就不再赘述。The specific implementations of the cross-entropy dissimilarity-based adaptive template matching device, equipment, and computer-readable storage medium provided in this application may correspond to the cross-entropy dissimilarity-based adaptive template matching method described above. Reference here will not repeat them.

本申请中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in the present application is described in a progressive manner, each embodiment focuses on the differences from other embodiments, and the same and similar parts of the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.

还需说明的是,在本申请文件中,诸如“第一”和“第二”之类的关系术语,仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或者操作之间存在任何这种实际的关系或者顺序。此外,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this application, relative terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between such entities or operations. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上对本申请所提供的技术方案进行了详细介绍。本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。The technical solution provided by the present application has been introduced in detail above. In this paper, specific examples are used to illustrate the principles and implementation methods of the present application, and the descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application. It should be pointed out that those skilled in the art can make some improvements and modifications to the application without departing from the principles of the application, and these improvements and modifications also fall within the protection scope of the claims of the application.

Claims (10)

1. a kind of adaptive masterplate matching process based on cross entropy distinctiveness ratio, which is characterized in that including:
Determine the coordinate effective range of the matching starting point of images to be recognized and coordinate initial value;
In the coordinate effective range, gradually according to default translation direction and the seat of the translational movement adjustment matching starting point Mark, and the template image with matching target carries out distinctiveness ratio calculating, to obtain the distinctiveness ratio corresponding to each matching starting point Value;
Determine the minimum in all different angle value;
It determines to match target in the images to be recognized according to the corresponding coordinate for matching starting point of each minimum Position;
Wherein, each translational movement has identical monotonicity with the different angle value corresponding to each matching starting point; The calculation expression of the distinctiveness ratio is:
Wherein, the pixel size of the template image is a × b;P (i, j) is ash of the template image at point coordinates (i, j) Angle value;A, b, i and j are positive integer, and 1≤i≤a, 1≤j≤b;(x, y) is that the matching of the images to be recognized originates The coordinate of point;Q (x+i, y+j) is gray value of the images to be recognized at point coordinates (x+i, y+j);F (x, y) be with it is described Match the corresponding different angle value of starting point (x, y).
2. adaptive masterplate matching process according to claim 1, which is characterized in that the default translation direction for row to Translation.
3. adaptive masterplate matching process according to claim 2, which is characterized in that the calculation expression of the translational movement For:
Wherein, h is the translational movement, and is positive integer;δ is multiple sample images containing the matching target and the template Image match the mean value of obtained different angle value;C is predetermined coefficient, c >=1;[t] is the integer part for taking t.
4. adaptive masterplate matching process according to any one of claims 1 to 3, which is characterized in that described according to each The position that the corresponding coordinate for matching starting point of the minimum determines to match target in the images to be recognized includes:
Judge the distance between matching starting point corresponding to the two neighboring minimum whether less than pre-determined distance threshold value;
If so, judge the matching starting point corresponding to smaller value of the images to be recognized in the two neighboring minimum There are a matching targets at place;
If it is not, then judge that the images to be recognized is deposited respectively in the two neighboring corresponding matching starting point of minimum In a matching target.
5. adaptive template matching process according to claim 4, which is characterized in that the pre-determined distance threshold value includes pre- If lateral distance threshold value and default fore-and-aft distance threshold value;
Whether the distance between described matching starting point judged corresponding to two neighboring minimum is less than pre-determined distance threshold value packet It includes:
Judge whether that the lateral distance between the matching starting point corresponding to the two neighboring minimum is less than the default horizontal stroke It is default less than described to the fore-and-aft distance between the matching starting point corresponding to distance threshold or the two neighboring minimum Fore-and-aft distance threshold value.
6. a kind of adaptive masterplate coalignment based on cross entropy distinctiveness ratio, which is characterized in that including:
First determining module:For determining the coordinate effective range of the matching starting point of images to be recognized and coordinate initial value;
Matching module:For in the coordinate effective range, gradually adjusting described according to default translation direction and translational movement Coordinate with starting point, and the template image with matching target carries out distinctiveness ratio calculating, to obtain each matching starting point institute Corresponding different angle value;
Second determining module:For determining the minimum in all different angle value;And distinguished according to each minimum The coordinate of corresponding matching starting point determines to match the position of target in the images to be recognized;
Wherein, each translational movement has identical monotonicity with the different angle value corresponding to each matching starting point; The calculation expression of the distinctiveness ratio is:
Wherein, the pixel size of the template image is a × b;P (i, j) is ash of the template image at point coordinates (i, j) Angle value;A, b, i and j are positive integer, and 1≤i≤a, 1≤j≤b;(x, y) is that the matching of the images to be recognized originates The coordinate of point;Q (x+i, y+j) is gray value of the images to be recognized at point coordinates (x+i, y+j);F (x, y) be with it is described Match the corresponding different angle value of starting point (x, y).
7. adaptive masterplate coalignment according to claim 6, which is characterized in that the default translation direction for row to Translation.
8. adaptive masterplate coalignment according to claim 7, which is characterized in that the calculation expression of the translational movement For:
Wherein, h is the translational movement, and is positive integer;δ is multiple sample images containing the matching target and the template Image match the mean value of obtained different angle value;C is predetermined coefficient, c >=1;[t] is the integer part for taking t.
9. a kind of adaptive masterplate matching unit based on cross entropy distinctiveness ratio, which is characterized in that including:
Memory:For storing computer instruction;
Processor:For performing the computer instruction cross entropy phase is based on as described in any one of claim 1 to 5 to realize The step of adaptive masterplate matching process of different degree.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program is realized when the computer program is executed by processor as described in any one of claim 1 to 5 different based on cross entropy The step of adaptive masterplate matching process of degree.
CN201810022316.9A 2018-01-10 2018-01-10 A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio Pending CN108256565A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810022316.9A CN108256565A (en) 2018-01-10 2018-01-10 A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810022316.9A CN108256565A (en) 2018-01-10 2018-01-10 A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio

Publications (1)

Publication Number Publication Date
CN108256565A true CN108256565A (en) 2018-07-06

Family

ID=62725040

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810022316.9A Pending CN108256565A (en) 2018-01-10 2018-01-10 A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio

Country Status (1)

Country Link
CN (1) CN108256565A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901334A (en) * 2009-05-31 2010-12-01 汉王科技股份有限公司 Static object detection method
CN104484868A (en) * 2014-10-08 2015-04-01 浙江工业大学 Moving object aerial photograph tracking method with template matching and picture contour being combined
CN106600600A (en) * 2016-12-26 2017-04-26 华南理工大学 Wafer defect detection method based on characteristic matching

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901334A (en) * 2009-05-31 2010-12-01 汉王科技股份有限公司 Static object detection method
CN104484868A (en) * 2014-10-08 2015-04-01 浙江工业大学 Moving object aerial photograph tracking method with template matching and picture contour being combined
CN106600600A (en) * 2016-12-26 2017-04-26 华南理工大学 Wafer defect detection method based on characteristic matching

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
RTYGBWWWERR: "交叉熵(Cross-Entropy)", 《HTTPS://BLOG.CSDN.NET/RTYGBWWWERR/ARTICLE/DETAILS/50778098?OPS_REQUEST_MISC=&REQUEST_ID=&BIZ_ID=102&UTM_TERM=%E4%BA%A4%E5%8F%89%E7%86%B5&UTM_MEDIUM=DISTRIBUTE.PC_SEARCH_RESULT.NONE-TASK-BLOG-2~ALL~SOBAIDUWEB~DEFAULT-7-50778098.FIRST_RANK_V2_PC_RANK_ *
张静等: "基于灰色系统理论和粒子滤波器的目标跟踪算法", 《计算机应用与软件》 *

Similar Documents

Publication Publication Date Title
JP5075757B2 (en) Image processing apparatus, image processing program, image processing method, and electronic apparatus
CN109325532A (en) The image processing method of EDS extended data set under a kind of small sample
US8068122B2 (en) Method of image scaling
CN110738707A (en) Distortion correction method, device, equipment and storage medium for cameras
CN108256566A (en) A kind of adaptive masterplate matching process and device based on cosine similarity
CN109308478B (en) Character recognition method and device
CN110400278A (en) A fully automatic correction method, device and equipment for image color and geometric distortion
US10474935B2 (en) Method and device for target detection
CN110705544B (en) Self-adaptive rapid target detection method based on fast-RCNN
CN110443252A (en) A kind of character detecting method, device and equipment
WO2010050412A1 (en) Calibration index determination device, calibration device, calibration performance evaluation device, system, method, and program
CN113808193A (en) A method of spot centroid localization based on block threshold
CN108256564B (en) Self-adaptive template matching method and device based on distance measurement dissimilarity
CN110728718B (en) Method for improving camera calibration parameters
JP4020093B2 (en) Edge detection method and apparatus, program, storage medium, and frame detection method, apparatus, program, and storage medium
CN108256565A (en) A kind of adaptive masterplate matching process and device based on cross entropy distinctiveness ratio
CN106951902B (en) Image binarization processing method and device
CN112381844A (en) Self-adaptive ORB feature extraction method based on image blocking
CN114550173A (en) Image preprocessing method and device, electronic equipment and readable storage medium
CN111695550A (en) Character extraction method, image processing device and computer readable storage medium
CN108257174A (en) Image block matching method and soldered ball position-recognizing system based on sub-pixel level image
CN112215240B (en) Optimization method for improving 2D complex edge detection precision
CN104580830B (en) A kind of quasistatic image anti-jitter method of facing video monitoring
CN115797383A (en) A Threshold Calculation Method for Image Segmentation Based on Brightness Weighted Maximum Between-Class Variance
WO2018189772A1 (en) Correlation value calculation device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180706

RJ01 Rejection of invention patent application after publication