Disclosure of Invention
Aiming at the problems existing in the prior art, the invention provides a visual positioning method, a visual positioning device, electronic equipment and a storage medium.
In a first aspect, the present invention provides a visual positioning method, comprising:
acquiring a panoramic image acquired at a target location;
determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determining a plane angle between the first feature point and the second feature point;
and determining a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and a rear intersection principle.
Optionally, according to the visual positioning method provided by the present invention, the determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image includes:
matching feature points of the panoramic image with images to be searched in a pre-constructed image feature library to obtain matching feature points;
determining a first three-dimensional coordinate value corresponding to the first feature point in the matched feature points and a second three-dimensional coordinate value corresponding to the second feature point in the matched feature points based on three-dimensional coordinate values corresponding to the feature points in the images to be searched stored in the image feature library;
a three-dimensional distance between the first feature point and the second feature point is determined based on the first three-dimensional coordinate value and the second three-dimensional coordinate value.
Optionally, according to the visual positioning method provided by the present invention, before the determining the three-dimensional distance between the first feature point and the second feature point in the panoramic image, the method further includes:
and correcting the panoramic image based on the sphere center projection principle to obtain a corrected panoramic image.
Optionally, according to the visual positioning method provided by the invention, the determining the plane angle between the first feature point and the second feature point includes:
and determining the plane angle between the first characteristic point and the second characteristic point based on the principle of sphere center projection.
Optionally, according to the visual positioning method provided by the invention, the determining the plane angle between the first feature point and the second feature point based on the principle of sphere center projection includes:
determining a plane distance between the first feature point and the second feature point, a pixel width of the panoramic image and an acquisition angle of the panoramic image;
and determining a plane angle between the first characteristic point and the second characteristic point based on the plane distance, the pixel width and the acquisition angle.
Optionally, according to the visual positioning method provided by the present invention, the determining the plane angle between the first feature point and the second feature point based on the plane distance, the pixel width and the acquisition angle includes:
determining a plane angle between the first feature point and the second feature point by the following formula:
wherein a represents a plane angle between the first feature point and the second feature point, s i Representing the plane distance, sL representing the pixel width, and a representing the acquisition angle.
In a second aspect, the present invention also provides a visual positioning device, comprising:
the acquisition module is used for acquiring the panoramic image acquired at the target position;
the first determining module is used for determining a three-dimensional distance between a first characteristic point and a second characteristic point in the panoramic image and determining a plane angle between the first characteristic point and the second characteristic point;
and the second determining module is used for determining the three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and the rear intersection principle.
In a third aspect, the present invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the visual localization method according to the first aspect when executing the program.
In a fourth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the visual positioning method according to the first aspect.
In a fifth aspect, the invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the visual positioning method according to the first aspect.
According to the visual positioning method, the visual positioning device, the electronic equipment and the storage medium, the panoramic image acquired at the target position is firstly acquired, then the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point in the panoramic image are determined, and further the three-dimensional coordinate value of the target position is determined based on the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point and the rear intersection principle; the invention performs visual positioning on the target position based on the panoramic image acquired at the target position, enriches the image scene, can improve the positioning precision, and also realizes the positioning on the target position based on the rear intersection principle, so that the camera internal reference for acquiring the panoramic image is not required to be calibrated, and the method is simple and easy to realize.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that, in the description of the present invention, the terms "first," "second," and the like are used for distinguishing between similar objects and not for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present invention may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more.
The following describes exemplary visual positioning methods, devices, electronic equipment and storage media provided by the invention with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a visual positioning method according to the present invention, as shown in fig. 1, the method includes:
step 100, acquiring a panoramic image acquired at a target location;
step 110, determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determining a plane angle between the first feature point and the second feature point;
step 120, determining a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and a rear intersection principle.
It should be noted that, the execution main body of the visual positioning method provided in the embodiment of the present invention may be any mobile terminal or mobile electronic device having an image capturing function or an image capturing function, for example, a mobile phone, a tablet computer, a notebook computer, a palm computer, a wearable device, an Ultra-mobile personal computer (Ultra-mobile Personal Computer, UMPC), a netbook, a personal digital assistant (Personal Digital Assistant, PDA), or the like.
The technical scheme of the embodiment of the invention is described in detail below by taking the mobile phone to execute the visual positioning method provided by the invention as an example.
Specifically, in order to overcome the defects that the prior art needs to rely on stable and accurate camera internal parameters and is easily influenced by repeated scenes and similar scenes when being positioned based on images under a single visual angle and has poor positioning accuracy, the invention determines the three-dimensional coordinate value of the target position based on the three-dimensional distance and plane angle between a first characteristic point and a second characteristic point in the panoramic image and then the three-dimensional distance and plane angle between the first characteristic point and the second characteristic point and the rear intersection principle by firstly acquiring the panoramic image acquired at the target position and then determining the three-dimensional distance and plane angle between the first characteristic point and the second characteristic point; the invention performs visual positioning on the target position based on the panoramic image acquired at the target position, enriches the image scene, can improve the positioning precision, and also realizes the positioning on the target position based on the rear intersection principle, so that the camera internal reference for acquiring the panoramic image is not required to be calibrated, and the method is simple and easy to realize.
Alternatively, a global image acquired by a camera of the handset at the target location may be acquired first.
It should be noted that, with the continuous development of visual image processing technologies, panoramic image stitching technologies are becoming more and more mature, for example, a smart phone can achieve panoramic image shooting at 200 degrees. The panoramic image can overcome the limitation of the orthographic image, has more characteristic information and wider visual angle, and can provide more effective information for resolving the positioning position in visual positioning.
Alternatively, after the panoramic image acquired at the target location is acquired, a three-dimensional distance between a first feature point and a second feature point in the acquired panoramic image, and a plane angle between the first feature point and the second feature point may be determined, wherein the first feature point and the second feature point are any two feature points in the panoramic image.
Alternatively, after the three-dimensional distance and the planar angle between the first feature point and the second feature point are obtained, the three-dimensional coordinate value of the target position may be determined using the principle of rear intersection.
The principle of rear intersection refers to erecting an instrument on an unknown point, and observing the included angle and distance of at least two known points to obtain the coordinates and elevation of the intersection station.
Alternatively, in the embodiment of the present invention, the first feature point and the second feature point may be connected, and the three-dimensional coordinate value of the target position may be calculated using the principle of rear intersection based on the three-dimensional distance and the plane angle between the first feature point and the second feature point.
In the embodiment of the present invention, the three-dimensional coordinate values are corresponding three-dimensional coordinate values in the geodetic coordinate system.
According to the visual positioning method provided by the invention, the panoramic image acquired at the target position is firstly acquired, then the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point in the panoramic image are determined, and further the three-dimensional coordinate value of the target position is determined based on the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point and the rear intersection principle; the invention performs visual positioning on the target position based on the panoramic image acquired at the target position, enriches the image scene, can improve the positioning precision, and also realizes the positioning on the target position based on the rear intersection principle, so that the camera internal reference for acquiring the panoramic image is not required to be calibrated, and the method is simple and easy to realize.
Optionally, the determining the three-dimensional distance between the first feature point and the second feature point in the panoramic image includes:
matching feature points of the panoramic image with images to be searched in a pre-constructed image feature library to obtain matching feature points;
determining a first three-dimensional coordinate value corresponding to the first feature point in the matched feature points and a second three-dimensional coordinate value corresponding to the second feature point in the matched feature points based on three-dimensional coordinate values corresponding to the feature points in the images to be searched stored in the image feature library;
a three-dimensional distance between the first feature point and the second feature point is determined based on the first three-dimensional coordinate value and the second three-dimensional coordinate value.
Specifically, in the embodiment of the present invention, in order to determine the three-dimensional distance between the first feature point and the second feature point in the panoramic image, feature point matching may be performed on the panoramic image and the image to be searched in the image feature library constructed in advance, so that feature points that can be matched in the panoramic image, that is, matching feature points, may be obtained, further, based on three-dimensional coordinate values corresponding to each feature point in the image to be searched stored in the image feature library, a first three-dimensional coordinate value corresponding to a first feature point in the matching feature points is determined, a second three-dimensional coordinate value corresponding to a second feature point in the matching feature points is determined, and then, based on the first three-dimensional coordinate value corresponding to the first feature point and the second three-dimensional coordinate value corresponding to the second feature point, the three-dimensional distance between the first feature point and the second feature point is determined.
It can be understood that in the embodiment of the invention, image retrieval is required to be performed in a pre-constructed image feature library based on panoramic images, an image to be retrieved which is most similar to the panoramic images is retrieved, and then feature point matching is performed on each feature point in the panoramic images and each feature point of the image to be retrieved, so as to obtain feature points which can be matched in the panoramic images, namely matching feature points; because a large number of images are stored in the image feature library which is built in advance, and three-dimensional coordinate values corresponding to the feature points in each image are also stored, the three-dimensional coordinate values of the matched feature points can be obtained; and then, the three-dimensional distance between the first feature point and the second feature point can be determined based on the first three-dimensional coordinate value corresponding to any first feature point in the matched feature points and the second three-dimensional coordinate value corresponding to any second feature point in the matched feature points.
It should be noted that, in the embodiment of the present invention, the visual image feature library is used for storing a priori maps, and three-dimensional coordinate values of each collected image and feature point positions in each image are stored therein.
Optionally, the visual image feature library may be any library and storage form, which is not limited in the embodiment of the present invention.
Optionally, before the determining the three-dimensional distance between the first feature point and the second feature point in the panoramic image, the method further comprises:
and correcting the panoramic image based on the sphere center projection principle to obtain a corrected panoramic image.
Specifically, in the embodiment of the invention, before determining the three-dimensional distance between the first feature point and the second feature point in the panoramic image or performing feature point matching based on the image to be searched in the image feature library to determine the three-dimensional distance between the first feature point and the second feature point in the panoramic image, correcting the panoramic image based on the principle of spherical center projection to obtain a corrected panoramic image, and then executing a subsequent processing flow based on the corrected panoramic image.
It should be noted that, panoramic images are obtained by stitching images under different viewing angles, and in the stitching process, an image distortion phenomenon occurs, so in the embodiment of the invention, the positioning accuracy can be further improved by correcting the distorted panoramic images and positioning the corrected panoramic images.
It should be noted that, the stitching of the panoramic image is to project a plurality of images into a spherical surface, and then the spherical surface is unfolded into a plane, so that the panoramic image is generated.
Optionally, the determining the plane angle between the first feature point and the second feature point includes:
and determining the plane angle between the first characteristic point and the second characteristic point based on the principle of sphere center projection.
Specifically, in the embodiment of the present invention, in order to obtain the plane angle between the first feature point and the second feature point, the plane angle between the first feature point and the second feature point may be determined based on the principle of the center of sphere projection, that is, the plane angle between the first feature point and the second feature point is calculated by mapping the image coordinates of the first feature point and the second feature point to the center of sphere projection.
Optionally, the determining the plane angle between the first feature point and the second feature point based on the principle of the sphere center projection includes:
determining a plane distance between the first feature point and the second feature point, a pixel width of the panoramic image and an acquisition angle of the panoramic image;
and determining a plane angle between the first characteristic point and the second characteristic point based on the plane distance, the pixel width and the acquisition angle.
Specifically, in the embodiment of the present invention, in order to determine the plane angle between the first feature point and the second feature point based on the principle of the spherical center projection, the plane distance between the first feature point and the second feature point, the pixel width of the panoramic image, and the acquisition angle of the panoramic image may be determined first, and then the plane angle between the first feature point and the second feature point may be determined based on the plane distance between the first feature point and the second feature point, the pixel width of the panoramic image, and the acquisition angle of the panoramic image.
It should be noted that, the acquisition angle of the panoramic image is generally 180 degrees or 200 degrees.
Optionally, the determining a plane angle between the first feature point and the second feature point based on the plane distance, the pixel width, and the acquisition angle includes:
determining a plane angle between the first feature point and the second feature point by the following formula:
wherein a represents the firstA plane angle s between a feature point and the second feature point i Representing the plane distance, sL representing the pixel width, and a representing the acquisition angle.
Specifically, in the embodiment of the present invention, after obtaining the plane distance between the first feature point and the second feature point, the pixel width of the panoramic image, and the acquisition angle of the panoramic image, the plane angle between the first feature point and the second feature point may be calculated by the above formula.
Fig. 2 is a second flow chart of a visual positioning method according to the present invention, as shown in fig. 2, the method includes: after the panoramic image is obtained, correcting the panoramic image based on the sphere center projection principle to obtain a corrected panoramic image, further carrying out image retrieval and feature point matching by utilizing the corrected panoramic image and images in an image feature library to obtain three-dimensional coordinate values of any two feature points in the panoramic image, determining the plane angle of the any two feature points based on the sphere center projection principle, and finally carrying out position calculation by utilizing the back intersection principle based on the three-dimensional coordinate values and the plane angle of the any two feature points to obtain the three-dimensional coordinate of the target position of the acquired panoramic image.
It should be noted that, according to the embodiment of the invention, through the rear intersection principle, the mode that the traditional positioning method needs to perform camera internal reference calibration is eliminated, and the position estimation of the camera without calibration can be realized; in addition, the embodiment of the invention uses the panoramic image for positioning, the imaging visual angle of the panoramic image is larger, the image features are rich, and compared with the traditional image under a single visual angle, the positioning precision can be improved by positioning based on the panoramic image.
According to the visual positioning method provided by the invention, the panoramic image acquired at the target position is firstly acquired, then the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point in the panoramic image are determined, and further the three-dimensional coordinate value of the target position is determined based on the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point and the rear intersection principle; the invention performs visual positioning on the target position based on the panoramic image acquired at the target position, enriches the image scene, can improve the positioning precision, and also realizes the positioning on the target position based on the rear intersection principle, so that the camera internal reference for acquiring the panoramic image is not required to be calibrated, and the method is simple and easy to realize.
The visual positioning device provided by the invention is described below, and the visual positioning device described below and the visual positioning method described above can be referred to correspondingly.
Fig. 3 is a schematic structural view of a visual positioning device provided by the present invention, as shown in fig. 3, the device includes: an acquisition module 310, a first determination module 320, and a second determination module 330; wherein:
the acquisition module 310 is configured to acquire a panoramic image acquired at a target location;
the first determining module 320 is configured to determine a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determine a plane angle between the first feature point and the second feature point;
the second determining module 330 is configured to determine a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle, and a rear intersection principle.
According to the visual positioning device, the panoramic image acquired at the target position is firstly acquired, then the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point in the panoramic image are determined, and further the three-dimensional coordinate value of the target position is determined based on the three-dimensional distance and the plane angle between the first characteristic point and the second characteristic point and the rear intersection principle; the invention performs visual positioning on the target position based on the panoramic image acquired at the target position, enriches the image scene, can improve the positioning precision, and also realizes the positioning on the target position based on the rear intersection principle, so that the camera internal reference for acquiring the panoramic image is not required to be calibrated, and the method is simple and easy to realize.
Optionally, the first determining module 320 is specifically configured to:
matching feature points of the panoramic image with images to be searched in a pre-constructed image feature library to obtain matching feature points;
determining a first three-dimensional coordinate value corresponding to the first feature point in the matched feature points and a second three-dimensional coordinate value corresponding to the second feature point in the matched feature points based on three-dimensional coordinate values corresponding to the feature points in the images to be searched stored in the image feature library;
a three-dimensional distance between the first feature point and the second feature point is determined based on the first three-dimensional coordinate value and the second three-dimensional coordinate value.
Optionally, the apparatus further comprises a correction module for:
and correcting the panoramic image based on the sphere center projection principle to obtain a corrected panoramic image.
Optionally, the first determining module 320 is further specifically configured to:
and determining the plane angle between the first characteristic point and the second characteristic point based on the principle of sphere center projection.
Optionally, the first determining module 320 is further specifically configured to:
determining a plane distance between the first feature point and the second feature point, a pixel width of the panoramic image and an acquisition angle of the panoramic image;
and determining a plane angle between the first characteristic point and the second characteristic point based on the plane distance, the pixel width and the acquisition angle.
Optionally, the first determining module 320 is further specifically configured to:
determining a plane angle between the first feature point and the second feature point by the following formula:
wherein a represents a plane angle between the first feature point and the second feature point, s i Representing the flatThe plane distance, sL, represents the pixel width, and a represents the acquisition angle.
It should be noted that, the visual positioning device provided by the embodiment of the present invention can implement all the method steps implemented by the embodiment of the visual positioning method, and can achieve the same technical effects, and detailed descriptions of the same parts and beneficial effects as those of the embodiment of the method in the embodiment are omitted.
Fig. 4 is a schematic physical structure of an electronic device according to the present invention, as shown in fig. 4, the electronic device may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform the visual positioning method provided by the methods described above, the method comprising:
acquiring a panoramic image acquired at a target location;
determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determining a plane angle between the first feature point and the second feature point;
and determining a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and a rear intersection principle.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the visual positioning method provided by the above methods, the method comprising:
acquiring a panoramic image acquired at a target location;
determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determining a plane angle between the first feature point and the second feature point;
and determining a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and a rear intersection principle.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the above provided visual positioning methods, the method comprising:
acquiring a panoramic image acquired at a target location;
determining a three-dimensional distance between a first feature point and a second feature point in the panoramic image, and determining a plane angle between the first feature point and the second feature point;
and determining a three-dimensional coordinate value of the target position based on the three-dimensional distance, the plane angle and a rear intersection principle.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.