WO2022218161A1 - Method and apparatus for target matching, device, and storage medium - Google Patents

Method and apparatus for target matching, device, and storage medium Download PDF

Info

Publication number
WO2022218161A1
WO2022218161A1 PCT/CN2022/084323 CN2022084323W WO2022218161A1 WO 2022218161 A1 WO2022218161 A1 WO 2022218161A1 CN 2022084323 W CN2022084323 W CN 2022084323W WO 2022218161 A1 WO2022218161 A1 WO 2022218161A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target
distance
feature point
matching
Prior art date
Application number
PCT/CN2022/084323
Other languages
French (fr)
Chinese (zh)
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 WO2022218161A1 publication Critical patent/WO2022218161A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/97Determining parameters from multiple pictures

Definitions

  • the present application relates to the technical field of image processing, and in particular, to a method, apparatus, device and storage medium for target matching.
  • Object matching in images is a fundamental problem in computer vision, and the accuracy of object matching will affect the operations after object matching.
  • the common target matching method in images mainly uses the two closest feature points in the two images to be matched as the matching point pair. Taking face matching as an example, it is mainly to judge the offset of the faces in the two images. If the coordinates of the faces in the vertical direction in the two images are the same, and the difference in the horizontal direction is the smallest, it is considered to be a mutual match. face.
  • the problem with this method is that in the case of multiple faces in the image, the face with the smallest position difference in the two images may not be the face that actually matches each other.
  • the present application provides at least one method, apparatus, device and storage medium for target matching.
  • the present application provides a target matching method, including: acquiring a first image and a second image, wherein the first image and the second image are obtained by shooting a target to be matched by different shooting components; based on the relationship between the target and at least one shooting component The first distance between the first image and the second image is obtained to obtain the parallax of the target between the first image and the second image; according to the parallax, the matching feature point pair about the target in the first image and the second image is determined.
  • the first image and the second image can be effectively realized.
  • Object matching between two images compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
  • determining the pair of matching feature points about the target in the first image and the second image according to the parallax includes: determining, based on the parallax, a reference position corresponding to the first feature point in the second image, wherein the first feature point is a pair of The first image is obtained by performing target feature point detection; based on the reference position, a second feature point matching the first feature point is selected in the second image, wherein the second feature point is the target feature point detection performed on the second image. owned.
  • the second feature point is determined according to the reference position, the area in the second image that matches the first feature point is reduced, and the match can be quickly found Point to improve the matching accuracy.
  • selecting a second feature point matching the first feature point in the second image includes: determining a candidate region including the reference position in the second image, and selecting a candidate region that matches the first feature point in the candidate region The second feature point whose positional relationship of the epipolar line corresponding to the point in the second image satisfies the preset requirement is taken as the second feature point matching the first feature point.
  • the accuracy of target matching is improved compared to using a single dimension.
  • the epipolar line corresponding to the first feature point in the second image is determined by the following operations: the epipolar line is obtained by using the coordinates of the first feature point and the fundamental matrix.
  • the preset requirement is that the distance between the second feature point and the epipolar line in the candidate region is the smallest.
  • the second feature point corresponding to the first feature point should be on the epipolar line, but errors will inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, so the candidate is selected.
  • the feature point with the smallest distance from the epipolar line in the region is used as the second feature point corresponding to the first feature point, which can improve the success rate of target matching.
  • the first image or the second image is the reference image
  • the photographing component corresponding to the reference image is the reference photographing component
  • the first distance is the distance between the target and the reference photographing component
  • the first distance is obtained through the following steps: determining that the target is in the reference The first size of the corresponding target area in the image; the first distance is obtained by using the ratio between the first size and the preset size.
  • the technical effect that the distance between the target and the shooting component can be determined by using a single image is achieved, which breaks the
  • the traditional perception of the distance between the target and the photographed component can be obtained by combining at least two or more images.
  • the first size includes the first width and the first height of the target area
  • the preset size includes the preset width and the preset height
  • using the ratio between the first size and the preset size to obtain the first distance including: obtaining a first ratio between the first width and the preset width, and a second ratio between the first height and the preset height; the second distance between the target and the reference shooting component is obtained based on the first ratio, and based on the second
  • the ratio obtains the third distance between the target and the reference photographing component; the first distance is obtained based on the second distance and the third distance.
  • the first distance is obtained by the weighted summation of the second distance and the third distance, which can comprehensively consider the results in the width and height directions, rather than using the second or third distance obtained in a single direction as the first distance In other words, the accuracy of the first distance can be improved.
  • obtaining the second distance between the target and the reference photographing component based on the first ratio includes: multiplying the first ratio by the first focal length of the reference photographing component in the width direction to obtain the second distance; obtaining the target based on the second ratio
  • the third distance from the reference photographing component includes: multiplying the second ratio by the second focal length of the reference photographing component in the height direction to obtain the third distance; and obtaining the first distance based on the second distance and the third distance
  • the method includes: weighted summation of the second distance and the third distance to obtain the first distance.
  • the resolution of the reference capture assembly may be different in the width or height direction, by multiplying the first ratio by the first focal length of the reference capture assembly in the width direction, and multiplying the second ratio by the reference capture assembly in the height direction Multiplying the second focal length of , the second and third distances are more accurate.
  • determining the first size of the target corresponding to the target area in the reference image includes any one of the following: obtaining the first size based on the coordinates of at least two first feature points obtained by detecting the target feature points on the reference image; or, based on The size of the area obtained by performing the target area detection on the reference image is obtained to obtain the first size.
  • the process is simple and the computing power required by the device is low.
  • the first distance is the distance between the target and the reference photographing component
  • the reference photographing component is the photographing component corresponding to the first image or the second image
  • the parallax between an image and the second image includes: obtaining the parallax based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image.
  • the whole process is simple and requires The computing power is low, so that the processing resources of the execution device can be saved.
  • the present application provides a target matching device, comprising: an image acquisition module for acquiring a first image and a second image, wherein the first image and the second image are obtained by shooting a target to be matched by different shooting components; parallax acquisition a module for obtaining the parallax of the target between the first image and the second image based on the first distance between the target and the at least one photographing component; the matching module for determining the difference between the first image and the second image according to the parallax Matching feature point pairs about the target.
  • the present application provides an electronic device, including a memory and a processor, where the processor is configured to execute program instructions stored in the memory, so as to implement the target matching method in the first aspect.
  • a fourth aspect of the present application provides a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the target matching method in the above-mentioned first aspect is implemented.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
  • Fig. 1 is a schematic flow chart 1 of an embodiment of a target matching method of the present application
  • FIG. 2 is a second schematic flowchart of an embodiment of a target matching method of the present application
  • FIG. 3 is a schematic structural diagram of an embodiment of a target matching device of the present application.
  • FIG. 4 is a schematic structural diagram of an embodiment of an electronic device of the present application.
  • FIG. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium of the present application.
  • Target matching refers to matching corresponding feature points belonging to the same target in the first image and the second image, so as to find out the same target in the first image and the second image.
  • the target can be any object, such as a face, a building, a vehicle, and so on.
  • FIG. 1 is a first schematic flowchart of an embodiment of a target matching method of the present application. Specifically, the target matching method may include the following steps:
  • Step S11 Acquire a first image and a second image, wherein the first image and the second image are obtained by photographing the target to be matched by different photographing components, respectively.
  • the shooting components corresponding to the first image and the second image can be placed arbitrarily, as long as the imaging planes of the first image and the second image are parallel, for example, the two shooting components can be placed side by side in the horizontal direction, It can also be placed side by side in the vertical direction.
  • Two shooting components can form a binocular camera system.
  • two photographing components are placed side by side in the horizontal direction as an example.
  • the device that performs target matching and the photographing component may be an integrated device, or may be independent devices. Integrated means that the device that performs target matching and the photographing component can be controlled by the same processor, and independent means that the execution Target matching equipment and shooting components are controlled by different processors.
  • the first image and the second image may be images that have not been image-processed, or may be images that have been image-processed. Image processing can be adjusting brightness, resolution, etc. Further, the modality of the first image and the second image may be the same or different.
  • the first image and the second image may be both visible light images or infrared light images, or one of them may be a visible light image and the other may be an infrared light image. image.
  • the form of the first image and the second image is not specified here.
  • Both the first image and the second image include at least one target, and one of the targets is used as the target to be matched, so as to match the feature points of the target in the first image and the second image, and then compare the first image and the second image. Find the target in the image to achieve target matching.
  • the target is a human face as an example.
  • Step S12 Obtain the parallax of the target between the first image and the second image based on the first distance between the target and the at least one photographing component.
  • the first distance between the target and at least one photographing component may be the distance between the target and one of the photographing components, or the distance from the position between the two photographing components.
  • the distance from the position between the two photographing components may specifically be the distance from the midpoint of the baselines of the two photographing components. Because the first distance from the photographing components is different, the parallax between the images obtained by photographing is also different. Specifically, the longer the first distance between the target and the photographing component, the smaller the parallax. Similarly, the closer the first distance between the target and the photographing component is, the greater the parallax. Therefore, the magnitude of the parallax can be determined according to the first distance between the target and the photographing component.
  • Step S13 According to the parallax, determine the matching feature point pair about the target in the first image and the second image.
  • the method of determining the matching feature point pair about the target in the first image and the second image according to the parallax may be to first determine a certain feature point in one of the images, and then determine the corresponding feature point in the other image according to the parallax Matching points to obtain the matching feature point pair of the target. If the target is a human face, the feature points related to the target in the first image and the second image may be obtained by performing feature detection on a region containing a human face in the images.
  • the first step can be effectively achieved.
  • Object matching between an image and a second image compared to the method of directly using the closest feature point in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax
  • the matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
  • the first image or the second image is a reference image
  • the photographing component corresponding to the reference image is the reference photographing component
  • the first distance is the distance between the target and the reference photographing component.
  • the first size includes a first width and a first height of the target area.
  • the target area may be an area corresponding to a specific part of the target in the reference image.
  • the target region may be a corresponding region in the reference image of a face region composed of eyebrows, eyes, nose and mouth.
  • the first method is to obtain the first size based on the coordinates of the first feature point obtained by performing the target feature point detection on the reference image.
  • the embodiment of the present disclosure takes the reference image as the first image as an example.
  • the feature point coordinate information (X11, Y11), . . . (Xln, Yln) of the target to be detected in the first image and the second image are obtained
  • the first width may be the difference between the maximum value and the minimum value in all the width coordinates of the reference image, expressed as the first width by a formula
  • the first height can be the difference between the maximum value and the minimum value among all the height coordinates of the reference image, expressed as the first height by a formula
  • the feature point coordinate information of another image is simultaneously acquired, which simplifies the target matching process.
  • the second is to obtain the first size based on the size of the region obtained by performing target region detection on the reference image.
  • the area obtained by performing the target area detection on the reference image may be the area included in the target detection frame, and the area included in the target detection frame may correspond to a specific part of the target.
  • the width of the target detection frame is used as the first width
  • the height of the target detection frame is used as the first height.
  • the target detection frame may be a face detection frame, wherein the area included in the face detection frame is an area jointly formed by eyebrows, eyes, nose and mouth.
  • the reference image is input into the second target detection deep neural network, and a face detection frame is output, wherein the width of the face detection frame can be used as the first width, and the height of the face detection frame can be used as the first height.
  • the first distance is obtained by using the ratio between the first size and the preset size.
  • the preset size may include a preset width and a preset height.
  • the ratio between the first size and the preset size may be the ratio between the widths of the two or the ratio between the heights, or a combination of the ratio between the widths and the height.
  • the first distance may be obtained by performing perspective transformation using the first size.
  • the first ratio between the first width and the preset width, and the second ratio between the first height and the preset height may be acquired.
  • the second distance between the target and the reference photographing component is obtained based on the first ratio
  • the third distance between the target and the reference photographing component is obtained based on the second ratio.
  • the preset size here is the real size of the preset target with the same attribute as the target.
  • the preset size is the preset real size of other faces.
  • both the first size and the preset size may be sizes corresponding to the target preset part.
  • the preset size corresponds to the real size of an area composed of eyebrows, eyes, nose and mouth of the preset target
  • the first size corresponds to a target composed of eyebrows, eyes, nose and mouth in the reference image size of the area.
  • the second distance may be obtained by multiplying the first ratio by the first focal length of the reference photographing component in the width direction.
  • the formula for obtaining the second distance D2 is:
  • W1 is the preset width
  • w is the first width
  • fx is the first focal length of the reference photographing component in the width direction
  • different photographing components have different focal lengths in the width direction.
  • f x can be obtained by calibration of two reference shooting components, mainly by converting the real focal length of the reference shooting components to obtain the first focal length in the width direction and the second focal length in the height direction.
  • the definition of the width and height here is consistent with the definition of the width and height of the reference image.
  • the third distance may be obtained by multiplying the second ratio by the second focal length of the reference photographing component in the height direction.
  • the formula for obtaining the third distance D3 may be
  • H 1 refers to the preset height
  • f y refers to the second focal length of the reference shooting component in the height direction, and different shooting components have different focal lengths in the height direction
  • h refers to the first height
  • the first distance is obtained.
  • the second distance and the third distance may be weighted and summed to obtain the first distance.
  • the formula for the weighted summation can be
  • D 1 refers to the first distance
  • D 2 refers to the second distance
  • D 3 refers to the third distance
  • is a preset parameter, and 0 ⁇ 1, for example, the value of ⁇ is 0.5.
  • is a fixed parameter
  • the value of ⁇ is mainly related to the resolution of the reference photographing component. If the resolution of the reference photographing component is higher, the value of ⁇ is closer to 0.5.
  • the value of ⁇ can also be dynamically adjusted.
  • is set to 0.5; if the absolute value of the difference between the acquired second distance and the third distance is greater than the first difference, the value of ⁇ is greater than 0.5 or less than 0.5.
  • the value of ⁇ is greater than 0.5, and if the second distance is less than the third distance, the value of ⁇ is less than 0.5.
  • the first distance is obtained by the weighted summation of the second distance and the third distance, which can comprehensively consider the results in the width and height directions, rather than using the second or third distance obtained in a single direction as the first distance In other words, the accuracy of the first distance can be improved.
  • the resolution of the reference photographing component in the width or height direction may be different, by multiplying the first ratio by the first focal length of the reference photographing component in the width direction, and multiplying the second ratio by the reference photographing component in the The second focal length in the height direction is multiplied, and the obtained second and third distances are more accurate.
  • the first distance is the distance between the target and the reference photographing component
  • the reference photographing component may be the photographing component corresponding to the first image or the second image.
  • the parallax is obtained based on the first distance, the focal length of the reference photographing component, and the baseline between the photographing components corresponding to the first image and the second image.
  • the formula for obtaining the parallax ⁇ d is as follows:
  • ⁇ d is the parallax
  • f x is the focal length of the reference photographing component in the width direction
  • D 1 is the first distance
  • B is the length of the baseline.
  • the length of the baseline can be obtained by calibrating the two shooting components.
  • the step of determining the matching feature point pair about the target in the first image and the second image includes: based on the parallax, determining a reference position corresponding to the first feature point in the second image.
  • the first feature point is obtained by detecting target feature points on the first image. Assuming that the coordinates of the first feature point in the first image are (x ln , y ln ) and the parallax is ⁇ d, the corresponding reference position of the first feature point in the second image should be (x ln + ⁇ d,y ln + ⁇ d).
  • the second feature point corresponding to the first feature point in the second image should be near the reference position (x ln + ⁇ d, y ln + ⁇ d). Then, based on the reference position, a second feature point that matches the first feature point is selected in the second image.
  • the second feature point is obtained by performing target feature point detection on the second image.
  • the feature point closest to the reference position in the second image may be selected as the second feature point matching the first feature point.
  • the distance here can be the Euclidean distance.
  • the second feature point is determined according to the reference position, the area in the second image that matches the first feature point is reduced, and the match can be quickly found Point to improve the matching accuracy.
  • the matching speed is also greatly improved, and the power consumption of the apparatus for performing the target matching method is reduced.
  • the step of determining the matching feature point pair about the target in the first image and the second image further includes determining the epipolar line corresponding to the first feature point in the second image.
  • the coordinates of the first feature point and the basic matrix can be used to obtain the epipolar line corresponding to the first feature point in the second image.
  • the basic matrix is obtained by calibrating two shooting components. Specifically, the process of calibrating the two photographing components can be performed before step S11.
  • the formula to obtain the epipolar line l can be:
  • (x ln , y ln , 1) is the homogeneous coordinate of the first feature point
  • F is the fundamental matrix
  • a candidate area including the reference position may be determined in the second image, and a second feature point whose positional relationship with the epipolar line meets a preset requirement may be selected in the candidate area.
  • the candidate area may be an area of a preset candidate size centered on the reference position.
  • the determination of the preset candidate size can be set according to experience, and no specific provisions are made here.
  • the feature point whose positional relationship with the epipolar line meets the preset requirements as the second feature point matching the first feature point it is equivalent to reducing the feature matching area from two-dimensional to one-dimensional, reducing two The effect of placement between photographic components on target matching.
  • target matching based on the two dimensions of disparity and epipolar geometric constraints, even when there are multiple faces in the first image and the second image, false matching is less likely to occur.
  • the preset requirement may be that the distance between the second feature point and the epipolar line in the candidate region is the smallest. That is, in the candidate region, the feature point with the smallest distance from the epipolar line is selected as the second feature point matching the first feature point.
  • the distance here can be the Euclidean distance.
  • the second feature point corresponding to the first feature point should be on the epipolar line, but errors will inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, so the candidate is selected.
  • the feature point with the smallest distance from the epipolar line in the region is used as the second feature point corresponding to the first feature point, which can improve the success rate of target matching.
  • FIG. 2 is a second schematic flowchart of an embodiment of a target matching method of the present application.
  • the target matching method proposed by the embodiment of the present disclosure can be subdivided into the following steps:
  • Step S11 Acquire a first image and a second image, wherein the first image and the second image are obtained by photographing the target by different photographing components respectively.
  • Step S121 Obtain the first distance between the target and the reference photographing component.
  • the reference photographing component may be a photographing component corresponding to the first image, or may be a photographing component corresponding to the second image.
  • the reference photographing component may be made to the above, and details are not described herein again.
  • Step S122 Based on the first distance, obtain the parallax of the target between the first image and the second image.
  • the method of obtaining the parallax can refer to the above, and details are not repeated here.
  • Step S131 Determine a reference position corresponding to the first feature point in the second image based on the parallax, wherein the first feature point is obtained by performing target feature point detection on the first image.
  • Step S132 Determine the epipolar line corresponding to the first feature point in the second image.
  • step S131 and step S132 may be performed synchronously. Of course, in other embodiments, one may be performed first, and then the other may be performed. The execution order of step S131 and step S132 is not specified here.
  • Step S133 Determine a candidate region containing the reference position in the second image, and in the candidate region, select a second feature point whose positional relationship with the epipolar line meets the preset requirements, as the second feature point matching the first feature point. Feature points.
  • the preset requirements may be as described above; in the candidate area, the process of selecting the second feature point matching the first feature point is as described above, which will not be repeated here.
  • the second feature point matching the first feature point is determined by integrating the two dimensions of disparity and epipolar geometric constraint, which improves the accuracy of target matching compared to using a single dimension. Moreover, by selecting the feature point whose positional relationship with the epipolar line meets the preset requirements as the second feature point matching the first feature point, it is equivalent to reducing the feature matching area from two-dimensional to one-dimensional, reducing two The effect of placement between photographic components on target matching. And by performing target matching based on the two dimensions of disparity and epipolar geometric constraints, even when there are multiple faces in the first image and the second image, false matching is less likely to occur.
  • the extracted matching feature point pair about the target can be further utilized, for example, depth acquisition, living body detection, body temperature measurement, etc.
  • depth acquisition For example, in a multi-person temperature measurement scenario, it is necessary to locate the same face captured by different cameras in the binocular camera system, and then obtain the position of the face in the thermal imager according to the face coordinates, and finally perform temperature extraction. Therefore, face matching is a pre-task for rapid body temperature measurement in a multi-person scenario.
  • a face matching result with high precision and high robustness can be obtained to assist the body temperature in a multi-person scenario. Measurement.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
  • the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.
  • the execution subject of the target matching method may be a target matching apparatus.
  • the target matching method may be executed by a terminal device or a server or other processing device, wherein the terminal device may be a user equipment with requirements such as visual positioning, three-dimensional reconstruction, and image registration.
  • UE User Equipment
  • PDA Personal Digital Assistant
  • handheld devices computing devices, in-vehicle devices, wearable devices and autonomous vehicles, there are Robots with positioning and mapping requirements, medical imaging systems with registration requirements, glasses, helmets and other products for augmented reality or virtual reality.
  • the target matching method may be implemented by the processor invoking computer-readable instructions stored in the memory.
  • the target matching device 30 includes an image acquisition module 31 , a parallax acquisition module 32 , and a matching module 33 .
  • the image acquisition module 31 is used to acquire a first image and a second image, wherein the first image and the second image are obtained by shooting the target to be matched by different shooting components;
  • the parallax acquisition module 32 is used for shooting based on the target and at least one The first distance between the components is used to obtain the parallax of the target between the first image and the second image;
  • the matching module 33 is configured to determine the matching feature point pair about the target in the first image and the second image according to the parallax.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax The matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
  • the matching module 33 determines, according to the parallax, a pair of matching feature points about the target in the first image and the second image, including: determining a reference position corresponding to the first feature point in the second image based on the parallax, wherein , the first feature point is obtained by performing target feature point detection on the first image; based on the reference position, a second feature point matching the first feature point is selected in the second image, wherein the second feature point is the first feature point.
  • the two images are obtained by detecting the target feature points.
  • the second feature point is determined according to the reference position, and the area in the second image that is matched with the first feature point is reduced, which can quickly Find matching point pairs to improve the matching accuracy.
  • the matching module 33 selects a second feature point in the second image that matches the first feature point based on the reference position, including: determining a candidate region including the reference position in the second image, and selecting a candidate region in the candidate region. , a second feature point whose positional relationship with the epipolar line corresponding to the first feature point in the second image satisfies a preset requirement is selected as the second feature point matching the first feature point.
  • the second feature point matching the first feature point is determined by integrating the two dimensions of disparity and epipolar geometric constraint, which improves the accuracy of target matching compared to using a single dimension.
  • the matching module 33 determines the epipolar line corresponding to the first feature point in the second image, including: obtaining the epipolar line by using the coordinates of the first feature point and the fundamental matrix.
  • the preset requirement is that the distance between the second feature point and the epipolar line in the candidate region is the smallest.
  • the second feature point corresponding to the first feature point should be on the epipolar line, but errors inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, Therefore, selecting the feature point with the smallest distance from the epipolar line in the candidate region as the second feature point corresponding to the first feature point can improve the success rate of target matching.
  • the first image or the second image is a reference image
  • the photographing component corresponding to the reference image is the reference photographing component
  • the first distance is the distance between the target and the reference photographing component
  • the parallax obtaining module 32 is further configured to execute The first distance is obtained by the following steps: determining the first size of the target corresponding to the target area in the reference image; and obtaining the first distance by using the ratio between the first size and the preset size.
  • the technical effect that the distance between the target and the shooting component can be determined by using a single image is achieved. , which breaks the traditional cognition that it is necessary to combine at least two images to obtain the distance between the target and the shooting component.
  • the first size includes a first width and a first height of the target area
  • the preset size includes a preset width and a preset height
  • the parallax obtaining module 32 obtains by using the ratio between the first size and the preset size.
  • the first distance includes: obtaining a first ratio between the first width and a preset width, and a second ratio between the first height and the preset height; and obtaining the first ratio between the target and the reference shooting component based on the first ratio.
  • two distances, and the third distance between the target and the reference photographing component is obtained based on the second ratio; the first distance is obtained based on the second distance and the third distance.
  • the first distance is obtained by weighting the second distance and the third distance, and the results in the width and height directions can be comprehensively considered. Compared with the second distance or the third distance obtained by using a single direction as For the first distance, the accuracy of the first distance can be improved.
  • the parallax obtaining module 32 obtains the second distance between the target and the reference photographing component based on the first ratio, including: multiplying the first ratio by the first focal length of the reference photographing component in the width direction to obtain the second distance. ; Obtain the third distance between the target and the reference shooting component based on the second ratio, comprising: multiplying the second ratio by the second focal length of the reference shooting component in the height direction to obtain the third distance; Based on the second distance and the third distance Obtaining the first distance includes: weighted summation of the second distance and the third distance to obtain the first distance.
  • the resolution of the reference photographing component in the width or height direction may be different, by multiplying the first ratio by the first focal length of the reference photographing component in the width direction, and multiplying the second ratio by the reference photographing component in the width direction.
  • the second focal length in the height direction is multiplied, and the obtained second and third distances are more accurate.
  • the parallax obtaining module 32 determines the first size of the target corresponding to the target area in the reference image, including: obtaining the first size based on the coordinates of at least two first feature points obtained by performing target feature point detection on the reference image. or, obtaining the first size based on the size of the region obtained by performing target region detection on the reference image.
  • the first size of the target area is obtained according to the coordinates of the first feature point or the size of the area obtained by detecting the target area on the first image, the process is simple, and the computing power required by the device is low.
  • the first distance is the distance between the target and the reference photographing component, and the reference photographing component is the photographing component corresponding to the first image or the second image;
  • the parallax obtaining module 32 is based on the distance between the target and at least one photographing component.
  • the first distance is to obtain the parallax of the target between the first image and the second image, including: based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, obtaining Parallax.
  • the above scheme obtains the parallax of the target between the first image and the second image based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, and the whole process is simple , the required computing power is low, so that the processing resources of the execution device can be saved.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax The matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
  • FIG. 4 is a schematic structural diagram of an embodiment of an electronic device of the present application.
  • the electronic device 40 includes a memory 41 and a processor 42, and the processor 42 is configured to execute program instructions stored in the memory 41, so as to implement the steps in the above-mentioned embodiments of the target matching method.
  • the electronic device 40 may include, but is not limited to, a microcomputer and a server.
  • the electronic device 40 may also include mobile devices such as a notebook computer and a tablet computer, which are not limited herein.
  • the processor 42 is used to control itself and the memory 41 to implement the steps in the above-mentioned embodiment of the target matching method.
  • the processor 42 may also be referred to as a CPU (Central Processing Unit, central processing unit).
  • the processor 42 may be an integrated circuit chip with signal processing capability.
  • the processor 42 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the processor 42 may be jointly implemented by an integrated circuit chip.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
  • FIG. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium of the present application.
  • the computer-readable storage medium 50 stores program instructions 501 that can be executed by a processor, and the program instructions 501 are used to implement the steps in the above embodiments of the target matching method.
  • the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
  • the functions or modules included in the apparatuses provided in the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments.
  • the disclosed method and apparatus may be implemented in other manners.
  • the device implementations described above are only illustrative.
  • the division of modules or units is only a logical function division. In actual implementation, there may be other divisions.
  • modules or units may be combined or integrated. to another system, or some features can be ignored or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented as a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

