CN112465050B - 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
CN112465050B
CN112465050B CN202011409002.8A CN202011409002A CN112465050B CN 112465050 B CN112465050 B CN 112465050B CN 202011409002 A CN202011409002 A CN 202011409002A CN 112465050 B CN112465050 B CN 112465050B
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.)
Active
Application number
CN202011409002.8A
Other languages
Chinese (zh)
Other versions
CN112465050A (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

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 quantization index of template image selection can be provided, and the minimum matchable image template size is 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 resource consumption during image matching caused by oversized template 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, an image template selection device and a 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 optimal matching position. The size of the image template is critical to the influence of matching precision, and the excessive size of the image template can cause the increase of time consumption of image matching and influence the instantaneity of the matching process; too small an image template can result in too little template information, resulting in a mismatching of the image.
Classical image template selection methods can be divided into three main categories: the first method is to intercept the image template in the whole image area to be searched in a global image threshold mode, and the method is suitable for the image to be searched with large contrast and simpler characteristic and texture information. Secondly, the template size selected by the method still has the condition of being too small, 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 problem is that the image template is too large to cause resource waste, and too small to cause mismatching due to too small image information; the third is to directly select an image template with the target feature, which can cause difficulty in intercepting a reasonable local area as a matching template when the target feature lacks texture or structural information. Therefore, the existing image matching template selection method has the defects of high randomness, difficult quantization, high resource consumption and the like.
Disclosure of Invention
The embodiment of the invention provides an image template selection method, device, equipment and storage medium, which are used for realizing the quantization index capable of providing template image selection and selecting the minimum matchable image template size, thereby improving the accuracy of image template size selection.
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 area where the two target points are located.
Further, partitioning the image to be searched according to the thread number to obtain at least two regions, including:
obtaining standard deviations corresponding to different Gaussian kernel functions according to preset rules;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the images to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
extracting detail characteristic information of each expression image in the expression image set through a Laplace characteristic 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 partitioning the image to be searched according to the thread number to obtain at least two areas, the method further includes:
determining a feature 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 region where the two target points are located, including:
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 point is;
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 template size corresponding to the area surrounded by the target area.
Further, selecting an image template size according to a template size corresponding to an area surrounded by the target area, 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 template size corresponding to the first area.
Further, determining the feature scale for each region includes:
obtaining characteristic points of each region, wherein the characteristic points are pixel extreme points in a preset pixel region under an adjacent scale, and the preset pixel region comprises: a target pixel point in the region and adjacent pixel points of the target pixel point;
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, where the apparatus includes:
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 area where the two target points are located.
Further, the partition module includes:
the acquisition unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to preset rules;
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 the 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 further comprises the following steps:
the first determining module is used for determining the characteristic scale of each region after partitioning the image to be searched 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 if the two target points are in different areas and selecting the size of the image template according to the template size corresponding to the area surrounded by the target area.
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 template size corresponding to the first area.
Further, determining the feature scale for each region includes:
obtaining characteristic points of each region, wherein the characteristic points are pixel extreme points in a preset pixel region under an adjacent scale, and the preset pixel region comprises: a target pixel point in the region and adjacent pixel points of the target pixel point;
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 in the memory and capable of running 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, embodiments of the present invention further provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an image template selection method according to any of the embodiments of the present invention.
According to the embodiment of the invention, the image to be searched is preprocessed, the image to be searched is partitioned according to the number of threads to obtain the template size corresponding to each region, and then the image template size is selected according to the region where two target points input by a user are located, so that the problems of high randomness, difficulty in quantization and large resource consumption of the existing image matching template selection method are solved, quantization indexes of template image selection are 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 meanwhile, the excessive resource consumption during image matching caused by oversized template size is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for selecting an image template 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 target image corresponding to two expression images of different scales
FIG. 2b is a schematic diagram of a method for determining feature points of each region in accordance with a second embodiment of the present invention;
FIG. 2c is a partial enlarged view of a preset pixel region of the q-th region at the p-th scale of FIG. 2 b;
FIG. 2d is a schematic diagram of a method for determining a target area according to two target points in a second embodiment of the invention;
FIG. 2e is a flowchart of an image template selection method according to a second embodiment of the present invention;
FIG. 2f is a graph showing the result of the size and matching accuracy of different image templates in the second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an image template selecting device in a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device in a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1
Fig. 1 is a flowchart of an image template selection method according to an embodiment of the present invention, where the method may be applied to a case of selecting an image template size during image matching, and the method may be performed by an image template selection device according to an embodiment of the present invention, and the device may be implemented in a software and/or hardware manner, as shown in fig. 1, and 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 a user on the image to be searched is acquired to determine the starting point of the pre-selected image template at the upper left corner, and a second target point selected by the user on the image to be searched is acquired to determine the end point of the pre-selected image template at the lower right corner, so that the image template is created in a manner of constructing a rectangle based on the two target points.
Specifically, the method for 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 and an image sensor, or can be an image to be searched input by a user, or can be a device with a search function obtained from a storage server. The manner of acquiring the two target points input by the user may be to select the second target point by moving the mouse and clicking the mouse button after the user inputs one target point. The embodiment of the present invention is not limited thereto.
S120, partitioning the image to be searched according to the thread number to obtain at least two areas.
The thread number can be the CPU core number obtained by reading the computer system parameters or the thread number corresponding to the CPU core, one core corresponds to at least one thread, and the thread number represents the task number of the CPU capable of simultaneously and parallelly processing.
Specifically, the image to be searched is uniformly partitioned according to the thread number to obtain at least two areas, so that a computer can process the images of the areas in parallel, and the efficiency of selecting the image templates is improved.
S130, selecting the size of the image template according to the area where the two target points are located.
Specifically, the region after the image to be searched is partitioned, in which the two target points input by the user are respectively located, is determined, and the size of the image template is selected according to the optimal template size corresponding to each region.
Specifically, the mode of selecting the image template size according to the region 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 size corresponding to the area where the two target points are located respectively; or may be: if the two target points are in the same area, the image template size is selected 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, the target area is determined according to the two target points, and the image template size is selected according to the template size corresponding to the area surrounded by the target area. According to the technical scheme, at least two areas are obtained by partitioning the image to be searched according to the number of threads, and the image template size is selected according to the area where the two target points input by the user are located, so that the minimum matchable image template size can be selected, the accuracy of the image template size selection is improved, the probability of mismatching of the image caused by undersize template size is reduced, and meanwhile, the resource consumption during image matching caused by oversized template size is reduced.
Example two
Fig. 2 is a flowchart of an image template selection method according to a second embodiment of the present invention, where the optimization is performed based on the foregoing embodiment, and in this embodiment, partitioning the image to be searched according to the number of threads to obtain at least two regions includes:
obtaining standard deviations corresponding to different Gaussian kernel functions according to preset rules;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the images to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
extracting detail characteristic information of each expression image in the expression image set through a Laplace characteristic 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.
S220, obtaining standard deviations corresponding to different Gaussian kernel functions according to preset rules.
Specifically, the sigma is selected i Has important effect on Gaussian scale expression. If sigma i Too large a choice will result in a variation in feature points between the gaussian scale hard to express scales if σ i Choosing too small may require the creation of enough gaussian scale expressions, consuming time and computer resources. Thus, given the standard deviation sigma of different and proportional relationships i Obtaining standard deviation sigma corresponding to different Gaussian kernel functions i The preset rules of (2) are as follows:
σ i =1.1 i
wherein i is 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. Sigma (sigma) i The standard deviation corresponding to the Gaussian kernel function represents the scale of the Gaussian kernel function and is represented by sigma i Constituent Scale sequence (sigma) 12 ,…,σ n )。
S230, establishing Gaussian kernel functions under different scales according to the standard deviation.
Specifically, standard deviations corresponding to different Gaussian kernel functions are obtained according to preset rules, and the Gaussian kernel functions under different scales are established as follows:
wherein, (x, y) is the pixel point of the image to be searched, e is a natural constant, and is about equal to 2.71828; pi is the circumference ratio, approximately equal to 3.1415927, G (x, y, sigma) i ) For different scales sigma i The gaussian kernel function below.
S240, processing the images to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set.
Specifically, the expressed image is obtained by convolving the Gaussian kernel function under different scales with the image to be searched, namely:
L(x,y,σ i )=G(x,y,σ i )×I(x,y);
wherein I (x, y) is the pixel point coordinates of the image to be searched, L (x, y, sigma) i ) To express an image, the gaussian size expression of the image at different gaussian standard deviation scales is represented.
Expressed image L (x, y, sigma) according to different scales i ) Form the expression image set { L (x, y, σ) i )}。
In order to better express the gaussian size expression of the image to be searched, the image to be searched can be preprocessed by a linear filter, so that noise of the image to be searched is effectively restrained, and the image is smoothed. The principle of preprocessing the image to be searched is that the whole image is subjected to weighted average, 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 generating a template by a preset Gaussian filter according to the Gaussian function, and performing convolution operation on the template and the image to be searched to obtain the preprocessed image to be searched.
The preset Gaussian kernel function is:
wherein, (x, y) is the pixel point 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 invention. The smaller the sigma is, the larger the center 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 sigma is larger, the difference of each coefficient of the generated template is not large, and the smoothing effect on the image is obvious similar to the average template.
The preprocessed image to be searched is:
P(x,y)=G(x,y)×I(x,y);
wherein L (x, y) is the preprocessed image to be searched, 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 function under different scales to obtain an expression image, namely:
L(x,y,σ i )=G(x,y,σ i )×P(x,y)。
s250, extracting detail characteristic information of each expression image in the expression image set through a Laplace characteristic function to obtain a target image set.
Specifically, after the expression image set of the image to be searched under different scales is obtained, the detail and structural feature information of the expression image need to be extracted. Therefore, the detail information of each expression image in the expression image set is extracted using the second order differential laplace operator as a feature function. The laplace operator is:
wherein the laplace operator ∈ is adapted to digital image processing 2 The general approximation of f (x, y) expressed in discrete form is:
extracting detail characteristic information of each expression image in the expression image set through the Laplace characteristic function to obtain a target image, namely:
wherein M (x, y, sigma) i ) Is a target image obtained through the Laplace characteristic function processing.
Expressed image L (x, y, sigma) according to different scales i ) Corresponding target image M (x, y, sigma i ) Forming a target image set { M (x, y, sigma) i )}。
Fig. 2a illustrates an exemplary target image obtained by processing two expression images of different scales through a laplace feature function.
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) i ) Each target image M (x, y, σ) i ) Partitioning to obtain L regions, wherein the target image M (x, y, sigma i ) And obtaining images after the expression images under different scales are processed by the Laplacian characteristic function. The thread number L may be obtained by reading a computer system parameter.
S270, selecting the size of the image template according to the area where the two target points are located.
Optionally, after partitioning the image to be searched according to the thread number to obtain at least two regions, the method further includes:
determining a feature 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, determining the feature scale of each region obtained by partitioning the image to be searched under different scales according to the number of threads, and determining a feature scale sequence (j, k) according to the region and the feature scale corresponding to the region. Obtaining a response scale s corresponding to the feature scale j according to the feature scale sequence (j, k) k The calculation formula of the response scale is as follows:
s k =σ j =1.1 j ,k=1,2,…,L;
wherein k represents the region of the image to be searched, j represents the feature scale corresponding to the region k, and L represents the number of the regions of the image to be searched under one scale, namely the number of computer threads.
According to the response scale s k The template size corresponding to each region is determined by the following calculation method:
wherein a represents a constant coefficient which can be set according to actual requirements or experimental dataThe obtained empirical value is set.Representing the calculated s k Rounding up, M k Representing the minimum size of the image template selection at the image region k to be searched, each region corresponding to a template size of min (M k )。
It should be noted that, since 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 enough matching feature information, it is preferable to round upAdding 1 and multiplying the coefficient a to obtain the template size corresponding to each region, namely:
then, the template size corresponding to each region is min (M k )。
Exemplary, the characteristic scale sequence of the first region of an image to be searched is (19,1), and the response scale calculated by the coefficient a=6 is s 1 =σ 19 =1.1 19 = 6.115, a first region is given corresponding to a template size ofPixels (pixels).
Optionally, determining the feature scale of each region includes:
obtaining characteristic points of each region, wherein the characteristic points are pixel extreme points in a preset pixel region under an adjacent scale, and the preset pixel region comprises: a target pixel point in the region and adjacent pixel points of the target pixel point.
Counting the number of the characteristic points of each region;
and determining the feature scale of each region according to the maximum value of the number of the feature points of each region.
Specifically, after the image to be searched is partitioned according to the thread number to obtain at least two areas, the feature point of each area is obtained. The characteristic points are pixel extreme points in a preset pixel area corresponding to the pixel points with coordinates of (x, y) in the same area of the image to be searched under the adjacent scale, and the preset pixel area is the pixel points with the coordinates of (x, y) and adjacent pixel points around the pixel points.
For example, fig. 2b is a preset pixel region corresponding to a pixel point with coordinates (x, y) in the same region at the p-th scale and the adjacent scales of the p-th scale (the p-1 th scale and the p+1-th scale), where fig. 2c is a partial enlarged view of the preset pixel region 201 of the q-th region of the p-th scale. If the pixel 202 (the pixel with the (x, y) coordinates of the q-th region in the p-th scale) is the pixel extreme point of the total 27 pixel points corresponding to the preset pixel region 201 in the q-th region in the three scales of the image to be searched, the pixel 202 is the characteristic point of the q-th region. The pixel extreme point may be a pixel maximum point or a pixel minimum point. According to the characteristic point judging method, if the number of the characteristic points of the image to be searched in each area is at least one, 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 image template size according to the area 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 point is;
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 template size 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 template size corresponding to the area where the target point is 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 template size corresponding to the area surrounded by the target area.
Optionally, selecting the image template size according to the template size corresponding to the area surrounded by the target area 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 template size 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 to be a first area, and the template size corresponding to the first area is determined to be the image target size. For example, according to the number of threads, the image to be searched is divided into four regions, as shown in fig. 2d, if the region surrounded by the target region includes a region 1, a region 2, a region 3 and a region 4, the template sizes corresponding to the four regions are compared, the template size corresponding to the region 3 is the largest, the region 3 is taken as a first region, and the template size corresponding to the first region is determined as the image template size. If the area surrounded by the target area includes an area 1 and an area 2, and 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: obtaining a target image set by obtaining images to be searched of the number of users, carrying out Gaussian filtering on the images to be searched, expressing different Gaussian scales and enhancing the details of Laplacian characteristic functions, obtaining the number of threads in computer system parameters, partitioning each target image in the target image set according to the number of threads, sequentially calculating the characteristic scale, the scale sequence and the response scale of each region by parallel multithreading, and calculating the template size of each region 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 template size corresponding to the area where the target points are; and if the two target points are in different areas, selecting the size of the image template according to the template size corresponding to the area with the largest template size in the area surrounded by the target area.
Fig. 2f shows the result of different image template sizes and matching accuracy. As shown in fig. 2f, in this embodiment, "Lena" is used as an image to be searched, and templates are cut out with different sizes in different areas on the image to be searched for matching. The method is applied to the image to be searched, the obtained scale sequence is j=19, the size of the image template is 43pixels, the template images are intercepted by taking the 43pixels and 40pixels square matrixes respectively, when the size of the image template is lower than 43pixels, the matching error (the actual matching angle is 60 degrees, the final matching angle is 58 degrees) exists in the eyes of the image, and the size of the image template is 43pixels, so that the matching is normal. Therefore, the present invention can effectively give the minimum image template size for image matching.
According to the technical scheme, the target image is obtained by preprocessing the image to be searched through the Gaussian kernel function and the Laplace characteristic function, at least two areas are obtained by partitioning the target image according to the number of threads, the template size corresponding to each area is calculated according to the characteristic scale of each area, the image template size is selected according to the area where two target points input by a user are located, quantization indexes for template image selection can be provided, and the minimum matchable image template size is 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 meanwhile, the resource consumption during image matching caused by oversized template size is reduced.
Example III
Fig. 3 is a schematic structural diagram of an image template selecting device according to a third embodiment of the present invention. This embodiment may be applied to the case of selecting the size of an image template during image matching, where the apparatus may be implemented in software and/or hardware, and the apparatus may be integrated in any device that provides 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 partition module 320, and a selection module 330.
The first acquiring module 310 is configured to acquire 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 thread number to obtain at least two regions;
and a selection module 330, configured to select the size of the image template according to the area where the two target points are located.
Optionally, the partition module includes:
the acquisition unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to preset rules;
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 the 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 comprises:
the first determining module is used for determining the characteristic scale of each region after partitioning the image to be searched 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 if the two target points are in different areas and selecting the size of the image template according to the template size corresponding to the area surrounded by the target area.
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 template size corresponding to the first area.
Optionally, determining the feature scale of each region includes:
obtaining characteristic points of each region, wherein the characteristic points are pixel extreme points in a preset pixel region under an adjacent scale, and the preset pixel region comprises: a target pixel point in the region and adjacent pixel points of the target pixel point;
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 the 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 number of threads to obtain the template size corresponding to each region, the image template size is selected according to the region where two target points input by a user are located, quantization indexes for template image selection are provided, and the minimum matchable image template size is 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 meanwhile, the resource consumption during image matching caused by oversized template size is reduced.
Example IV
Fig. 4 is a schematic structural diagram of a computer device according to a 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 merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in FIG. 4, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include 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 can 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. The 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 or write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard disk drive"). Although not shown in fig. 4, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules 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 in, for example, 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 or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. In addition, in the computer device 12 of the present embodiment, the display 24 is not present as a separate body but is embedded in the mirror surface, and the display surface of the display 24 and the mirror surface are visually integrated when the display surface of the display 24 is not displayed. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs 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 area where the two target points are located.
Example five
A fifth embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an image template selection method as provided in all the embodiments 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 area where the two target points are located.
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. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 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.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. 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, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

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;
selecting the size of an image template according to the region where the two target points are located;
wherein selecting the image template size according to the region where the two target points are located 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 point is;
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 template size corresponding to the area surrounded by the target area.
2. The method of claim 1, wherein partitioning the image to be searched according to the number of threads results in at least two regions, comprising:
obtaining standard deviations corresponding to different Gaussian kernel functions according to preset rules;
establishing Gaussian kernel functions under different scales according to the standard deviation;
processing the images to be searched according to the Gaussian kernel functions under different scales to obtain an expression image set;
extracting detail characteristic information of each expression image in the expression image set through a Laplace characteristic 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, further comprising, after partitioning the image to be searched according to the number of threads to obtain at least two regions:
determining a feature 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 1, wherein selecting an image template size according to a template size corresponding to an area surrounded 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 template size corresponding to the first area.
5. A method according to claim 3, wherein determining the feature scale for each region comprises:
obtaining characteristic points of each region, wherein the characteristic points are pixel extreme points in a preset pixel region under an adjacent scale, and the preset pixel region comprises: a target pixel point in the region and adjacent pixel points of the target pixel point;
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.
6. An image template selecting apparatus, comprising:
the acquisition module is used for acquiring the 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;
the selection module is used for selecting the size of the image template according to the area where the two target points are located;
wherein, the selection 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 if the two target points are in different areas and selecting the size of the image template according to the template size corresponding to the area surrounded by the target area.
7. The apparatus of claim 6, wherein the partitioning module comprises:
the acquisition unit is used for acquiring standard deviations corresponding to different Gaussian kernel functions according to preset rules;
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 the 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.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-5 when the program is executed by the processor.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
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 CN112465050A (en) 2021-03-09
CN112465050B true 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)

