Indoor positioning processing method and device based on single lamp, terminal and storage medium

By elliptical fitting and mark point extraction in the pixel coordinate system of the receiver, combined with similar triangle relationships, the positioning error problem of single-light visible light positioning in the inclined state is solved, and high-precision and stable indoor positioning are achieved.

CN119936783APending Publication Date: 2025-05-06CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510024998.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

When the existing imaging-type visible light positioning technology only has one LED lighting lamp in the receiver field angle or the receiver is in an inclined state, the positioning calculation error is large, and the traditional method requires IMU assistance, which has a large amount of calculation and unstable effect.

Method used

By converting the world coordinate system where the transmitter is located to the pixel coordinate system where the receiver is located, the terminal's camera acquires the light image, performs ellipse fitting and marking point extraction, determines the azimuth angle, and forms a similar triangle to obtain the position coordinates of the terminal.

Benefits of technology

The accuracy of the receiver attitude angle during single lamp positioning is improved, the IMU measurement error is reduced, the calculation amount is reduced, and the positioning accuracy and stability are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119936783A_ABST
    Figure CN119936783A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an indoor positioning processing method and device based on a single lamp, a terminal and a storage medium. The method comprises the steps that a world coordinate system where a transmitter is located is converted into a pixel coordinate system where a receiver is located, the transmitter is a single circular lamp, and the receiver is a terminal; acquiring a first image of the lamp using a camera of the terminal; fitting an outline ellipse of the lamp in the first image to obtain a first coordinate parameter of the ellipse of the lamp in a pixel coordinate system; acquiring a second coordinate parameter of a mark point in the first image in a pixel coordinate system, wherein the mark point is a point arranged at the edge of the appearance of the lamp; determining a first azimuth angle based on the first coordinate parameter and the second coordinate parameter; forming a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected to the projection plane in the first image to obtain a first position coordinate of the terminal; and determining a second position coordinate of the terminal based on the first position coordinate and the azimuth angle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to, but is not limited to, the field of positioning technology, and in particular to an indoor positioning processing method and device based on a single lamp, a terminal and a storage medium. Background Art

[0002] With the development of information technology, the demand for high-precision location services in industry and social life is becoming more and more urgent. Satellite navigation systems such as the Global Positioning System (GPS) and China's BeiDou Navigation Satellite System (BDS) can effectively solve the problem of outdoor scene positioning, but due to the obstruction of buildings, the application scenarios of these satellite navigation systems in indoor scenarios are very limited.

[0003] Visible light positioning (VLP) is a new type of indoor positioning technology. It can take into account both lighting and wireless optical communication and has broad application prospects. Visible light positioning technology can be divided into two types according to the receiving method: non-imaging and imaging. Among them, non-imaging visible light positioning technology mainly performs positioning by receiving light signal intensity and time difference; imaging visible light positioning technology performs positioning by receiving image information.

[0004] Currently, in imaging-based visible light positioning technology, there is still a problem of large positioning calculation errors in the following situations: (1) when there is a light emitting diode (LED) lighting lamp within the receiver's field of view (FOV); (2) when the receiver is in a tilted state. Summary of the invention

[0005] In view of this, the embodiments of the present invention provide a single-lamp-based indoor positioning processing method and device, a terminal and a storage medium to solve the above technical problems.

[0006] The technical solution of the present invention is achieved in this way:

[0007] In a first aspect, an embodiment of the present invention provides an indoor positioning processing method based on a single lamp, the method comprising:

[0008] Convert the world coordinate system where the transmitter is located to the pixel coordinate system where the receiver is located, where the transmitter is a single circular light and the receiver is a terminal;

[0009] Acquire a first image of the lamp using a camera of the terminal;

[0010] Fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system;

[0011] Obtaining a second coordinate parameter of a marking point in the first image in a pixel coordinate system, wherein the marking point is a point set on the edge of the shape of the lamp;

[0012] Determine a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the tilt angle in the pixel coordinate system projected on a horizontal projection plane;

[0013] A similar triangle is formed based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain a first position coordinate of the terminal;

[0014] Based on the first position coordinates and the azimuth, the second position coordinates of the terminal are determined.

[0015] In some embodiments, converting a world coordinate system where a transmitter is located into a pixel coordinate system where a receiver is located includes:

[0016] The world coordinate system where the transmitter is located is rotated and translated to obtain the camera coordinate system where the receiver is located;

[0017] Convert the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain an image coordinate system;

[0018] The image coordinate system is converted into a measurement unit to obtain the pixel coordinate system where the receiver is located.

[0019] In some embodiments, fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system includes:

[0020] Obtaining the outline points of the lamp from the first image;

[0021] Based on minimizing the sum of squares of algebraic distances from the curve to the contour points, a first equation for ellipse fitting of the lamp is obtained;

[0022] The first equation is solved to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system, wherein the first coordinate parameters include the major axis, the minor axis and the center coordinates of the ellipse.

[0023] In some embodiments, determining the first azimuth angle based on the first coordinate parameter and the second coordinate parameter includes:

[0024] The tilt angle is determined based on the ratio of the first line segment to the second line segment; wherein the first line segment is the distance from the marked point to the first point in the pixel plane in the pixel coordinate system, and the first point is the perpendicular point from the marked point to the major axis of the ellipse parallel to the axis of the pixel coordinate system; the second line segment is the distance from the center of the ellipse to the first point;

[0025] Based on the tilt angle, a first azimuth angle is determined.

[0026] In some embodiments, determining the tilt angle based on a ratio of the first line segment to the second line segment includes:

[0027] Determining a tangent value of the tilt angle based on a ratio of the first line segment to the second line segment;

[0028] Based on the tangent value of the tilt angle, the tilt angle is determined.

[0029] In some embodiments, determining the first azimuth angle based on the tilt angle includes:

[0030] When the pixel plane is parallel to the projection plane, determining the tilt angle as a first azimuth angle;

[0031] or,

[0032] In the case that the pixel plane is not parallel to the projection plane, a first azimuth angle is determined based on the tilt angle and the pitch angle, wherein the pitch angle is the angle between the screen of the terminal and the projection plane.

[0033] In some embodiments, the method further includes: acquiring a second azimuth angle, the second azimuth angle being an angle between a pixel plane measured by the terminal and a projection plane; and correcting the first azimuth angle based on the second azimuth angle to obtain a corrected first azimuth angle;

[0034] Determining the second position coordinates of the terminal based on the first position coordinates and the azimuth includes: acquiring the second position coordinates based on the first position coordinates and the corrected first azimuth.

[0035] In some embodiments, forming a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain the first position coordinate of the terminal includes:

[0036] Based on the third coordinate parameter of the lamp in the world coordinate system and the fourth coordinate parameter of the lamp projected onto the projection plane in the first image, a similar triangle is formed;

[0037] Based on the proportional relationship of corresponding sides of similar triangles, the first position coordinates are obtained, wherein the proportional relationship of corresponding sides of similar triangles is: the ratio of the first side to the second side is equal to the ratio of the third side to the fourth side; the first side is the outer diameter of the lamp in the world coordinate system; the second side is the major axis of the lamp in the projection plane; the third side is the distance between the center point of the lamp in the world coordinate system and the vertical point of the terminal perpendicular to the world coordinate system; the fourth side is the distance between the center point of the lamp in the projection plane and the vertical point of the terminal perpendicular to the pixel coordinate system.

[0038] In a second aspect, an embodiment of the present invention provides an indoor positioning processing device based on a single lamp, comprising:

