WO2022116492A1 - 图像模板选择方法、装置、设备及存储介质 - Google Patents

图像模板选择方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022116492A1
WO2022116492A1 PCT/CN2021/096920 CN2021096920W WO2022116492A1 WO 2022116492 A1 WO2022116492 A1 WO 2022116492A1 CN 2021096920 W CN2021096920 W CN 2021096920W WO 2022116492 A1 WO2022116492 A1 WO 2022116492A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target
area
template
searched
Prior art date
Application number
PCT/CN2021/096920
Other languages
English (en)
French (fr)
Inventor
刘吉刚
张翔
王月
王升
孙仲旭
徐必业
吴丰礼
Original Assignee
广东拓斯达科技股份有限公司
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 广东拓斯达科技股份有限公司 filed Critical 广东拓斯达科技股份有限公司
Publication of WO2022116492A1 publication Critical patent/WO2022116492A1/zh

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

Definitions

  • the present application relates to the field of computer vision, for example, to an image template selection method, apparatus, device, and storage medium.
  • Image matching is an important application in the field of computer vision. Image matching is to calculate the similarity between 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 selection of image template size is very important to the accuracy of matching. Too large an image template will increase the time-consuming of image matching and affect the real-time performance of the matching process; if an image template is too small, it will lead to too little template information, resulting in incorrect image matching.
  • the classic image template selection methods can be mainly divided into three types: the first is to intercept the image template in the entire image area to be searched by means of global image threshold. Search for images. Secondly, the template size selected by this method will still be too small, which will affect the matching accuracy. The second is to randomly create a template based on the image area to be matched and the prior information, and the size of the template is randomly generated. The problem is that the image template is too large, which will cause a waste of resources. If the template is too small, it will be caused by too little image information. Mismatching; the third is to directly select image templates with target features. When the target features lack texture or structure information, it will be difficult to intercept a reasonable local area as a matching template. Therefore, the selection method of the image matching template has disadvantages such as large randomness, difficult to quantify, and large resource consumption.
  • the present application provides an image template selection method, device, device and storage medium, so as to provide a quantitative index for template image selection, and to select the smallest matchable image template size, thereby improving the accuracy of image template size selection.
  • Image template selection methods including:
  • Image template selection means are also provided, including:
  • the first acquisition module is configured to acquire the image to be searched and two target points input by the user;
  • the partition module is configured to partition the image to be searched according to the number of threads to obtain at least two regions;
  • the selection module is configured to obtain at least two regions according to the The size of the image template is selected for the regions where the two target points in the at least two regions are located.
  • a computer device which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the above-mentioned image template selection method when the processor executes the program.
  • a computer-readable storage medium is also provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned image template selection method is implemented.
  • FIG. 1 is a flowchart of a method for selecting an image template provided in Embodiment 1 of the present application;
  • FIG. 2 is a flowchart of a method for selecting an image template provided in Embodiment 2 of the present application;
  • Fig. 2a is a target image corresponding to two expression images of different scales provided in the second embodiment of the present application;
  • FIG. 2b is a schematic diagram of a method for determining feature points of each area provided by Embodiment 2 of the present application;
  • Fig. 2c is a partial enlarged view of the preset pixel area of the qth area under the pth scale in Fig. 2a;
  • 2d is a schematic diagram of a method for determining a target area according to two target points provided in Embodiment 2 of the present application;
  • FIG. 2e is a flowchart of a method for selecting an image template provided in Embodiment 2 of the present application;
  • Fig. 2f is the result diagram of different image template sizes and matching accuracy provided by the second embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an image template selection device provided in Embodiment 3 of the present application.
  • FIG. 4 is a schematic structural diagram of a computer device according to Embodiment 4 of the present application.
  • FIG. 1 is a flowchart of an image template selection method provided in Embodiment 1 of the present application. This embodiment is applicable to the case of selecting an image template size during image matching.
  • the method can be selected by the image template selection device in the embodiment of the present application
  • the device can be implemented by software and/or hardware. As shown in FIG. 1 , the method includes the following steps:
  • S110 Acquire the image to be searched and the two target points input by the user.
  • the first target point selected by the user on the image to be searched After acquiring the image to be searched, acquire the first target point selected by the user on the image to be searched, determine the starting point of the pre-selected image template located in the upper left corner of the pre-selected image template, and acquire the second target selected by the user on the image to be searched The point determines the end point of the pre-selected image template at the lower right corner of the pre-selected image template to create the image template in such a way that a rectangle is constructed based on the two target points.
  • the method of acquiring the image to be searched may be: acquiring the image to be searched from an image acquisition device, and the image acquisition device may be any device with an image acquisition function, such as a camera, a scanner, and an image sensor, or may be an image to be searched entered by a user , and can also obtain the image to be searched from the 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 embodiments of the present application do not limit the manner of acquiring the image to be searched and the manner of acquiring the two target points input by the user.
  • S120 at least two regions are obtained by partitioning the image to be searched according to the number of threads.
  • the number of threads may be the number of Central Processing Unit (CPU) cores obtained by reading computer system parameters or the number of threads corresponding to the CPU cores, one core corresponds to at least one thread, and the number of threads indicates that the CPU can process parallel processing at the same time. number of tasks.
  • CPU Central Processing Unit
  • the image to be searched is uniformly partitioned according to the number of threads to obtain at least two areas, so that the computer can process images of multiple areas in parallel, so as to improve the efficiency of image template selection.
  • S130 Select an image template size according to the regions where the two target points in the at least two regions are located.
  • the method of selecting the image template size according to the regions where the two target points are located may be: if the two target points are in the same region, select the image template size according to the optimal template size corresponding to the regions where the two target points are located. If the two target points are in different areas, the image template size is selected according to the optimal template size corresponding to the areas where the two target points are located; or it can be: if the two target points are in the same area, then the size of the image template is selected according to the area where the target points are located. The corresponding optimal template size selects the image template size. If the two target points are in different regions, 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. .
  • the image to be searched is preprocessed, the image to be searched is partitioned according to the number of threads to obtain at least two regions, and the size of the image template is selected according to the regions where the two target points input by the user are located.
  • the selection method of the image matching template has the problems of large randomness, difficult to quantify, and high resource consumption. It provides a quantitative index for template image selection, realizes the selection of the smallest matchable image template size, and improves the accuracy of image template size selection. Reduce the probability of image mismatch caused by too small template size, and reduce the resource consumption during image matching caused by too large template size.
  • FIG. 2 is a flowchart of an image template selection method provided in Embodiment 2 of the present application. This embodiment is described on the basis of the above-mentioned embodiment.
  • the image to be searched is partitioned according to the number of threads to obtain At least two areas, including:
  • the method of this embodiment includes the following steps:
  • S210 Acquire the image to be searched and the two target points input by the user.
  • S220 Obtain different standard deviations corresponding to different Gaussian kernel functions according to a preset rule.
  • the selected standard deviation ⁇ i plays an important role in the Gaussian scale expression. If the selection of ⁇ i is too large, it will be difficult for the Gaussian scale to express the change of feature points between scales. If the selection of ⁇ i is too small, more Gaussian scale expressions may need to be established, which consumes time and computer resources. Therefore, given different and proportional standard deviations ⁇ i , the preset rules for obtaining the standard deviations ⁇ i corresponding to different Gaussian kernel functions are:
  • n is the first threshold
  • the first threshold can be set according to actual needs, and optionally, the first threshold is 20.
  • ⁇ i is the standard deviation corresponding to the Gaussian kernel function, representing the scale of the Gaussian kernel function, and ⁇ i constitutes a scale sequence ( ⁇ 1 , ⁇ 2 ,..., ⁇ n ).
  • (x, y) is the pixel point of the image to be searched
  • e is a natural constant, approximately equal to 2.71828
  • is the pi ratio, approximately equal to 3.1415927
  • G(x, y, ⁇ i ) is the Gaussian kernel at different scales ⁇ i function.
  • S240 Process the to-be-searched image according to the Gaussian kernel function at different scales to obtain an expression image set including expression images at different scales.
  • the expression image is obtained by convolving the Gaussian kernel function under the different scales with the image to be searched, namely:
  • I(x,y) is the pixel coordinate of the image to be searched
  • L(x,y, ⁇ i ) is the expression image
  • G(x,y, ⁇ i ) is the Gaussian image at different Gaussian standard deviation scales Size expression.
  • an expression image set ⁇ L(x, y, ⁇ i ) ⁇ is formed.
  • a linear filter can be used to preprocess the image to be searched, which can effectively suppress the noise of the image to be searched and smooth the image.
  • the principle of the preprocessing of the image to be searched lies in the process of weighted averaging of the entire image, and the value of each pixel is obtained by weighted averaging of itself and other pixel values in its neighborhood.
  • a Gaussian filter is used. The preset Gaussian filter generates a template according to the Gaussian function, and then performs a convolution operation with the image to be searched to obtain the preprocessed image to be searched.
  • the default Gaussian kernel function is:
  • (x, y) is the pixel point coordinates of the image to be searched
  • is the standard deviation
  • the value of ⁇ can be set according to actual requirements, and the embodiment of the present application does not limit the value of ⁇ .
  • the preprocessed image to be searched is:
  • P(x,y) is the image to be searched after preprocessing
  • I(x,y) is the image to be searched
  • G(x,y) is the preset Gaussian kernel function.
  • the image to be searched is processed according to the Gaussian kernel function under the different scales to obtain an expression image, that is:
  • the second-order differential Laplacian operator is used as a feature function to extract the detailed information of each expression image in the expression image set.
  • the Laplacian operator is:
  • the detailed feature information of each expression image in the expression image set is extracted by the Laplace feature function to obtain the target image, namely:
  • M(x, y, ⁇ i ) is the target image obtained after processing by the Laplace feature function.
  • a target image set ⁇ M(x, y, ⁇ i ) ⁇ is formed.
  • FIG. 2a is a target image corresponding to two expression images of different scales provided in the second embodiment of the present application.
  • the target image in Fig. 2a is the target image obtained by processing the expression image with the Laplacian feature function.
  • S260 at least two regions are obtained by partitioning each target image in the target image set according to the number of threads.
  • each target image M(x,y, ⁇ i ) in the target image set ⁇ M(x,y, ⁇ i ) ⁇ is partitioned to obtain L regions, wherein the target image M(x , y, ⁇ i ) are the images obtained by processing the Laplacian feature function of the expression images at different scales.
  • the thread number L can be obtained by reading computer system parameters.
  • S270 Select an image template size according to the regions where the two target points in the at least two regions are located.
  • the to-be-searched image is partitioned to obtain at least two regions according to the number of threads, it also includes:
  • the response scale s k corresponding to the characteristic scale j is obtained according to the characteristic scale sequence (j, k).
  • the calculation formula of the response scale is as follows:
  • k represents the area of the image to be searched
  • j represents the feature scale corresponding to the area k
  • L represents the number of areas of the image to be searched under one scale, that is, the number of computer threads.
  • the calculation method of determining the template size corresponding to each region according to the response scale sk is as follows:
  • a represents a constant coefficient, which can be set according to actual needs or based on experience obtained from experimental data Indicates that the calculated s k is rounded up, M k represents the minimum size of the image template selected at the image area k to be searched under different scales, and the template size corresponding to each area is min(M k ).
  • the template size corresponding to each region is min(M k )
  • the corresponding template size is Pixels.
  • determine the feature scale of each region including:
  • the preset pixel area includes: target pixel points in each area and adjacent pixel points of the target pixel point. Count the number of feature points of each region in the target image at different scales respectively; determine the feature of each region according to the maximum value of the number of feature points of each region in the target image under different scales scale.
  • the feature point is the pixel extreme point in the preset pixel area corresponding to the pixel point whose coordinates are (x, y) in the same area of the image to be searched under the adjacent scale, and the preset pixel area is the coordinate of ( x, y) and adjacent pixels around the pixel.
  • FIG. 2b is a schematic diagram of a method for determining feature points of each region provided in Embodiment 2 of the present application.
  • Figure 2b shows the preset pixel area corresponding to the pixel with the coordinates (x, y) in the same area under the p-th scale and the p-th scale's adjacent scales (p-1th scale and p+1th scale)
  • FIG. 2c is a partial enlarged view of the preset pixel area 201 of the qth area under the pth scale.
  • the pixel point 202 (the pixel point with the coordinates of (x, y) in the qth area under the pth scale) is the pixel point in the total 27 pixel points corresponding to the preset pixel area 201 in the qth area under the three scales of the image to be searched value point
  • the pixel point 202 is the feature point of the qth area under the pth scale.
  • the pixel extreme value point may be a pixel maximum value point or a pixel minimum value point.
  • the number of feature points of images to be searched with different scales in each region is at least one, and the number of feature points of images to be searched with different scales in each region is counted. Calculate the maximum value of the number of feature points in each region of the image to be searched at different scales, and use the maximum value of the number of feature points as the feature scale of each region.
  • selecting the image template size according to the regions where the two target points in the at least two regions are located including:
  • the size of the image template is selected according to the template size corresponding to the area where the two target points are located; if the two target points are in different areas, the size of the image template is determined according to the two target points target area, and select the image template size according to the template size corresponding to the area enclosed by the target area.
  • the size of the image template is selected according to the template size corresponding to the area where the two target points are located; if the two target points are in different areas, the size of the image template is determined according to the two target points target area, and select the image template size according to the template size corresponding to the area enclosed by the target area.
  • select the image template size according to the template size corresponding to the area surrounded by the target area including:
  • the image to be searched is divided into four areas, as shown in Figure 2d, if the area surrounded by the target area includes area 1, area 2, area 3 and area 4, compare the corresponding areas of the four areas.
  • Template size the template size corresponding to area 3 is the largest, then area 3 is used 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 includes area 1 and area 2, and the template size corresponding to area 2 is larger than the template size corresponding to area 1, area 2 is used as the first area, and the template size corresponding to the first area is determined as the image template size.
  • the steps of the embodiment of the present application are: acquiring the images to be searched for the number of users, performing Gaussian filtering on the images to be searched, expressing different Gaussian scales and enhancing the details of the Laplacian feature function to obtain a target image set, and acquiring The number of threads in the computer system parameters, partition each target image in the target image set according to the number of threads, and calculate the feature scale, scale sequence and response scale of each area in turn by parallel multi-threading, and calculate each area according to the response scale. template size.
  • the image template selection strategy it is judged whether the two target points input by the user are in the same area, if the two target points are in the same area, the image template size is selected according to the template size corresponding to the area where the target points are located; If the two target points are in different areas, the image template size is selected according to the template size corresponding to the area with the largest template size in the area surrounded by the target area.
  • Figure 2f shows the results of different image template sizes and matching accuracy.
  • “Lena” is used as the image to be searched, and templates are cut out in different areas on the image to be searched with different sizes for matching.
  • the size of the image template obtained by calculation is 43pixels
  • the square matrix of 43pixels and 40pixels is taken respectively to intercept the template image, and it is obtained that when it is lower than 43pixels, there exists in the eye part of the image.
  • the matching error (the actual matching angle should be 60°, and the final matching angle is 58°), while the image template size is 43pixels, the matching is normal. Therefore, the present application can effectively give the minimum image template size for image matching.
  • the target image is obtained by preprocessing the image to be searched by the Gaussian kernel function and the Laplacian feature function, and at least two regions are obtained by partitioning the target image according to the number of threads, and according to the feature scale of each region Calculate the template size corresponding to the area, and then select the image template size according to the regions where the two target points input by the user are located, which can provide a quantitative index for template image selection, and realize the selection of the smallest matchable image template size, thereby improving image template size selection. It reduces the probability of image mismatch caused by too small template size, and reduces the resource consumption during image matching caused by too large template size.
  • FIG. 3 is a schematic structural diagram of an image template selection apparatus according to Embodiment 3 of the present application. This embodiment is applicable to the case where the size of the image template is selected during image matching.
  • the device can be implemented in software and/or hardware, and the device can be integrated into any device that provides the function of image template selection, as shown in FIG. 3 .
  • the image template selection apparatus includes: a first acquisition module 310 , a partition module 320 and a selection module 330 .
  • the first acquisition module 310 is set to acquire the image to be searched and two target points input by the user; the partition module 320 is set to partition the image to be searched according to the number of threads to obtain at least two areas; the selection module 330 is set to The size of the image template is selected according to the regions where the two target points in the at least two regions are located.
  • the partition module 320 includes:
  • an obtaining unit set to obtain different standard deviations corresponding to different Gaussian kernel functions according to preset rules; a establishing unit, set to establish Gaussian kernel functions at different scales according to the different standard deviations; a processing unit, set to according to the different scales
  • the image to be searched is processed with the Gaussian kernel function under the following conditions, and an expression image set including expression images at different scales is obtained; the extraction unit is set to extract the expression image of each expression image in the expression image set through the Laplacian feature function.
  • the detailed feature information obtains a target image set including target images at different scales; the partitioning unit is configured to partition each target image in the target image set according to the number of threads to obtain at least two regions.
  • the first determination module is configured to determine the feature scale of each region after partitioning the to-be-searched image according to the number of threads to obtain at least two regions; the second acquisition module is configured to obtain the response scale corresponding to the feature scale ; a second determining module, configured to determine the template size corresponding to each region according to the response scale.
  • the selection module 330 includes:
  • the first selection unit is set to select the image template size according to the template size corresponding to the area where the two target points are located if the two target points are in the same area; the second selection unit is set to if the two target points are located in the same area. If the points are in different areas, the target area is determined according to the two target points, and the size of the image template is selected according to the template size corresponding to the area surrounded by the target area.
  • the second selection unit is set to:
  • the first determining module is configured to determine the feature scale of each region in the following manner:
  • the preset pixel area includes: the target pixel point in each area and the adjacent pixel point of the target pixel point; the characteristics of each area in the target image under different scales are counted respectively The number of points; the feature scale of each region is determined according to the maximum value of the number of feature points of each region in the target image at different scales.
  • the above product can execute the method provided by any embodiment of the present application, and has functional modules and effects corresponding to the execution method.
  • the image to be searched is preprocessed, and the image to be searched is partitioned according to the number of threads to obtain the template size corresponding to each area, and then the image template is selected according to the areas where the two target points input by the user are located.
  • Size provides a quantitative index for template image selection, and realizes the selection of the smallest image template size that can be matched, thereby improving the accuracy of image template size selection, reducing the probability of image mismatch caused by the template size being too small, and reducing the template size. Resource consumption for image matching caused by too large size.
  • FIG. 4 is a schematic structural diagram of a computer device according to Embodiment 4 of the present application.
  • FIG. 4 shows a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present application.
  • the computer device 12 shown in FIG. 4 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present application.
  • computer device 12 takes 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 , system memory 28 , and a bus 18 connecting various system components including system memory 28 and processing unit 16 .
  • Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures.
  • these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (Video Electronics Standards) Association, VESA) local bus and Peripheral Component Interconnect (PCI) bus.
  • Computer device 12 includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including both volatile and nonvolatile media, removable and non-removable media.
  • 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 include other removable/non-removable , volatile/non-volatile computer system storage media.
  • the storage system 34 may be configured to read and write to a non-removable, non-volatile magnetic medium (not shown in FIG. 4, commonly referred to as a "hard drive” ).
  • a magnetic disk drive configured to read and write to removable non-volatile magnetic disks (such as "floppy disks"), as well as to removable non-volatile optical disks (such as CD-ROMs (CD-ROMs).
  • Memory 28 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of embodiments of the present application.
  • a program/utility 40 having a set (at least one) of program modules 42, which 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 programs Modules and program data, each or a combination of these examples may include an implementation of a network environment.
  • Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
  • Computer device 12 may also communicate with one or more external devices 14 (eg, keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable a user to interact with computer device 12, and/or communicate with Any device (eg, network card, modem, etc.) that enables the computer device 12 to communicate with one or more other computing devices. Such communication may take place through an input/output (I/O) interface 22 .
  • the display 24 does not exist as an independent entity, but is embedded in the mirror surface. 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.
  • computer device 12 may communicate with one or more networks (eg, Local Area Network (LAN), Wide Area Network (WAN), and/or public networks such as the Internet) through network adapter 20.
  • network adapter 20 communicates with other modules of computer device 12 via bus 18 .
  • 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, Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.
  • the processing unit 16 executes a variety of functional applications and data processing by running the program stored in the system memory 28, such as implementing the image template selection method provided by the embodiment of the present application:
  • the fifth embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the image template selection methods provided by all the application embodiments of the present application:
  • the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. Examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, RAM, ROM, Erasable Programmable Read-Only Memory (Erasable Programmable Read-Only Memory) Memory, EPROM or flash memory), optical fiber, CD-ROM, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a propagated data signal in baseband or as part of a carrier wave, with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • suitable medium including but not limited to wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • Computer program code for carrying out the operations of the present application may be written in one or more programming languages, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional A procedural programming language, such as the "C" language or similar programming language.
  • 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.
  • the remote computer may be connected to the user computer through any kind of network, including a LAN or WAN, or may be connected to an external computer (eg, using an Internet service provider to connect through the Internet).

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

一种图像模板选择方法、装置、设备及存储介质。该图像模板选择方法包括:获取待搜索图像和用户输入的两个目标点(S110);根据线程数对所述待搜索图像进行分区得到至少两个区域(S120);根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸(S130)。

Description

图像模板选择方法、装置、设备及存储介质
本申请要求在2020年12月04日提交中国专利局、申请号为202011409002.8的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机视觉领域,例如涉及一种图像模板选择方法、装置、设备及存储介质。
背景技术
图像匹配是计算机视觉领域的重要应用。图像匹配是通过逐个像素比较的手段,计算已知的图像模板和待搜索图像在每个像素下的相似度,最终得到最佳的匹配位置。图像模板尺寸的选择对于匹配的精度的影响至关重要,图像模板过大会导致图像匹配耗时增加,影响匹配进程的实时性;图像模板过小会导致模板信息过少,造成图像的误匹配。
经典的图像模板选择方法主要可以分为三种:第一种是通过全局图像阈值的方式,在整个待搜索图像区域内截取图像模板,该方法适用于对比度大、特征和纹理信息较简单的待搜索图像。其次,该方法选择的模板尺寸依然会存在过小的情况,对于匹配的精度会造成影响。第二种是基于待匹配图像区域,和先验信息随机创建模板,模板的大小随机生成,由此带来的问题是图像模板过大会造成资源的浪费,模板过小会因为图像信息过少造成误匹配;第三种是直接选取具有目标特征的图像模板,当目标特征缺少纹理或结构信息时,会导致难以截取合理的局部区域作为匹配模板。因此,图像匹配模板的选取方法存在随机性大、难以量化、资源消耗量大等缺点。
发明内容
本申请提供一种图像模板选择方法、装置、设备及存储介质,以提供模板图像选择的量化指标,选择最小可匹配的图像模板尺寸,从而提高图像模板尺寸选择的准确度。
提供了图像模板选择方法,包括:
获取待搜索图像和用户输入的两个目标点;根据线程数对所述待搜索图像进行分区得到至少两个区域;根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
还提供了图像模板选择装置,包括:
第一获取模块,设置为获取待搜索图像和用户输入的两个目标点;分区模块,设置为根据线程数对所述待搜索图像进行分区得到至少两个区域;选择模块,设置为根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
还提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述的图像模板选择方法。
还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述的图像模板选择方法。
附图说明
图1是本申请实施例一提供的一种图像模板选择方法的流程图;
图2是本申请实施例二提供的一种图像模板选择方法的流程图;
图2a是本申请实施例二提供的一种两个不同尺度的表达图像分别对应的目标图像;
图2b是本申请实施例二提供的一种确定每个区域的特征点的方法的示意图;
图2c是图2a中第p尺度下第q区域的预设像素区域的局部放大图;
图2d是本申请实施例二提供的一种根据两个目标点确定目标区域的方法的示意图;
图2e是本申请实施例二提供的一种图像模板选择方法的流程图;
图2f是本申请实施例二提供的不同图像模板尺寸与匹配精度的结果图;
图3是本申请实施例三提供的一种图像模板选择装置的结构示意图;
图4是本申请实施例四提供的一种计算机设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请进行说明。
相似的标号和字母在附图中表示类似项,因此,一旦一项在一个附图中被定义,则在随后的附图中不需要对其进行定义和解释。同时,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
实施例一
图1为本申请实施例一提供的一种图像模板选择方法的流程图,本实施例可适用于在图像匹配时选择图像模板尺寸的情况,该方法可以由本申请实施例中的图像模板选择装置来执行,该装置可采用软件和/或硬件的方式实现,如图1所示,该方法包括如下步骤:
S110,获取待搜索图像和用户输入的两个目标点。
在获取待搜索图像之后,获取用户在待搜索图像上选择的第一个目标点确定位于预选择图像模板左上角的预选择图像模板的起点,获取用户在待搜索图像上选择的第二个目标点确定位于预选择图像模板右下角的预选择图像模板的终点,从而基于两个目标点构造矩形的方式创建图像模板。
获取待搜索图像的方式可以为:从图像采集装置获取待搜索图像,所述图像采集装置可以为摄像头、扫描仪和图像传感器等任何具有图像采集功能的装置,或者可以为用户输入的待搜索图像,还可以为从存储服务器获取待搜索图像。获取用户输入的两个目标点的方式可以为在用户输入一个目标点之后通过移动鼠标并点击鼠标键选取第二目标点。本申请实施例对获取待搜索图像的方式以及获取用户输入的两个目标点的方式不设限制。
S120,根据线程数对所述待搜索图像进行分区得到至少两个区域。
线程数可以是通过读取计算机系统参数获取的中央处理器(Central Processing Unit,CPU)核心数或者CPU核心对应的线程数,一个核心最少对应一个线程,所述线程数表示CPU能同时并行处理的任务数。
根据线程数对所述待搜索图像进行均匀分区得到至少两个区域,使计算机可以对多个区域的图像并行处理,以提高图像模板选择的效率。
S130,根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
确定用户输入的两个目标点分别所处于的待搜索图像分区后的区域,根据确定的每个区域所对应的最优模板尺寸选择图像模板尺寸。
根据所述两个目标点所在区域选择图像模板尺寸的方式可以为:若两个目标点在同一个区域,则根据所述两个目标点所在区域对应的最优模板尺寸选择图像模板尺寸,若两个目标点在不同区域,则根据两个目标点所在区域分别对应的最优模板尺寸选择图像模板尺寸;或者可以为:若两个目标点在同一个区域,则根据所述目标点所在区域对应的最优模板尺寸选择图像模板尺寸,若两 个目标点在不同区域,则根据所述两个目标点确定目标区域,并根据所述目标区域所包围的区域对应的模板尺寸选择图像模板尺寸。
本实施例的技术方案,通过对待搜索图像进行预处理,并根据线程数对所述待搜索图像进行分区得到至少两个区域,并根据用户输入的两个目标点所在区域选择图像模板尺寸,解决图像匹配模板的选取方法存在随机性大、难以量化、资源消耗量大的问题,提供了模板图像选择的量化指标,实现选择最小可匹配的图像模板尺寸,从而提高图像模板尺寸选择的准确度,降低因模板尺寸过小带来的图像误匹配的概率,同时减少因模板尺寸过大导致的图像匹配时的资源消耗。
实施例二
图2为本申请实施例二提供的一种图像模板选择方法的流程图,本实施例以上述实施例为基础进行说明,在本实施例中,根据线程数对所述待搜索图像进行分区得到至少两个区域,包括:
根据预设规则获取不同高斯核函数对应的不同标准差;根据所述不同标准差建立不同尺度下的高斯核函数;根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到包含不同尺度下的表达图像的表达图像集;通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到包含不同尺度下的目标图像的目标图像集;根据线程数对所述目标图像集中的每个目标图像进行分区得到至少两个区域。
如图2所示,本实施例的方法包括如下步骤:
S210,获取待搜索图像和用户输入的两个目标点。
S220,根据预设规则获取不同高斯核函数对应的不同标准差。
选取的标准差σ i对高斯尺度表达具有重要的作用。若σ i选择过大会导致高斯尺度难以表达尺度之间的特征点的变化情况,若σ i选择过小可能会使得需要建立较多的高斯尺度表达,耗费时间和计算机资源。因此,给定不同且成比例关系的标准差σ i,获取不同高斯核函数对应的标准差σ i的预设规则为:
σ i=1.1 i
其中,i∈N +且i≤n,n为第一阈值,所述第一阈值可以根据实际需要设定,可选的,第一阈值为20。σ i为高斯核函数对应的标准差,表示高斯核函数的尺度,由σ i构成尺度序列(σ 12,…,σ n)。
S230,根据所述不同标准差建立不同尺度下的高斯核函数。
根据预设规则获取不同高斯核函数对应的不同标准差,建立不同尺度下的高斯核函数为:
Figure PCTCN2021096920-appb-000001
其中,(x,y)为待搜索图像的像素点,e为自然常数,约等于2.71828;π为圆周率,约等于3.1415927,G(x,y,σ i)为不同尺度σ i下的高斯核函数。
S240,根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到包含不同尺度下的表达图像的表达图像集。
根据所述不同尺度下的高斯核函数与待搜索图像进行卷积得到表达图像,即:
L(x,y,σ i)=G(x,y,σ i)×I(x,y);
其中,I(x,y)为待搜索图像的像素点坐标,L(x,y,σ i)为表达图像,G(x,y,σ i)表示图像在不同高斯标准差尺度下的高斯尺寸表达。
根据不同尺度的表达图像L(x,y,σ i)构成表达图像集{L(x,y,σ i)}。
为了表达待搜索图像的高斯尺寸表达,可以采用线性滤波器对待搜索图像进行预处理,有效抑制待搜索图像的噪声,平滑图像。对待搜索图像预处理的原理在于对整幅图像进行加权平均的过程,每一个像素点的值都由其本身和邻域内的其他像素值经过加权平均后得到。可选的,采用高斯滤波器。预设高斯滤波器根据高斯函数生成一个模板,再与待搜索图像进行卷积操作得到预处理后的待搜索图像。
预设高斯核函数为:
Figure PCTCN2021096920-appb-000002
其中,(x,y)为待搜索图像的像素点坐标,σ为标准差,σ的值可以根据实际需求设定,本申请实施例对σ的值不设限制。σ越小,生成的模板中心系数越大,周围系数越小,对图像的平滑效果就不明显;反之,σ较大,则生成模板的多个系数相差就不大,类似于均值模板,对图像的平滑效果比较明显。
预处理后的待搜索图像为:
P(x,y)=G(x,y)×I(x,y);
其中,P(x,y)为预处理后的待搜索图像,I(x,y)为待搜索图像,G(x,y)为预设高斯核函数。
根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到表达图像,即:
L(x,y,σ i)=G(x,y,σ i)×P(x,y)。
S250,通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到包含不同尺度下的目标图像的目标图像集。
在获得待搜索图像在不同尺度下的表达图像集后,需要提取表达图像的细节和结构特征信息。因此,将二阶微分拉普拉斯算子作为特征函数提取表达图像集中每个表达图像的细节信息。所述拉普拉斯算子为:
Figure PCTCN2021096920-appb-000003
其中,为了更适合于数字图像处理,将所述拉普拉斯算子
Figure PCTCN2021096920-appb-000004
表示为离散形式的通用近似结果为:
Figure PCTCN2021096920-appb-000005
则通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到目标图像,即:
Figure PCTCN2021096920-appb-000006
其中,M(x,y,σ i)为通过拉普拉斯特征函数处理后得到的目标图像。
根据不同尺度的表达图像L(x,y,σ i)对应的目标图像M(x,y,σ i)构成目标图像集{M(x,y,σ i)}。
示例性的,图2a是本申请实施例二提供的一种两个不同尺度的表达图像分别对应的目标图像。其中,图2a中的目标图像是通过对表达图像进行拉普拉斯特征函数处理后得到的目标图像。
S260,根据线程数对所述目标图像集中的每个目标图像进行分区得到至少两个区域。
根据线程数L对所述目标图像集{M(x,y,σ i)}中的每个目标图像M(x,y,σ i)进行分区得到L个区域,其中,目标图像M(x,y,σ i)为不同尺度下的表达图像经拉普拉斯特征函数处理后的得到图像。所述线程数L可以通过读取计算机系统参数获取。
S270,根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
可选的,在根据线程数对所述待搜索图像进行分区得到至少两个区域之后, 还包括:
确定每个区域的特征尺度;获取所述特征尺度对应的响应尺度;根据所述响应尺度确定每个区域对应的模板尺寸。
确定根据线程数对不同尺度下的待搜索图像经分区后得到的每一个区域的特征尺度,根据所述区域对应的特征尺度和所述区域确定特征尺度序列(j,k)。根据特征尺度序列(j,k)获取特征尺度j对应的响应尺度s k,响应尺度的计算公式如下:
s k=σ j=1.1 j,k=1,2,…,L;
其中,k表示待搜索图像的区域,j表示区域k对应的特征尺度,L表示一个尺度下待搜索图像的区域个数,即计算机线程数。
根据所述响应尺度s k确定每个区域对应的模板尺寸的计算方式如下:
Figure PCTCN2021096920-appb-000007
其中,a表示常数系数,可以根据实际需求设定或根据实验数据得到的经验
Figure PCTCN2021096920-appb-000008
Figure PCTCN2021096920-appb-000009
表示对计算得到的s k向上取整,M k表示不同尺度下的待搜索图像区域k处图像模板选择的最小尺寸,则每个区域对应的模板尺寸为min(M k)。
由于实际模板选择的尺寸不会达到基于图像尺度特征计算得到的最小值,为保证选取的图像模板具有足够的匹配特征信息,可选的,将向上取整得到的
Figure PCTCN2021096920-appb-000010
加1,乘以系数a,得到每一个区域对应的模板尺寸,即:
Figure PCTCN2021096920-appb-000011
则,每一个区域对应的模板尺寸为min(M k)
示例性的,一个待搜索图像的第一区域的特征尺度序列为(19,1),系数a=6计算得到的响应尺度为s 1=σ 19=1.1 19=6.115,给出的第一区域对应的模板尺寸大小为
Figure PCTCN2021096920-appb-000012
像素(pixels)。
可选的,确定每个区域的特征尺度,包括:
分别获取不同尺度下的目标图像中所述每个区域的特征点,其中,所述特征点为相邻尺度下的目标图像中所述每个区域中预设像素区域中的像素极值点,所述预设像素区域包括:所述每个区域中的目标像素点和所述目标像素点的相邻像素点。分别统计不同尺度下的目标图像中所述每个区域的特征点的数量;根据不同尺度下的目标图像中所述每个区域的特征点的数量的极大值确定所述每个区域的特征尺度。
在根据线程数对所述待搜索图像进行分区得到至少两个区域之后,获取每 个区域的特征点。所述特征点为待搜索图像在相邻尺度下的同一区域中坐标为(x,y)的像素点对应的预设像素区域中的像素极值点,所述预设像素区域为坐标为(x,y)的像素点以及所述像素点周围相邻的像素点。
示例性的,图2b是本发明申请实施例二提供中的一种确定每个区域的特征点的方法的示意图。图2b示出了第p尺度和第p尺度的相邻尺度(第p-1尺度和第p+1尺度)下的同一区域中坐标为(x,y)的像素点对应的预设像素区域,其中,图2c为第p尺度下第q区域的预设像素区域201的局部放大图。若像素点202(第p尺度下第q区域坐标为(x,y)的像素点)为待搜索图像三个尺度下第q区域对应预设像素区域201的共计27个像素点中的像素极值点,则像素点202为第p尺度下第q区域的特征点。所述像素极值点可以为像素极大值点或者像素极小值点。按照上述特征点判定方法,不同尺度的待搜索图像在每个区域内的特征点个数至少为一个,则统计不同尺度的待搜索图像在每个区域内的特征点个数。计算不同尺度的待搜索图像在每个区域的特征点的数量的极大值,将所述特征点的数量的极大值作为每个区域的特征尺度。
可选的,根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸,包括:
若所述两个目标点在同一区域,则根据所述两个目标点所在区域对应的模板尺寸选择图像模板尺寸;若所述两个目标点在不同区域,则根据所述两个目标点确定目标区域,并根据所述目标区域所包围的区域对应的模板尺寸选择图像模板尺寸。
若所述两个目标点在同一区域,则根据所述两个目标点所在区域对应的模板尺寸选择图像模板尺寸;若所述两个目标点在不同区域,则根据所述两个目标点确定目标区域,并根据所述目标区域所包围的区域对应的模板尺寸选择图像模板尺寸。
可选的,根据所述目标区域所包围的区域对应的模板尺寸选择图像模板尺寸,包括:
获取所述目标区域所包围的区域中模板尺寸最大的第一区域;根据所述第一区域对应的模板尺寸选择图像模板尺寸。
获取目标区域所包围的区域对应的模板尺寸,确定目标区域所包围的区域中模板尺寸最大的区域为第一区域,将所述第一区域对应的模板尺寸确定为图像目标尺寸。示例性的,根据线程数,将待搜索图像分为四个区域,如图2d所示,若目标区域所包围的区域包括区域1、区域2、区域3和区域4,比较四个区域对应的模板尺寸,区域3对应的模板尺寸最大,则将区域3作为第一区域, 第一区域对应的模板尺寸确定为图像模板尺寸。若目标区域所包围的区域包括区域1和区域2,区域2对应的模板尺寸大于区域1对应的模板尺寸,则区域2作为第一区域,第一区域对应的模板尺寸确定为图像模板尺寸。
如图2e所示,本申请实施例的步骤为:获取用户数的待搜索图像、对待搜索图像进行高斯滤波、不同高斯尺度的表达和拉普拉斯特征函数的细节增强得到目标图像集,获取计算机系统参数中的线程数,根据线程数对目标图像集中的每一个目标图像进行分区,并行多线程依次计算每个区域的特征尺度、尺度序列和响应尺度,根据所述响应尺度计算每个区域的模板尺寸。根据图像模板选择策略,判断用户输入的两个目标点是否处于同一区域,若所述两个目标点在同一区域,则根据所述目标点所在区域对应的模板尺寸选择图像模板尺寸;若所述两个目标点在不同区域,则根据目标区域所包围的区域中模板尺寸最大的区域对应的模板尺寸选择图像模板尺寸。
图2f为不同图像模板尺寸与匹配精度的结果。如图2f所示,本实施例以“Lena”作为待搜索图像,分别在待搜索图像上的不同区域以不同尺寸截取模板进行匹配。将本申请方法应用在待搜索图像上得到的尺度序列为j=19,计算得到的图像模板尺寸为43pixels,分别取43pixels和40pixels方阵截取模板图像,得到当低于43pixels时在图像眼睛部分存在匹配误差(实际应匹配角度60°,最终匹配角度为58°),而图像模板尺寸大小为43pixels则匹配正常。因此,本申请可有效给出用于图像匹配的最小图像模板尺寸。
本实施例的技术方案,通过高斯核函数和拉普拉斯特征函数对待搜索图像进行预处理得到目标图像,并根据线程数对目标图像进行分区得到至少两个区域,根据每个区域的特征尺度计算所述区域对应的模板尺寸,进而根据用户输入的两个目标点所在区域选择图像模板尺寸,能提供模板图像选择的量化指标,实现选择最小可匹配的图像模板尺寸,从而提高图像模板尺寸选择的准确度,降低因模板尺寸过小带来的图像误匹配的概率,同时减少因模板尺寸过大导致的图像匹配时的资源消耗。
实施例三
图3为本申请实施例三提供的一种图像模板选择装置的结构示意图。本实施例可适用于在图像匹配时选择图像模板尺寸的情况,该装置可采用软件和/或硬件的方式实现,该装置可集成在任何提供图像模板选择的功能的设备中,如图3所示,所述图像模板选择的装置包括:第一获取模块310、分区模块320和选择模块330。
第一获取模块310,设置为获取待搜索图像和用户输入的两个目标点;分区模块320,设置为根据线程数对所述待搜索图像进行分区得到至少两个区域;选择模块330,设置为根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
可选的,所述分区模块320,包括:
获取单元,设置为根据预设规则获取不同高斯核函数对应的不同标准差;建立单元,设置为根据所述不同标准差建立不同尺度下的高斯核函数;处理单元,设置为根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到包含不同尺度下的表达图像的表达图像集;提取单元,设置为通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到包含不同尺度下的目标图像的目标图像集;分区单元,设置为根据线程数对所述目标图像集中的每个目标图像进行分区得到至少两个区域。
可选的,还包括:
第一确定模块,设置为在根据线程数对所述待搜索图像进行分区得到至少两个区域之后,确定每个区域的特征尺度;第二获取模块,设置为获取所述特征尺度对应的响应尺度;第二确定模块,设置为根据所述响应尺度确定每个区域对应的模板尺寸。
可选的,所述选择模块330,包括:
第一选择单元,设置为若所述两个目标点在同一区域,则根据所述两个目标点所在区域对应的模板尺寸选择图像模板尺寸;第二选择单元,设置为若所述两个目标点在不同区域,则根据所述两个目标点确定目标区域,并根据所述目标区域所包围的区域对应的模板尺寸选择图像模板尺寸。
可选的,所述第二选择单元,设置为:
获取所述目标区域所包围的区域中模板尺寸最大的第一区域;根据所述第一区域对应的模板尺寸选择图像模板尺寸。
可选的,第一确定模块设置为通过如下方式确定每个区域的特征尺度:
分别获取所述不同尺度下的目标图像中所述每个区域的特征点,其中,所述特征点为相邻尺度下的目标图像中所述每个区域中预设像素区域中的像素极值点,所述预设像素区域包括:所述每个区域中的目标像素点和所述目标像素点的相邻像素点;分别统计所述不同尺度下的目标图像中所述每个区域的特征点的数量;根据所述不同尺度下的目标图像中所述每个区域的特征点的数量的极大值确定每个区域的特征尺度。
上述产品可执行本申请任意实施例所提供的方法,具备执行方法相应的功能模块和效果。
本实施例的技术方案,通过对待搜索图像进行预处理,并根据线程数对所述待搜索图像进行分区得到每一个区域对应的模板尺寸,进而根据用户输入的两个目标点所在区域选择图像模板尺寸,提供了模板图像选择的量化指标,实现选择最小可匹配的图像模板尺寸,从而提高图像模板尺寸选择的准确度,降低因模板尺寸过小带来的图像误匹配的概率,同时减少因模板尺寸过大导致的图像匹配时的资源消耗。
实施例四
图4为本申请实施例四提供的一种计算机设备的结构示意图。图4示出了适于用来实现本申请实施方式的示例性计算机设备12的框图。图4显示的计算机设备12仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图4所示,计算机设备12以通用计算设备的形式表现。计算机设备12的组件可以包括但不限于:一个或者多个处理器或者处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry Standard Architecture,ISA)总线,微通道体系结构(Micro Channel Architecture,MAC)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association,VESA)局域总线以及外围组件互连(Peripheral Component Interconnect,PCI)总线。
计算机设备12包括多种计算机系统可读介质。这些介质可以是任何能够被计算机设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
系统存储器28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器((Random Access Memory,RAM)30和/或高速缓存存储器32。计算机设备12可以包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以设置为读写不可移动的、非易失性磁介质(图4未显示,通常称为“硬盘驱动器”)。尽管图4中未示出,可以提供设置为对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非 易失性光盘(例如光盘只读存储器(Compact Disc Read-Only Memory,CD-ROM),数字多功能盘只读存储器(Digital Versatile Disc-ROM,DVD-ROM)或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本申请实施例的功能。
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如存储器28中,这样的程序模块42包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或一种组合中可能包括网络环境的实现。程序模块42通常执行本申请所描述的实施例中的功能和/或方法。
计算机设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该计算机设备12交互的设备通信,和/或与使得该计算机设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(Input/Output,I/O)接口22进行。另外,本实施例中的计算机设备12,显示器24不是作为独立个体存在,而是嵌入镜面中,在显示器24的显示面不予显示时,显示器24的显示面与镜面从视觉上融为一体。并且,计算机设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与计算机设备12的其它模块通信。应当明白,尽管图中未示出,可以结合计算机设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、磁盘阵列(Redundant Arrays of Independent Disks,RAID)系统、磁带驱动器以及数据备份存储系统等。
处理单元16通过运行存储在系统存储器28中的程序,从而执行多种功能应用以及数据处理,例如实现本申请实施例所提供的图像模板选择方法:
获取待搜索图像和用户输入的两个目标点;根据线程数对所述待搜索图像进行分区得到至少两个区域;根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
实施例五
本申请实施例五提供了一种计算机可读存储介质,其上存储有计算机程序, 该程序被处理器执行时实现如本申请所有申请实施例提供的图像模板选择方法:
获取待搜索图像和用户输入的两个目标点;根据线程数对所述待搜索图像进行分区得到至少两个区域;根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM或闪存)、光纤、CD-ROM、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本申请操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言,诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言,诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括LAN或WAN—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。

Claims (10)

  1. 一种图像模板选择方法,包括:
    获取待搜索图像和用户输入的两个目标点;
    根据线程数对所述待搜索图像进行分区得到至少两个区域;
    根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
  2. 根据权利要求1所述的方法,其中,所述根据线程数对所述待搜索图像进行分区得到至少两个区域,包括:
    根据预设规则获取不同高斯核函数对应的不同标准差;
    根据所述不同标准差建立不同尺度下的高斯核函数;
    根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到包含不同尺度下的表达图像的表达图像集;
    通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到包含不同尺度下的目标图像的目标图像集;
    根据所述线程数对所述目标图像集中的每个目标图像进行分区得到所述至少两个区域。
  3. 根据权利要求2所述的方法,在所述根据线程数对所述待搜索图像进行分区得到至少两个区域之后,还包括:
    确定每个区域的特征尺度;
    获取所述特征尺度对应的响应尺度;
    根据所述响应尺度确定所述每个区域对应的模板尺寸。
  4. 根据权利要求3所述的方法,其中,所述根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸,包括:
    在所述两个目标点在同一区域的情况下,根据所述两个目标点所在区域对应的模板尺寸选择所述图像模板尺寸;
    在所述两个目标点在不同区域的情况下,根据所述两个目标点确定目标区域,并根据所述目标区域所包围的区域对应的模板尺寸选择所述图像模板尺寸。
  5. 根据权利要求4所述的方法,其中,所述根据所述目标区域所包围的区域对应的模板尺寸选择所述图像模板尺寸,包括:
    获取所述目标区域所包围的区域中模板尺寸最大的第一区域;
    根据所述第一区域对应的模板尺寸选择所述图像模板尺寸。
  6. 根据权利要求3所述的方法,其中,所述确定每个区域的特征尺度,包 括:
    分别获取所述不同尺度下的目标图像中所述每个区域的特征点,其中,所述特征点为相邻尺度下的目标图像中所述每个区域中预设像素区域中的像素极值点,所述预设像素区域包括:所述每个区域中的目标像素点和所述目标像素点的相邻像素点;
    分别统计所述不同尺度下的目标图像中所述每个区域的特征点的数量;
    根据所述不同尺度下的目标图像中所述每个区域的特征点的数量的极大值确定所述每个区域的特征尺度。
  7. 一种图像模板选择装置,包括:
    获取模块,设置为获取待搜索图像和用户输入的两个目标点;
    分区模块,设置为根据线程数对所述待搜索图像进行分区得到至少两个区域;
    选择模块,设置为根据所述至少两个区域中的所述两个目标点所在区域选择图像模板尺寸。
  8. 根据权利要求7所述的装置,其中,所述分区模块,包括:
    获取单元,设置为根据预设规则获取不同高斯核函数对应的不同标准差;
    建立单元,设置为根据所述不同标准差建立不同尺度下的高斯核函数;
    处理单元,设置为根据所述不同尺度下的高斯核函数对所述待搜索图像进行处理,得到包含不同尺度下的表达图像的表达图像集;
    提取单元,设置为通过拉普拉斯特征函数提取所述表达图像集中每个表达图像的细节特征信息得到包含不同尺度下的目标图像的目标图像集;
    分区单元,设置为根据所述线程数对所述目标图像集中的每个目标图像进行分区得到所述至少两个区域。
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求1-6中任一项所述的图像模板选择方法。
  10. 一种计算机可读存储介质,存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-6中任一项所述的图像模板选择方法。
PCT/CN2021/096920 2020-12-04 2021-05-28 图像模板选择方法、装置、设备及存储介质 WO2022116492A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011409002.8A CN112465050B (zh) 2020-12-04 2020-12-04 一种图像模板选择方法、装置、设备及存储介质
CN202011409002.8 2020-12-04

Publications (1)

Publication Number Publication Date
WO2022116492A1 true WO2022116492A1 (zh) 2022-06-09

Family

ID=74805790

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/096920 WO2022116492A1 (zh) 2020-12-04 2021-05-28 图像模板选择方法、装置、设备及存储介质

Country Status (2)

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

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115455227A (zh) * 2022-09-20 2022-12-09 上海弘玑信息技术有限公司 图形界面的元素搜索方法及电子设备、存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465050B (zh) * 2020-12-04 2024-02-09 广东拓斯达科技股份有限公司 一种图像模板选择方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464951A (zh) * 2007-12-21 2009-06-24 北大方正集团有限公司 图像识别方法及系统
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
CN111738232A (zh) * 2020-08-06 2020-10-02 深圳须弥云图空间科技有限公司 一种标记桩基的方法和装置
CN112465050A (zh) * 2020-12-04 2021-03-09 广东拓斯达科技股份有限公司 一种图像模板选择方法、装置、设备及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4394926B2 (ja) * 2003-11-06 2010-01-06 日本電信電話株式会社 画像処理方法及びその装置、プログラム並びにこの記録媒体
JP2019020839A (ja) * 2017-07-12 2019-02-07 キヤノン株式会社 画像処理装置、画像処理方法、及びプログラム
CN109118529B (zh) * 2018-08-13 2022-06-03 四川长虹电器股份有限公司 一种基于视觉的螺孔图像快速定位方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464951A (zh) * 2007-12-21 2009-06-24 北大方正集团有限公司 图像识别方法及系统
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
CN111738232A (zh) * 2020-08-06 2020-10-02 深圳须弥云图空间科技有限公司 一种标记桩基的方法和装置
CN112465050A (zh) * 2020-12-04 2021-03-09 广东拓斯达科技股份有限公司 一种图像模板选择方法、装置、设备及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115455227A (zh) * 2022-09-20 2022-12-09 上海弘玑信息技术有限公司 图形界面的元素搜索方法及电子设备、存储介质

Also Published As

Publication number Publication date
CN112465050A (zh) 2021-03-09
CN112465050B (zh) 2024-02-09

Similar Documents

Publication Publication Date Title
US20220147822A1 (en) Training method and apparatus for target detection model, device and storage medium
US20200320273A1 (en) Remote sensing image recognition method and apparatus, storage medium and electronic device
WO2020199931A1 (zh) 人脸关键点检测方法及装置、存储介质和电子设备
WO2019238072A1 (zh) 深度神经网络的归一化方法和装置、设备、存储介质
WO2019242416A1 (zh) 视频图像处理方法及装置、计算机可读介质和电子设备
WO2020224405A1 (zh) 图像处理方法、装置、计算机可读介质及电子设备
WO2022116492A1 (zh) 图像模板选择方法、装置、设备及存储介质
WO2021164550A1 (zh) 图像分类方法及装置
EP3876201B1 (en) Object detection and candidate filtering system
WO2019214344A1 (zh) 系统增强学习方法和装置、电子设备、计算机存储介质
US9025889B2 (en) Method, apparatus and computer program product for providing pattern detection with unknown noise levels
EP3846122A2 (en) Method and apparatus for generating background-free image, device, and medium
WO2020125062A1 (zh) 一种图像融合方法及相关装置
CN115294332B (zh) 一种图像处理方法、装置、设备和存储介质
CN112163577A (zh) 游戏画面中的文字识别方法、装置、电子设备和存储介质
WO2022048414A1 (zh) 一种图像生成方法、装置、设备及存储介质
CN113837194A (zh) 图像处理方法、图像处理装置、电子设备以及存储介质
CN113627298A (zh) 目标检测模型的训练方法及检测目标对象的方法、装置
WO2020087949A1 (zh) 数据库更新方法和装置、电子设备、计算机存储介质
WO2023273188A1 (zh) 一种文本处理方法及相关装置
CN113327194A (zh) 图像风格迁移方法、装置、设备和存储介质
CN114140852A (zh) 图像检测方法和装置
EP4330932A1 (en) Texture completion
CN111462220A (zh) 待侦测物体阴影面积提取方法、装置、设备及介质
CN113052175B (zh) 目标检测方法、装置、电子设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21899535

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21899535

Country of ref document: EP

Kind code of ref document: A1