Disclosure of Invention
The application provides a positioning method, a system, electronic equipment and a storage medium based on a weight factor and WKNN, which can improve the accuracy degree of Bluetooth positioning measurement of coordinates of a to-be-positioned point.
The application provides a positioning method based on a weight factor and WKNN, which comprises the steps of dividing a preset site into a grid structure, setting a positioning initial reference point at a node of each grid, setting a plurality of Bluetooth positioning beacons in the preset site, wherein the Bluetooth positioning beacons are used for sending Bluetooth signals to the positioning initial reference points and the to-be-positioned points, acquiring first coordinates corresponding to the positioning initial reference points, acquiring a plurality of first receiving signal intensity indication values received by the positioning initial reference points, acquiring a plurality of second receiving signal intensity indication values received by the to-be-positioned points, and acquiring actual coordinates corresponding to the to-be-positioned points based on the first coordinates, the first receiving signal intensity indication values and the second receiving signal intensity indication values.
By adopting the technical scheme, the preset field is divided into the grid structures, and the positioning initial reference points are arranged at the nodes of each grid, so that the positioning initial reference points are uniformly distributed in the whole preset field, and the signal acquisition coverage is comprehensive. By setting a plurality of Bluetooth positioning beacons in a preset site, the Bluetooth positioning beacons are used for transmitting Bluetooth signals to a plurality of initial positioning reference points and to-be-positioned points, so that a Bluetooth signal network covering the whole site is established. And acquiring a first coordinate corresponding to each positioning initial reference point, and acquiring a plurality of first received signal strength indication values received by each positioning initial reference point, thereby forming a detailed fingerprint database. The real-time signal strength data for the pending site is provided by obtaining a plurality of second received signal strength indication values received by the pending site. The actual coordinates corresponding to the to-be-positioned point are obtained based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values, so that high-precision indoor positioning is realized, and the accuracy degree of measuring the to-be-positioned point coordinates by Bluetooth positioning is improved.
Optionally, the obtaining the actual coordinates corresponding to the to-be-positioned point based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values specifically includes determining a preset number of positioning actual reference points from the positioning initial reference points based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values, determining second coordinates corresponding to each positioning actual reference point, and obtaining the actual coordinates based on the second coordinates.
By adopting the technical scheme, the reference points closest to the signal strength of the to-be-positioned point are screened out by determining the actual positioning reference points with the preset number from the initial positioning reference points based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values. And determining second coordinates corresponding to the actual reference points of each positioning, so as to provide accurate datum data for subsequent positioning calculation. The actual coordinates are obtained based on the plurality of second coordinates, so that the high-precision positioning of the to-be-positioned point is realized. The position of the to-be-positioned point can be accurately calculated by integrating the coordinate information of a plurality of actual reference points and utilizing a weighted average method.
The method comprises the steps of determining a preset number of positioning actual reference points from a plurality of positioning initial reference points based on a plurality of first coordinates, a plurality of first received signal strength indication values and a plurality of second received signal strength indication values, determining weight factors corresponding to the positioning initial reference points based on the first received signal strength indication values, calculating a first Euclidean distance between the to-be-positioned point and each positioning initial reference point based on the weight factors, the second received signal strength indication values and the first received signal strength indication values, sorting the first Euclidean distances to obtain sorting results, and determining the preset number of positioning actual reference points from the positioning initial reference points based on the sorting results.
By adopting the technical scheme, the weight factors corresponding to the initial positioning reference points are determined based on the first received signal strength indication values, so that the signal strength of each reference point and the contribution degree of the signal strength to the positioning result can be accurately reflected. The degree of similarity between the pending site and each reference point can be quantified by calculating a first euclidean distance between the pending site and each of the initial reference points for location based on the plurality of weight factors, the plurality of second received signal strength indication values, and the plurality of first received signal strength indication values. And sequencing the first Euclidean distances to obtain a sequencing result, so that the reference point closest to the to-be-positioned point can be effectively screened. Based on the sorting result, a preset number of positioning actual reference points are determined from a plurality of positioning initial reference points, so that the most useful reference points are screened out, the calculation complexity is reduced, and the positioning efficiency and the positioning accuracy are improved.
Optionally, the obtaining the actual coordinates based on the plurality of second coordinates specifically includes determining a second euclidean distance between each positioning actual reference point and the to-be-positioned point, obtaining weight parameters corresponding to each positioning actual reference point based on each second euclidean distance, and obtaining the actual coordinates based on the plurality of second coordinates and the plurality of weight parameters.
By adopting the technical scheme, the second Euclidean distance between each positioning actual reference point and each to-be-positioned point is determined, so that the signal intensity difference between each to-be-positioned point and each actual reference point can be accurately measured. And obtaining weight parameters corresponding to the actual positioning reference points based on the second Euclidean distances, so that the influence of each reference point in final positioning calculation can be reasonably distributed. The introduction of the weight parameters ensures that the reference point which is closer to the to-be-positioned point obtains larger weight, and the accuracy and the reliability of positioning calculation are further improved. The actual coordinates are obtained based on the plurality of second coordinates and the plurality of weight parameters, so that the high-precision positioning of the to-be-positioned point is realized. And integrating the coordinates of each reference point and the corresponding weight parameters, and calculating the actual coordinates of the to-be-positioned points by a weighted average method. The influence of single reference point errors is effectively reduced, the accuracy and stability of a positioning result are enhanced, and the reliability of the system in various environments is ensured.
Optionally, the determining the weight factor corresponding to each positioning initial reference point based on each first received signal strength indication value specifically includes calculating the weight factor corresponding to each positioning initial reference point by the following formula: Wherein, the For the weight factor between the i-th said location initial reference point and the u-th said bluetooth location beacon,And N is the number of the initial positioning reference points for the first received signal strength indication value between the i th initial positioning reference point and the u th Bluetooth positioning beacon.
Optionally, the obtaining the weight parameter corresponding to each positioning actual reference point based on each second euclidean distance specifically includes calculating the weight parameter corresponding to each positioning actual reference point according to the following formula: Wherein k is the number of the positioning actual reference points, w j is a weight parameter corresponding to the j-th positioning actual reference point, and d j is a second Euclidean distance between the j-th positioning actual reference point and the to-be-positioned point.
Optionally, the obtaining the actual coordinates based on the plurality of second coordinates and the plurality of weight parameters specifically includes calculating the actual coordinates by the following formula: Wherein k is the number of the positioning actual reference points, (X, Y) is the actual coordinates, w j is the weight parameter corresponding to the j-th positioning actual reference point, and (X j,yj) is the second coordinates corresponding to the j-th positioning actual reference point.
The application provides a positioning system based on a weight factor and WKNN, which comprises a processing module and an acquisition module, wherein the processing module is used for dividing the preset site into a grid structure and setting positioning initial reference points at nodes of each grid, the processing module is also used for setting a plurality of Bluetooth positioning beacons in the preset site, the Bluetooth positioning beacons are used for sending Bluetooth signals to a plurality of positioning initial reference points and to-be-positioned points, the acquisition module is used for acquiring first coordinates corresponding to each positioning initial reference point and acquiring a plurality of first received signal strength indication values received by each positioning initial reference point, the acquisition module is also used for acquiring a plurality of second received signal strength indication values received by each to-be-positioned point, and the processing module is also used for acquiring actual coordinates corresponding to the to-be-positioned points based on the plurality of first coordinates, the plurality of first received signal strength indication values and the plurality of second received signal strength indication values.
In a third aspect the application provides an electronic device comprising a processor, a memory for storing instructions, a user interface and a network interface for communicating to other devices, the processor being arranged to execute the instructions stored in the memory to cause the electronic device to perform a method according to any of the first aspects of the application.
In a fourth aspect of the application a computer readable storage medium is provided, storing a computer program capable of being loaded by a processor and performing a method according to any of the first aspects of the application.
In summary, one or more technical solutions provided in the embodiments of the present application at least have the following technical effects or advantages:
1. The preset field is divided into grid structures, and positioning initial reference points are arranged at the nodes of each grid, so that the initial reference points are uniformly distributed and positioned in the whole preset field, and the signal acquisition coverage is comprehensive. By setting a plurality of Bluetooth positioning beacons in a preset site, the Bluetooth positioning beacons are used for transmitting Bluetooth signals to a plurality of initial positioning reference points and to-be-positioned points, so that a Bluetooth signal network covering the whole site is established. And acquiring a first coordinate corresponding to each positioning initial reference point, and acquiring a plurality of first received signal strength indication values received by each positioning initial reference point, thereby forming a detailed fingerprint database. The real-time signal strength data for the pending site is provided by obtaining a plurality of second received signal strength indication values received by the pending site. The actual coordinates corresponding to the to-be-positioned point are obtained based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values, so that high-precision indoor positioning is realized, and the accuracy degree of measuring the to-be-positioned point coordinates by Bluetooth positioning is improved.
2. And determining a preset number of positioning actual reference points from a plurality of positioning initial reference points based on the plurality of first coordinates, the plurality of first received signal strength indication values and the plurality of second received signal strength indication values, thereby screening out the reference point closest to the signal strength of the to-be-positioned point. And determining second coordinates corresponding to the actual reference points of each positioning, so as to provide accurate datum data for subsequent positioning calculation. The actual coordinates are obtained based on the plurality of second coordinates, so that the high-precision positioning of the to-be-positioned point is realized. The position of the to-be-positioned point can be accurately calculated by integrating the coordinate information of a plurality of actual reference points and utilizing a weighted average method.
3. And determining the weight factor corresponding to each initial positioning reference point based on each first received signal strength indication value, so that the signal strength of each reference point and the contribution degree of the signal strength to a positioning result can be accurately reflected. The degree of similarity between the pending site and each reference point can be quantified by calculating a first euclidean distance between the pending site and each of the initial reference points for location based on the plurality of weight factors, the plurality of second received signal strength indication values, and the plurality of first received signal strength indication values. And sequencing the first Euclidean distances to obtain a sequencing result, so that the reference point closest to the to-be-positioned point can be effectively screened. Based on the sorting result, a preset number of positioning actual reference points are determined from a plurality of positioning initial reference points, so that the most useful reference points are screened out, the calculation complexity is reduced, and the positioning efficiency and the positioning accuracy are improved.
4. By determining the second Euclidean distance between each positioning actual reference point and the to-be-positioned point, the signal intensity difference between the to-be-positioned point and each actual reference point can be accurately measured. And obtaining weight parameters corresponding to the actual positioning reference points based on the second Euclidean distances, so that the influence of each reference point in final positioning calculation can be reasonably distributed. The introduction of the weight parameters ensures that the reference point which is closer to the to-be-positioned point obtains larger weight, and the accuracy and the reliability of positioning calculation are further improved. The actual coordinates are obtained based on the plurality of second coordinates and the plurality of weight parameters, so that the high-precision positioning of the to-be-positioned point is realized. And integrating the coordinates of each reference point and the corresponding weight parameters, and calculating the actual coordinates of the to-be-positioned points by a weighted average method. The influence of single reference point errors is effectively reduced, the accuracy and stability of a positioning result are enhanced, and the reliability of the system in various environments is ensured.
Detailed Description
In order that those skilled in the art will better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments.
In describing embodiments of the present application, words such as "for example" or "for example" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "such as" or "for example" in embodiments of the application should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "or" for example "is intended to present related concepts in a concrete fashion.
In the description of embodiments of the application, the term "plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating an indicated technical feature. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The application provides a positioning method based on a weight factor and WKNN, and referring to FIG. 1, one of flow diagrams of the positioning method based on the weight factor and WKNN is shown. The method comprises the steps S1-S5, wherein the steps are as follows:
step S1, dividing a preset field into grid structures, and setting positioning initial reference points at nodes of each grid.
In the present invention, step S1 aims at dividing a preset site into grid structures and setting a positioning initial reference point at a node of each grid. The implementation of this step is significant for the accuracy and efficiency of the overall positioning system.
First, a preset field is divided into a grid structure. The purpose of this is to systematically cover the entire location area, ensuring that bluetooth signals can be evenly distributed and acquired throughout the field. By dividing the site into regular grids, the information of each grid node can be conveniently managed and recorded, thereby providing an accurate data basis for subsequent positioning calculation.
In the implementation process, the size and shape of the grid need to be determined first, and generally square or rectangular grids are adopted. According to the actual size of the field, the field is divided into a plurality of small grid cells, and the size of each cell can be set according to the specific situation of the field and the positioning accuracy requirement. For example, if the field is large and high accuracy positioning is required, smaller grid cells may be employed.
A positioning initial reference point is set at a node of each grid. The initial reference points are positioned so that the Received Signal Strength Indication (RSSI) values can be effectively acquired at the grid nodes, and these reference points will serve as data acquisition points for the off-line phase. At each positioning initial reference point, the corresponding first coordinate, namely the accurate position of the reference point in the preset field, is recorded. In order to ensure accurate coordinate data of the reference points, high-precision measuring tools are required to measure and calibrate the reference points.
By setting the initial reference point for positioning in the preset site, a network of reference points covering the whole site can be formed. These reference points will be used to receive signals from bluetooth positioning beacons and record their received signal strength indication values. These data will be used in subsequent steps to calculate the actual coordinates of the site to be located.
And S2, setting a plurality of Bluetooth positioning beacons in a preset site, wherein the Bluetooth positioning beacons are used for transmitting Bluetooth signals to a plurality of initial positioning reference points and to-be-positioned points.
For facilitating understanding of the following schemes, reference may be made to fig. 2, which is a schematic diagram illustrating a scenario of locating a beacon, locating an initial reference point, and a to-be-located point according to an embodiment of the present application.
In the present invention, step S2 is aimed at setting a plurality of bluetooth positioning beacons in a preset site for transmitting bluetooth signals to a plurality of positioning initial reference points and to-be-positioned points. The implementation of this step is critical to the construction of a stable, efficient bluetooth positioning system.
First, in a bluetooth indoor location system, a location beacon is a key device that transmits bluetooth signals. Through setting up a plurality of bluetooth location beacons, can ensure that bluetooth signal evenly distributed in whole default place, form a stable signal coverage network. In this way, each of the initial reference point and the pending location point can receive received signal strength indication values for multiple beacons, thereby providing the necessary data for accurate location.
In the specific implementation process, the positions of the Bluetooth positioning beacons are reasonably arranged in a preset field according to the division of the grid structure and the distribution condition of the reference points. Firstly, the number and arrangement density of Bluetooth positioning beacons are determined, so that the beacons can cover all corners of the whole preset field, and signal dead zones are avoided. In general, the arrangement density of beacons depends on the size of the field and the positioning accuracy required. To ensure uniform distribution of signals, an equally spaced approach may be used to uniformly distribute beacons across each area of the venue.
Each bluetooth location beacon needs to be installed in a fixed location and try to avoid large metal objects or other obstructions around it that could interfere with the bluetooth signal. After installation, the signal coverage of each beacon is tested, ensuring that the signal strength is sufficiently stable and covers all initial reference points and possible areas of the site to be located. If a certain area signal is weak, the number of beacons can be increased or the positions of the beacons can be adjusted appropriately.
And S3, acquiring a first coordinate corresponding to each positioning initial reference point, and acquiring a plurality of first received signal strength indication values received by each positioning initial reference point.
In the present invention, the purpose of step S3 is to obtain a first coordinate corresponding to each positioning initial reference point, and obtain a plurality of first received signal strength indication values received by each positioning initial reference point. This step is of great importance for building accurate positioning system databases.
First, the first coordinates of the initial reference point are important datum data in the positioning algorithm, and by acquiring the coordinates, the system can be ensured to have accurate reference when calculating the position of the to-be-positioned point. The acquisition of the plurality of received signal strength indication values is to construct a fingerprint database, and the signal acquisition in an off-line stage can be realized through the received signal strength indication values, so that a data base is provided for on-line positioning.
In the implementation process, firstly, after a preset site is divided into a grid structure and positioning initial reference points are set, each reference point is accurately measured, and the actual coordinates of each reference point in the site are recorded. The use of high precision measurement tools (e.g., laser rangefinder, total station, etc.) ensures that the coordinates of each reference point are accurate and error free, and these coordinates will be stored as the first coordinates in the system database.
Then, at each positioning initial reference point, the Bluetooth device is started to receive signals sent by a plurality of Bluetooth positioning beacons. Within a preset site, a plurality of bluetooth positioning beacons will continuously transmit bluetooth signals, and a bluetooth device locating an initial reference point will receive these signals and record their signal strengths. In order to ensure the reliability of the data, each reference point needs to collect the received signal strength indication value for multiple times at different times and different positions, and calculates the average value of the received signal strength indication values as a first received signal strength indication value corresponding to the reference point.
These first coordinates and the first received signal strength indication values will be stored in a database of the positioning system forming a fingerprint database. When storing data, the format and structure of the data are required to be consistent, so that the subsequent data retrieval and calculation are convenient.
And S4, acquiring a plurality of second received signal strength indication values received by the to-be-positioned point.
In the present invention, the purpose of step S4 is to obtain a plurality of second received signal strength indication values received by the pending site. This step is critical to achieving real-time positioning and improving positioning accuracy.
In a specific implementation process, when the positioning system is running, a to-be-positioned site (for example, a bluetooth device carried by a user) receives signals sent by a plurality of bluetooth positioning beacons in a preset site. In order to ensure stability and accuracy of signal reception, the device to be localized needs to have a bluetooth receiving module with high sensitivity. The Bluetooth function of the device to be positioned is started, so that the device to be positioned can receive signals sent by all surrounding Bluetooth positioning beacons.
The pending site device will record in real time the received signal strength indication value for each received signal. Since the pending site may move or the environment changes to cause signal strength fluctuations, the received signal strength indication value needs to be acquired multiple times and the average value thereof is calculated to obtain more stable and reliable data. In order to improve the real-time performance of the data, a shorter sampling interval can be set, so that the equipment can update the received signal strength indication value in time.
In actual operation, the device to be located can acquire the received signal strength indication values of all nearby bluetooth beacons through a bluetooth scanning function. Each beacon will be identified by a unique MAC address and the device will record the MAC address of each beacon and the corresponding received signal strength indicator value. The collected received signal strength indication values may be transmitted to a location server for processing via a wireless network or other communication means.
And S5, obtaining the actual coordinates corresponding to the to-be-positioned point based on the first coordinates, the first received signal strength indication values and the second received signal strength indication values.
In the present invention, the purpose of step S5 is to obtain the actual coordinates corresponding to the pending site based on the plurality of first coordinates, the plurality of first received signal strength indication values, and the plurality of second received signal strength indication values. This step is a key part for realizing high-precision positioning, and the position of the to-be-positioned site can be precisely determined through comprehensive calculation.
In a possible implementation manner, reference is made to fig. 3, which shows a second flow chart of a positioning method based on a weight factor and WKNN according to an embodiment of the present application. Step S5 specifically includes steps S51-S53:
Step S51, determining a preset number of positioning actual reference points from a plurality of positioning initial reference points based on a plurality of first coordinates, a plurality of first received signal strength indication values and a plurality of second received signal strength indication values.
In particular, since bluetooth signals are susceptible to interference and attenuation in indoor environments, the direct use of all positioning initial reference points may introduce errors. By selecting the reference points with the number closest to the received signal strength indication value received by the to-be-positioned point, the influence of environmental noise and interference on positioning accuracy can be effectively reduced, and thus, the positioning accuracy and stability are improved.
In a possible implementation manner, reference is made to fig. 4, which shows a third flow chart of a positioning method based on a weight factor and WKNN according to an embodiment of the present application. Step S51 specifically includes steps S511-S514:
Step S511, determining weight factors corresponding to the initial reference points of the positioning based on the first received signal strength indication values.
In one possible implementation, step S511 specifically includes the following steps:
Calculating weight factors corresponding to the initial reference points of each positioning through the following formula:
Wherein, the For the weight factor between the i-th location initial reference point and the u-th bluetooth location beacon,For a first received signal strength indicator value between an ith positioning initial reference point and a ith bluetooth positioning beacon, N is the number of positioning initial reference points.
Specifically, first, in the positioning system, there may be differences in the received signal strength indication values received by the respective positioning initial reference points, and these differences are affected by various factors such as environmental factors, distances, obstacles, and the like. In order to better utilize this information in calculating the position of the site to be located, a weight factor needs to be assigned to each initial reference point for location. The larger the weight factor is, the larger the contribution of the received signal strength indication value of the reference point to the positioning result is, so that the positioning accuracy can be improved.
In the formulaIn order to reasonably distribute weights, so that the influence of the signal intensity of each positioning initial reference point on the positioning result is properly reflected. First, the received signal strength indication value reflects the strength of the signal received by the reference point. In general, the greater the signal strength, the closer the reference point is to the beacon, and the higher the positioning accuracy. Thus, the contribution of the strong signal can be better represented by calculating the weights using the square of the received signal strength indication value.
Using squaring (i.e) The difference in signal strength can be amplified so that the weight of the strong signal is more prominent and the weight of the weak signal is relatively reduced. This design may increase the robustness and accuracy of the positioning calculation, as a strong signal generally implies a more reliable distance estimation. And denominator partIs the sum of squares of the received signal strength indication values of all reference points, and is used for normalizing the received signal strength indication square value of each reference point, so as to ensure that the sum of all weight factors is 1. This avoids imbalance due to absolute size differences in the received signal strength indication values themselves, while ensuring that the weighting factors for all reference points are within a comparable range.
Step S512, calculating a first Euclidean distance between the to-be-positioned point and each initial reference point of positioning based on the plurality of weight factors, the plurality of second received signal strength indication values and the plurality of first received signal strength indication values.
In the present invention, the purpose of step S512 is to calculate a first euclidean distance between the pending site and each positioning initial reference point based on the plurality of weight factors, the plurality of second received signal strength indication values, and the plurality of first received signal strength indication values. This step is critical for determining the position of the site to be localized. The first Euclidean distance is an effective method for measuring the signal intensity difference between the to-be-positioned point and the reference point, and the closest reference point to the to-be-positioned point can be found out by calculating the Euclidean distance between the second received signal intensity indication value received by the to-be-positioned point and the first received signal intensity indication value received by each reference point, so that the positioning accuracy is improved. The contribution of each signal strength indication value to distance calculation can be further adjusted by using the weight factors, so that the positioning accuracy is enhanced.
First, a first received signal strength indication value and a corresponding weight factor of each positioning initial reference point are obtained from a fingerprint database, and a plurality of second received signal strength indication values received by a to-be-positioned point in real time are obtained. Then, a first Euclidean distance between the pending site and each reference point is calculated. Specifically, for each reference point, a weighted RSSI difference between the pending site and each bluetooth beacon signal received by the reference point is calculated as follows: wherein d i is the first Euclidean distance between the to-be-positioned point and the ith positioning initial reference point, M is the number of Bluetooth positioning beacons, For the weight factor between the i-th positioning initial reference point and the u-th bluetooth positioning beacon, RTP u is a second received signal strength indication value between the pending site and the u-th bluetooth positioning beacon,For a first received signal strength indication value between an i-th location initial reference point and a u-th bluetooth location beacon.
Through the calculation, the weighted Euclidean distance between the to-be-positioned point and each reference point can be obtained. The weighting processing enables the influence of the signal intensity on the positioning result to be more obvious, and the positioning accuracy is improved. Finally, by the weighted distance calculation method, the reference points closest to the RSSI value of the to-be-positioned point can be found, and the reference points play an important role in subsequent positioning calculation. The weighting process effectively utilizes the weighting factors, enhances the influence of the signal intensity, and reduces the influence of the environmental noise and the interference on the positioning result.
Step S513, sorting the first Euclidean distances to obtain sorting results.
Specifically, after calculating the first euclidean distance between the to-be-positioned point and each positioning initial reference point, a plurality of reference points closest to the to-be-positioned point in the reference points need to be found. This is because the closer the reference point is to the location, the more similar the RSSI value is to the RSSI value of the location to be located, and the greater the impact on the final location result. Therefore, by sorting the first Euclidean distance, the reference points which have the greatest contribution to the positioning result can be effectively screened out.
In the sorting process, common sorting algorithms such as quick sorting, merging sorting and the like can be used to ensure the accuracy and efficiency of sorting results. In order to facilitate the processing of the subsequent steps, the reference point information corresponding to each distance value needs to be recorded simultaneously. That is, the sorting result includes not only the sorted distance values, but also the corresponding reference point identifications, so that the reference points can be accurately located in the subsequent steps.
Step S514, determining a preset number of positioning actual reference points from a plurality of positioning initial reference points based on the sequencing result.
Specifically, in step S513, the first euclidean distances between the to-be-positioned points and the respective positioning initial reference points have been ordered in order from small to large. Next, a preset number of locating actual reference points need to be selected from the ranking results. Assuming that the preset number is k, the first k reference points with the smallest distance are selected as positioning actual reference points.
In the selection process, the selected reference point information needs to be ensured to be complete, including the identification of the reference point, the first coordinate, the first received signal strength indication value and the corresponding weight factor. This information will be used in subsequent steps to further calculate the actual coordinates of the site to be located.
And S52, determining second coordinates corresponding to the actual reference points of each positioning.
Specifically, a preset number of positioning actual reference points have been selected in step S514. Next, the coordinate information of these locating actual reference points needs to be extracted from the fingerprint database. Each of the positioning actual reference points has corresponding coordinates in the fingerprint database, which are measured and stored in advance at the time of system initialization, called second coordinates.
And step S53, obtaining actual coordinates based on the plurality of second coordinates.
Specifically, in the previous step, a preset number of positioning actual reference points have been selected and their second coordinates are determined. The coordinates of each reference point and its corresponding weight factor contribute differently to the positioning result. By integrating the coordinates and weights of the reference points, the actual coordinates of the to-be-positioned points can be calculated more accurately. By the aid of the method, the influence of errors of a single reference point can be reduced, and overall positioning accuracy is improved.
In a possible implementation manner, reference is made to fig. 5, which shows a fourth flow chart of a positioning method based on a weight factor and WKNN according to an embodiment of the present application. Step S53 specifically includes steps S531-S533:
and step S531, determining a second Euclidean distance between each positioning actual reference point and the to-be-positioned point.
Specifically, in the previous step, the first euclidean distance between the to-be-located point and each of the location initial reference points has been calculated, and therefore, in this step, it is necessary to screen out the second euclidean distance between each of the location actual reference points and the to-be-located point from the plurality of first euclidean distances.
And S532, obtaining weight parameters corresponding to the actual positioning reference points based on the second Euclidean distances.
In one possible implementation, step S532 specifically includes the following steps:
calculating weight parameters corresponding to the actual reference points of each positioning through the following formula:
Wherein k is the number of the positioning actual reference points, w j is the weight parameter corresponding to the j-th positioning actual reference point, and d j is the second Euclidean distance between the j-th positioning actual reference point and the to-be-positioned point.
Specifically, during the positioning process, the second Euclidean distance between each positioning actual reference point and the to-be-positioned point reflects the degree of similarity between them. The smaller the distance, the closer the RSSI value representing the reference point is to the RSSI value of the site to be located, and thus the greater the contribution of the reference point to the positioning result should be. By calculating the weight parameters, the influence of each reference point in final positioning calculation can be reasonably distributed, and the accuracy and stability of a positioning result are ensured.
Formula (VI)And the weight parameters are used for calculating the actual reference points of the positioning. The design of the formula aims at reasonably distributing the influence of each reference point in the final positioning result and ensuring the accuracy and stability of positioning.
The degree of similarity between the site to be located and each reference point is measured by a second Euclidean distance d j. The smaller the distance, the closer the RSSI value representing the reference point is to the RSSI value of the location to be located, and thus the greater the contribution of the reference point to the final location result should be. To quantify this contribution, a method of calculating the weight parameters is employed. Molecular part in the formulaThe inverse of the distance is reflected, which means that the smaller the distance, the larger the inverse and thus the greater the weight. This design allows the reference points closer to the site to be located to be weighted more heavily, ensuring that these important reference points contribute more significantly to the location results.
In order to sum the weights of all reference points to 1, the denominator part of the formulaThe inverse of all reference points are summed. This normalization ensures a reasonable relative distribution of weights and avoids computational imbalance due to excessive weights of individual reference points. The normalized weight parameter reflects the relative importance of each reference point with respect to the other reference points.
Step S533, obtaining the actual coordinates based on the plurality of second coordinates and the plurality of weight parameters.
In one possible implementation, step S533 specifically includes the following steps:
the actual coordinates are calculated by the following formula:
Wherein k is the number of the positioning actual reference points, (X, Y) is the actual coordinates, w j is the weight parameter corresponding to the j-th positioning actual reference point, and (X j,yj) is the second coordinates corresponding to the j-th positioning actual reference point.
In particular, in the previous step, several positioning actual reference points have been selected and their second coordinates and corresponding weight parameters are determined. Each reference point contributes differently to the positioning result, and the weight parameter reflects this difference. By integrating the coordinates and weights of the reference points, the actual coordinates of the to-be-positioned points can be calculated more accurately, so that the positioning accuracy is improved.
Formula (VI)For calculating the actual coordinates of the site to be localized. The purpose of this formula design is to integrate the position information of the actual reference points of each positioning by a weighted average method so as to obtain a more accurate position of the to-be-positioned point.
The position of the site to be located requires reference to information of a plurality of actual reference points of location, which have different contributions to the result of the location. The weight parameter w j reflects the importance of each reference point to the positioning result. The larger the weight is, the closer the distance between the reference point and the to-be-positioned point is, the closer the RSSI value of the reference point is to the RSSI value of the to-be-positioned point is, and the larger the influence on the positioning result is. Therefore, the coordinates of each positioning actual reference point are weighted and accumulated according to the weight of the positioning actual reference point, so that the finally calculated coordinates (X, Y) of the to-be-positioned point are more accurate, the comprehensive information of all positioning actual reference points is reflected, and the positioning error is reduced.
Referring to fig. 6, a schematic structural diagram of a positioning system based on a weight factor and WKNN according to an embodiment of the present application is shown, where the system includes a processing module 1 and an obtaining module 2;
The system comprises a processing module 1, a processing module and a processing module, wherein the processing module 1 is used for dividing a preset field into grid structures and setting a positioning initial reference point at a node of each grid;
The acquisition module 2 is used for acquiring first coordinates corresponding to each positioning initial reference point and acquiring a plurality of first received signal strength indication values received by each positioning initial reference point;
the acquisition module 2 is further configured to acquire a plurality of second received signal strength indication values received by the to-be-positioned point;
the processing module 1 is further configured to obtain an actual coordinate corresponding to the pending site based on the plurality of first coordinates, the plurality of first received signal strength indication values, and the plurality of second received signal strength indication values.
In a possible implementation manner, the processing module 1 is further configured to determine a preset number of positioning actual reference points from a plurality of positioning initial reference points based on the plurality of first coordinates, the plurality of first received signal strength indication values and the plurality of second received signal strength indication values;
the processing module 1 is further used for determining second coordinates corresponding to each positioning actual reference point;
The processing module 1 is further configured to obtain an actual coordinate based on the plurality of second coordinates.
In a possible implementation manner, the processing module 1 is further configured to determine a weight factor corresponding to each positioning initial reference point based on each first received signal strength indication value;
the processing module 1 is further configured to calculate a first euclidean distance between the to-be-positioned point and each positioning initial reference point based on the plurality of weight factors, the plurality of second received signal strength indication values, and the plurality of first received signal strength indication values;
The processing module 1 is further used for sequencing the first Euclidean distances to obtain a sequencing result;
The processing module 1 is further configured to determine a preset number of positioning actual reference points from a plurality of positioning initial reference points based on the sorting result.
In a possible embodiment, the processing module 1 is further configured to determine a second euclidean distance between each positioning actual reference point and the to-be-positioned point;
the processing module 1 is further configured to obtain weight parameters corresponding to each positioning actual reference point based on each second euclidean distance;
the processing module 1 is further configured to obtain an actual coordinate based on the plurality of second coordinates and the plurality of weight parameters.
In a possible implementation manner, the processing module 1 is further configured to calculate the weight factor corresponding to each positioning initial reference point by the following formula:
Wherein, the For the weight factor between the i-th location initial reference point and the u-th bluetooth location beacon,For a first received signal strength indicator value between an ith positioning initial reference point and a ith bluetooth positioning beacon, N is the number of positioning initial reference points.
In a possible implementation manner, the processing module 1 is further configured to calculate the weight parameter corresponding to each positioning actual reference point by the following formula:
Wherein k is the number of the positioning actual reference points, w j is the weight parameter corresponding to the j-th positioning actual reference point, and d j is the second Euclidean distance between the j-th positioning actual reference point and the to-be-positioned point.
In a possible embodiment, the processing module 1 is further configured to calculate the actual coordinates by the following formula:
Wherein k is the number of the positioning actual reference points, (X, Y) is the actual coordinates, w j is the weight parameter corresponding to the j-th positioning actual reference point, and (X j,yj) is the second coordinates corresponding to the j-th positioning actual reference point.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the embodiments of the apparatus and the method provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the embodiments of the method are detailed in the method embodiments, which are not repeated herein.
The application also discloses electronic equipment. Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 700 may include at least one processor 701, at least one network interface 704, a user interface 703, memory 705, and at least one communication bus 702.
Wherein the communication bus 702 is used to enable connected communications between these components.
The user interface 703 may include a Display screen (Display), a Camera (Camera), and the optional user interface 703 may further include a standard wired interface, and a wireless interface.
The network interface 704 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Wherein the processor 701 may include one or more processing cores. The processor 701 connects various portions of the overall server using various interfaces and lines, performs various functions of the server and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 705, and invoking data stored in the memory 705. Alternatively, the processor 701 may be implemented in hardware in at least one of digital signal processing (DigitalSignalProcessing, DSP), field programmable gate array (Field-ProgrammableGateArray, FPGA), and programmable logic array (ProgrammableLogicArray, PLA). The processor 701 may integrate one or a combination of several of a central processor (CentralProcessingUnit, CPU), an image processor (GraphicsProcessingUnit, GPU), a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like, the GPU is used for rendering and drawing contents required to be displayed by the display screen, and the modem is used for processing wireless communication. It will be appreciated that the modem may not be integrated into the processor 701 and may be implemented by a single chip.
The memory 705 may include a random access memory (RandomAccessMemory, RAM) or a Read-only memory (rom). Optionally, the memory 705 includes a non-transitory computer readable medium (non-transitorycomputer-readablestoragemedium). Memory 705 may be used to store instructions, programs, code, sets of codes, or instruction sets. The memory 705 may include a stored program area that may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, etc., and a stored data area that may store data related to the various method embodiments described above, etc. The memory 705 may also optionally be at least one storage device located remotely from the processor 701. Referring to fig. 7, an operating system, a network communication module, a user interface module, and an application program may be included in the memory 705, which is a computer-readable storage medium.
In the electronic device 700 shown in fig. 7, the user interface 703 is primarily used to provide an input interface for a user to obtain data entered by the user, while the processor 701 may be used to invoke an application program stored in the memory 705 that, when executed by the one or more processors 701, causes the electronic device 700 to perform a method as in one or more of the embodiments described above. It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all of the preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, such as a division of units, merely a division of logic functions, and there may be additional divisions in actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some service interface, device or unit indirect coupling or communication connection, electrical or otherwise.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in whole or in part in the form of a software product stored in a memory, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. The memory includes various media capable of storing program codes, such as a USB flash disk, a mobile hard disk, a magnetic disk or an optical disk.
The above are merely exemplary embodiments of the present disclosure and are not intended to limit the scope of the present disclosure. That is, equivalent changes and modifications are contemplated by the teachings of this disclosure, which fall within the scope of the present disclosure. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure.
This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a scope and spirit of the disclosure being indicated by the claims.