[0039] A first processing module is used to convert a world coordinate system where a transmitter is located into a pixel coordinate system where a receiver is located, wherein the transmitter is a single circular light and the receiver is a terminal;

[0040] A camera module, used for acquiring a first image of the lamp using a camera of the terminal;

[0041] A second processing module is used to fit the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system;

[0042] A second processing module is used to obtain a second coordinate parameter of a marking point in the first image in a pixel coordinate system, wherein the marking point is a point set on the edge of the shape of the lamp;

[0043] A second processing module is used to determine a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the tilt angle in the pixel coordinate system projected on a horizontal projection plane;

[0044] A second processing module, configured to construct a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image, so as to obtain a first position coordinate of the terminal;

[0045] The first processing module is used to determine the second position coordinates of the terminal based on the first position coordinates and the azimuth.

[0046] In a third aspect, an embodiment of the present invention provides a terminal, comprising a processor and a memory for storing a computer program that can be run on the processor; wherein, when the processor is used to run the computer program, the indoor positioning processing method based on a single lamp of any embodiment of the present invention is implemented.

[0047] In a fourth aspect, an embodiment of the present invention further provides a computer storage medium, in which there are computer executable instructions, and the computer executable instructions are executed by a processor to implement the indoor positioning processing method based on a single lamp according to any embodiment of the present invention.

[0048] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the indoor positioning processing method based on a single lamp of any embodiment of the present invention is implemented.

[0049] In an embodiment of the present invention, when the receiver (i.e., the terminal) is tilted with respect to the horizontal plane, the circular lamp is photographed and appears as an ellipse in the first image. After image processing, the ellipse in the first image is fitted with an ellipse. At the same time, a marking point is set on the outer edge of the circular lamp. The marking point in the first image photographed by the receiver will be different from the ellipse in the first image, and the marking point in the first image can be extracted. In this way, the geometric constraints formed by the fitted ellipse and the marking point can be corrected for the azimuth, thereby obtaining a reliable attitude angle (i.e., the first azimuth) of the receiver when positioning a single lamp. In addition, similar triangles can be extracted using the coordinates of the receiver in the world coordinate system and the coordinates of the lamp projected onto the horizontal plane (i.e., the projection plane) in the first image to obtain the first position coordinates of the terminal that are not tilted in the world coordinate system. The first position coordinates are then calibrated in combination with the corrected first azimuth to obtain accurate second position coordinates of the receiver. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic flow chart of a first single-lamp based indoor positioning processing method provided in an embodiment of the present invention.

[0051] Figure 2 A schematic diagram of a world coordinate system and a pixel coordinate system provided by an embodiment of the present invention.

[0052] Figure 3 A schematic diagram of a single-lamp positioning algorithm provided in an embodiment of the present invention.

[0053] Figure 4 A schematic diagram of an ellipse fitting principle provided by an embodiment of the present invention.

[0054] Figure 5 A schematic flow chart of a second single-lamp based indoor positioning processing method provided in an embodiment of the present invention.

[0055] Figure 6 A schematic diagram of an azimuth geometric correction algorithm provided by an embodiment of the present invention.

[0056] Figure 7 A schematic flow chart of a third single-lamp based indoor positioning processing method provided in an embodiment of the present invention.

[0057] Figure 8 A schematic diagram of a coordinate system conversion process provided by an embodiment of the present invention.

[0058] Fig. 9 A schematic diagram of obtaining the coordinates of a marking point provided by an embodiment of the present invention.

[0059] Fig.10 A schematic structural diagram of an indoor positioning processing device based on a single lamp provided in an embodiment of the present invention.

[0060] Fig.11 A schematic diagram of the hardware structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0062] In the subsequent description, the use of suffixes such as "module", "component" or "unit" to indicate elements is only for the purpose of facilitating the description of the present invention, and has no specific meaning in itself. Therefore, "module", "component" or "unit" can be used in a mixed manner. In addition, in the subsequent description, the use of prefixes such as "first" or "second" to identify information is only for the purpose of facilitating the description of the present invention, and has no specific meaning in itself. In addition, in the subsequent description, "multiple" refers to two or more; "multiple" refers to two or more.

[0063] For indoor positioning, systems using satellite navigation such as GPS or BDS are very limited in indoor application scenarios. Indoor positioning systems using technologies such as ultra-wideband (UWB), Bluetooth, and radio frequency (RF) have a series of disadvantages, such as weak signals, limited frequency band resources, mutual interference between signals, and high costs. Visible light positioning can effectively improve the above problems, and can take into account both lighting and wireless optical communication at the same time, and has broad application prospects.

[0064] Visible light positioning technology can be divided into two types according to the receiving method: non-imaging and imaging. Among them, non-imaging visible light positioning technology mainly performs positioning by receiving the intensity and time difference of the light signal; this technology usually uses a photodiode (PD) as a receiver to detect the intensity and arrival time of the light signal, and then uses a triangulation positioning algorithm to calculate the position of the target. Imaging visible light positioning technology performs positioning through the received image information; this technology usually uses a camera or image sensor as a receiver to obtain image information related to the target position, and then uses image processing and computer vision algorithms to analyze the image, extract features and calculate the position of the target.

[0065] The current solutions to the storage problems of visible light positioning technology are as follows:

[0066] (1) Visible light positioning solution for a single LED lamp. The indoor visible light positioning system for a single LED lamp based on a smartphone camera and motion sensor can combine the geometric information of the projected LED image and the detected rotation angle for positioning, overcoming the problem of the traditional visible light positioning system that requires the simultaneous capture of multiple LEDs for positioning. The tracking system based on a single LED lamp and a single LED effectively reduces the computational burden of the particle filter by applying a new Bayesian method; and uses the absolute position of a single LED lamp to continuously correct the long-term accumulated error of the inertial measurement unit (IMU).

[0067] (2) Visible light positioning scheme for tilted state. The visible light positioning scheme based on neural network algorithm aims to correct the error caused by the tilt angle of the camera. Because when the tilt angle changes, the camera will capture different LED images and produce different features. This scheme uses neural network to extract these features and establish a relationship between these features and the distance between the transmitter and receiver. Finally, the receiver is located by triangulation. Using the 3D visible light positioning scheme, the Cayley-Menger determinant (CMD) and linear least squares (LLS) trilateration algorithm use the received signal strength to estimate the 3D position of the receiver. For the positioning method of LED tilt, the influence of the tilted transmitter on the lighting uniformity is studied by the received power from the line of sight (LoS) and non-line of sight (NLoS) transmission paths. The proposed scheme has a relatively high improvement in visible light positioning accuracy compared to the non-tilted transmitter.

[0068] However, there are still some problems in the above schemes. For example, when there is only one light in the field of view of the receiver, the visible light positioning technology usually requires IMU to assist in position estimation. The receiver azimuth error measured by IMU is large. The current solution is to use projective geometry to calibrate the azimuth measurement value of IMU. This method requires the assumption that the world coordinates of the light-emitting diode are located at the origin of the coordinate system, which is limited in actual application scenarios. The existing single-light positioning calculation uses a linear classifier or a plane intersection scheme of projected geometric features. Such schemes have problems such as large amount of calculation and unstable effect. For another example, in the case where the receiver is tilted, the existing system uses neural networks and studies the influence of the received power of the transmission path on the uniformity of illumination to improve the accuracy. Such methods are suitable for systems with 3 or more LEDs in the field of view of the receiver and are based on the Angle of Arrival (AOA) algorithm for positioning, and the use scenarios are limited. In addition, since the system with PD as the receiver needs to achieve positioning through the intensity of the light received by the direct channel and the reflected channel, it is sensitive to the direction of the light beam, which greatly limits the mobility of the positioning terminal. In addition, the positioning results of the PD-based positioning system rely on angle measurement, measurement of received signal strength, changes in light intensity, and solving quadratic equations for position calculation. These uncertain parameters will lead to large errors.

[0069] Therefore, an embodiment of the present invention provides an indoor positioning processing method based on a single lamp. Aiming at the problem of large azimuth error measured by the inertial measurement unit, an azimuth geometry correction algorithm is proposed; aiming at the situation where the receiver may be tilted and only a single LED lamp is captured, a visible light positioning optimization algorithm based on a single lamp is proposed; in this way, by combining the azimuth geometry correction algorithm and the visible light positioning optimization algorithm, at least some of the above-mentioned problems can be solved.

[0070] like Figure 1 As shown, an embodiment of the present invention provides an indoor positioning processing method based on a single lamp, comprising the following steps:

[0071] Step S101: converting the world coordinate system where the transmitter is located into the pixel coordinate system where the receiver is located, wherein the transmitter is a single circular light and the receiver is a terminal;

[0072] Step S102: using a camera of the terminal to obtain a first image of the lamp;

[0073] Step S103: fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system;

[0074] Step S104: obtaining a second coordinate parameter of a marking point in the first image in a pixel coordinate system, wherein the marking point is a point set on the edge of the shape of the lamp;

[0075] Step S105: determining a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the inclination angle in the pixel coordinate system projected on a horizontal projection plane;

[0076] Step S106: constructing a similar triangle based on the third coordinate parameter of the lamp in the world coordinate system and the fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain the first position coordinate of the terminal;

[0077] Step S107: Determine the second position coordinates of the terminal based on the first position coordinates and the azimuth.

[0078] The single-lamp-based indoor positioning processing method provided in the embodiment of the present invention can be executed by a terminal; the terminal can be any mobile terminal or fixed terminal. For example, the terminal can be but not limited to at least one of the following: a mobile communication device, a computer, a server, a tablet computer, a gaming device, an intelligent office device, an industrial device and / or a wearable device, etc. The mobile communication device can be but not limited to a mobile phone or a smart phone.

[0079] Optionally, the transmitter may refer to a single round lamp that emits light at will. For example, the lamp may be an LED lamp, or an incandescent lamp, or any other luminous lighting lamp, etc. For example, the lamp is on the ceiling of the room.

[0080] Optionally, the terminal refers to a target object to be located, and the terminal includes a camera. Exemplarily, the camera can be replaced by any camera assembly, camera device, or camera head, etc., as long as the camera assembly, camera device, or camera head meets the shooting requirements.

[0081] Optionally, before step S102, the method further includes: setting a marking point on the outer edge of the lamp. Exemplarily, the outer edge of the lamp may refer to the edge of the lampshade or the outline of the lamp. Exemplarily, the marking point may be any point on the outer edge of the lamp.

[0082] Optionally, visually, the world coordinate system is the coordinate system where the transmitter is located; visually, the pixel coordinate system is the coordinate system where the terminal is located. For example, Figure 2 As shown, the coordinate system of XYZ is the world coordinate system; the coordinate system of xoy is the pixel coordinate system.

[0083] Optionally, the first image is any image taken by the camera of the terminal, as long as the image includes the image of the lamp with the marking point set. Exemplarily, if the pixel plane where the terminal is located is parallel to the horizontal plane, the image of the lamp in the first image is circular; or, if the pixel plane where the terminal is located is not parallel to the horizontal plane (that is, the screen of the terminal is inclined to the horizontal plane), the image of the lamp in the first image is elliptical. Here, the pixel plane is a plane in the pixel coordinate system; the pixel plane is parallel to the screen of the terminal. The horizontal plane overlaps or is parallel to the projection plane, that is, the projection plane can be considered as a horizontal plane.

[0084] Optionally, the first coordinate parameter may be a parameter describing the equation of the ellipse. Exemplarily, the first coordinate parameter may be, but is not limited to, at least one of the following: the major axis (2a), the minor axis (2b), the center coordinate (p0), and the rotation angle (θ) of the ellipse. Exemplarily, the first coordinate parameter may be a parameter describing the coordinates of each point of the ellipse (e.g., p i (xy)). Exemplarily, the first coordinate parameter may be the equation of an ellipse.

[0085] Optionally, the second coordinate parameter is a point on the ellipse; the point is a marking point set on the lamp. Figure 2 As shown, the second coordinate parameter may be point M of the ellipse.

[0086] Optionally, step S106 may include: constructing a triangle based on the third coordinate parameter of the lamp in the world coordinate system, the fifth coordinate parameter of the terminal perpendicular to the ceiling where the lamp is located and the sixth coordinate parameter perpendicular to the projection plane, and the fourth coordinate parameter of the lamp projected onto the projection plane in the image, so as to obtain the first position parameter of the terminal. For example, Figure 3 As shown, the third coordinate parameter of the lamp in the world coordinate system can be the center point coordinate L(X l , Y l ) and the overall dimensions L of the lamp; the fifth coordinate parameter P(X p , Y p ), the sixth coordinate parameter D of the lamp perpendicular to the projection plane; the fourth coordinate parameter of the lamp projected on the projection plane in the first image can be the coordinates C′ of the center point of the projected ellipse and F′H′ of the major axis of the projected ellipse.

[0087] Optionally, both the first position coordinate and the second position coordinate may refer to the position coordinate of the terminal in the world coordinate system; the first position coordinate refers to the position coordinate of the terminal in the world coordinate system when the terminal is not tilted, and the second position coordinate is the position coordinate of the terminal in the world coordinate system when the terminal is tilted.

[0088] Optionally, step S107 may include: determining the second position coordinates of the terminal based on the product of the first position coordinates and the azimuth angle.

[0089] In an embodiment of the present invention, when the receiver (i.e., the terminal) is tilted with respect to the horizontal plane, the circular lamp is photographed and appears as an ellipse in the first image. After image processing, the ellipse in the first image is fitted with an ellipse. At the same time, a marking point is set on the outer edge of the circular lamp. The marking point in the first image photographed by the receiver will be different from the ellipse in the first image, and the marking point in the first image can be extracted. In this way, the geometric constraints formed by the fitted ellipse and the marking point can be corrected for the azimuth, thereby obtaining a reliable attitude angle (i.e., the first azimuth) of the receiver when positioning a single lamp. In addition, similar triangles can be extracted using the coordinates of the receiver in the world coordinate system and the coordinates of the lamp projected onto the horizontal plane (i.e., the projection plane) in the first image to obtain the first position coordinates of the terminal that are not tilted in the world coordinate system. The first position coordinates are then calibrated in combination with the corrected first azimuth to obtain accurate second position coordinates of the receiver.

[0090] In some embodiments, in step S101, converting the world coordinate system where the transmitter is located into the pixel coordinate system where the receiver is located includes:

[0091] The world coordinate system where the transmitter is located is rotated and translated to obtain the camera coordinate system where the receiver is located;

[0092] Convert the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain an image coordinate system;

[0093] The image coordinate system is converted into a measurement unit to obtain the pixel coordinate system where the receiver is located.

[0094] Optionally, the world coordinate system where the transmitter is located is rotated and translated to obtain the camera coordinate system where the receiver is located, including: obtaining a rotated first coordinate system based on the product of the world coordinate system and the rotation matrix, wherein the rotation is determined based on the rotation of the screen of the camera or terminal relative to the horizontal plane; obtaining a translated camera coordinate system based on the sum of the first coordinate system and the translation matrix, wherein the translation matrix is ​​determined based on the translation of the screen of the camera or terminal relative to the light.

[0095] For example, if the world coordinate system is (X, Y, Z), the rotation matrix R = R z (γ)R y (β)R x (α), the translation matrix is ​​T, and the camera coordinate system is P(X c , Y c , Z c ); the conversion relationship from the world coordinate system to the camera coordinate system can be The first coordinate system is

[0096] Optionally, converting the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain the image coordinate system includes: based on perspective projection, converting the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain the image coordinate system.

[0097] For example, if the camera coordinate system is P(X c , Y c , Z c ), the image coordinate system is (x, y); then the conversion relationship from the camera coordinate system to the image coordinate system can be: or Where s is the scale factor, s = a / r; a and r are the radius of the LED Region of Interest (RoI) and the radius of the LED light dimensions, respectively; f is the focal length of the camera; let K = diag{f, f, 1}, where diag is a diagonal matrix. LED ROI refers to the area of ​​the LED light in the image that needs special attention or processing (such as the area of ​​the LED light in the first image).

[0098] Optionally, the measurement unit is a pixel. Both the image coordinate system and the pixel coordinate system are on the imaging plane, and the difference between them is that the image coordinate system corresponds to the origin, and the pixel coordinate system corresponds to the measurement unit.

[0099] For example, if the image coordinate system is (x, y) and the pixel coordinate system is (u, v), then the conversion relationship from the image coordinate system to the pixel coordinate system can be: Among them, 1 / dx and 1 / dy are the physical sizes of the pixel in the x-axis and y-axis directions respectively, and (u0, v0) is the coordinate of the principal point (image origin).

[0100] Exemplarily, the conversion relationship from the world coordinate system to the pixel coordinate system may be:

[0101]

[0102] In an embodiment of the present invention, the world coordinate system where the transmitter is located can be rotated and translated to obtain the camera coordinate system where the receiver is located, and the camera coordinate system can be converted into an image coordinate system through the camera imaging principle, and finally the image coordinate system can be metrically transformed to obtain the pixel coordinate system where the receiver is located; in this way, the world coordinate system where the transmitter is located can be accurately converted to the pixel coordinate system where the receiver is located, so as to facilitate the subsequent fitting of the lights on the ceiling to the pixel plane to obtain a fitted ellipse.

[0103] In some embodiments, step S103 includes:

[0104] Obtaining the outline points of the lamp from the first image;

[0105] Based on minimizing the sum of squares of algebraic distances from the curve to the contour points, a first equation for ellipse fitting of the lamp is obtained;

[0106] The first equation is solved to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system, wherein the first coordinate parameters include the major axis, the minor axis and the center coordinates of the ellipse.

[0107] Optionally, the first image of the lamp acquired by the terminal may be as follows: Figure 4 As shown in the left figure, the contour point p of the lamp is obtained from the first image. i (x, y) can be expressed as Figure 4 As shown in the ellipse in the right figure, the major axis of the ellipse is 2a, the minor axis is 2b, the center coordinate is p0, and the rotation angle is θ.

[0108] Optionally, the first equation for fitting an ellipse to the lamp based on minimizing the sum of squares of algebraic distances from the curve to the contour points may include: setting the conic curve of the ellipse to F(a, x)=a·x=k0x 2 +k1xy+k2y 2 +k3x+k4y+k5=0, where a=[k0 k1 k2 k3 k4 k5] T , x=[x 2 xy y 2 xy 1] T ; Determine N contour points x i ; Determine the minimum curve to N contour points x i The square of the algebraic distance and the conic section are fitted to obtain the first equation

[0109] Optionally, solving the first equation to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system may include: solving the first equation by a rank-deficient generalized eigenvalue system To obtain the first coordinate parameter of the ellipse of the light in the pixel coordinate system. For example, D T Da=λCa to obtain the first coordinate parameter.

[0110] In the embodiment of the present invention, the first coordinate parameters of the ellipse of the lamp in the pixel coordinate system may be obtained according to any clustering or least-product fitting algorithm; no limitation is made here.

[0111] In the embodiment of the present invention, if the terminal is tilted to the horizontal plane, it can be found that the pixel plane of the light in the pixel coordinate system is an ellipse, so the first coordinate parameter of the ellipse of the light in the pixel plane can be accurately obtained by ellipse fitting.

[0112] like Figure 5As shown, in some embodiments, determining the first azimuth angle based on the first coordinate parameter and the second coordinate parameter in step S105 includes:

[0113] Step S1051: determining the tilt angle based on the ratio of the first line segment to the second line segment; wherein the first line segment is the distance from the marked point to the first point in the pixel plane in the pixel coordinate system, and the first point is the perpendicular point from the marked point to the major axis of the ellipse parallel to the axis of the pixel coordinate system; and the second line segment is the distance from the center of the ellipse to the first point;

[0114] Step S1052: Determine a first azimuth angle based on the tilt angle.

[0115] In some embodiments, step S1051 determines the tilt angle based on the ratio of the first line segment to the second line segment, including:

[0116] Determining a tangent value of the tilt angle based on a ratio of the first line segment to the second line segment;

[0117] Based on the tangent value of the tilt angle, the tilt angle is determined.

[0118] Alternatively, if Figure 6 As shown, the tilt angle in the pixel plane is γ tilt , the first line segment is MM1, the second line segment is CM1; determine the tangent value of the inclination angle According to the coordinates of MM1 and CM1, the tangent value of the tilt angle can be determined as Determine the bevel angle or

[0119] Optionally, step S1052 includes: when the pixel plane is parallel to the projection plane, determining the tilt angle as a first azimuth angle. Exemplarily, if the pixel plane is parallel to a plane parallel to the projection plane, determining the tilt angle γ tilt is the first azimuth angle γ, that is or

[0120] Optionally, step S1052 includes: when the pixel plane is not parallel to the projection plane, determining a first azimuth angle based on the tilt angle and the pitch angle, wherein the pitch angle is the angle between the screen of the terminal and the projection plane. Figure 6 As shown, the azimuth angle γ of the projection plane is the true azimuth angle (i.e., the first azimuth angle) of the receiver (i.e., the terminal); the tangent value of the first azimuth angle is Here, MM″=AB, and in the pixel plane, we know that AB=x m -x c , in the pixel coordinate system, CA-MB = y c -y m,but Determine the first azimuth as Among them, α is the pitch angle.

[0121] In an embodiment of the present invention, the first coordinate parameter of the light in the pixel coordinate system and the second coordinate parameter of the marking point in the pixel coordinate system, that is, the spatial relationship between the light imaging in the pixel plane and the projection plane, can be utilized to obtain the true azimuth of the receiver (i.e., the terminal). Compared with obtaining the azimuth by using the inertial measurement unit in the terminal, the error of the azimuth can be greatly reduced, thereby improving the accuracy of obtaining the azimuth of the receiver (i.e., the terminal).

[0122] like Figure 7 As shown, in some embodiments, the method further includes:

[0123] Step S108: Acquire a second azimuth angle, where the second azimuth angle is an angle between a pixel plane and a projection plane measured by the terminal; correct the first azimuth angle based on the second azimuth angle to obtain a corrected first azimuth angle;

[0124] Step S107 includes: Step S1071, obtaining the second position coordinates based on the first position coordinates and the corrected first azimuth.

[0125] Optionally, step S108 may be before step S106.

[0126] Optionally, an inertial measurement unit or an inertial measurement sensor is provided in the terminal, and the inertial measurement unit or the inertial measurement sensor is used to obtain the second azimuth (for example, γ s ).

[0127] Optionally, in step S108, the first azimuth angle is corrected based on the second azimuth angle to obtain a corrected first azimuth angle, including: if the second azimuth angle is within a first interval range and the first azimuth angle is within a second interval range, obtaining a corrected first azimuth angle based on the first azimuth angle and the offset angle.

[0128] Exemplarily, when the first interval ranges from 0 to 180 degrees, the second interval ranges from 180 to 360 degrees; or, when the first interval ranges from 180 to 360 degrees, the second interval ranges from 0 to 180 degrees.

[0129] Exemplarily, the offset angle may be any value less than or equal to 180 degrees; or, it is sufficient that the interval range of the first azimuth angle corrected according to the offset angle is the same as the interval range of the second azimuth angle.

[0130] In an embodiment of the present invention, the second azimuth measured by the inertial measurement unit in the terminal can be considered to realize the second azimuth to correct the first azimuth, thereby realizing auxiliary determination of the azimuth through the inertial measurement unit, and further improving the accuracy of obtaining the true azimuth of the terminal.

[0131] In some embodiments, step S106 includes:

[0132] Based on the third coordinate parameter of the lamp in the world coordinate system and the fourth coordinate parameter of the lamp projected onto the projection plane in the first image, a similar triangle is formed;

[0133] Based on the proportional relationship of corresponding sides of similar triangles, the first position coordinates are obtained, wherein the proportional relationship of corresponding sides of similar triangles is: the ratio of the first side to the second side is equal to the ratio of the third side to the fourth side; the first side is the outer diameter of the lamp in the world coordinate system; the second side is the major axis of the lamp in the projection plane; the third side is the distance between the center point of the lamp in the world coordinate system and the vertical point of the terminal perpendicular to the world coordinate system; the fourth side is the distance between the center point of the lamp in the projection plane and the vertical point of the terminal perpendicular to the pixel coordinate system.

[0134] Alternatively, if Figure 3 As shown, the similar triangles formed can be: triangle ΔD 11 D 12 G is similar to triangle ΔH′F′G, triangle ΔLD 12 G is similar to triangle ΔC′F′G, and triangle ΔLPG is similar to triangle ΔC′DG; where triangle ΔD 11 D 12 When G is similar to triangle ΔH′F′G, Triangle ΔLD 12 When G is similar to triangle ΔC′F′G, When the triangle ΔLPG is similar to the triangle ΔC′DG, Can be determined Right now Among them, D1 is the first side, F′H′ is the second side, PL is the third side, and DC′ is the fourth side.

[0135] In an embodiment of the present invention, similar triangles can be found based on the relative spatial relationship between the inclination of the receiver (i.e., the terminal) and the lights on the ceiling, so as to accurately determine the first position coordinates of the terminal, so as to facilitate the subsequent determination of the actual position of the receiver in combination with the azimuth provided by the azimuth geometry correction algorithm.

[0136] In order to further explain any embodiment of the present invention, a specific embodiment is provided below:

[0137] The present invention can use IMU to perform attitude calculation. Here, if IMU is used for attitude calculation for a long time, the cumulative error of the attitude will be very large, so the cumulative error needs to be corrected.

[0138] The present invention uses a front camera of a smartphone to capture an image of an LED lamp. The outer shape of the LED lamp is circular. If the tilt angle of the smartphone in the horizontal direction is large enough, it can be found that the LED lamp in the captured image is elliptical, which affects the positioning accuracy of the positioning system. In order to improve the positioning accuracy, it is necessary to obtain the accurate azimuth of the receiver. In view of the problem that the azimuth error measured by the inertial measurement unit is large, the present invention proposes an azimuth geometric correction algorithm. First, a marking point is added to the edge of the LED lamp shape. Secondly, image processing is fully utilized to extract the marking points and the contour points of the LED lamp for ellipse fitting to obtain the center coordinates of the two. Then, the azimuth of the inclined pixel plane is calculated. Finally, the spatial relationship between the LED lamp imaging on the pixel plane and the projection plane is used to calculate the true azimuth of the receiver. Here, the smartphone can be the terminal in the previous embodiment; the front camera can be the camera in the previous embodiment; the LED lamp can be the lamp in the previous embodiment; and the LED lamp image can be the first image in the previous embodiment.

[0139] Step 1: Determine the relationship between the object and its projected pixel coordinates based on the visual analysis method and convert them to each other. This includes the geometric relationship and coordinate conversion between the position of the object in the world coordinates and its projected position on the image sensor. The present invention mainly involves four coordinate systems: world coordinate system, camera coordinate system, image coordinate system and pixel coordinate system. The conversion process is as follows: Figure 8 As shown in the figure: the world coordinate system is transformed into a camera coordinate system by a rigid body transformation; the camera coordinate system is transformed into an image coordinate system according to perspective projection; the image coordinate system is discretized to obtain a pixel coordinate system. The specific transformation process can be as follows:

[0140] First, the coordinates of the transmitter are converted from the world coordinate system to the receiver coordinate system. This is a rigid body change, with no deformation, only rotation and translation. The world coordinates of the transmitter are (X, Y, Z), and the coordinates after conversion to the camera coordinate system are P(X c , Y c , Z c ), the conversion relationship is as follows: Where T is the offset between the coordinate systems, and the rotation matrix R = R z (γ)R y (β)R x (α) has the following relationship: Among them, α, β, and γ are the rotation angles of the receiver image sensor relative to the transmitter LED.

[0141] Secondly, according to the camera imaging principle, the camera coordinate system is converted into the image coordinate system through perspective projection; P(X c , Y c , Z c ) is converted to the two-dimensional image coordinate system (x, y), the following relationship exists: Where s is the scale factor, s = a / r, a and r are the radius of the LED-ROI and the radius of the LED outer dimensions, respectively. f is the focal length of the camera, and K = diag{f, f, 1}.

[0142] Finally, the image coordinate system is converted to the pixel coordinate system. Both the image coordinate system and the pixel coordinate system are on the imaging plane. The difference between them is the origin and the unit of measurement. The origin of the pixel coordinate system is the upper left corner of the imaging plane, and the unit of measurement is pixel, while the origin of the image coordinate system is the point where the camera optical axis intersects the imaging plane, and the unit of measurement is generally centimeters. The image coordinate system is converted to the pixel coordinate system (u, v): Among them, 1 / dx and 1 / dy are the physical sizes of the pixel in the x-axis and y-axis directions respectively, and (u0, v0) is the coordinate of the principal point (image origin).

[0143] Here, the target object in the world coordinate system is transformed into the pixel coordinate system of the imaging plane and can be expressed as:

[0144]

[0145] Step 2: Perform ellipse fitting on the contour points of the LED light. The principle of ellipse fitting can be as follows: Figure 4 As shown, the coordinate system established by the pixel plane (i.e., the pixel coordinate system) is recorded as xoy. First, the LED light image is captured by setting reasonable camera parameters. After that, after the image is processed by Gaussian blur, grayscale, binarization, etc., the contour points of the LED light are detected using the Canny operator. Then, the contour points are taken out, and the major axis 2a, minor axis 2b, center coordinate p0, and rotation angle θ of the ellipse are fitted. Here, the pixel coordinate system xoy in the second step can be the pixel coordinate system (u, v) in the first step.

[0146] In ellipse fitting technology, two methods are mainly used: clustering and least squares fitting. The core of the least squares fitting method is to find a set of parameters that minimizes the distance between the data points and the fitted ellipse. Usually, we can use an implicit equation containing a second-order polynomial to represent a general conic section, as shown in the following formula: F(a, x) = a·x = k0x 2 +k1xy+k2y 2 +k3x+k4y+k5=0; among them, a=[k0 k1 k2 k3 k4 k5] T , x=[x 2xy y 2 xy 1] T . Let F(a;x i ) is the algebraic distance from the point (x, y) to the conic curve F(a; x) = 0. In general, we can minimize the distance from the curve to N data points x i The square sum of the algebraic distances is used to fit the conic section. The square sum of the algebraic distances is recorded as Should for:

[0147] To avoid invalid solutions a = 06, any multiple of the known solution a represents the same quadratic curve, and the parameter vector a should be constrained to some extent. If quadratic constraints are set on the parameters (for example, invalid solutions a = 06), the minimization can be solved by considering the rank-deficient generalized eigenvalue system. The following calculation relationship is obtained: T Da=λCa;wherein, the design matrix D=[x1 x2 …x n ], C is the constraint matrix, and λ is the Lagrange multiplier.

[0148] Ellipse fitting is essentially a nonlinear problem, so an iterative method must be used. In order to retain the efficiency of solving the linear least squares problem, the parameter vector a is constrained so that the conic curve tends to an ellipse. The general constraint condition is to let the discriminant b 2 -4ac is negative. However, it is often difficult to impose this constraint, in which case one can simply incorporate an arbitrary scaling parameter into the constraint, letting 4ac-b 2 =1, which can be expressed as:

[0149] This constraint can be written as a T Ca = 1, where C is the above 6×6 constraint matrix, the following system of simultaneous equations can be obtained: The system of simultaneous equations can be written in the following form: Where s is the scatter matrix D T D, the system of equations can be easily solved.

[0150] Calculate the rotation angle θ as: The major axis 2a, minor axis 2b and center coordinates of the ellipse are obtained as follows: Where A = k0cos 2 θ+k1sinθcosθ+k2sin 2 θ,B=k0sin 2 θ-k1sinθcosθ+k2cos 2 θ, C=k3cosθ+k4sinθ, D=-k3sinθ+k4cosθ.

[0151] Step 3: Determine the azimuth angle of the smartphone. Here, the principle of designing the azimuth angle geometric correction algorithm is as follows Figure 6 As shown, in actual use scenarios, smartphones will have different degrees of tilt, which causes the smartphone screen to form an angle with the horizontal plane, namely the pitch angle α. The imaging of the circular LED light varies with different positions and postures of the receiver. The present invention will further explore the information contained in the LED light imaging. The pitch angle can be measured by the embedded IMU. Figure 6 It describes that in most cases, the image of LED light is an ellipse, the inclined image plane forms a projection geometric relationship with the horizontal projection plane, and the azimuth angle of the smartphone is the angle between the center line of the projection plane and the north direction. Figure 6 The coordinate system of the right figure is the coordinate system xoy of the pixel plane. tilt It is not an exact azimuth angle, but the spatial relationship between the LED light areas in the two planes and the calculated γ tilt , the azimuth angle γ measured by IMU can be s Correction is performed to obtain the corrected azimuth angle γ.

[0152] The specific steps for calculating the corrected azimuth are as follows:

[0153] (1) Solving γ tilt . Establish a coordinate system on the pixel plane such as Figure 6 As shown, in ΔCMM1, tanγ tilt =MM1 / CM1, according to the coordinate values ​​of the corresponding points, the tilt angle γ can be obtained tilt There are the following relations: Among them, M(x m ,y m ) and C(x c ,y c ) can be obtained through image processing steps such as Gaussian blur, edge detection algorithm, and ellipse fitting.

[0154] (2) Solve for γ. The azimuth angle γ of the projection plane is the true azimuth angle of the receiver camera. Let the projection plane coordinate system be x′oy′, and the projection point M′(x′ m , y′ m ), the projection point C′(x′) of ellipse C c , y′ c ), point M″ is perpendicular to M′. In ΔCM′M″, the azimuth angle γ has the following calculation relationship: Among them, MM″=AB, and in the pixel plane, it can be seen that AB=x m -x c , in the pixel coordinate system, CA-MB = y c -y m, we have tanγ=x m -x c / (y c -y m )cosα; the formula Substitute tanγ = x m -x c / (y c -y m )cosα, that is, the azimuth angle after correction:

[0155] (3) Apply constraints to γ. The azimuth angle γ measured by IMU needs to be s Determine the specific gamma value.

[0156] Optionally, when the receiver smartphone is placed horizontally, the LED imaging is as shown in the figure, and the image plane is parallel to the horizontal plane, so the LED-ROI is circular. It is easy to know that the value of the angle ∠M1CM is the required azimuth angle γ. According to the triangle relationship, γ has the following relationship: Substituting the point coordinate information into the above equation, the azimuth angle γ has the following calculation relationship: The azimuth angle γ measured by IMU s Determine the specific gamma value.

[0157] The specific implementation of the algorithm is mainly implemented by two sub-processes:

[0158] (1) Obtain the center coordinates of the LED region of interest (LED-ROI). After enabling the camera to capture images, read the image from a specific path and first perform image preprocessing operations such as Gaussian blur, grayscale, and binarization on the image. Decode the LED-ID. If the demodulation is successful, extract the LED-ROI coordinate point set, and obtain the center coordinates of the ellipse through least squares ellipse fitting. If the demodulation is unsuccessful, take another photo until the image can be demodulated successfully.

[0159] (2) Get the center coordinates of the marking point. While getting the center coordinates of the LED light region of interest (LED-ROI), enable the child thread to get the center coordinates of the marking point, such as Fig. 9 As shown, the marker point is a small area in the image. First, the RGB image is converted to an HSV image. Secondly, the marker point area is extracted according to the specific color interval. Finally, the point set of the marker point contour is ellipse fitted to calculate the center coordinates of the marker point. Finally, according to the above logical relationship, the azimuth measured from the IMU is corrected. Here, the azimuth is the first azimuth in the previous embodiment.

[0160] Step 4: Visible light positioning optimization algorithm based on a single lamp. Here, when there is only one LED lamp in the field of view of the receiver, the attitude angle information provided by the IMU sensor is needed to assist in positioning. The present invention takes into account that the tilt imaging of the receiver is an ellipse and designs a single lamp positioning optimization algorithm. When the projection plane coordinate system is parallel to the horizontal and vertical coordinates of the world coordinate system, the principle of the single lamp positioning optimization algorithm is as follows: Figure 6 shown.

[0161] The world coordinate system is XOY, and point L(X l , Y l ) is the world coordinate of the LED center, D1 is the LED size, point c(x c ,y c ), point P′(x p , x p ) are the LED center pixel coordinates and the image center coordinates respectively. Assume that the receiver coordinates are P(X p , Y p ), the final target position is the coordinate value of point P. According to similar triangles, there is the following relationship: Among them, F′H′ is twice F′C′. For the convenience of calculation, within the error range, EC′ can be used to be approximately equal to F′C′, which will not have a significant impact on the positioning result.

[0162] (1) Calculate EC'. In ΔGCH, tan∠GCH = f / a, where a is the semi-major axis of the LED imaging ellipse and f is the focal length of the camera. Based on the angle relationship in the figure and tan∠ECC' = EC' / CE, EC' is obtained as:

[0163]

[0164] (2) Solve for DC′. Point P has coordinates (x p ,y p ),Other Then there is the relationship of formula (21):

[0165] (3) Calculate the positioning result P(X p , Y p ). According to the above formulas, the current positioning coordinates have the following relationship: When the horizontal and vertical coordinates in the receiver projection plane coordinate system are not parallel to the world coordinate system, rotation occurs. At this time, the rotated coordinates need to be converted into horizontal projection coordinates. The rotation angle is θ, x r oy r For a rotating coordinate system, there is the following conversion relationship: Here, the rotation angle θ is the azimuth angle γ in the previous embodiment; here, P(X p, Y p ) or (x r ,y r ) is the first position coordinate in the previous embodiment; (x, y) is the second position coordinate in the previous embodiment.

[0166] Here, in a single-light positioning system, the θ is the same as the azimuth angle γ, so regardless of the receiver attitude, the angle is obtained from the result of the azimuth geometric correction algorithm.

[0167] Here, the relationship between the single-light positioning optimization algorithm and the azimuth geometric correction algorithm is: the receiver rotation angle in the single-light positioning optimization algorithm is the azimuth after correction. The program flow of the single-light positioning optimization algorithm, the positioning main thread mainly includes two sub-threads, which respectively complete the following two operations:

[0168] (1) Decoding, obtaining information such as the world coordinate position and external dimensions (i.e., the first side in the previous embodiment) of the LED lamp. The image is read from a specific path, and the image is first Gaussian blurred, grayed, and binarized to obtain an image containing light and dark stripes. The Canny operator edge detection algorithm is then used to extract the region of interest of the LED lamp, and then decoded. The decoded sequence is matched with the LED database to obtain the current LED lamp, thereby obtaining the external dimensions and world coordinate system of the LED lamp.

[0169] (2) When the receiver is tilted, the positioning is calculated using the relationship between ellipse fitting and imaging space. First, the contour point set of the LED light is extracted, and the ellipse fitting is performed to obtain the values ​​of the ellipse's major axis, minor axis, and center point. Secondly, the azimuth geometric correction algorithm is used to obtain the accurate azimuth angle. The azimuth angle is used to determine whether the receiver has rotated. If rotation occurs, the coordinate value needs to be rotated to a coordinate system that is parallel to the world coordinate system and horizontal. Finally, the known parameters are used to obtain the terminal's position coordinates.

[0170] In an embodiment of the present invention, an azimuth geometric correction algorithm based on ellipse fitting is designed, which solves the problem of large azimuth measurement errors in the traditional single-lamp visible light positioning system using an inertial measurement unit. Aiming at the problem of inaccurate azimuth obtained from a magnetic sensor (such as an IMU), an azimuth geometric correction algorithm is designed. First, marker points are added to the edge of the LED lighting lamp shape. Next, image processing is fully utilized to extract the marker points and the contour points of the LED lamp, and then ellipse fitting is performed to obtain the center coordinates of the two. Then, the azimuth of the tilted pixel plane is calculated. Finally, the spatial relationship between the imaging of the LED lamp on the pixel plane and the projection plane is used to calculate the true azimuth of the receiver.

[0171] In an embodiment of the present invention, a visible light positioning optimization algorithm based on a single lamp is designed, which solves the problem that the tilt of the target device camera produces pixel deformation and thus leads to increased positioning error. First, the imaging principle of the LED lamp, the imaging of the LED lamp on the pixel plane, and the spatial relationship formed on the perspective projection plane are obtained by using the camera imaging principle to form similar triangles. Secondly, the similar triangles are calculated using information such as the external dimensions of the LED lamp, the ellipse fitting results of the contour points of the LED lamp, and the pixel center coordinates to obtain the length of the line segment. Finally, the target position is calculated.

[0172] The embodiments of the present invention can effectively correct IMU angle measurement errors in the case of sparse light sources, achieve centimeter-level high-precision positioning within the normal tilt angle of the receiver, and improve the robustness of the system to a certain extent.

[0173] It should be pointed out here that the following description of the indoor positioning processing device based on a single lamp is similar to the description of the indoor positioning processing method based on a single lamp, and the description of the beneficial effects of the same method is not repeated. For technical details not disclosed in the embodiment of the indoor positioning processing device based on a single lamp of the present invention, please refer to the description of the embodiment of the indoor positioning processing method based on a single lamp of the present invention.

[0174] like Fig.10 As shown, an embodiment of the present invention provides an indoor positioning processing device based on a single lamp, comprising:

[0175] A first processing module 21 is used to convert a world coordinate system where a transmitter is located into a pixel coordinate system where a receiver is located, wherein the transmitter is a single circular light and the receiver is a terminal;

[0176] A camera module 22, used to obtain a first image of the lamp using a camera of the terminal;

[0177] A second processing module 23 is used to fit the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system;

[0178] The second processing module 23 is used to obtain a second coordinate parameter of a marking point in the first image in a pixel coordinate system, wherein the marking point is a point set at the edge of the shape of the lamp;

[0179] A second processing module 23 is used to determine a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the tilt angle in the pixel coordinate system projected on a horizontal projection plane;

[0180] A second processing module 23, configured to construct a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image, so as to obtain a first position coordinate of the terminal;

[0181] The first processing module 21 is used to determine the second position coordinates of the terminal based on the first position coordinates and the azimuth.

[0182] In some embodiments, the first processing module 21 is used to rotate and translate the world coordinate system where the transmitter is located to obtain the camera coordinate system where the receiver is located; convert the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain the image coordinate system; and convert the image coordinate system into measurement units to obtain the pixel coordinate system where the receiver is located.

[0183] In some embodiments, the second processing module 23 is used to obtain the contour points of the lamp from the first image; obtain a first equation for elliptical fitting of the lamp based on minimizing the sum of squares of algebraic distances from the curve to the contour points; solve the first equation to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system, wherein the first coordinate parameters include the major axis, minor axis and center coordinates of the ellipse.

[0184] In some embodiments, the second processing module 23 is used to determine the tilt angle based on the ratio of the first line segment to the second line segment; wherein the first line segment is the distance from the marked point to the first point in the pixel plane in the pixel coordinate system, and the first point is the perpendicular point from the marked point to the major axis of the ellipse parallel to the axis of the pixel coordinate system; the second line segment is the distance from the center of the ellipse to the first point; and the first azimuth is determined based on the tilt angle.

[0185] In some embodiments, the second processing module 23 is used to determine the tangent value of the tilt angle based on the ratio of the first line segment to the second line segment; and determine the tilt angle based on the tangent value of the tilt angle.

[0186] In some embodiments, the second processing module 23 is used to determine the tilt angle as a first azimuth angle when the pixel plane is parallel to the projection plane; or, when the pixel plane is not parallel to the projection plane, determine the first azimuth angle based on the tilt angle and the pitch angle, wherein the pitch angle is the angle between the screen of the terminal and the projection plane.

[0187] In some embodiments, the device also includes an acquisition module, which is used to acquire a second azimuth angle, where the second azimuth angle is the angle between the pixel plane measured by the terminal and the projection plane; a first processing module 21 is used to correct the first azimuth angle based on the second azimuth angle to obtain a corrected first azimuth angle; and obtain the second position coordinates based on the first position coordinates and the corrected first azimuth angle.