Families Citing this family (2)

* 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
CN115455227B (en) * 2022-09-20 2023-07-18 上海弘玑信息技术有限公司 Element searching method of graphical interface, electronic equipment and storage medium

Citations (5)

* 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
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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5434621B2 (en) * 2010-01-19 2014-03-05 ソニー株式会社 Information processing apparatus, information processing method, and program thereof
WO2014024854A1 (en) * 2012-08-10 2014-02-13 コニカミノルタ株式会社 Image processing device, image processing method, and image processing program
CN112465050B (en) * 2020-12-04 2024-02-09 广东拓斯达科技股份有限公司 Image template selection method, device, equipment and storage medium

Patent Citations (5)

* 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
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

Also Published As

Publication number Publication date
CN112465050A (en) 2021-03-09
WO2022116492A1 (en) 2022-06-09

Similar Documents

Publication Publication Date Title
US11798132B2 (en) Image inpainting method and apparatus, computer device, and storage medium
US11854283B2 (en) Method and apparatus for visual question answering, computer device and medium
CN109447154B (en) Picture similarity detection method, device, medium and electronic equipment
CN110781885A (en) Text detection method, device, medium and electronic equipment based on image processing
WO2016054779A1 (en) Spatial pyramid pooling networks for image processing
CN109711508B (en) Image processing method and device
CN112465050B (en) Image template selection method, device, equipment and storage medium
CN109741394B (en) Image processing method, image processing device, electronic equipment and storage medium
CN111444807B (en) Target detection method, device, electronic equipment and computer readable medium
CN113095333B (en) Unsupervised feature point detection method and unsupervised feature point detection device
CN110910445B (en) Object size detection method, device, detection equipment and storage medium
JP2016206837A (en) Object detection method and image search system
Liu et al. Microscopic 3D reconstruction based on point cloud data generated using defocused images
Zhao et al. Region-based saliency estimation for 3D shape analysis and understanding
CN115861715A (en) Knowledge representation enhancement-based image target relation recognition algorithm
CN114445825A (en) Character detection method and device, electronic equipment and storage medium
CN113627298A (en) Training method of target detection model and method and device for detecting target object
CN115471439A (en) Method and device for identifying defects of display panel, electronic equipment and storage medium
CN113610856B (en) Method and device for training image segmentation model and image segmentation
CN115631370A (en) Identification method and device of MRI (magnetic resonance imaging) sequence category based on convolutional neural network
Gao et al. Multiscale phase congruency analysis for image edge visual saliency detection
CN112906652A (en) Face image recognition method and device, electronic equipment and storage medium
CN112861940A (en) Binocular disparity estimation method, model training method and related equipment
CN108154107B (en) Method for determining scene category to which remote sensing image belongs
CN115239994B (en) Grade information generation method and device applied to liquorice decoction pieces and electronic equipment

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