The present application provides a method and apparatus for target matching, a device, and a storage medium. The target matching method comprises: acquiring a first image and a second image, wherein the first image and the second image are obtained through photography by different photographing components on a target to be matched; obtaining a parallax of the target between the first image and the second image on the basis of a first distance between the target and at least one photographing component; and according to the parallax, determining a matching feature point pair with respect to the target in the first image and the second image. According to the solution above, the accuracy of target matching between different images can be improved.

Description

用于目标匹配的方法、装置、设备及存储介质Method, apparatus, device and storage medium for target matching
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2021年4月16日提交的、申请号为202110413815.2的中国专利申请的优先权,该中国专利申请公开的全部内容以引用的方式并入本文中。This application claims priority to the Chinese patent application with application number 202110413815.2 filed on April 16, 2021, the entire contents of which are incorporated herein by reference.
技术领域technical field
本申请涉及图像处理技术领域,特别是涉及用于目标匹配的方法、装置、设备及存储介质。The present application relates to the technical field of image processing, and in particular, to a method, apparatus, device and storage medium for target matching.
背景技术Background technique
图像中的目标匹配是计算机视觉中的基础问题,目标匹配的准确度会影响目标匹配之后的操作。常见的图像中目标匹配方式主要是将待匹配的两张图像中位置最近的两个特征点作为匹配点对。以人脸匹配为例,主要就是判断两张图像中人脸的偏移量,如果人脸在两张图像中竖直方向上的坐标一致,且水平方向上的差距最小,则认为是相互匹配的人脸。这种方式存在的问题是,在图像中存在多个人脸的情况下,两个图像中位置相差最小的人脸可能并不是实际相互匹配的人脸。Object matching in images is a fundamental problem in computer vision, and the accuracy of object matching will affect the operations after object matching. The common target matching method in images mainly uses the two closest feature points in the two images to be matched as the matching point pair. Taking face matching as an example, it is mainly to judge the offset of the faces in the two images. If the coordinates of the faces in the vertical direction in the two images are the same, and the difference in the horizontal direction is the smallest, it is considered to be a mutual match. face. The problem with this method is that in the case of multiple faces in the image, the face with the smallest position difference in the two images may not be the face that actually matches each other.
发明内容SUMMARY OF THE INVENTION
本申请至少提供一种用于目标匹配的方法、装置、设备及存储介质。The present application provides at least one method, apparatus, device and storage medium for target matching.
本申请提供了一种目标匹配方法,包括:获取第一图像和第二图像,其中,第一图像和第二图像由不同的拍摄组件对待匹配的目标拍摄得到;基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差;根据视差,确定第一图像和第二图像中关于目标的匹配特征点对。The present application provides a target matching method, including: acquiring a first image and a second image, wherein the first image and the second image are obtained by shooting a target to be matched by different shooting components; based on the relationship between the target and at least one shooting component The first distance between the first image and the second image is obtained to obtain the parallax of the target between the first image and the second image; according to the parallax, the matching feature point pair about the target in the first image and the second image is determined.
通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配点对,提高了不同图像间目标匹配的准确度。By obtaining the parallax of the target between the first image and the second image based on the first distance between the target and the at least one photographing component, and determining the matching feature point pair of the target according to the parallax, the first image and the second image can be effectively realized. Object matching between two images. In addition, compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
其中,根据视差,确定第一图像和第二图像中关于目标的匹配特征点对,包括:基于视差,确定第二图像中与第一特征点对应的参考位置,其中,第一特征点为对第一图像进行目标特征点检测得到的;基于参考位置,在第二图像中选出与第一特征点匹配的第二特征点,其中,第二特征点为对第二图像进行目标特征点检测得到的。Wherein, determining the pair of matching feature points about the target in the first image and the second image according to the parallax includes: determining, based on the parallax, a reference position corresponding to the first feature point in the second image, wherein the first feature point is a pair of The first image is obtained by performing target feature point detection; based on the reference position, a second feature point matching the first feature point is selected in the second image, wherein the second feature point is the target feature point detection performed on the second image. owned.
通过基于视差确定第二图像中与第一特征点对应的参考位置,从而根据该参考位置确定第二特征点,缩小了第二图像中与第一特征点进行匹配的区域,可以快速查找到匹配点对,提高匹配的准确度。By determining the reference position corresponding to the first feature point in the second image based on the parallax, the second feature point is determined according to the reference position, the area in the second image that matches the first feature point is reduced, and the match can be quickly found Point to improve the matching accuracy.
其中,基于参考位置,在第二图像中选出第一特征点匹配的第二特征点,包括:在第二图像中确定包含参考位置的候选区域,并在候选区域中,选择与第一特征点在第二图像中对应的对极线的位置关系满足预设要求的第二特征点,作为与第一特征点匹配的第二特征点。Wherein, based on the reference position, selecting a second feature point matching the first feature point in the second image includes: determining a candidate region including the reference position in the second image, and selecting a candidate region that matches the first feature point in the candidate region The second feature point whose positional relationship of the epipolar line corresponding to the point in the second image satisfies the preset requirement is taken as the second feature point matching the first feature point.
通过将视差与对极几何约束这两个维度综合来确定与第一特征点匹配的第二特征点,相比于使用单个维度而言,提高了目标匹配的准确度。By combining the two dimensions of disparity and epipolar geometric constraints to determine the second feature point that matches the first feature point, the accuracy of target matching is improved compared to using a single dimension.
其中,通过如下操作确定第一特征点在第二图像中对应的对极线:利用第一特征点的坐标与基础矩阵得到对极线。Wherein, the epipolar line corresponding to the first feature point in the second image is determined by the following operations: the epipolar line is obtained by using the coordinates of the first feature point and the fundamental matrix.
其中,预设要求为在候选区域中第二特征点与对极线之间的距离最小。The preset requirement is that the distance between the second feature point and the epipolar line in the candidate region is the smallest.
根据对极几何约束原理,与第一特征点对应的第二特征点应该在对极线上,但在目标匹配过程中难免出现误差,导致第二特征点没有处于对极线上,所以选择候选区域中与对极线之间的距离最小的特征点作为与第一特征点对应的第二特征点,能够提高目标匹配的成功率。According to the principle of epipolar geometric constraint, the second feature point corresponding to the first feature point should be on the epipolar line, but errors will inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, so the candidate is selected. The feature point with the smallest distance from the epipolar line in the region is used as the second feature point corresponding to the first feature point, which can improve the success rate of target matching.
其中,第一图像或第二图像为参考图像,参考图像对应的拍摄组件为参考拍摄组件,第一距离为目标与参考拍摄组件之间的距离;通过以下步骤得到第一距离:确定目标在参考图像中对应目标区域的第一尺寸;利用第一尺寸与预设尺寸之间的比值,得到第一距离。Wherein, the first image or the second image is the reference image, the photographing component corresponding to the reference image is the reference photographing component, and the first distance is the distance between the target and the reference photographing component; the first distance is obtained through the following steps: determining that the target is in the reference The first size of the corresponding target area in the image; the first distance is obtained by using the ratio between the first size and the preset size.
通过利用目标在参考图像中对应目标区域的第一尺寸与预设尺寸之间的比值确定第一距离,实现了利用单张图像即可确定目标与拍摄组件之间的距离的技术效果,打破了需要结合至少两张以上的图像才能够获取目标与拍摄组件之间的距离的传统认知。By using the ratio between the first size of the target corresponding to the target area in the reference image and the preset size to determine the first distance, the technical effect that the distance between the target and the shooting component can be determined by using a single image is achieved, which breaks the The traditional perception of the distance between the target and the photographed component can be obtained by combining at least two or more images.
其中,第一尺寸包括目标区域的第一宽度和第一高度,预设尺寸包括预设宽度和预设高度;利用第一尺寸与预设尺寸之间的比值,得到第一距离,包括:获取第一宽度与 预设宽度之间的第一比值,以及第一高度与预设高度之间的第二比值;基于第一比值得到目标与参考拍摄组件之间的第二距离,并基于第二比值得到目标与参考拍摄组件之间的第三距离;基于第二距离和第三距离得到第一距离。Wherein, the first size includes the first width and the first height of the target area, and the preset size includes the preset width and the preset height; using the ratio between the first size and the preset size to obtain the first distance, including: obtaining a first ratio between the first width and the preset width, and a second ratio between the first height and the preset height; the second distance between the target and the reference shooting component is obtained based on the first ratio, and based on the second The ratio obtains the third distance between the target and the reference photographing component; the first distance is obtained based on the second distance and the third distance.
通过将第二距离和第三距离进行加权求和得到第一距离,能够综合考虑宽度和高度方向上的结果,相比使用单个方向上求取得到的第二距离或第三距离作为第一距离而言,能够提高第一距离的准确度。The first distance is obtained by the weighted summation of the second distance and the third distance, which can comprehensively consider the results in the width and height directions, rather than using the second or third distance obtained in a single direction as the first distance In other words, the accuracy of the first distance can be improved.
其中,基于第一比值得到目标与参考拍摄组件之间的第二距离,包括:将第一比值乘以参考拍摄组件在宽度方向上的第一焦距,得到第二距离;基于第二比值得到目标与参考拍摄组件之间的第三距离,包括:将第二比值乘以参考拍摄组件在高度方向上的第二焦距,得到第三距离;基于第二距离和第三距离,得到第一距离,包括:将第二距离和第三距离进行加权求和,得到第一距离。Wherein, obtaining the second distance between the target and the reference photographing component based on the first ratio includes: multiplying the first ratio by the first focal length of the reference photographing component in the width direction to obtain the second distance; obtaining the target based on the second ratio The third distance from the reference photographing component includes: multiplying the second ratio by the second focal length of the reference photographing component in the height direction to obtain the third distance; and obtaining the first distance based on the second distance and the third distance, The method includes: weighted summation of the second distance and the third distance to obtain the first distance.
因为参考拍摄组件在宽度或高度方向上的分辨率可能不同,所以通过将第一比值与参考拍摄组件在宽度方向上的第一焦距相乘,以及将第二比值与参考拍摄组件在高度方向上的第二焦距相乘,得到的第二距离和第三距离更准确。Because the resolution of the reference capture assembly may be different in the width or height direction, by multiplying the first ratio by the first focal length of the reference capture assembly in the width direction, and multiplying the second ratio by the reference capture assembly in the height direction Multiplying the second focal length of , the second and third distances are more accurate.
其中,确定目标在参考图像中对应目标区域的第一尺寸,包括以下任一:基于对参考图像进行目标特征点检测得到的至少两个第一特征点的坐标,得到第一尺寸;或者,基于对参考图像进行目标区域检测得到的区域的尺寸,得到第一尺寸。Wherein, determining the first size of the target corresponding to the target area in the reference image includes any one of the following: obtaining the first size based on the coordinates of at least two first feature points obtained by detecting the target feature points on the reference image; or, based on The size of the area obtained by performing the target area detection on the reference image is obtained to obtain the first size.
通过根据第一特征点坐标或根据对第一图像进行目标区域检测得到的区域的尺寸,得到目标区域的第一尺寸,过程简单,设备所需的计算力较低。By obtaining the first size of the target area according to the coordinates of the first feature point or according to the size of the area obtained by detecting the target area on the first image, the process is simple and the computing power required by the device is low.
其中,第一距离为目标与参考拍摄组件之间的距离,参考拍摄组件为第一图像或第二图像对应的拍摄组件;基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,包括:基于第一距离、参考拍摄组件的焦距、以及第一图像和第二图像对应的拍摄组件之间的基线,得到视差。Wherein, the first distance is the distance between the target and the reference photographing component, and the reference photographing component is the photographing component corresponding to the first image or the second image; The parallax between an image and the second image includes: obtaining the parallax based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image.
通过基于第一距离、参考拍摄组件的焦距、以及第一图像和第二图像对应的拍摄组件之间的基线,获取目标在第一图像和第二图像之间的视差,整个过程简单,需要的计算力较低,从而可以节约执行设备的处理资源。By obtaining the parallax of the target between the first image and the second image based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, the whole process is simple and requires The computing power is low, so that the processing resources of the execution device can be saved.
本申请提供了一种目标匹配装置,包括:图像获取模块,用于获取第一图像和第二图像,其中,第一图像和第二图像由不同的拍摄组件对待匹配的目标拍摄得到;视差获取模块,用于基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第 二图像之间的视差;匹配模块,用于根据视差,确定第一图像和第二图像中关于目标的匹配特征点对。The present application provides a target matching device, comprising: an image acquisition module for acquiring a first image and a second image, wherein the first image and the second image are obtained by shooting a target to be matched by different shooting components; parallax acquisition a module for obtaining the parallax of the target between the first image and the second image based on the first distance between the target and the at least one photographing component; the matching module for determining the difference between the first image and the second image according to the parallax Matching feature point pairs about the target.
本申请提供了一种电子设备,包括存储器和处理器,处理器用于执行存储器中存储的程序指令,以实现上述第一方面中的目标匹配方法。The present application provides an electronic device, including a memory and a processor, where the processor is configured to execute program instructions stored in the memory, so as to implement the target matching method in the first aspect.
本申请第四方面提供了一种计算机可读存储介质,其上存储有程序指令,程序指令被处理器执行时实现上述第一方面中的目标匹配方法。A fourth aspect of the present application provides a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the target matching method in the above-mentioned first aspect is implemented.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first Object matching between the image and the second image. In addition, compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本申请。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
附图说明Description of drawings
此处的附图示出了符合本申请的实施例,并与说明书一起用于说明本申请的技术方案。The accompanying drawings herein illustrate embodiments consistent with the present application, and together with the description, serve to explain the technical solutions of the present application.
图1是本申请目标匹配方法一实施例的流程示意图一;Fig. 1 is a schematic flow chart 1 of an embodiment of a target matching method of the present application;
图2是本申请目标匹配方法一实施例的流程示意图二;FIG. 2 is a second schematic flowchart of an embodiment of a target matching method of the present application;
图3是本申请目标匹配装置一实施例的结构示意图;3 is a schematic structural diagram of an embodiment of a target matching device of the present application;
图4是本申请电子设备一实施例的结构示意图;4 is a schematic structural diagram of an embodiment of an electronic device of the present application;
图5是本申请计算机可读存储介质一实施例的结构示意图。FIG. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium of the present application.
具体实施方式Detailed ways
下面结合说明书附图,对本申请实施例的方案进行详细说明。The solutions of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、接口、技术之类的具体细节,以便透彻理解本申请。In the following description, for purposes of illustration and not limitation, specific details such as specific system structures, interfaces, techniques, etc. are set forth in order to provide a thorough understanding of the present application.
本文中术语“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如, A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象之间是一种“或”的关系。此外,本文中的“多”表示两个或者多于两个。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this paper is used to describe the relationship between related objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and B exists alone. three conditions. In addition, the character "/" in this document generally indicates that there is an "or" relationship between the related objects before and after. Also, "multiple" herein means two or more than two. In addition, the term "at least one" herein refers to any combination of any one of the plurality or at least two of the plurality, for example, including at least one of A, B, and C, and may mean including from A, B, and C. Any one or more elements selected from the set of B and C.
本申请提供一些目标匹配方法以及装置。目标匹配是指将第一图像和第二图像中属于同一目标的相应特征点进行匹配,进而查找出第一图像和第二图像中的同一目标。该目标可以为任意对象,例如为人脸、建筑物、车辆等。The present application provides some object matching methods and apparatuses. Target matching refers to matching corresponding feature points belonging to the same target in the first image and the second image, so as to find out the same target in the first image and the second image. The target can be any object, such as a face, a building, a vehicle, and so on.
请参阅图1,图1是本申请目标匹配方法一实施例的流程示意图一。具体而言,目标匹配方法可以包括如下步骤:Please refer to FIG. 1 . FIG. 1 is a first schematic flowchart of an embodiment of a target matching method of the present application. Specifically, the target matching method may include the following steps:
步骤S11:获取第一图像和第二图像,其中,第一图像和第二图像分别由不同的拍摄组件对待匹配的目标拍摄得到。Step S11: Acquire a first image and a second image, wherein the first image and the second image are obtained by photographing the target to be matched by different photographing components, respectively.
其中,拍摄第一图像和拍摄第二图像对应的拍摄组件之间可以任意摆放,只要第一图像和第二图像的成像平面平行即可,例如两个拍摄组件可以是水平方向上并列放置,也可以是竖直方向上并列放置等。两个拍摄组件可以组成一个双目相机系统。本公开实施例以两个拍摄组件在水平方向上并列放置为例。其中,执行目标匹配的设备与拍摄组件可以是一体式设备,也可以是相互独立的设备,一体式指的是执行目标匹配的设备与拍摄组件可以由同一处理器控制,相互独立指的是执行目标匹配的设备与拍摄组件由不同的处理器控制。其中,第一图像和第二图像可以是未经图像处理过的图像,也可以是经过图像处理过的图像。图像处理可以是调整亮度、分辨率等等。进一步地,第一图像和第二图像的模态可以相同也可以不同,例如,第一图像和第二图像可以同时为可见光图像或红外光图像,或其中一个为可见光图像,另一个为红外光图像。关于第一图像和第二图像的形式此处不做具体规定。Wherein, the shooting components corresponding to the first image and the second image can be placed arbitrarily, as long as the imaging planes of the first image and the second image are parallel, for example, the two shooting components can be placed side by side in the horizontal direction, It can also be placed side by side in the vertical direction. Two shooting components can form a binocular camera system. In the embodiment of the present disclosure, two photographing components are placed side by side in the horizontal direction as an example. Among them, the device that performs target matching and the photographing component may be an integrated device, or may be independent devices. Integrated means that the device that performs target matching and the photographing component can be controlled by the same processor, and independent means that the execution Target matching equipment and shooting components are controlled by different processors. Wherein, the first image and the second image may be images that have not been image-processed, or may be images that have been image-processed. Image processing can be adjusting brightness, resolution, etc. Further, the modality of the first image and the second image may be the same or different. For example, the first image and the second image may be both visible light images or infrared light images, or one of them may be a visible light image and the other may be an infrared light image. image. The form of the first image and the second image is not specified here.
第一图像和第二图像中均包括至少一个目标,将其中一个目标作为待匹配的目标,以将第一图像和第二图像中关于目标的特征点进行匹配,进而在第一图像和第二图像中查找该目标,实现目标匹配。本公开实施例以目标为人脸为例。Both the first image and the second image include at least one target, and one of the targets is used as the target to be matched, so as to match the feature points of the target in the first image and the second image, and then compare the first image and the second image. Find the target in the image to achieve target matching. In this embodiment of the present disclosure, the target is a human face as an example.
步骤S12:基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差。Step S12: Obtain the parallax of the target between the first image and the second image based on the first distance between the target and the at least one photographing component.
其中,目标与至少一个拍摄组件之间的第一距离可以是目标与其中一个拍摄组件的 距离、或与两个拍摄组件之间位置的距离。其中,与两个拍摄组件之间位置的距离具体可以是与两个拍摄组件的基线中点的距离。因为与拍摄组件之间的第一距离不同,导致拍摄得到的图像之间的视差也不同。具体地,目标与拍摄组件之间的第一距离越远,则该视差越小,同理,目标与拍摄组件之间的第一距离越近,则该视差越大。因此,可以根据目标与拍摄组件之间的第一距离确定该视差的大小。Wherein, the first distance between the target and at least one photographing component may be the distance between the target and one of the photographing components, or the distance from the position between the two photographing components. Wherein, the distance from the position between the two photographing components may specifically be the distance from the midpoint of the baselines of the two photographing components. Because the first distance from the photographing components is different, the parallax between the images obtained by photographing is also different. Specifically, the longer the first distance between the target and the photographing component, the smaller the parallax. Similarly, the closer the first distance between the target and the photographing component is, the greater the parallax. Therefore, the magnitude of the parallax can be determined according to the first distance between the target and the photographing component.
步骤S13:根据视差,确定第一图像和第二图像中关于目标的匹配特征点对。Step S13: According to the parallax, determine the matching feature point pair about the target in the first image and the second image.
其中,根据视差确定第一图像和第二图像中关于目标的匹配特征点对的方式可以是首先确定其中一张图像中的某个特征点,然后根据视差确定另一图像中该特征点对应的匹配点,从而得到目标的匹配特征点对。若目标为人脸,则第一图像和第二图像中关于目标的特征点,可以是经过对图像中包含人脸的区域进行特征检测得到。The method of determining the matching feature point pair about the target in the first image and the second image according to the parallax may be to first determine a certain feature point in one of the images, and then determine the corresponding feature point in the other image according to the parallax Matching points to obtain the matching feature point pair of the target. If the target is a human face, the feature points related to the target in the first image and the second image may be obtained by performing feature detection on a region containing a human face in the images.
上述方案中,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。这样,相比于直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配特征点对,提高了不同图像间目标匹配的准确度。In the above solution, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and the at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first step can be effectively achieved. Object matching between an image and a second image. In this way, compared to the method of directly using the closest feature point in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax The matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
一些公开实施例中,第一图像或第二图像为参考图像,参考图像对应的拍摄组件为参考拍摄组件,第一距离为目标与参考拍摄组件之间的距离。其中,获取第一距离的方式可以是:In some disclosed embodiments, the first image or the second image is a reference image, the photographing component corresponding to the reference image is the reference photographing component, and the first distance is the distance between the target and the reference photographing component. Wherein, the method of obtaining the first distance may be:
首先,确定目标在参考图像中对应目标区域的第一尺寸。可选地,第一尺寸包括目标区域的第一宽度和第一高度。目标区域可以是目标的特定部位在参考图像中对应的区域。例如,若目标为人脸,目标区域可以是眉毛、眼睛、鼻子以及嘴巴共同构成的一个人脸区域在参考图像中的对应区域。具体确定目标在参考图像中对应目标区域的第一尺寸的方式有多种。First, determine the first size of the target corresponding to the target area in the reference image. Optionally, the first size includes a first width and a first height of the target area. The target area may be an area corresponding to a specific part of the target in the reference image. For example, if the target is a human face, the target region may be a corresponding region in the reference image of a face region composed of eyebrows, eyes, nose and mouth. There are various ways to specifically determine the first size of the target corresponding to the target area in the reference image.
例如,第一种是基于对参考图像进行目标特征点检测得到的第一特征点的坐标,来得到第一尺寸。本公开实施例以参考图像为第一图像为例。例如,通过将第一图像和第二图像输入第一目标检测深度神经网络,得到第一图像中关于待检测目标的特征点坐标信息(Xl1,Yl1),…(Xln,Yln)以及第二图像中关于待检测目标的特征点坐标信息(Xr1,Yr1),…(Xrn,Yrn)。其中,第一宽度可以是参考图像的所有宽度坐标中的最大值与最小值之差,以公式表达为第一宽度For example, the first method is to obtain the first size based on the coordinates of the first feature point obtained by performing the target feature point detection on the reference image. The embodiment of the present disclosure takes the reference image as the first image as an example. For example, by inputting the first image and the second image into the first target detection deep neural network, the feature point coordinate information (X11, Y11), . . . (Xln, Yln) of the target to be detected in the first image and the second image are obtained The feature point coordinate information about the target to be detected in (Xr1, Yr1),...(Xrn, Yrn). Wherein, the first width may be the difference between the maximum value and the minimum value in all the width coordinates of the reference image, expressed as the first width by a formula
w=max(Xl1,…Xln)-min(Xl1,…Xln)w=max(Xl1,...Xln)-min(Xl1,...Xln)
第一高度可以是参考图像的所有高度坐标中的最大值与最小值之差,以公式表达为第一高度The first height can be the difference between the maximum value and the minimum value among all the height coordinates of the reference image, expressed as the first height by a formula
h=max(Yl1,…Yln)-min(Yl1,…Yln)h=max(Yl1,...Yln)-min(Yl1,...Yln)
通过在获取参考图像的特征点坐标时,一并获取另一图像的特征点坐标信息,简化了目标匹配流程。When the feature point coordinates of the reference image are acquired, the feature point coordinate information of another image is simultaneously acquired, which simplifies the target matching process.
第二种是基于对参考图像进行目标区域检测得到的区域的尺寸,来得到第一尺寸。其中,对参考图像进行目标区域检测得到的区域可以是目标检测框包含的区域,目标检测框中包含的区域可对应目标的特定部位。可选地,将目标检测框的宽度作为第一宽度,将目标检测框的高度作为第一高度。例如,以目标为人脸为例,则目标检测框可以为人脸检测框,其中,人脸检测框所包含的区域是眉毛、眼睛、鼻子以及嘴巴所共同构成的区域。例如,将参考图像输入第二目标检测深度神经网络,输出人脸检测框,其中,人脸检测框的宽度则可作为第一宽度,人脸检测框的高度则可作为第一高度。通过根据第一特征点坐标或根据对第一图像进行目标区域检测得到的区域的尺寸,得到目标区域的第一尺寸,过程简单,设备所需的计算力较低。The second is to obtain the first size based on the size of the region obtained by performing target region detection on the reference image. The area obtained by performing the target area detection on the reference image may be the area included in the target detection frame, and the area included in the target detection frame may correspond to a specific part of the target. Optionally, the width of the target detection frame is used as the first width, and the height of the target detection frame is used as the first height. For example, taking the target as a face as an example, the target detection frame may be a face detection frame, wherein the area included in the face detection frame is an area jointly formed by eyebrows, eyes, nose and mouth. For example, the reference image is input into the second target detection deep neural network, and a face detection frame is output, wherein the width of the face detection frame can be used as the first width, and the height of the face detection frame can be used as the first height. By obtaining the first size of the target area according to the coordinates of the first feature point or according to the size of the area obtained by detecting the target area on the first image, the process is simple and the computing power required by the device is low.
其次,利用第一尺寸与预设尺寸之间的比值,得到第一距离。其中,预设尺寸可以包括预设宽度和预设高度。其中,第一尺寸与预设尺寸之间的比值可以是二者宽度之间的比值或二者高度之间的比值,或者进一步将宽度之间的比值与高度之间的比值进行结合。其中,可以利用第一尺寸进行透视变换,来得到第一距离。通过利用目标在参考图像中对应目标区域的第一尺寸与预设尺寸之间的比值确定第一距离,实现了利用单张图像即可确定目标与拍摄组件之间的距离的技术效果,打破了需要结合至少两张以上的图像才能够获取目标与拍摄组件之间的距离的传统认知。Secondly, the first distance is obtained by using the ratio between the first size and the preset size. The preset size may include a preset width and a preset height. The ratio between the first size and the preset size may be the ratio between the widths of the two or the ratio between the heights, or a combination of the ratio between the widths and the height. The first distance may be obtained by performing perspective transformation using the first size. By using the ratio between the first size of the target corresponding to the target area in the reference image and the preset size to determine the first distance, the technical effect that the distance between the target and the shooting component can be determined by using a single image is achieved, which breaks the The traditional perception of the distance between the target and the photographed component can be obtained by combining at least two or more images.
具体地,可以获取第一宽度与预设宽度之间的第一比值,以及第一高度与预设高度之间的第二比值。并基于第一比值得到目标与参考拍摄组件之间的第二距离,以及基于第二比值得到目标与参考拍摄组件之间的第三距离。其中,这里的预设尺寸是与目标为同一属性的预设目标的真实尺寸。例如,目标为人脸时,预设尺寸则为预设的其他人脸的真实尺寸。其中,第一尺寸和预设尺寸均可以是与目标预设部位对应的尺寸。例如,预设尺寸对应的是预设目标的眉毛、眼睛、鼻子以及嘴巴共同构成的一个区域的真实尺寸,则第一尺寸对应的是参考图像中眉毛、眼睛、鼻子以及嘴巴共同构成的一个目标区 域的尺寸。Specifically, the first ratio between the first width and the preset width, and the second ratio between the first height and the preset height may be acquired. The second distance between the target and the reference photographing component is obtained based on the first ratio, and the third distance between the target and the reference photographing component is obtained based on the second ratio. Wherein, the preset size here is the real size of the preset target with the same attribute as the target. For example, when the target is a face, the preset size is the preset real size of other faces. Wherein, both the first size and the preset size may be sizes corresponding to the target preset part. For example, the preset size corresponds to the real size of an area composed of eyebrows, eyes, nose and mouth of the preset target, and the first size corresponds to a target composed of eyebrows, eyes, nose and mouth in the reference image size of the area.
其中,可以将第一比值乘以参考拍摄组件在宽度方向上的第一焦距,来得到第二距离。具体地,获取第二距离D2的公式为The second distance may be obtained by multiplying the first ratio by the first focal length of the reference photographing component in the width direction. Specifically, the formula for obtaining the second distance D2 is:
D 2=W 1f x/w D 2 =W 1 f x /w
其中,W 1为预设宽度;w为第一宽度;f x为参考拍摄组件在宽度方向上的第一焦距,不同拍摄组件在宽度方向上的焦距不同。其中,f x可以是由两个参考拍摄组件进行标定得到,主要是将参考拍摄组件的真实焦距通过一定的转换,得到在宽度方向上的第一焦距以及高度方向上的第二焦距。这里的宽度和高度的界定与参考图像的宽度和高度的界定方法一致。 Wherein, W1 is the preset width; w is the first width; fx is the first focal length of the reference photographing component in the width direction, and different photographing components have different focal lengths in the width direction. Wherein, f x can be obtained by calibration of two reference shooting components, mainly by converting the real focal length of the reference shooting components to obtain the first focal length in the width direction and the second focal length in the height direction. The definition of the width and height here is consistent with the definition of the width and height of the reference image.
可以将第二比值乘以参考拍摄组件在高度方向上的第二焦距,来得到第三距离。具体地,获取第三距离D3的公式可以是The third distance may be obtained by multiplying the second ratio by the second focal length of the reference photographing component in the height direction. Specifically, the formula for obtaining the third distance D3 may be
D 3=H 1f y/h D 3 =H 1 f y /h
其中,H 1指的是预设高度;f y指的是参考拍摄组件在高度方向上的第二焦距,不同拍摄组件在高度方向上的焦距不同;h指的是第一高度。 Wherein, H 1 refers to the preset height; f y refers to the second focal length of the reference shooting component in the height direction, and different shooting components have different focal lengths in the height direction; h refers to the first height.
最后,基于第二距离和第三距离,得到第一距离。具体地,可以将第二距离和第三距离进行加权求和,得到第一距离。其中,加权求和的公式可以是Finally, based on the second distance and the third distance, the first distance is obtained. Specifically, the second distance and the third distance may be weighted and summed to obtain the first distance. where the formula for the weighted summation can be
D 1=λD 2+(1-λ)D 3 D 1 =λD 2 +(1-λ)D 3
其中,D 1指的是第一距离,D 2指的是第二距离,D 3指的是第三距离,λ为预设参数,并且0≤λ≤1,例如,将λ取值0.5。本公开实施例中,λ为固定参数,λ的取值主要与参考拍摄组件的分辨率有关,若参考拍摄组件的分辨率越高,则λ取值越接近0.5。但是另一些公开实施例中,λ的取值还可以动态调整。一般地,若获取的第二距离与第三距离之间差值的绝对值小于第一差值,则将λ取值0.5;若获取的第二距离与第三距离之间差值的绝对值大于第一差值,则λ取值大于0.5或小于0.5。可选地,若第二距离大于第三距离,则λ取值大于0.5,若第二距离小于第三距离,则λ取值小于0.5。并且二者之间差值的绝对值越大,则λ取值越远离0.5。 Wherein, D 1 refers to the first distance, D 2 refers to the second distance, D 3 refers to the third distance, and λ is a preset parameter, and 0≤λ≤1, for example, the value of λ is 0.5. In the embodiment of the present disclosure, λ is a fixed parameter, and the value of λ is mainly related to the resolution of the reference photographing component. If the resolution of the reference photographing component is higher, the value of λ is closer to 0.5. However, in other disclosed embodiments, the value of λ can also be dynamically adjusted. Generally, if the absolute value of the difference between the acquired second distance and the third distance is smaller than the first difference, λ is set to 0.5; if the absolute value of the difference between the acquired second distance and the third distance is greater than the first difference, the value of λ is greater than 0.5 or less than 0.5. Optionally, if the second distance is greater than the third distance, the value of λ is greater than 0.5, and if the second distance is less than the third distance, the value of λ is less than 0.5. And the larger the absolute value of the difference between the two is, the farther the λ value is from 0.5.
通过将第二距离和第三距离进行加权求和得到第一距离,能够综合考虑宽度和高度方向上的结果,相比使用单个方向上求取得到的第二距离或第三距离作为第一距离而言,能够提高第一距离的准确度。The first distance is obtained by the weighted summation of the second distance and the third distance, which can comprehensively consider the results in the width and height directions, rather than using the second or third distance obtained in a single direction as the first distance In other words, the accuracy of the first distance can be improved.
进一步地,因为参考拍摄组件在宽度或高度方向上的分辨率可能不同,所以通过将第一比值与参考拍摄组件在宽度方向上的第一焦距相乘,以及将第二比值与参考拍摄组件在高度方向上的第二焦距相乘,得到的第二距离和第三距离更准确。Further, since the resolution of the reference photographing component in the width or height direction may be different, by multiplying the first ratio by the first focal length of the reference photographing component in the width direction, and multiplying the second ratio by the reference photographing component in the The second focal length in the height direction is multiplied, and the obtained second and third distances are more accurate.
一些公开实施例中,第一距离为目标与参考拍摄组件之间的距离,参考拍摄组件可以为第一图像或第二图像对应的拍摄组件。其中,基于目标与参考拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,包括:In some disclosed embodiments, the first distance is the distance between the target and the reference photographing component, and the reference photographing component may be the photographing component corresponding to the first image or the second image. Wherein, based on the first distance between the target and the reference shooting component, the disparity of the target between the first image and the second image is obtained, including:
基于第一距离、参考拍摄组件的焦距,以及第一图像和第二图像对应的拍摄组件之间的基线,得到视差。具体地,获取视差Δd的公式如下:The parallax is obtained based on the first distance, the focal length of the reference photographing component, and the baseline between the photographing components corresponding to the first image and the second image. Specifically, the formula for obtaining the parallax Δd is as follows:
Δd=f xB/D 1 Δd=f x B/D 1
其中,Δd为视差,f x为参考拍摄组件在宽度方向上的焦距,D 1为第一距离,B为基线长度。其中,基线的长度可以通过对两个拍摄组件进行标定得到。通过基于第一距离、参考拍摄组件的焦距、以及第一图像和第二图像对应的拍摄组件之间的基线,获取目标在第一图像和第二图像之间的视差,整个过程简单,需要的计算力较低,从而可以节约执行设备的处理资源。 Among them, Δd is the parallax, f x is the focal length of the reference photographing component in the width direction, D 1 is the first distance, and B is the length of the baseline. The length of the baseline can be obtained by calibrating the two shooting components. By obtaining the parallax of the target between the first image and the second image based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, the whole process is simple and requires The computing power is low, so that the processing resources of the execution device can be saved.
其中,根据视差,确定第一图像和第二图像中关于目标的匹配特征点对的步骤包括:基于视差,确定第二图像中与第一特征点对应的参考位置。其中,第一特征点为对第一图像进行目标特征点检测得到。假设第一特征点在第一图像中的坐标为(x ln,y ln),视差为Δd,则第一特征点在第二图像中对应的参考位置应为(x ln+Δd,y ln+Δd)。也就是说,第二图像中与第一特征点对应的第二特征点应该在参考位置(x ln+Δd,y ln+Δd)附近。然后基于该参考位置,在第二图像中选出与第一特征点匹配的第二特征点。第二特征点为对第二图像进行目标特征点检测得到的。其中,可以选择第二图像中距离参考位置最近的特征点作为与第一特征点匹配的第二特征点。这里的距离可以是欧式距离。通过基于视差确定第二图像中与第一特征点对应的参考位置,从而根据该参考位置确定第二特征点,缩小了第二图像中与第一特征点进行匹配的区域,可以快速查找到匹配点对,提高匹配的准确度。另一方面,正因为减小了第二图像中与第一特征点匹配的区域,很大程度上也提高了匹配速度,以及降低了执行目标匹配方法的设备的功耗。 Wherein, according to the parallax, the step of determining the matching feature point pair about the target in the first image and the second image includes: based on the parallax, determining a reference position corresponding to the first feature point in the second image. The first feature point is obtained by detecting target feature points on the first image. Assuming that the coordinates of the first feature point in the first image are (x ln , y ln ) and the parallax is Δd, the corresponding reference position of the first feature point in the second image should be (x ln +Δd,y ln + Δd). That is, the second feature point corresponding to the first feature point in the second image should be near the reference position (x ln +Δd, y ln +Δd). Then, based on the reference position, a second feature point that matches the first feature point is selected in the second image. The second feature point is obtained by performing target feature point detection on the second image. Wherein, the feature point closest to the reference position in the second image may be selected as the second feature point matching the first feature point. The distance here can be the Euclidean distance. By determining the reference position corresponding to the first feature point in the second image based on the parallax, the second feature point is determined according to the reference position, the area in the second image that matches the first feature point is reduced, and the match can be quickly found Point to improve the matching accuracy. On the other hand, because the area matching the first feature point in the second image is reduced, the matching speed is also greatly improved, and the power consumption of the apparatus for performing the target matching method is reduced.
一些公开实施例中,根据视差,确定第一图像和第二图像中关于目标的匹配特征点对的步骤中还包括,确定第一特征点在第二图像中对应的对极线。其中,可以利用第一特征点的坐标与基础矩阵,来得到第一特征点在第二图像中对应的对极线。其中,基础矩阵是通过对两个拍摄组件进行标定得到。具体对两个拍摄组件进行标定的过程可在步 骤S11之前执行。获取对极线l的公式可以是:In some disclosed embodiments, according to the parallax, the step of determining the matching feature point pair about the target in the first image and the second image further includes determining the epipolar line corresponding to the first feature point in the second image. Wherein, the coordinates of the first feature point and the basic matrix can be used to obtain the epipolar line corresponding to the first feature point in the second image. Among them, the basic matrix is obtained by calibrating two shooting components. Specifically, the process of calibrating the two photographing components can be performed before step S11. The formula to obtain the epipolar line l can be:
l=(x ln,y ln,1)*F l=(x ln ,y ln ,1)*F
其中,(x ln,y ln,1)是第一特征点的齐次坐标,F是基础矩阵。 Among them, (x ln , y ln , 1) is the homogeneous coordinate of the first feature point, and F is the fundamental matrix.
其中,可以在第二图像中确定包括参考位置的候选区域,并在候选区域中选择与对极线的位置关系满足预设要求的第二特征点。其中,候选区域可以是以参考位置为中心的预设候选尺寸的区域。预设候选尺寸的确定可根据经验设置,此处不做具体规定。通过将视差与对极几何约束这两个维度综合来确定与第一特征点匹配的第二特征点,相比于使用单个维度而言,提高了目标匹配的准确度。并且,通过选择与对极线的位置关系满足预设要求的特征点作为与第一特征点匹配的第二特征点,相当于将特征匹配区域从二维降到一维,减小了两个拍摄组件之间的摆放位置对目标匹配的影响。并且通过基于视差和对极几何约束这两个维度进行目标匹配,使得即便在第一图像和第二图像中存在多个人脸的情况下,也不易出现错误匹配。Wherein, a candidate area including the reference position may be determined in the second image, and a second feature point whose positional relationship with the epipolar line meets a preset requirement may be selected in the candidate area. The candidate area may be an area of a preset candidate size centered on the reference position. The determination of the preset candidate size can be set according to experience, and no specific provisions are made here. By combining the two dimensions of disparity and epipolar geometric constraints to determine the second feature point that matches the first feature point, the accuracy of target matching is improved compared to using a single dimension. Moreover, by selecting the feature point whose positional relationship with the epipolar line meets the preset requirements as the second feature point matching the first feature point, it is equivalent to reducing the feature matching area from two-dimensional to one-dimensional, reducing two The effect of placement between photographic components on target matching. And by performing target matching based on the two dimensions of disparity and epipolar geometric constraints, even when there are multiple faces in the first image and the second image, false matching is less likely to occur.
预设要求可以是在候选区域中第二特征点与对极线之间的距离最小。也就是在候选区域中选择与对极线距离最小的特征点作为与第一特征点匹配的第二特征点。这里的距离可以是欧式距离。根据对极几何约束原理,与第一特征点对应的第二特征点应该在对极线上,但在目标匹配过程中难免出现误差,导致第二特征点没有处于对极线上,所以选择候选区域中与对极线之间的距离最小的特征点作为与第一特征点对应的第二特征点,能够提高目标匹配的成功率。The preset requirement may be that the distance between the second feature point and the epipolar line in the candidate region is the smallest. That is, in the candidate region, the feature point with the smallest distance from the epipolar line is selected as the second feature point matching the first feature point. The distance here can be the Euclidean distance. According to the principle of epipolar geometric constraint, the second feature point corresponding to the first feature point should be on the epipolar line, but errors will inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, so the candidate is selected. The feature point with the smallest distance from the epipolar line in the region is used as the second feature point corresponding to the first feature point, which can improve the success rate of target matching.
上述方案,即便是在第一图像和第二图像中存在多个干扰目标的情况下,通过获取目标与拍摄组件之间的第一距离并获取视差,从而根据视差确定属于目标的特征点对,减少了将目标的特征点与其他干扰目标的特征点进行错误匹配的情况,从而提高了在干扰目标较多的情况下对目标的匹配特征点的提取准确度。In the above solution, even if there are multiple interfering targets in the first image and the second image, by obtaining the first distance between the target and the shooting component and obtaining the parallax, the feature point pair belonging to the target is determined according to the parallax, The situation of incorrectly matching the feature points of the target with the feature points of other interfering targets is reduced, thereby improving the extraction accuracy of the matching feature points of the target when there are many interfering targets.
为更好地理解本公开实施例提出的技术方案,请参见下例。To better understand the technical solutions proposed by the embodiments of the present disclosure, please refer to the following examples.
同时参见图2,图2是本申请目标匹配方法一实施例的流程示意图二。如图2所示,本公开实施例提出的目标匹配方法可细分为以下步骤:Referring to FIG. 2 at the same time, FIG. 2 is a second schematic flowchart of an embodiment of a target matching method of the present application. As shown in FIG. 2 , the target matching method proposed by the embodiment of the present disclosure can be subdivided into the following steps:
步骤S11:获取第一图像和第二图像,其中,第一图像和第二图像分别由不同的拍摄组件对目标拍摄得到。Step S11: Acquire a first image and a second image, wherein the first image and the second image are obtained by photographing the target by different photographing components respectively.
具体获取第一图像和第二图像的方式可参见上述,此处不再赘述。For the specific manner of acquiring the first image and the second image, reference may be made to the above, and details are not described herein again.
步骤S121:获取目标与参考拍摄组件之间的第一距离。Step S121: Obtain the first distance between the target and the reference photographing component.
其中,参考拍摄组件可以是第一图像对应的拍摄组件,也可以是第二图像对应的拍摄组件。具体获取目标与参考拍摄组件之间的第一距离的方式可参见上述,此处不再赘述。The reference photographing component may be a photographing component corresponding to the first image, or may be a photographing component corresponding to the second image. For a specific manner of obtaining the first distance between the target and the reference photographing component, reference may be made to the above, and details are not described herein again.
步骤S122:基于第一距离,获取目标在第一图像和第二图像之间的视差。Step S122: Based on the first distance, obtain the parallax of the target between the first image and the second image.
其中,获取视差的方式可参见上述,此处不再赘述。The method of obtaining the parallax can refer to the above, and details are not repeated here.
步骤S131:基于视差,确定第二图像中与第一特征点对应的参考位置,其中,第一特征点为对第一图像进行目标特征点检测得到。Step S131 : Determine a reference position corresponding to the first feature point in the second image based on the parallax, wherein the first feature point is obtained by performing target feature point detection on the first image.
其中,基于视差确定第二图像中与第一特征点对应的参考位置的方式可如上述,此处不再赘述。The manner of determining the reference position corresponding to the first feature point in the second image based on the parallax can be as described above, and details are not described herein again.
步骤S132:确定第一特征点在第二图像中对应的对极线。Step S132: Determine the epipolar line corresponding to the first feature point in the second image.
具体地,确定第一特征点在第二图像中对应的对极线的方式如上述,此处不再赘述。本公开实施例所给出的示例中步骤S131和步骤S132可为同步进行的步骤,当然,在其他实施例中,可以先执行其中一个,再执行另一个。关于步骤S131和步骤S132的执行顺序此处不做具体规定。Specifically, the manner of determining the epipolar line corresponding to the first feature point in the second image is as described above, and details are not repeated here. In the example given in the embodiment of the present disclosure, step S131 and step S132 may be performed synchronously. Of course, in other embodiments, one may be performed first, and then the other may be performed. The execution order of step S131 and step S132 is not specified here.
步骤S133:在第二图像中确定包含参考位置的候选区域,并在候选区域中,选择与对极线的位置关系满足预设要求的第二特征点,作为与第一特征点匹配的第二特征点。Step S133: Determine a candidate region containing the reference position in the second image, and in the candidate region, select a second feature point whose positional relationship with the epipolar line meets the preset requirements, as the second feature point matching the first feature point. Feature points.
其中,预设要求可如上述;在候选区域中,选择与第一特征点匹配的第二特征点的过程如上述,此处不再赘述。The preset requirements may be as described above; in the candidate area, the process of selecting the second feature point matching the first feature point is as described above, which will not be repeated here.
上述方案,通过将视差与对极几何约束这两个维度综合来确定与第一特征点匹配的第二特征点,相比于使用单个维度而言,提高了目标匹配的准确度。并且,通过选择与对极线的位置关系满足预设要求的特征点作为与第一特征点匹配的第二特征点,相当于将特征匹配区域从二维降到一维,减小了两个拍摄组件之间的摆放位置对目标匹配的影响。并且通过基于视差和对极几何约束这两个维度进行目标匹配,使得即便在第一图像和第二图像中存在多个人脸的情况下,也不易出现错误匹配。In the above solution, the second feature point matching the first feature point is determined by integrating the two dimensions of disparity and epipolar geometric constraint, which improves the accuracy of target matching compared to using a single dimension. Moreover, by selecting the feature point whose positional relationship with the epipolar line meets the preset requirements as the second feature point matching the first feature point, it is equivalent to reducing the feature matching area from two-dimensional to one-dimensional, reducing two The effect of placement between photographic components on target matching. And by performing target matching based on the two dimensions of disparity and epipolar geometric constraints, even when there are multiple faces in the first image and the second image, false matching is less likely to occur.
通过本公开实施例提出的方案获取到关于目标的匹配特征点对之后,能够对提取到的关于目标的匹配特征点对进行进一步地利用,例如利用匹配特征点对进行深度获取、活体检测、体温测量等操作。例如,在多人测温场景中,需要定位双目相机系统中不同相机拍摄到的相同人脸,然后根据人脸坐标获取该人脸在热像仪中的位置,最后进行温 度提取。因此,人脸匹配是多人场景下快速体温测量的前置任务,通过本公开实施例提供的方案,能够得出高精度、高鲁棒性的人脸匹配结果,辅助多人场景下的体温测量。After the matching feature point pair about the target is obtained through the solution proposed in the embodiment of the present disclosure, the extracted matching feature point pair about the target can be further utilized, for example, depth acquisition, living body detection, body temperature measurement, etc. For example, in a multi-person temperature measurement scenario, it is necessary to locate the same face captured by different cameras in the binocular camera system, and then obtain the position of the face in the thermal imager according to the face coordinates, and finally perform temperature extraction. Therefore, face matching is a pre-task for rapid body temperature measurement in a multi-person scenario. With the solution provided by the embodiments of the present disclosure, a face matching result with high precision and high robustness can be obtained to assist the body temperature in a multi-person scenario. Measurement.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first Object matching between the image and the second image. In addition, compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that in the above method of the specific implementation, the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.
目标匹配方法的执行主体可以是目标匹配装置,例如,目标匹配方法可以由终端设备或服务器或其它处理设备执行,其中,终端设备可以为具有视觉定位、三维重建、图像配准等需求的用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备以及自动驾驶汽车,有定位及建图需求的机器人,有配准需求的医疗成像系统,用于增强现实或虚拟现实的眼镜、头盔等产品等。在一些可能的实现方式中,该目标匹配方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。The execution subject of the target matching method may be a target matching apparatus. For example, the target matching method may be executed by a terminal device or a server or other processing device, wherein the terminal device may be a user equipment with requirements such as visual positioning, three-dimensional reconstruction, and image registration. (User Equipment, UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (Personal Digital Assistant, PDA), handheld devices, computing devices, in-vehicle devices, wearable devices and autonomous vehicles, there are Robots with positioning and mapping requirements, medical imaging systems with registration requirements, glasses, helmets and other products for augmented reality or virtual reality. In some possible implementations, the target matching method may be implemented by the processor invoking computer-readable instructions stored in the memory.
请参阅图3,图3是本申请目标匹配装置一实施例的结构示意图。目标匹配装置30包括图像获取模块31、视差获取模块32、匹配模块33。图像获取模块31,用于获取第一图像和第二图像,其中,第一图像和第二图像由不同的拍摄组件对待匹配的目标拍摄得到;视差获取模块32,用于基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差;匹配模块33,用于根据视差,确定第一图像和第二图像中关于目标的匹配特征点对。Please refer to FIG. 3 , which is a schematic structural diagram of an embodiment of a target matching apparatus of the present application. The target matching device 30 includes an image acquisition module 31 , a parallax acquisition module 32 , and a matching module 33 . The image acquisition module 31 is used to acquire a first image and a second image, wherein the first image and the second image are obtained by shooting the target to be matched by different shooting components; the parallax acquisition module 32 is used for shooting based on the target and at least one The first distance between the components is used to obtain the parallax of the target between the first image and the second image; the matching module 33 is configured to determine the matching feature point pair about the target in the first image and the second image according to the parallax.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比于直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配特征点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first Object matching between the image and the second image. Moreover, compared with the method of directly using the feature points with the closest positions in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax The matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
一些公开实施例中,匹配模块33根据视差,确定第一图像和第二图像中关于目标的匹配特征点对,包括:基于视差,确定第二图像中与第一特征点对应的参考位置,其中,第一特征点为对第一图像进行目标特征点检测得到的;基于参考位置,在第二图像中选出与第一特征点匹配的第二特征点,其中,第二特征点为对第二图像进行目标特征点检测得到的。In some disclosed embodiments, the matching module 33 determines, according to the parallax, a pair of matching feature points about the target in the first image and the second image, including: determining a reference position corresponding to the first feature point in the second image based on the parallax, wherein , the first feature point is obtained by performing target feature point detection on the first image; based on the reference position, a second feature point matching the first feature point is selected in the second image, wherein the second feature point is the first feature point. The two images are obtained by detecting the target feature points.
上述方案,通过基于视差确定第二图像中与第一特征点对应的参考位置,从而根据该参考位置确定第二特征点,缩小了第二图像中与第一特征点进行匹配的区域,可以快速查找到匹配点对,提高匹配的准确度。In the above solution, by determining the reference position corresponding to the first feature point in the second image based on the parallax, the second feature point is determined according to the reference position, and the area in the second image that is matched with the first feature point is reduced, which can quickly Find matching point pairs to improve the matching accuracy.
一些公开实施例中,匹配模块33基于参考位置,在第二图像中选出第一特征点匹配的第二特征点,包括:在第二图像中确定包含参考位置的候选区域,并在候选区域中,选择与第一特征点在第二图像中对应的对极线的位置关系满足预设要求的第二特征点,作为与第一特征点匹配的第二特征点。In some disclosed embodiments, the matching module 33 selects a second feature point in the second image that matches the first feature point based on the reference position, including: determining a candidate region including the reference position in the second image, and selecting a candidate region in the candidate region. , a second feature point whose positional relationship with the epipolar line corresponding to the first feature point in the second image satisfies a preset requirement is selected as the second feature point matching the first feature point.
上述方案,通过将视差与对极几何约束这两个维度综合来确定与第一特征点匹配的第二特征点,相比于使用单个维度而言,提高了目标匹配的准确度。In the above solution, the second feature point matching the first feature point is determined by integrating the two dimensions of disparity and epipolar geometric constraint, which improves the accuracy of target matching compared to using a single dimension.
一些公开实施例中,匹配模块33确定第一特征点在第二图像中对应的对极线,包括:利用第一特征点的坐标与基础矩阵得到对极线。In some disclosed embodiments, the matching module 33 determines the epipolar line corresponding to the first feature point in the second image, including: obtaining the epipolar line by using the coordinates of the first feature point and the fundamental matrix.
一些公开实施例中,预设要求为在候选区域中第二特征点与对极线之间的距离最小。In some disclosed embodiments, the preset requirement is that the distance between the second feature point and the epipolar line in the candidate region is the smallest.
上述方案,根据对极几何约束原理,与第一特征点对应的第二特征点应该在对极线上,但在目标匹配过程中难免出现误差,导致第二特征点没有处于对极线上,所以选择候选区域中与对极线之间的距离最小的特征点作为与第一特征点对应的第二特征点,能够提高目标匹配的成功率。In the above scheme, according to the principle of epipolar geometric constraint, the second feature point corresponding to the first feature point should be on the epipolar line, but errors inevitably occur during the target matching process, resulting in the second feature point not being on the epipolar line, Therefore, selecting the feature point with the smallest distance from the epipolar line in the candidate region as the second feature point corresponding to the first feature point can improve the success rate of target matching.
一些公开实施例中,第一图像或第二图像为参考图像,参考图像对应的拍摄组件为参考拍摄组件,第一距离为目标与参考拍摄组件之间的距离;视差获取模块32还用于执行以下步骤以得到第一距离:确定目标在参考图像中对应目标区域的第一尺寸;利用第一尺寸与预设尺寸之间的比值得到第一距离。In some disclosed embodiments, the first image or the second image is a reference image, the photographing component corresponding to the reference image is the reference photographing component, and the first distance is the distance between the target and the reference photographing component; the parallax obtaining module 32 is further configured to execute The first distance is obtained by the following steps: determining the first size of the target corresponding to the target area in the reference image; and obtaining the first distance by using the ratio between the first size and the preset size.
上述方案,通过利用目标在参考图像中对应目标区域的第一尺寸与预设尺寸之间的比值确定第一距离,实现了利用单张图像即可确定目标与拍摄组件之间的距离的技术效果,打破了需要结合至少两张以上的图像才能够获取目标与拍摄组件之间的距离的传统认知。In the above solution, by using the ratio between the first size of the target corresponding to the target area in the reference image and the preset size to determine the first distance, the technical effect that the distance between the target and the shooting component can be determined by using a single image is achieved. , which breaks the traditional cognition that it is necessary to combine at least two images to obtain the distance between the target and the shooting component.
一些公开实施例中,第一尺寸包括目标区域的第一宽度和第一高度,预设尺寸包括预设宽度和预设高度;视差获取模块32利用第一尺寸与预设尺寸之间的比值得到第一距离,包括:获取第一宽度与预设宽度之间的第一比值,以及第一高度与预设高度之间的第二比值;基于第一比值得到目标与参考拍摄组件之间的第二距离,并基于第二比值得到目标与参考拍摄组件之间的第三距离;基于第二距离和第三距离得到第一距离。In some disclosed embodiments, the first size includes a first width and a first height of the target area, and the preset size includes a preset width and a preset height; the parallax obtaining module 32 obtains by using the ratio between the first size and the preset size. The first distance includes: obtaining a first ratio between the first width and a preset width, and a second ratio between the first height and the preset height; and obtaining the first ratio between the target and the reference shooting component based on the first ratio. two distances, and the third distance between the target and the reference photographing component is obtained based on the second ratio; the first distance is obtained based on the second distance and the third distance.
上述方案,通过将第二距离和第三距离进行加权求和得到第一距离,能够综合考虑宽度和高度方向上的结果,相比使用单个方向上求取得到的第二距离或第三距离作为第一距离而言,能够提高第一距离的准确度。In the above scheme, the first distance is obtained by weighting the second distance and the third distance, and the results in the width and height directions can be comprehensively considered. Compared with the second distance or the third distance obtained by using a single direction as For the first distance, the accuracy of the first distance can be improved.
一些公开实施例中,视差获取模块32基于第一比值得到目标与参考拍摄组件之间的第二距离,包括:将第一比值乘以参考拍摄组件在宽度方向上的第一焦距得到第二距离;基于第二比值得到目标与参考拍摄组件之间的第三距离,包括:将第二比值乘以参考拍摄组件在高度方向上的第二焦距得到第三距离;基于第二距离和第三距离得到第一距离,包括:将第二距离和第三距离进行加权求和得到第一距离。In some disclosed embodiments, the parallax obtaining module 32 obtains the second distance between the target and the reference photographing component based on the first ratio, including: multiplying the first ratio by the first focal length of the reference photographing component in the width direction to obtain the second distance. ; Obtain the third distance between the target and the reference shooting component based on the second ratio, comprising: multiplying the second ratio by the second focal length of the reference shooting component in the height direction to obtain the third distance; Based on the second distance and the third distance Obtaining the first distance includes: weighted summation of the second distance and the third distance to obtain the first distance.
上述方案,因为参考拍摄组件在宽度或高度方向上的分辨率可能不同,所以通过将第一比值与参考拍摄组件在宽度方向上的第一焦距相乘,以及将第二比值与参考拍摄组件在高度方向上的第二焦距相乘,得到的第二距离和第三距离更准确。In the above solution, because the resolution of the reference photographing component in the width or height direction may be different, by multiplying the first ratio by the first focal length of the reference photographing component in the width direction, and multiplying the second ratio by the reference photographing component in the width direction. The second focal length in the height direction is multiplied, and the obtained second and third distances are more accurate.
一些公开实施例中,视差获取模块32确定目标在参考图像中对应目标区域的第一尺寸,包括:基于对参考图像进行目标特征点检测得到的至少两个第一特征点的坐标得到第一尺寸;或者,基于对参考图像进行目标区域检测得到的区域的尺寸得到第一尺寸。In some disclosed embodiments, the parallax obtaining module 32 determines the first size of the target corresponding to the target area in the reference image, including: obtaining the first size based on the coordinates of at least two first feature points obtained by performing target feature point detection on the reference image. or, obtaining the first size based on the size of the region obtained by performing target region detection on the reference image.
上述方案,通过根据第一特征点坐标或根据对第一图像进行目标区域检测得到的区域的尺寸,得到目标区域的第一尺寸,过程简单,设备所需的计算力较低。In the above solution, the first size of the target area is obtained according to the coordinates of the first feature point or the size of the area obtained by detecting the target area on the first image, the process is simple, and the computing power required by the device is low.
一些公开实施例中,第一距离为目标与参考拍摄组件之间的距离,参考拍摄组件为第一图像或第二图像对应的拍摄组件;视差获取模块32基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,包括:基于第一距离、参考拍摄组件的焦距、以及第一图像和第二图像对应的拍摄组件之间的基线,得到视差。In some disclosed embodiments, the first distance is the distance between the target and the reference photographing component, and the reference photographing component is the photographing component corresponding to the first image or the second image; the parallax obtaining module 32 is based on the distance between the target and at least one photographing component. The first distance is to obtain the parallax of the target between the first image and the second image, including: based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, obtaining Parallax.
上述方案,通过基于第一距离、参考拍摄组件的焦距、以及第一图像和第二图像对应的拍摄组件之间的基线,获取目标在第一图像和第二图像之间的视差,整个过程简单,需要的计算力较低,从而可以节约执行设备的处理资源。The above scheme obtains the parallax of the target between the first image and the second image based on the first distance, the focal length of the reference shooting component, and the baseline between the shooting components corresponding to the first image and the second image, and the whole process is simple , the required computing power is low, so that the processing resources of the execution device can be saved.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图 像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比于直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配特征点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first Object matching between the image and the second image. Moreover, compared with the method of directly using the feature points with the closest positions in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then utilizes the parallax The matching feature point pairs are obtained, which improves the accuracy of target matching between different images.
请参阅图4,图4是本申请电子设备一实施例的结构示意图。电子设备40包括存储器41和处理器42,处理器42用于执行存储器41中存储的程序指令,以实现上述目标匹配方法实施例中的步骤。在一个具体的实施场景中,电子设备40可以包括但不限于:微型计算机、服务器,此外,电子设备40还可以包括笔记本电脑、平板电脑等移动设备,在此不做限定。Please refer to FIG. 4 , which is a schematic structural diagram of an embodiment of an electronic device of the present application. The electronic device 40 includes a memory 41 and a processor 42, and the processor 42 is configured to execute program instructions stored in the memory 41, so as to implement the steps in the above-mentioned embodiments of the target matching method. In a specific implementation scenario, the electronic device 40 may include, but is not limited to, a microcomputer and a server. In addition, the electronic device 40 may also include mobile devices such as a notebook computer and a tablet computer, which are not limited herein.
具体而言,处理器42用于控制其自身以及存储器41以实现上述目标匹配方法实施例中的步骤。处理器42还可以称为CPU(Central Processing Unit,中央处理单元)。处理器42可能是一种集成电路芯片,具有信号的处理能力。处理器42还可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。另外,处理器42可以由集成电路芯片共同实现。Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in the above-mentioned embodiment of the target matching method. The processor 42 may also be referred to as a CPU (Central Processing Unit, central processing unit). The processor 42 may be an integrated circuit chip with signal processing capability. The processor 42 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 42 may be jointly implemented by an integrated circuit chip.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以有效实现第一图像和第二图像间的目标匹配。并且,相比直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first Object matching between the image and the second image. In addition, compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
请参阅图5,图5为本申请计算机可读存储介质一实施例的结构示意图。计算机可读存储介质50存储有能够被处理器运行的程序指令501,程序指令501用于实现上述目标匹配方法实施例中的步骤。Please refer to FIG. 5 , which is a schematic structural diagram of an embodiment of a computer-readable storage medium of the present application. The computer-readable storage medium 50 stores program instructions 501 that can be executed by a processor, and the program instructions 501 are used to implement the steps in the above embodiments of the target matching method.
上述方案,通过基于目标与至少一个拍摄组件之间的第一距离,得到目标在第一图像和第二图像之间的视差,并根据该视差确定目标的匹配特征点对,可以实现第一图像和第二图像间的目标匹配。并且,相比直接将两张图像中位置最近的特征点作为匹配特征点对的方式而言,本申请由于参考了目标与拍摄组件之间的距离,获得较为准确的视差,进而利用该视差得到匹配点对,提高了不同图像间目标匹配的准确度。In the above scheme, by obtaining the parallax of the target between the first image and the second image based on the first distance between the target and the at least one shooting component, and determining the matching feature point pair of the target according to the parallax, the first image can be realized and the target match between the second image. In addition, compared with the method of directly using the feature point with the closest position in the two images as the matching feature point pair, the present application obtains a more accurate parallax by referring to the distance between the target and the shooting component, and then uses the parallax to obtain Matching point pairs improves the accuracy of target matching between different images.
在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述,为了简洁,这里不再赘述。In some embodiments, the functions or modules included in the apparatuses provided in the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments. For specific implementation, reference may be made to the descriptions of the above method embodiments. For brevity, here No longer.
上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考,为了简洁,本文不再赘述。The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, details are not repeated herein.
在本申请所提供的几个实施例中,应该理解到,所揭露的方法和装置,可以通过其它的方式实现。例如,以上所描述的装置实施方式仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如模块或单元可以结合或者可以集成到另一个系统,或一些特征可以忽略或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性、机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the device implementations described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other divisions. For example, modules or units may be combined or integrated. to another system, or some features can be ignored or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented as a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Claims (13)

  1. 一种目标匹配方法,其特征在于,包括:A target matching method, comprising:
    获取第一图像和第二图像,其中,所述第一图像和所述第二图像由不同的拍摄组件对待匹配的目标拍摄得到;acquiring a first image and a second image, wherein the first image and the second image are obtained by photographing the target to be matched by different photographing components;
    基于所述目标与至少一个所述拍摄组件之间的第一距离,得到所述目标在所述第一图像和第二图像之间的视差;obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one of the photographing components;
    根据所述视差,确定所述第一图像和所述第二图像中关于所述目标的匹配特征点对。According to the disparity, a matching feature point pair about the target in the first image and the second image is determined.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述视差,确定所述第一图像和所述第二图像中关于所述目标的匹配特征点对,包括:The method according to claim 1, wherein the determining, according to the parallax, a pair of matching feature points about the target in the first image and the second image, comprising:
    基于所述视差,确定所述第二图像中与第一特征点对应的参考位置,其中,所述第一特征点为对所述第一图像进行目标特征点检测得到的;determining, based on the parallax, a reference position corresponding to the first feature point in the second image, wherein the first feature point is obtained by performing target feature point detection on the first image;
    基于所述参考位置,在所述第二图像中选出与所述第一特征点匹配的第二特征点,其中,所述第二特征点为对所述第二图像进行目标特征点检测得到的。Based on the reference position, a second feature point matching the first feature point is selected in the second image, wherein the second feature point is obtained by performing target feature point detection on the second image of.
  3. 根据权利要求2所述的方法,其特征在于,所述基于所述参考位置,在所述第二图像中选出与所述第一特征点匹配的第二特征点,包括:The method according to claim 2, wherein the selecting a second feature point matching the first feature point in the second image based on the reference position comprises:
    在所述第二图像中确定包含所述参考位置的候选区域,并determining a candidate region in the second image that includes the reference location, and
    在所述候选区域中,选择与所述第一特征点在所述第二图像中对应的对极线的位置关系满足预设要求的第二特征点,作为与所述第一特征点匹配的第二特征点。In the candidate area, a second feature point whose positional relationship with the epipolar line corresponding to the first feature point in the second image satisfies a preset requirement is selected as a matching feature point with the first feature point. Second feature point.
  4. 根据权利要求3所述的方法,其特征在于,通过如下操作确定所述第一特征点在所述第二图像中对应的对极线:The method according to claim 3, wherein the epipolar line corresponding to the first feature point in the second image is determined by the following operations:
    利用所述第一特征点的坐标与基础矩阵,得到所述对极线。Using the coordinates of the first feature point and the fundamental matrix, the epipolar line is obtained.
  5. 根据权利要求3或4所述的方法,其特征在于,所述预设要求为在所述候选区域中所述第二特征点与所述对极线之间的距离最小。The method according to claim 3 or 4, wherein the preset requirement is that the distance between the second feature point and the epipolar line in the candidate region is the smallest.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述第一图像或所述第二图像为参考图像,所述参考图像对应的所述拍摄组件为参考拍摄组件,所述第一距离为所述目标与所述参考拍摄组件之间的距离;通过以下步骤得到所述第一距离:The method according to any one of claims 1 to 5, wherein the first image or the second image is a reference image, the photographing component corresponding to the reference image is a reference photographing component, and the The first distance is the distance between the target and the reference shooting component; the first distance is obtained through the following steps:
    确定所述目标在所述参考图像中对应目标区域的第一尺寸;determining the first size of the target corresponding to the target area in the reference image;
    利用所述第一尺寸与预设尺寸之间的比值,得到所述第一距离。The first distance is obtained by using the ratio between the first size and the preset size.
  7. 根据权利要求6所述的方法,其特征在于,所述第一尺寸包括所述目标区域的第一宽度和第一高度,所述预设尺寸包括预设宽度和预设高度;所述利用所述第一尺寸与预设尺寸之间的比值,得到所述第一距离,包括:The method according to claim 6, wherein the first size includes a first width and a first height of the target area, and the preset size includes a preset width and a preset height; The ratio between the first size and the preset size to obtain the first distance, including:
    获取所述第一宽度与所述预设宽度之间的第一比值,以及所述第一高度与所述预设高度之间的第二比值;obtaining a first ratio between the first width and the preset width, and a second ratio between the first height and the preset height;
    基于所述第一比值得到所述目标与所述参考拍摄组件之间的第二距离,并基于所述第二比值得到所述目标与所述参考拍摄组件之间的第三距离;Obtaining a second distance between the target and the reference photographing component based on the first ratio, and obtaining a third distance between the target and the reference photographing component based on the second ratio;
    基于所述第二距离和所述第三距离,得到所述第一距离。Based on the second distance and the third distance, the first distance is obtained.
  8. 根据权利要求7所述的方法,其特征在于,The method of claim 7, wherein:
    所述基于所述第一比值得到所述目标与所述参考拍摄组件之间的第二距离,包括:The obtaining the second distance between the target and the reference photographing component based on the first ratio includes:
    将所述第一比值乘以所述参考拍摄组件在宽度方向上的第一焦距,得到所述第二距离;multiplying the first ratio by the first focal length of the reference photographing component in the width direction to obtain the second distance;
    所述基于所述第二比值得到所述目标与所述参考拍摄组件之间的第三距离,包括:The obtaining the third distance between the target and the reference photographing component based on the second ratio includes:
    将所述第二比值乘以所述参考拍摄组件在高度方向上的第二焦距,得到第三距离;multiplying the second ratio by the second focal length of the reference photographing component in the height direction to obtain a third distance;
    所述基于所述第二距离和第三距离,得到所述第一距离,包括:The obtaining the first distance based on the second distance and the third distance includes:
    将所述第二距离和第三距离进行加权求和,得到所述第一距离。The second distance and the third distance are weighted and summed to obtain the first distance.
  9. 根据权利要求6至8任一项所述的方法,其特征在于,所述确定所述目标在所述参考图像中对应目标区域的第一尺寸,包括以下任一:The method according to any one of claims 6 to 8, wherein the determining the first size of the target corresponding to the target area in the reference image comprises any of the following:
    基于对所述参考图像进行目标特征点检测得到的至少两个第一特征点的坐标,得到所述第一尺寸;obtaining the first size based on the coordinates of at least two first feature points obtained by performing target feature point detection on the reference image;
    基于对所述参考图像进行目标区域检测得到的区域的尺寸,得到所述第一尺寸。The first size is obtained based on a size of an area obtained by performing target area detection on the reference image.
  10. 根据权利要求1至9任一项所述的方法,其特征在于,所述第一距离为所述目标与参考拍摄组件之间的距离,所述参考拍摄组件为所述第一图像或所述第二图像对应的拍摄组件;所述基于所述目标与至少一个所述拍摄组件之间的第一距离,得到所述目标在所述第一图像和所述第二图像之间的视差,包括:The method according to any one of claims 1 to 9, wherein the first distance is a distance between the target and a reference photographing component, and the reference photographing component is the first image or the the photographing component corresponding to the second image; and obtaining the parallax of the target between the first image and the second image based on the first distance between the target and at least one of the photographing components, including :
    基于所述第一距离、所述参考拍摄组件的焦距、以及所述第一图像和所述第二图像对应的所述拍摄组件之间的基线,得到所述视差。The parallax is obtained based on the first distance, the focal length of the reference photographing component, and the baseline between the photographing components corresponding to the first image and the second image.
  11. 一种目标匹配装置,其特征在于,包括:A target matching device, comprising:
    图像获取模块,用于获取第一图像和第二图像,其中,所述第一图像和所述第二图像由不同的拍摄组件对待匹配的目标拍摄得到;an image acquisition module, configured to acquire a first image and a second image, wherein the first image and the second image are obtained by photographing the target to be matched by different photographing components;
    视差获取模块,用于基于所述目标与至少一个所述拍摄组件之间的第一距离,得到所述目标在所述第一图像和所述第二图像之间的视差;a parallax obtaining module, configured to obtain the parallax of the target between the first image and the second image based on the first distance between the target and at least one of the shooting components;
    匹配模块,用于根据所述视差,确定所述第一图像和所述第二图像中关于所述目标的匹配特征点对。A matching module, configured to determine, according to the parallax, a pair of matching feature points about the target in the first image and the second image.
  12. 一种电子设备,其特征在于,包括存储器和处理器,所述处理器用于执行所述存储器中存储的程序指令,以实现权利要求1至10任一项所述的方法。An electronic device is characterized by comprising a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory, so as to implement the method of any one of claims 1 to 10.
  13. 一种计算机可读存储介质,其上存储有程序指令,其特征在于,所述程序指令被处理器执行时实现权利要求1至10任一项所述的方法。A computer-readable storage medium having program instructions stored thereon, characterized in that, when the program instructions are executed by a processor, the method of any one of claims 1 to 10 is implemented.
PCT/CN2022/084323 2021-04-16 2022-03-31 Method and apparatus for target matching, device, and storage medium WO2022218161A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110413815.2 2021-04-16
CN202110413815.2A CN113159161A (en) 2021-04-16 2021-04-16 Target matching method and device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022218161A1 true WO2022218161A1 (en) 2022-10-20

Family

ID=76868521

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084323 WO2022218161A1 (en) 2021-04-16 2022-03-31 Method and apparatus for target matching, device, and storage medium

Country Status (3)

Country Link
CN (1) CN113159161A (en)
TW (1) TW202242716A (en)
WO (1) WO2022218161A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113159161A (en) * 2021-04-16 2021-07-23 深圳市商汤科技有限公司 Target matching method and device, equipment and storage medium
CN113837246B (en) * 2021-09-06 2022-12-27 广州极飞科技股份有限公司 Image matching method and device and unmanned equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150009295A1 (en) * 2013-07-03 2015-01-08 Electronics And Telecommunications Research Institute Three-dimensional image acquisition apparatus and image processing method using the same
CN108876835A (en) * 2018-03-28 2018-11-23 北京旷视科技有限公司 Depth information detection method, device and system and storage medium
CN111160178A (en) * 2019-12-19 2020-05-15 深圳市商汤科技有限公司 Image processing method and device, processor, electronic device and storage medium
CN111739081A (en) * 2020-08-06 2020-10-02 成都极米科技股份有限公司 Feature point matching method, splicing method and device, electronic equipment and storage medium
CN113159161A (en) * 2021-04-16 2021-07-23 深圳市商汤科技有限公司 Target matching method and device, equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6202367B2 (en) * 2013-05-14 2017-09-27 株式会社リコー Image processing device, distance measurement device, mobile device control system, mobile device, and image processing program
CN110335315B (en) * 2019-06-27 2021-11-02 Oppo广东移动通信有限公司 Image processing method and device and computer readable storage medium
CN111457886B (en) * 2020-04-01 2022-06-21 北京迈格威科技有限公司 Distance determination method, device and system
CN111901499B (en) * 2020-07-17 2022-04-01 青岛聚好联科技有限公司 Method and equipment for calculating actual pixel distance in video image
CN112560592A (en) * 2020-11-30 2021-03-26 深圳市商汤科技有限公司 Image processing method and device, and terminal control method and device
CN112507992B (en) * 2021-02-04 2021-05-07 腾讯科技(深圳)有限公司 Method, device, equipment and medium for determining shooting distance between road images

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150009295A1 (en) * 2013-07-03 2015-01-08 Electronics And Telecommunications Research Institute Three-dimensional image acquisition apparatus and image processing method using the same
CN108876835A (en) * 2018-03-28 2018-11-23 北京旷视科技有限公司 Depth information detection method, device and system and storage medium
CN111160178A (en) * 2019-12-19 2020-05-15 深圳市商汤科技有限公司 Image processing method and device, processor, electronic device and storage medium
CN111739081A (en) * 2020-08-06 2020-10-02 成都极米科技股份有限公司 Feature point matching method, splicing method and device, electronic equipment and storage medium
CN113159161A (en) * 2021-04-16 2021-07-23 深圳市商汤科技有限公司 Target matching method and device, equipment and storage medium

Also Published As

Publication number Publication date
CN113159161A (en) 2021-07-23
TW202242716A (en) 2022-11-01

Similar Documents

Publication Publication Date Title
US9111347B2 (en) Method for determining the pose of a camera with respect to at least one real object
CN110809786B (en) Calibration device, calibration chart, chart pattern generation device, and calibration method
WO2022218161A1 (en) Method and apparatus for target matching, device, and storage medium
WO2017076106A1 (en) Method and device for image splicing
CN107084680B (en) A kind of target depth measurement method based on machine monocular vision
US9615081B2 (en) Method and multi-camera portable device for producing stereo images
WO2014044126A1 (en) Coordinate acquisition device, system and method for real-time 3d reconstruction, and stereoscopic interactive device
CN112184811B (en) Monocular space structured light system structure calibration method and device
WO2014084181A1 (en) Image measurement device
CN115049738A (en) Method and system for estimating distance between person and camera
CN112802114A (en) Multi-vision sensor fusion device and method and electronic equipment
WO2021193672A1 (en) Three-dimensional model generation method and three-dimensional model generation device
TWI731430B (en) Information display method and information display system
JP2014060611A (en) Image processing apparatus, image projection system, and program
CN116929290A (en) Binocular visual angle difference three-dimensional depth measurement method, binocular visual angle difference three-dimensional depth measurement system and storage medium
WO2015079054A1 (en) Estimating gaze from un-calibrated eye measurement points
EP2866446B1 (en) Method and multi-camera portable device for producing stereo images
CN112330726B (en) Image processing method and device
JP5727969B2 (en) Position estimation apparatus, method, and program
CN113034615B (en) Equipment calibration method and related device for multi-source data fusion
WO2021259287A1 (en) Depth map generation method, and device and storage medium
CN114663519A (en) Multi-camera calibration method and device and related equipment
CN111489384B (en) Method, device, system and medium for evaluating shielding based on mutual viewing angle
TWI637353B (en) Measurement device and measurement method
WO2023179390A1 (en) Object recognition method and apparatus, electronic device, computer readable storage medium and computer program product

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: 22787388

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE