CN112465050A - Image template selection method, device, equipment and storage medium - Google Patents

Image template selection method, device, equipment and storage medium Download PDF

Info

Publication number
CN112465050A
CN112465050A CN202011409002.8A CN202011409002A CN112465050A CN 112465050 A CN112465050 A CN 112465050A CN 202011409002 A CN202011409002 A CN 202011409002A CN 112465050 A CN112465050 A CN 112465050A
Authority
CN
China
Prior art keywords
image
template
target
size
area
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.)
Granted
Application number
CN202011409002.8A
Other languages
Chinese (zh)
Other versions
CN112465050B (en
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 Topstar Technology Co Ltd
Original Assignee
Guangdong Topstar Technology Co Ltd
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 Topstar Technology Co Ltd filed Critical Guangdong Topstar Technology Co Ltd
Priority to CN202011409002.8A priority Critical patent/CN112465050B/en
Publication of CN112465050A publication Critical patent/CN112465050A/en
Priority to PCT/CN2021/096920 priority patent/WO2022116492A1/en
Application granted granted Critical
Publication of CN112465050B publication Critical patent/CN112465050B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/94Hardware or software architectures specially adapted for image or video understanding
    • G06V10/955Hardware or software architectures specially adapted for image or video understanding using specific electronic processors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses an image template selection method, an image template selection device, image template selection equipment and a storage medium. The method comprises the following steps: acquiring an image to be searched and two target points input by a user; partitioning the image to be searched according to the thread number to obtain at least two areas; according to the technical scheme of the invention, the quantitative index of template image selection can be provided, and the smallest matchable image template size can be selected, so that the accuracy of image template size selection is improved, the probability of image mismatching caused by undersize of the template is reduced, and the overlarge resource consumption caused by overlarge template size during image matching is reduced.

Description

Image template selection method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the field of computer vision, in particular to an image template selection method, device, equipment and storage medium.
Background
Image matching is an important application in the field of computer vision. The image matching is to calculate the similarity of the known image template and the image to be searched under each pixel by means of pixel-by-pixel comparison, and finally obtain the best matching position. The size of the image template is selected to be important for the influence of the matching precision, and the excessive image template can increase the time consumption of image matching and influence the real-time performance of the matching process; too small an image template may result in too little template information, resulting in a mismatch of the image.
The classical image template selection methods can be mainly divided into three types: the first is to intercept the image template in the whole image area to be searched by means of global image threshold, and the method is suitable for the image to be searched with large contrast and simple characteristic and texture information. Secondly, the template size selected by the method still has an excessively small condition, and the matching precision is influenced. Secondly, a template is randomly created based on an image area to be matched and prior information, and the size of the template is randomly generated, so that the problems that the resource is wasted due to the fact that the image template is too large, and mismatching is caused due to the fact that the image information is too small due to the fact that the image template is too small are brought; the third is to directly select an image template with a target feature, which when the target feature lacks texture or structural information, it may cause difficulty in intercepting a reasonable local area as a matching template. Therefore, the existing image matching template selecting method has the defects of high randomness, difficulty in quantification, high resource consumption and the like.
Disclosure of Invention
The embodiment of the invention provides an image template selection method, an image template selection device, image template selection equipment and a storage medium, which are used for providing a quantization index for template image selection and selecting the smallest matched image template size, so that the accuracy of image template size selection is improved.
In a first aspect, an embodiment of the present invention provides an image template selection method, including:
acquiring an image to be searched and two target points input by a user;
partitioning the image to be searched according to the thread number to obtain at least two areas;
and selecting the size of the image template according to the areas of the two target points.
Further, the step of partitioning the image to be searched according to the number of threads to obtain at least two regions includes:
acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the image to be searched according to the Gaussian kernel function under different scales to obtain an expression image set;
extracting detail feature information of each expression image in the expression image set through a Laplace feature function to obtain a target image set;
and partitioning each target image in the target image set according to the thread number to obtain at least two areas.
Further, after the image to be searched is partitioned according to the number of threads to obtain at least two regions, the method further includes:
determining a characteristic scale of each region;
acquiring a response scale corresponding to the characteristic scale;
and determining the size of the template corresponding to each region according to the response scale.
Further, selecting the size of the image template according to the areas where the two target points are located includes:
if the two target points are in the same area, selecting the size of the image template according to the size of the template corresponding to the area where the target points are located;
and if the two target points are in different areas, determining a target area according to the two target points, and selecting the size of the image template according to the size of the template corresponding to the area surrounded by the target area.
Further, selecting the template size of the image according to the template size corresponding to the region surrounded by the target region includes:
acquiring a first area with the largest template size in an area surrounded by the target area;
and selecting the size of the image template according to the size of the template corresponding to the first area.
Further, determining a feature scale of each region comprises:
acquiring a feature point of each region, wherein the feature point is a pixel extreme point in a preset pixel region under adjacent scales, and the preset pixel region comprises: target pixel points in the region and adjacent pixel points of the target pixel points;
counting the number of the characteristic points of each region;
and determining the characteristic scale of each region according to the maximum value of the number of the characteristic points of each region.
In a second aspect, an embodiment of the present invention further provides an image template selecting apparatus, including:
the first acquisition module is used for acquiring an image to be searched and two target points input by a user;
the partitioning module is used for partitioning the image to be searched according to the thread number to obtain at least two areas;
and the selection module is used for selecting the size of the image template according to the areas of the two target points.
Further, the partition module includes:
the acquiring unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
the establishing unit is used for establishing Gaussian kernel functions under different scales according to the standard deviation;
the processing unit is used for processing the image to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
the extraction unit is used for extracting the detail characteristic information of each expression image in the expression image set through a Laplace characteristic function to obtain a target image set;
and the partitioning unit is used for partitioning each target image in the target image set according to the thread number to obtain at least two areas.
Further, the method also comprises the following steps:
the first determining module is used for determining the characteristic scale of each region after the image to be searched is partitioned according to the thread number to obtain at least two regions;
the second acquisition module is used for acquiring a response scale corresponding to the characteristic scale;
and the second determining module is used for determining the template size corresponding to each region according to the response scale.
Further, the selecting module includes:
the first selection unit is used for selecting the size of the image template according to the size of the template corresponding to the area where the target points are located if the two target points are located in the same area;
and the second selection unit is used for determining a target area according to the two target points and selecting the size of the image template according to the template size corresponding to the area surrounded by the target area if the two target points are in different areas.
Further, the second selecting unit is specifically configured to:
acquiring a first area with the largest template size in an area surrounded by the target area;
and selecting the size of the image template according to the size of the template corresponding to the first area.
Further, determining a feature scale of each region comprises:
acquiring a feature point of each region, wherein the feature point is a pixel extreme point in a preset pixel region under adjacent scales, and the preset pixel region comprises: target pixel points in the region and adjacent pixel points of the target pixel points;
counting the number of the characteristic points of each region;
and determining the characteristic scale of each region according to the maximum value of the number of the characteristic points of each region.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the image template selection method according to any one of the embodiments of the present invention when executing the program.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the image template selection method according to any one of the embodiments of the present invention.
The embodiment of the invention carries out preprocessing on the image to be searched, divides the image to be searched according to the number of threads to obtain the template size corresponding to each area, and further selects the image template size according to the areas where two target points input by a user, solves the problems of high randomness, difficulty in quantization and high resource consumption of the existing image matching template selecting method, provides a quantization index for selecting the template image, and realizes the selection of the smallest matchable image template size, thereby improving the accuracy of image template size selection, reducing the probability of image mismatching caused by undersize of the template, and simultaneously reducing the overlarge resource consumption caused by overlarge size of the template during image matching.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flowchart of an image template selection method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of an image template selection method according to a second embodiment of the present invention;
FIG. 2a is a diagram of target images corresponding to two different scale expression images
FIG. 2b is a diagram illustrating a method for determining feature points of each region according to a second embodiment of the present invention;
FIG. 2c is a partially enlarged view of a predetermined pixel region of a q-th area at a p-th scale in FIG. 2 b;
FIG. 2d is a diagram illustrating a method for determining a target area according to two target points according to a second embodiment of the present invention;
FIG. 2e is a flowchart of an image template selection method according to the second embodiment of the present invention;
FIG. 2f is a diagram showing the results of different image template sizes and matching accuracy in the second embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an image template selecting apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example one
Fig. 1 is a flowchart of an image template selecting method according to an embodiment of the present invention, where this embodiment is applicable to a case of selecting a size of an image template during image matching, and the method may be executed by an image template selecting apparatus according to an embodiment of the present invention, where the apparatus may be implemented in software and/or hardware, as shown in fig. 1, where the method specifically includes the following steps:
s110, acquiring an image to be searched and two target points input by a user.
Specifically, after the image to be searched is acquired, a first target point selected by the user on the image to be searched is acquired, a starting point of the pre-selected image template at the upper left corner is determined, a second target point selected by the user on the image to be searched is acquired, and an end point of the pre-selected image template at the lower right corner is determined, so that the image template is created in a rectangular mode based on the two target points.
Specifically, the manner of acquiring the image to be searched may be: the image to be searched is obtained from an image acquisition device, wherein the image acquisition device can be any device with an image acquisition function, such as a camera, a scanner, an image sensor and the like, or can be the image to be searched input by a user, or can be the image to be searched obtained from a storage server. The manner of acquiring the two target points input by the user may be that after the user inputs one target point, the second target point is selected by moving the mouse and clicking the mouse button. The embodiments of the present invention are not limited thereto.
And S120, partitioning the image to be searched according to the thread number to obtain at least two areas.
The thread number may be a CPU core number obtained by reading a computer system parameter or a thread number corresponding to the CPU core, where one core at least corresponds to one thread, and the thread number represents a task number that the CPU can simultaneously process in parallel.
Specifically, the image to be searched is uniformly partitioned according to the thread number to obtain at least two regions, so that the computer can process the images of the multiple regions in parallel to improve the efficiency of image template selection.
S130, selecting the size of the image template according to the areas where the two target points are located.
Specifically, areas of the image to be searched, in which two target points input by a user are respectively located, are partitioned, and the size of the image template is selected according to the optimal template size corresponding to each area.
Specifically, the method for selecting the size of the image template according to the areas where the two target points are located may be: if the two target points are in the same area, selecting the image template size according to the optimal template size corresponding to the area where the target points are located, and if the two target points are in different areas, selecting the image template size according to the optimal template sizes corresponding to the areas where the two target points are located; or may be: if the two target points are in the same area, selecting the image template size according to the optimal template size corresponding to the area where the target points are located, if the two target points are in different areas, determining a target area according to the two target points, and selecting the image template size according to the template size corresponding to the area surrounded by the target area. According to the technical scheme of the embodiment, the image to be searched is partitioned according to the thread number to obtain at least two areas, the size of the image template is selected according to the areas where two target points input by a user are located, and the size of the image template which can be matched at the minimum can be selected, so that the accuracy of selecting the size of the image template is improved, the probability of image mismatching caused by the fact that the size of the template is too small is reduced, and the excessive resource consumption during image matching caused by the fact that the size of the template is too large is reduced.
Example two
Fig. 2 is a flowchart of an image template selection method in the second embodiment of the present invention, and this embodiment is optimized based on the above embodiment, and in this embodiment, the partitioning the image to be searched according to the number of threads to obtain at least two regions includes:
acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the image to be searched according to the Gaussian kernel function under different scales to obtain an expression image set;
extracting detail feature information of each expression image in the expression image set through a Laplace feature function to obtain a target image set;
and partitioning each target image in the target image set according to the thread number to obtain at least two areas.
As shown in fig. 2, the method of this embodiment specifically includes the following steps:
s210, acquiring an image to be searched and two target points input by a user.
And S220, acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule.
In particular, the selected σiHas important effect on Gaussian scale expression. If σiToo large a selection may result in a change in feature points between gaussian scales that are difficult to express, if σiChoosing too small may result in the need to build enough gaussian scale expressions, which is time and computer resource consuming. Thus, the standard deviation σ of the different and proportional relationships is giveniObtaining the standard deviation sigma corresponding to different Gaussian kernel functionsiThe preset rule is as follows:
σi=1.1i
wherein i ∈ N+And i is less than or equal to n, n is a first threshold value, the first threshold value can be set according to actual needs, and preferably, the first threshold value is 20. SigmaiThe standard deviation corresponding to the Gaussian kernel function represents the scale of the Gaussian kernel function, and is represented by sigmaiForm a scale sequence (σ)12,…,σn)。
And S230, establishing Gaussian kernel functions under different scales according to the standard deviation.
Specifically, the standard deviations corresponding to different gaussian kernel functions are obtained according to a preset rule, and the gaussian kernel functions under different scales are established as follows:
Figure BDA0002817179870000101
wherein, (x, y) is the pixel point of the image to be searched, e is a natural constant and is equal to about 2.71828; pi is the circumference ratio, which is equal to 3.1415927, G (x, y, sigma)i) For different scales sigmaiThe following gaussian kernel function.
S240, processing the image to be searched according to the Gaussian kernel function under different scales to obtain an expression image set.
Specifically, the expression image is obtained by performing convolution on the gaussian kernel function and the image to be searched under different scales, that is:
L(x,y,σi)=G(x,y,σi)×I(x,y);
wherein, I (x, y) is the pixel point coordinate of the image to be searched, L (x, y, sigma)i) To express the image, a gaussian size expression of the image at different gaussian standard deviation scales is represented.
Express image L (x, y, sigma) according to different scalesi) Construct a set of expression images { L (x, y, σ)i)}。
It should be noted that, in order to better express the gaussian size expression of the image to be searched, a linear filter may be used to preprocess the image to be searched, so as to effectively suppress the noise of the image to be searched and smooth the image. The principle of image preprocessing to be searched lies in the process of weighted average of the whole image, and the value of each pixel point is obtained by weighted average of the pixel point and other pixel values in the neighborhood. Preferably, a gaussian filter is used. And the preset Gaussian filter generates a template according to the Gaussian function, and then the template and the image to be searched are subjected to convolution operation to obtain the preprocessed image to be searched.
The preset gaussian kernel function is:
Figure BDA0002817179870000102
the (x, y) is the pixel coordinates of the image to be searched, σ is the standard deviation, and the value of σ can be set according to the actual requirement, which is not limited in the embodiment of the present invention. The smaller sigma is, the larger the central coefficient of the generated template is, the smaller the peripheral coefficient is, and the smoothing effect on the image is not obvious; on the contrary, if the σ is larger, the difference between the coefficients of the generated template is not large, similar to the mean template, and the smoothing effect on the image is more obvious.
The preprocessed image to be searched is as follows:
P(x,y)=G(x,y)×I(x,y);
wherein, L (x, y) is the image to be searched after preprocessing, I (x, y) is the image to be searched, and G (x, y) is a preset Gaussian kernel function.
Correspondingly, the image to be searched is processed according to the Gaussian kernel functions under different scales to obtain an expression image, namely:
L(x,y,σi)=G(x,y,σi)×P(x,y)。
and S250, extracting the detail feature information of each expression image in the expression image set through a Laplace feature function to obtain a target image set.
Specifically, after an expression image set of an image to be searched under different scales is obtained, details and structural feature information of the expression image need to be extracted. Therefore, the second order differential laplacian is used as a feature function to extract detail information of each expression image in the expression image set. The laplacian operator is:
Figure BDA0002817179870000111
wherein to be more suitable for digital image processing, the Laplacian ^ is ^ d2The general approximation that f (x, y) represents in discrete form is:
Figure BDA0002817179870000112
extracting detail feature information of each expression image in the expression image set through a Laplace feature function to obtain a target image, namely:
Figure BDA0002817179870000113
wherein, M (x, y, σ)i) The target image is obtained after the processing of the Laplace characteristic function.
Express image L (x, y, sigma) according to different scalesi) Corresponding target image M (x, y, σ)i) Form the target image set { M (x, y, σ)i)}。
For example, fig. 2a is a target image obtained by processing two expression images with different scales through a laplacian eigenfunction.
And S260, partitioning each target image in the target image set according to the thread number to obtain at least two areas.
Specifically, the target image set { M (x, y, sigma) is subjected to linear equation number Li) Every target image M (x, y, σ) ini) Partitioning to obtain L regions, wherein the target image M (x, y, sigma)i) And obtaining an image after the expression image under different scales is processed by a Laplace characteristic function. The thread number L may be obtained by reading a parameter of the computer system.
S270, selecting the size of the image template according to the areas where the two target points are located.
Optionally, after the image to be searched is partitioned according to the number of threads to obtain at least two regions, the method further includes:
determining a characteristic scale of each region;
acquiring a response scale corresponding to the characteristic scale;
and determining the size of the template corresponding to each region according to the response scale.
Specifically, the characteristic scale of each region obtained by partitioning the image to be searched under different scales according to the number of threads is determined, and the characteristic scale sequence (j, k) is determined according to the region and the characteristic scale corresponding to the region. Obtaining a response scale s corresponding to the characteristic scale j according to the characteristic scale sequence (j, k)kThe response scale is calculated as follows:
sk=σj=1.1j,k=1,2,…,L;
wherein k represents the area of the image to be searched, j represents the characteristic scale corresponding to the area k, and L represents the number of the areas of the image to be searched under one scale, namely the number of computer threads.
According to said response scale skThe calculation for determining the size of the template corresponding to each region is as follows:
Figure BDA0002817179870000131
wherein a represents a constant coefficient, which can be set according to actual requirements or empirical values obtained from experimental data.
Figure BDA0002817179870000132
Representing calculated skRounding up, MkRepresents the minimum size of the image template selection at the image area k to be searched, and the template size corresponding to each area is min (M)k)。
It should be noted that, because the size selected by the actual template does not reach the minimum value calculated based on the image scale features, in order to ensure that the selected image template has sufficient matching feature information, it is preferable that the size selected by the actual template is rounded up
Figure BDA0002817179870000133
Adding 1 and multiplying by a coefficient a to obtain the template size corresponding to each area, namely:
Figure BDA0002817179870000134
then, the template size corresponding to each region is min (M)k)。
Illustratively, the feature scale sequence of the first region of an image to be searched is (19,1), and the coefficient a ═ 6 is calculated to obtain a response scale s1=σ19=1.1196.115, the first region is given a template size of
Figure BDA0002817179870000135
Pixels (pixels).
Optionally, determining the characteristic dimension of each region includes:
acquiring a feature point of each region, wherein the feature point is a pixel extreme point in a preset pixel region under adjacent scales, and the preset pixel region comprises: and target pixel points in the region and adjacent pixel points of the target pixel points.
Counting the number of the characteristic points of each region;
and determining the characteristic scale of each region according to the maximum value of the number of the characteristic points of each region.
Specifically, after the image to be searched is partitioned according to the number of threads to obtain at least two regions, the feature point of each region is obtained. The characteristic points are pixel extreme points in a preset pixel region corresponding to a pixel point with coordinates (x, y) in the same region of the image to be searched under the adjacent scales, and the preset pixel region is a pixel point with coordinates (x, y) and adjacent pixel points around the pixel point.
Illustratively, fig. 2b is a preset pixel region corresponding to a pixel point with coordinates (x, y) in the same region at adjacent scales (p-1 scale and p +1 scale) of the p-th scale and the p-th scale, wherein fig. 2c is a partial enlarged view of the preset pixel region 201 of the p-th scale and the q-th region. If the pixel 202 (the pixel having the coordinate of the qth area of the pth scale of (x, y)) is a pixel extreme point of 27 pixels in total corresponding to the preset pixel area 201 in the qth area of the image to be searched, the pixel 202 is a feature point of the qth area. The pixel extreme point may be a pixel maximum point or a pixel minimum point. According to the characteristic point judgment method, the number of the characteristic points of the image to be searched in each area is at least one, and then the number of the characteristic points of the image to be searched in each area is counted. And calculating the maximum value of the number of the characteristic points of each region, and taking the maximum value of the number of the characteristic points as the characteristic scale of each region.
Optionally, selecting the size of the image template according to the areas where the two target points are located includes:
if the two target points are in the same area, selecting the size of the image template according to the size of the template corresponding to the area where the target points are located;
and if the two target points are in different areas, determining a target area according to the two target points, and selecting the size of the image template according to the size of the template corresponding to the area surrounded by the target area.
Specifically, if the two target points are in the same area, selecting the size of the image template according to the size of the template corresponding to the area where the target points are located; and if the two target points are in different areas, determining a target area according to the two target points, and selecting the size of the image template according to the size of the template corresponding to the area surrounded by the target area.
Optionally, selecting a template size of the image according to a template size corresponding to the region surrounded by the target region, including:
acquiring a first area with the largest template size in an area surrounded by the target area;
and selecting the size of the image template according to the size of the template corresponding to the first area.
Specifically, the template size corresponding to the area surrounded by the target area is obtained, the area with the largest template size in the area surrounded by the target area is determined as a first area, and the template size corresponding to the first area is determined as the image target size. Illustratively, the image to be searched is divided into four areas according to the number of threads, as shown in fig. 2d, if the area surrounded by the target area includes area 1, area 2, area 3 and area 4, the template sizes corresponding to the four areas are compared, and the template size corresponding to the area 3 is the largest, then the area 3 is taken as the first area, and the template size corresponding to the first area is determined as the image template size. If the area surrounded by the target area comprises an area 1 and an area 2, the template size corresponding to the area 2 is larger than the template size corresponding to the area 1, the area 2 is used as a first area, and the template size corresponding to the first area is determined as the image template size.
As shown in fig. 2e, the specific steps of the embodiment of the present invention are: the method comprises the steps of obtaining an image to be searched of a user number, conducting Gaussian filtering, expression of different Gaussian scales and detail enhancement of a Laplace characteristic function on the image to be searched to obtain a target image set, obtaining thread numbers in computer system parameters, partitioning each target image in the target image set according to the thread numbers, parallelly and multithreadingly calculating the characteristic scale, the scale sequence and the response scale of each area in sequence, and calculating the size of a template of each area according to the response scale. Judging whether two target points input by a user are in the same area or not according to an image template selection strategy, and if the two target points are in the same area, selecting the size of an image template according to the size of the template corresponding to the area where the target points are located; and if the two target points are in different areas, selecting the size of the image template according to the size of the template corresponding to the area with the largest template size in the area surrounded by the target areas.
Fig. 2f shows the results of different image template sizes and matching accuracy. As shown in fig. 2f, the present embodiment takes "Lena" as the image to be searched, and captures templates with different sizes in different areas on the image to be searched respectively for matching. The method is applied to an image to be searched to obtain a scale sequence j 19, the calculated image template size is 43pixels, square matrixes 43pixels and 40pixels are respectively adopted to intercept the template image, and the matching error (the actual matching angle is 60 degrees, the final matching angle is 58 degrees) exists at the eye part of the image when the image template size is lower than 43pixels, and the image template size is 43pixels and is normally matched. Therefore, the present invention can effectively give a minimum image template size for image matching.
According to the technical scheme, the image to be searched is preprocessed through the Gaussian kernel function and the Laplace characteristic function to obtain the target image, the target image is partitioned according to the number of threads to obtain at least two areas, the template size corresponding to the areas is calculated according to the characteristic scale of each area, the image template size is selected according to the areas where the two target points input by a user, the quantization index of template image selection can be provided, the minimum matchable image template size is selected, the accuracy of image template size selection is improved, the probability of image mismatching caused by undersize of the template is reduced, and the overlarge resource consumption caused by overlarge size of the template during image matching is reduced.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an image template selecting apparatus according to a third embodiment of the present invention. The embodiment is applicable to the case of selecting the size of an image template during image matching, and the apparatus may be implemented in software and/or hardware, and may be integrated in any device providing the function of image template selection, as shown in fig. 3, where the apparatus for image template selection specifically includes: a first acquisition module 310, a partitioning module 320, and a selection module 330.
The first obtaining module 310 is configured to obtain an image to be searched and two target points input by a user;
the partitioning module 320 is configured to partition the image to be searched according to the number of threads to obtain at least two regions;
and a selecting module 330, configured to select a size of the image template according to areas where the two target points are located.
Optionally, the partitioning module includes:
the acquiring unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
the establishing unit is used for establishing Gaussian kernel functions under different scales according to the standard deviation;
the processing unit is used for processing the image to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
the extraction unit is used for extracting the detail characteristic information of each expression image in the expression image set through a Laplace characteristic function to obtain a target image set;
and the partitioning unit is used for partitioning each target image in the target image set according to the thread number to obtain at least two areas.
Optionally, the method further includes:
the first determining module is used for determining the characteristic scale of each region after the image to be searched is partitioned according to the thread number to obtain at least two regions;
the second acquisition module is used for acquiring a response scale corresponding to the characteristic scale;
and the second determining module is used for determining the template size corresponding to each region according to the response scale.
Optionally, the selecting module includes:
the first selection unit is used for selecting the size of the image template according to the size of the template corresponding to the area where the target points are located if the two target points are located in the same area;
and the second selection unit is used for determining a target area according to the two target points and selecting the size of the image template according to the template size corresponding to the area surrounded by the target area if the two target points are in different areas.
Optionally, the second selecting unit is specifically configured to:
acquiring a first area with the largest template size in an area surrounded by the target area;
and selecting the size of the image template according to the size of the template corresponding to the first area.
Optionally, determining the characteristic dimension of each region includes:
acquiring a feature point of each region, wherein the feature point is a pixel extreme point in a preset pixel region under adjacent scales, and the preset pixel region comprises: target pixel points in the region and adjacent pixel points of the target pixel points;
counting the number of the characteristic points of each region;
and determining the characteristic scale of each region according to the maximum value of the number of the characteristic points of each region.
The product can execute the method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
According to the technical scheme, the image to be searched is preprocessed, the image to be searched is partitioned according to the thread number to obtain the template size corresponding to each area, the image template size is selected according to the areas where two target points input by a user are located, the quantization index of template image selection is provided, the minimum matched image template size is selected, the accuracy of image template size selection is improved, the probability of image mismatching caused by the fact that the template size is too small is reduced, and the fact that resource consumption is too large when the image is matched due to the fact that the template size is too large is reduced.
Example four
Fig. 4 is a schematic structural diagram of a computer device in the fourth embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 4 is only one example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 4, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. In the computer device 12 of the present embodiment, the display 24 is not provided as a separate body but is embedded in the mirror surface, and when the display surface of the display 24 is not displayed, the display surface of the display 24 and the mirror surface are visually integrated. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with the other modules of computer device 12 via bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, implementing an image template selection method provided by an embodiment of the present invention:
acquiring an image to be searched and two target points input by a user;
partitioning the image to be searched according to the thread number to obtain at least two areas;
and selecting the size of the image template according to the areas of the two target points.
EXAMPLE five
An embodiment five of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the image template selection method provided in all the inventive embodiments of the present application:
acquiring an image to be searched and two target points input by a user;
partitioning the image to be searched according to the thread number to obtain at least two areas;
and selecting the size of the image template according to the areas of the two target points.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An image template selection method, comprising:
acquiring an image to be searched and two target points input by a user;
partitioning the image to be searched according to the thread number to obtain at least two areas;
and selecting the size of the image template according to the areas of the two target points.
2. The method of claim 1, wherein the step of partitioning the image to be searched according to the number of threads to obtain at least two regions comprises:
acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the image to be searched according to the Gaussian kernel function under different scales to obtain an expression image set;
extracting detail feature information of each expression image in the expression image set through a Laplace feature function to obtain a target image set;
and partitioning each target image in the target image set according to the thread number to obtain at least two areas.
3. The method according to claim 2, wherein after the at least two regions are obtained by dividing the image to be searched according to the number of threads, the method further comprises:
determining a characteristic scale of each region;
acquiring a response scale corresponding to the characteristic scale;
and determining the size of the template corresponding to each region according to the response scale.
4. The method of claim 3, wherein selecting an image template size based on the area of the two target points comprises:
if the two target points are in the same area, selecting the size of the image template according to the size of the template corresponding to the area where the target points are located;
and if the two target points are in different areas, determining a target area according to the two target points, and selecting the size of the image template according to the size of the template corresponding to the area surrounded by the target area.
5. The method of claim 4, wherein selecting an image template size based on a template size corresponding to an area encompassed by the target area comprises:
acquiring a first area with the largest template size in an area surrounded by the target area;
and selecting the size of the image template according to the size of the template corresponding to the first area.
6. The method of claim 3, wherein determining the feature scale for each region comprises:
acquiring a feature point of each region, wherein the feature point is a pixel extreme point in a preset pixel region under adjacent scales, and the preset pixel region comprises: target pixel points in the region and adjacent pixel points of the target pixel points;
counting the number of the characteristic points of each region;
and determining the characteristic scale of each region according to the maximum value of the number of the characteristic points of each region.
7. An image template selection apparatus, comprising:
the acquisition module is used for acquiring an image to be searched and two target points input by a user;
the partitioning module is used for partitioning the image to be searched according to the thread number to obtain at least two areas;
and the selection module is used for selecting the size of the image template according to the areas of the two target points.
8. The apparatus of claim 7, wherein the partition module comprises:
the acquiring unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to a preset rule;
the establishing unit is used for establishing Gaussian kernel functions under different scales according to the standard deviation;
the processing unit is used for processing the image to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
the extraction unit is used for extracting the detail characteristic information of each expression image in the expression image set through a Laplace characteristic function to obtain a target image set;
and the partitioning unit is used for partitioning each target image in the target image set according to the thread number to obtain at least two areas.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-6 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202011409002.8A 2020-12-04 2020-12-04 Image template selection method, device, equipment and storage medium Active CN112465050B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011409002.8A CN112465050B (en) 2020-12-04 2020-12-04 Image template selection method, device, equipment and storage medium
PCT/CN2021/096920 WO2022116492A1 (en) 2020-12-04 2021-05-28 Image template selection method and apparatus, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011409002.8A CN112465050B (en) 2020-12-04 2020-12-04 Image template selection method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112465050A true CN112465050A (en) 2021-03-09
CN112465050B CN112465050B (en) 2024-02-09

Family

ID=74805790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011409002.8A Active CN112465050B (en) 2020-12-04 2020-12-04 Image template selection method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN112465050B (en)
WO (1) WO2022116492A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022116492A1 (en) * 2020-12-04 2022-06-09 广东拓斯达科技股份有限公司 Image template selection method and apparatus, device and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115455227B (en) * 2022-09-20 2023-07-18 上海弘玑信息技术有限公司 Element searching method of graphical interface, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005141458A (en) * 2003-11-06 2005-06-02 Nippon Telegr & Teleph Corp <Ntt> Image processing method and device, program, and recording medium for the program
CN101464951A (en) * 2007-12-21 2009-06-24 北大方正集团有限公司 Image recognition method and system
US20110176731A1 (en) * 2010-01-19 2011-07-21 Sony Corporation Information processing apparatus, information processing method, and program therefor
US20150186422A1 (en) * 2012-08-10 2015-07-02 Konica Minolta, Inc. Image processing apparatus, image processing method, and image processing program
CN109118529A (en) * 2018-08-13 2019-01-01 四川长虹电器股份有限公司 A kind of screw hole Image Quick Orientation method of view-based access control model
JP2019020839A (en) * 2017-07-12 2019-02-07 キヤノン株式会社 Image processing apparatus, image processing method and program
CN111738232A (en) * 2020-08-06 2020-10-02 深圳须弥云图空间科技有限公司 Method and device for marking pile foundation

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465050B (en) * 2020-12-04 2024-02-09 广东拓斯达科技股份有限公司 Image template selection method, device, equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005141458A (en) * 2003-11-06 2005-06-02 Nippon Telegr & Teleph Corp <Ntt> Image processing method and device, program, and recording medium for the program
CN101464951A (en) * 2007-12-21 2009-06-24 北大方正集团有限公司 Image recognition method and system
US20110176731A1 (en) * 2010-01-19 2011-07-21 Sony Corporation Information processing apparatus, information processing method, and program therefor
US20150186422A1 (en) * 2012-08-10 2015-07-02 Konica Minolta, Inc. Image processing apparatus, image processing method, and image processing program
JP2019020839A (en) * 2017-07-12 2019-02-07 キヤノン株式会社 Image processing apparatus, image processing method and program
CN109118529A (en) * 2018-08-13 2019-01-01 四川长虹电器股份有限公司 A kind of screw hole Image Quick Orientation method of view-based access control model
CN111738232A (en) * 2020-08-06 2020-10-02 深圳须弥云图空间科技有限公司 Method and device for marking pile foundation

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022116492A1 (en) * 2020-12-04 2022-06-09 广东拓斯达科技股份有限公司 Image template selection method and apparatus, device and storage medium

Also Published As

Publication number Publication date
WO2022116492A1 (en) 2022-06-09
CN112465050B (en) 2024-02-09

Similar Documents

Publication Publication Date Title
US11798132B2 (en) Image inpainting method and apparatus, computer device, and storage medium
CN109447154B (en) Picture similarity detection method, device, medium and electronic equipment
CN108304775B (en) Remote sensing image recognition method and device, storage medium and electronic equipment
CN110781885A (en) Text detection method, device, medium and electronic equipment based on image processing
TW202207077A (en) Text area positioning method and device
CN108510499B (en) Image threshold segmentation method and device based on fuzzy set and Otsu
WO2016170965A1 (en) Object detection method and image search system
CN111444807B (en) Target detection method, device, electronic equipment and computer readable medium
CN112465050B (en) Image template selection method, device, equipment and storage medium
CN110796108A (en) Method, device and equipment for detecting face quality and storage medium
CN111882565B (en) Image binarization method, device, equipment and storage medium
CN114266894A (en) Image segmentation method and device, electronic equipment and storage medium
Skirnevskiy et al. Digital image processing using parallel computing based on CUDA technology
CN113888635A (en) Visual positioning method, related device and computer program product
CN115471439A (en) Method and device for identifying defects of display panel, electronic equipment and storage medium
CN117710295A (en) Image processing method, device, apparatus, medium, and program product
CN116071625B (en) Training method of deep learning model, target detection method and device
CN116109627B (en) Defect detection method, device and medium based on migration learning and small sample learning
CN114511862B (en) Form identification method and device and electronic equipment
CN113610856B (en) Method and device for training image segmentation model and image segmentation
CN112598663A (en) Grain pest detection method and device based on visual saliency
CN112749691A (en) Image processing method and related equipment
CN108038514A (en) A kind of method, equipment and computer program product for being used to identify image
CN117474070B (en) Model pruning method, face recognition model training method and face recognition method
CN113052173B (en) Sample data characteristic enhancement method and 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
GR01 Patent grant
GR01 Patent grant