[0188] In some embodiments, the second processing module 23 is used to form similar triangles based on the third coordinate parameters of the lamp in the world coordinate system and the fourth coordinate parameters of the lamp projected onto the projection plane in the first image; and obtain the first position coordinates based on the proportional relationship of the corresponding sides of the similar triangles, wherein the proportional relationship of the corresponding sides of the similar triangles is: the ratio of the first side to the second side is equal to the ratio of the third side to the fourth side; the first side is the outer diameter of the lamp in the world coordinate system; the second side is the major axis of the lamp in the projection plane; the third side is the distance between the center point of the lamp in the world coordinate system and the vertical point of the terminal perpendicular to the world coordinate system; the fourth side is the distance between the center point of the lamp in the projection plane and the vertical point of the terminal perpendicular to the pixel coordinate system.

[0189] like Fig.11 As shown, an embodiment of the present invention further provides a terminal, which includes a processor 31 and a memory 32 for storing a computer program that can be run on the processor 31; wherein, when the processor 31 is used to run the computer program, the indoor positioning processing method based on a single lamp of any embodiment of the present invention is implemented.

[0190] In some embodiments, the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0191] The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor may be a microprocessor or the processor may also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0192] In some embodiments, the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the invention, or a combination thereof.

[0193] For software implementation, the techniques described herein can be implemented by modules (e.g., procedures, functions, etc.) that perform the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0194] An embodiment of the present invention provides a computer storage medium, wherein the computer-readable storage medium stores an executable program. When the executable program is executed by a processor, the steps of the indoor positioning processing method based on a single lamp of any embodiment of the present invention can be implemented.

[0195] An embodiment of the present invention provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the steps of the indoor positioning processing method based on a single lamp in any embodiment of the present invention are implemented.

[0196] In some embodiments, the computer storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0197] It should be noted that the technical solutions described in the embodiments of the present invention can be combined arbitrarily without conflict.

[0198] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A single-lamp-based indoor positioning processing method, characterized in that: The method comprises: Converting a world coordinate system where a transmitter is located into a pixel coordinate system where a receiver is located, wherein the transmitter is a single circular light and the receiver is a terminal; acquiring a first image of the lamp using a camera of the terminal; Fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system; Acquire a second coordinate parameter of a marking point in the first image in the pixel coordinate system, wherein the marking point is a point set on the edge of the shape of the lamp; Determine a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the inclination angle in the pixel coordinate system projected on a horizontal projection plane; Constructing a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain a first position coordinate of the terminal; Based on the first position coordinates and the azimuth, the second position coordinates of the terminal are determined.

2. The method according to claim 1, characterized in that The step of converting the world coordinate system where the transmitter is located into the pixel coordinate system where the receiver is located comprises: The world coordinate system where the transmitter is located is rotated and translated to obtain the camera coordinate system where the receiver is located; Convert the camera coordinate system from three-dimensional coordinates to two-dimensional coordinates to obtain an image coordinate system; The image coordinate system is converted into a measurement unit to obtain the pixel coordinate system where the receiver is located.

3. The method according to claim 1, characterized in that The step of fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system includes: Acquire contour points of the lamp from the first image; Based on minimizing the sum of squares of algebraic distances from the curve to the contour points, a first equation for ellipse fitting of the lamp is obtained; The first equation is solved to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system, wherein the first coordinate parameters include the major axis, the minor axis and the center coordinates of the ellipse.

4. The method according to claim 1, characterized in that The determining a first azimuth angle based on the first coordinate parameter and the second coordinate parameter includes: The tilt angle is determined based on the ratio of the first line segment to the second line segment; wherein the first line segment is the distance from the marked point to the first point in the pixel plane in the pixel coordinate system, and the first point is the perpendicular point from the marked point to the major axis of the ellipse parallel to the axis of the pixel coordinate system; the second line segment is the distance from the center of the ellipse to the first point; Based on the tilt angle, the first azimuth angle is determined.

5. The method according to claim 4, characterized in that The determining the tilt angle based on the ratio of the first line segment to the second line segment comprises: Determining a tangent value of the inclination angle based on a ratio of the first line segment to the second line segment; The tilt angle is determined based on a tangent value of the tilt angle.

6. The method according to claim 4, characterized in that The determining the first azimuth angle based on the tilt angle includes: In a case where the pixel plane is parallel to the projection plane, determining the tilt angle to be the first azimuth angle; or, In the case that the pixel plane is not parallel to the projection plane, the first azimuth angle is determined based on the tilt angle and the pitch angle, wherein the pitch angle is an angle between a screen of the terminal and the projection plane.

7. The method according to any one of claims 4 to 6, characterized in that: The method further includes: acquiring a second azimuth angle, where the second azimuth angle is an angle between the pixel plane and the projection plane measured by the terminal; and correcting the first azimuth angle based on the second azimuth angle to obtain a corrected first azimuth angle; Determining the second position coordinates of the terminal based on the first position coordinates and the azimuth includes: acquiring the second position coordinates based on the first position coordinates and the corrected first azimuth.

8. The method according to claim 1, characterized in that The forming a similar triangle based on the third coordinate parameter of the lamp in the world coordinate system and the fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain the first position coordinates of the terminal includes: constructing a similar triangle based on the third coordinate parameter of the lamp in the world coordinate system and the fourth coordinate parameter of the lamp projected onto the projection plane in the first image; Based on the proportional relationship of corresponding sides of similar triangles, the first position coordinates are obtained, wherein the proportional relationship of corresponding sides of the similar triangles is: the ratio of the first side to the second side is equal to the ratio of the third side to the fourth side; the first side is the outer diameter of the lamp in the world coordinate system; the second side is the major axis of the lamp in the projection plane; the third side is the distance between the center point of the lamp in the world coordinate system and the perpendicular point of the terminal perpendicular to the world coordinate system; the fourth side is the distance between the center point of the lamp in the projection plane and the perpendicular point of the terminal perpendicular to the pixel coordinate system.

9. An indoor positioning processing device based on a single lamp, characterized in that: include: A first processing module, used for converting a world coordinate system where a transmitter is located into a pixel coordinate system where a receiver is located, wherein the transmitter is a single circular lamp and the receiver is a terminal; A camera module, used for acquiring a first image of the lamp using a camera of the terminal; A second processing module, used for fitting the outline ellipse of the lamp in the first image to obtain first coordinate parameters of the ellipse of the lamp in the pixel coordinate system; The second processing module is used to obtain a second coordinate parameter of a marking point in the first image in the pixel coordinate system, wherein the marking point is a point set on the edge of the shape of the lamp; The second processing module is used to determine a first azimuth angle based on the first coordinate parameter and the second coordinate parameter, wherein the first azimuth angle is an angle of the inclination angle in the pixel coordinate system projected on a horizontal projection plane; The second processing module is used to construct a similar triangle based on a third coordinate parameter of the lamp in the world coordinate system and a fourth coordinate parameter of the lamp projected onto the projection plane in the first image to obtain a first position coordinate of the terminal; The first processing module is used to determine the second position coordinates of the terminal based on the first position coordinates and the azimuth.

10. A terminal, characterized in that: The terminal includes a processor and a memory for storing a computer program that can be run on the processor; wherein, when the processor is used to run the computer program, the indoor positioning processing method based on a single lamp as described in any one of claims 1 to 8 is implemented.

11. A computer storage medium, characterized in that: The computer storage medium contains computer executable instructions, wherein the computer executable instructions are executed by a processor to implement the indoor positioning processing method based on a single lamp as described in any one of claims 1 to 8.

12. A computer program product, comprising a computer program or instructions, characterized in that: When the computer program or instruction is executed by a processor, the indoor positioning processing method based on a single lamp as described in any one of claims 1 to 8 is implemented.