1. Introduction
Since the 21st century, LED (light-emitting diode) technology has developed rapidly and is widely used in many fields. Its branch, visible light communication (VLC), uses visible light as a signal transmitting base station and has advantages that traditional wireless communication methods do not have, such as a rich spectrum, a green environment, no electromagnetic radiation, and a low cost, and it can be combined with lighting. Visible light positioning (VLP) technology is a classic application of VLC, and VLP technology inherits the advantages of VLC and is a popular technology in the field of positioning [
1,
2].
In outdoor positioning, the United States developed the Global Position System (GPS) for civil satellite positioning [
3], which has become the mainstream positioning tool in society because of its meter-level positioning accuracy, high coverage, and complete functionality. However, GPS is difficult to be applied in indoor environments. Because the indoor complex environment interferes with the satellite signal and the signal is weakened in the indoor environment, it is difficult to achieve real-time positioning and the positioning error is large.
Currently, common indoor positioning technologies include infrared positioning, ultrasonic positioning, Wi-Fi positioning, ZigBee positioning, Bluetooth positioning, ultra-wideband (UWB) positioning, and visible light positioning (VLP) [
4]. Each of these positioning technologies and solutions has its own advantages and disadvantages, and the complexity of implementation and usage scenarios vary.
Table 1 shows the comparison of the differences between various classical indoor positioning technologies in terms of positioning accuracy, implementation cost, environmental range, stability, and anchor point classification.
As we can see, VLP is an important direction for the future development of indoor positioning technology because of its high positioning accuracy, low cost, and high interference resistance. Image VLP(i-VLP), whose receiver is an image sensor (IS), obtains information by photographing LED light sources and aids in precise positioning by photogrammetry, so it is also known as optical camera communication (OCC), and several studies [
5,
6,
7] have used this method for indoor precise positioning. Chen and Wu have proposed the use of QR codes as identification information but rely on dual lights for localization [
8,
9], and others have proposed a localization technique using a held flat panel light source but with improved circuitry [
10].
In this paper, an indoor information localization technique for basic flat panel light is proposed, incorporating a barcode to convey information, using a smartphone with an integrated image sensor as the signal receiver, constructing an OCC system, and designing algorithms to improve the localization accuracy of this system with the assistance of an angle sensor.
The rest of this paper is structured as follows:
Section 2 introduces the principle of this system design,
Section 3 introduces the process of fuzzy positioning,
Section 4 introduces the precise positioning algorithm assisted by angle sensors,
Section 5 shows the experiments undertaken according to the algorithms in the first two sections and the analysis of the results, and
Section 6 is the summary and conclusion of this paper.
2. System Design
The imaging VLP technology based on the received signal from the image sensor is characterized by the use of the image sensor as the front end of the receiving end of the VLP system. The image sensor is integrated on the camera, and the VLC system uses the camera as the front-end of the receiver [
11]. The transmitter side of the OCC system has two processes: first, the data information to be transmitted is coded and modulated for transmission to the driver circuit, and then the driver circuit amplifies the received signal to drive the LED lamp to send the light signal. The modulation of the LED lamp is generally based on changing the luminous intensity of the light source, and
Figure 1 shows a common i-VLP system.
In this paper, an LED flat panel lamp is used as the emitter. A frosted barcode or 2D code with location information is either laser-engraved on the frosted acrylic or transparent lampshade of the flat panel lamp, or the translucent frosted film paper is cut into the shape of the barcode or 2D code and pasted on the lampshade of the flat panel lamp to make it constitute a frosted graphic code. Without changing the circuit, the modification of the emitter can be realized, and the laying cost and modification cost are extremely low, simple to operate and practical. The signal transmitter side of the LED flat panel lamp information positioning technology proposed in this paper is easier to implement than the traditional OCC system, and as flat panel lamps become increasingly more used, the modification of only the lamp shade makes the hardware cost and system deployment cost much lower. The method is also more aesthetically pleasing compared to directly pasting the graphic code on the building.
Figure 2 shows the ideal graphic code and a diagram of the two states of the flat panel lamp after the lamp has been retrofitted with the lamp off and the lamp on.
LED flat panel light is a flat surface light source, and compared with traditional lamps and lanterns, the light source wattage is the same. LED flat panel light has the advantages of a soft light, a uniform, large luminous area, a high color rendering index, green energy saving, etc., which are becoming characteristics of choice for indoor lighting.
At the receiving end, the user can shoot the frosted graphic code on the flat lamp shade through the camera of the mobile terminal (smart phone), the image undergoes digital image processing algorithms and machine vision methods, obtaining the LED-ID number of the flat lamp to achieve fuzzy positioning. Then, assisted by the angle sensor in the phone to extract the angle information, the calculation obtains the precise coordinates. Followed by this, through the indoor electronic map of the building, the own location information of the area completes the positioning. The whole system process is shown in
Figure 3. This design is referred to as the LP-VLP system.
The flat panel light positioning technology in this paper uses barcodes to represent location information. According to the design and practical needs of the positioning system in this paper, the barcode frosted film has the following two requirements.
(1) It must minimize the normal lighting function of the lamp. The height of the graphic code from the ground should be above 2 m, and the side length should not be too small, so the pattern of the graphic code should be as simple as possible to ensure the aesthetics.
(2) Mobile devices need to collect images in the light illumination state, which may lead to a certain amount of barcode distortion in the images collected by the camera. In order to avoid this situation, a simple barcode coding method should be chosen as much as possible to ensure that the barcode coding information can still be decoded despite the image distortion and to enhance the system’s anti-interference properties.
Based on the above two requirements, the Code128 code system in the barcode is chosen in this paper [
12]. The information conveyed in this paper system is the information of the LED flat panel light, which can be distinguished by numbers only, so Code128 code can be used to meet the demand, i.e., pure digital coding.
3. Fuzzy Positioning
The receiver side of LP-VLP system mainly collects images from the cell phone camera and performs a series of processing on the images, and finally decodes the graphic code to obtain the location information to achieve positioning. The workflow of the receiver side in this paper mainly consists of four parts.
Figure 4 shows the flow chart of the whole fuzzy localization process.
The acquired images may be overexposed, skewed, and noisy, so digital image processing is performed to enhance the images in order to extract the LED-ID information from the images.
3.1. Image Pre-Processing
Because it is convenient to make a frosted barcode, this paper uses the approach of hollowing out during fabrication, so the black and white barcode of the frosted barcode is opposite to the normal barcode, the black part is cut off to transmit light so that it becomes the white part. Moreover, in order to ensure the normal use of the flat panel light, the image acquisition is relatively low in clarity and contrast, so the image must be pre-processed to facilitate the subsequent identification and decoding work. There is inevitably a lot of useless information in the captured image, and the target region extraction is to find the region of interest (ROI), which in this system is the region of the flat panel light. After extracting the barcode region, the image to be processed can be narrowed down and the interference of background noise, such as ambient light source and luminescence, can be reduced in the subsequent image processing. The specific algorithm process is to segment the flat panel light and the environment by image threshold segmentation, and then select the barcode region in the image by the connected domain feature.
The classical otsu algorithm is to select a gray level such that
is the maximum value by traversing the gray level range t ∈ [0, M − 1], and that gray level t is the best image segmentation threshold.
is the image feature factor, which is independent of the selection of gray level t;
is the class variance, which is a second-order statistical value;
is the class mean, which is a first-order statistical value. In order to obtain the optimal image segmentation threshold, a gray level t needs to be selected such that the values of λ and η are maximized [
13,
14].
The specific flow of the algorithm is as follows:
Calculate the probability of gray level for each pixel;
Calculate the global mean and variance;
Calculate the average density value and the average intensity value of the pixel;
Calculate the inter-class variance and find the separable threshold Kstar;
Find the average intensity and separable metric of the whole image;
Convert the image into a binarized image based on Kstar.
After the threshold segmentation of the acquired image, the connected domain with the largest area is the target area of the barcode, and all eight neighbors with less than 1000 pixels can be deleted to remove small objects for subsequent image processing.
Due to the influencing factors, such as the angle and tilt of the LED lights taken by the user terminal, it is difficult to directly identify the barcode information in the image. In order to improve the efficiency of the subsequent image processing and the accuracy of the identification decoding, the image needs to be tilt-corrected first to make it rectangular. This system adopts the image correction algorithm based on the projection interpolation method of corner point recognition based on the projection method [
15]. Assuming that the projection matrix M is
Then, the transformation equation is
{x,y} are the pixel coordinates of the original image, {X,Y} are the pixel coordinates of the corrected image, and i = {1,2,3,4} is the index of the corner points. Based on the identified irregular quadrilateral corner points, the quadrilateral edge lengths of the original pixel coordinates can be obtained, and the approximate edge lengths of the target rectangle can be calculated by averaging the de-pairing edges.
The interpolation algorithm [
16] is based on a known discrete sequence, using the interpolation function to generate a continuous function, and resampling the new function to obtain a new discrete sequence, with the following Equation (5).
3.2. Image Optimization
After pre-processing, the image can still be affected by complex factors such as ambient lighting and reflective objects, which can destroy the true information of the image, affect the visual effect of the image, and hinder the recognition decoding of the image. Therefore, it is necessary to perform further image optimization processing after the image has been preprocessed. Classical lighting compensation algorithms include the top hat method [
17]. In this paper, the adaptive illumination compensation algorithm is used to correct the illumination unevenness of the image [
18]. Illumination compensation is essentially an unequal stretching of the image grayscale values to extract the images with uneven illumination and remove the effects of uneven illumination using image subtraction operations. In this paper, we use the method of extracting the image background gray level in a region using mathematical statistics, calculating the standard deviation and mean value of the pixel gray level in the region, and calculating the gray level of the background in the region based on the statistical value. The specific process is as follows:
The image is segmented into m × n small regions, the background gray value of each region is estimated, and the standard deviation σ and mean μ of the pixel gray level of the region are calculated; max(vmin, μ − 3σ) is taken as the gray level of the region, and vmin is the minimum gray level of the region;
max(vmin, μ − 3σ) is expanded into a matrix of regional background gray values of the same size for that region; the same is done for each region, and the matrices are merged;
The original image matrix is subtracted from the background grayscale matrix, i.e., a new image matrix is generated to complete the image adaptive illumination compensation once.
After luminance correction by the illumination compensation algorithm, there is a significant brightness bias in the image, and the histogram equalization technique can be used to maintain the brightness characteristics of the image while enhancing the local details and optimizing the uneven distribution of pixel gray levels. Histogram equalization is a simple and effective image enhancement technique [
19,
20], which changes the gray level of each pixel in an image by changing the histogram of the image, and is mainly used to enhance the contrast of images with a small dynamic range. The basic principle of histogram equalization is that the grayscale values with a large number of pixels in the image (i.e., those that play a major role in the image) are widened, while those with a small number of pixels (i.e., those that do not play a major role in the image) are merged, thus increasing the contrast and making the image clear for the purpose of enhancement.
The mathematical process can be expressed by the following Equation (8).
where r
k is the kth gray level in the original image; s
k is the kth gray level in the output image, n is the total number of pixels in the image, n
i is the number of pixels in the image with gray level r
i, and k ∈ [0, L − 1].
3.3. Identification Decoding
The edge recognition of an image is generally defined as the set of those pixel points in the neighborhood with step changes in pixel gray value, which is an important feature for image segmentation, and the edges to be recognized in this paper are each edge of a barcode. Code128 barcodes use four different widths of black and white bars to represent the coding element “1” “2,” “3,” and “4” [
21]. Since the length l of each black or white bar is the same, its width h and area s are equivalent variables (s = lh). In the actual decoding process, the area s is obtained by counting the cumulative value of the width h in the direction of the length l. In order to enhance the tenacity of the system, this paper uses area s for the decoding calculation.
Figure 5 shows the decoding flow chart.
4. Precise Positioning Assisted by Angle Sensors
However, the light coverage of the flat panel light is larger, as shown in
Figure 6. Assuming that the blue area is the light coverage area of this flat panel light, people use mobile terminals to take pictures and collect images of the flat panel light in this larger area, and the positioning information is transmitted to the cell phone terminal through the wireless optical link. Then, the image is decoded to obtain the LED-ID of this flat panel light after optimized processing, and the location information is obtained. Each point in this blue area photographed is the same location information, so this location information is relatively fuzzy, the positioning accuracy of the system is room level, and the specific accuracy error depends on the density of the flat-panel lamp laying in the area. However, for some scenes, this positioning accuracy cannot meet the positioning needs of people’s production life, so this chapter will explore the precise positioning algorithm based on the iVLP system of flat panel lights.
At present, the vast majority of VLP precise positioning techniques require at least a two-lamp system or a three-lamp system [
22,
23] to precisely calculate the position based on the relative positions between multiple lamps in an image or the time and angle differences between multiple light signals received at the receiver to obtain more accurate positioning information. However, for the flat lamp VLP system proposed in this paper, because of the large size of flat lamps, it is difficult to simultaneously capture two or more flat lamps clearly in one image, and the multi-lamp precise positioning is not applicable to this system.
Therefore, this paper proposes a single-lamp precise positioning method based on angle (pose) sensor assistance to achieve visible light imaging positioning under sparse light sources.
At present, the vast majority of cell phones integrate multiple sensors, including an accelerometer, a gyroscope, GPS and magnetic sensors, etc. As an example, the Honor v30OXF-AN00 cell phone is shown in
Figure 7a, which was used to acquire images in this study. The gyroscope belongs to the three-axis angle sensor, which is widely used and has the role of detecting the device’s own behavior. The direction sensor of the phone is shown in
Figure 7b, and the angle sensor detects the azimuth angle θ, the roll angle γ, and the pitch angle ω to determine the direction of the phone at this time. Among them, the azimuth angle indicates the rotation of the phone in the xy plane, 0 degrees in the due north direction; the roll angle, also known as the side tilt angle, takes values in the range of (−180, 180).
The traditional dual lamp positioning method requires at least two LEDs to provide the corresponding position information [
24], and in combination with the position relationship between the sender and receiver, the projection relationship of the light source on the same horizontal plane is calculated and combined with the trigonometric relationship for positioning. This system reduces the barcode size of the flat lamp cover from 100% to 80%. As shown in
Figure 8, point A is the farthest point from the graphic code, and point O is the center point of the flat lamp. According to the fixed position of the flat lamp, i.e., the size information of the flat lamp, we can know the position coordinates of point A and point O. According to the position information of these two points, we can realize “pseudo dual lamp positioning”.
There is a mapping relationship between real-world coordinates and camera imaging plane coordinates, because only the case of the mobile terminal parallel to the lamp plane is considered in this chapter, so the simple schematic diagram is shown in
Figure 9. The height of the cell phone is h, the height of the flat lamp from the ground is fixed as H (H = 200 cm), the pitch angle of the cell phone is
, which can be obtained by the built-in sensor of the cell phone, and the absolute horizontal distance of the cell phone from the point O of the flat lamp is d. а can be expressed as:
As shown in
Figure 10, the yellow area is a flat lamp. Let the terminal coordinates P be (x,y,h). h is a known quantity; x, y coordinates are received by the camera plane to determine the intersection of the projection of A, O points. A, O points are the centers of the circles, and the absolute horizontal distance between the receiving end and A, O points forms the radius of a circle. The two circles intersect at two points P
1 and P
2, the relationship is
If the measured distance is less than the true distance, this will lead to no solution to the system of equations, and the coordinates of point P can be approximated as the midpoint of A and O. In the normal case, the equation has roots, then the two projected circles intersect at two points P1 and P2, which then need to be screened to determine the true coordinates. In the positioning process, assuming that the front end of the phone faces due north and the vertical position is on the north side of point A and point O, the y-value of the P point is greater than the y-value of point A and point O, and the flat light is located in the upper part of the image. Conversely, when the y-value of the phone is less than the y-value of the AO point, the flat light is located in the lower part of the image. The same is true for the east side and west side.
The algorithm for filtering coordinates can be summarized in two steps [
25].
Step 1: Using the midpoint of the image as the origin, a right-angle coordinate system is established. The coordinates of individual points of the image are solved using the pixel points as the point locations, and the polar coordinate system (ρ, θ) is used for the specific calculation because of the tilt rotation of the image.
Step 2: Determine the horizontal coordinates of point P. As shown in
Figure 11, in a polar coordinate system, assume the angles of point A and point O with the polar axis are θ
1, θ
2, respectively, and set
.
∆θ < 180°, ;
∆θ > 180°, .
By this method, the coordinates of the actual position of point P are determined.
5. Experimental Results and Analysis
As shown in
Figure 12, the simulation scenario in
Figure 9 is built in this paper. Due to the limited laboratory environment, the whole space size is 180 × 180 × 200 cm
3 and is surrounded by a black, thick, blackout cloth to cover the light. The modified flat panel light was taped to the ceiling and kept level with the floor. The mobile terminal was fixed on a tripod to control the height h and pitch angle а of the terminal, and 16 test points were selected on the ground, which were consistent with the test points of the light experiment.
Table 2 lists the parameter information of the equipment used in this experiment.
5.1. Fuzzy Localization Experimental Results
The results of pre-processing and optimization of the acquired images are shown in
Figure 13. The image enhancement is very effective, and finally the LED-ID is successfully identified.
We conducted an experimental analysis of the recognition decoding rate of the images by the control variable method. The variables are the shooting angle and the height of the phone from the flat lamp. The specific experiments are as follows: adjust the horizontal angle of the cell phone to 0 degrees, 15 degrees, 30 degrees, and 45 degrees, respectively (the tilt angle is too large to shoot); control the flat panel light within the field of view (FoV) of the cell phone (remove the incomplete image of the flat panel light); use the front camera of the cell phone to capture images. The vertical distance between the cell phone and the flat panel light is 80–200 cm (the closest distance is 80 cm, otherwise the cell phone FoV cannot accommodate the complete image of the flat panel light), 80 images are captured at every 20 cm interval (20 images per angle), and the control exposure parameters are −1EV, the flat area is within 300 × 300 cm, the size of the flat panel light is 30 × 60 cm, and the LED-ID value is 133,724. The image algorithm proposed in this paper is used to optimize the nearly 500 images collected by uniformly processing and decoding, and the success rate of decoding in each case is counted.
Figure 14 shows the results of the experiment. As can be seen from the figure, due to the large size of the flat panel light, the vertical distance between the cell phone and the flat panel light has little influence on the recognition rate, and the decoding rate is 100% when shooting at 0 degrees. The horizontal angle of the cell phone when shooting has a greater impact. Analyzing the reason, it can be seen that the tilt angle is too large; the area of the graphic code in the image is too small; the tilt correction algorithm is not easy to recover the image information, resulting in the failure of the decoding code; and the decoding code effect is the worst when the vertical distance is 45 degrees, which is 91.4%. The overall recognition rate of the whole system is 96.4%, which indicates that the VLP system for flat panel lights proposed in this paper has a certain feasibility.
5.2. Precise Positioning Experimental Results
The coordinates of the LED center O point are (90, 90, 200), the A point coordinates are (120, 75, 200), and the spacing is a fixed value of 33.54 cm. The vertical distance h changes between the receiving end and the ground. Considering the height of most users and the height of the ceiling in the conventional building, this experiment will set h to 40 cm, 60 cm, 80 cm, 100 cm, respectively, for 16 test points The experiment is conducted, and
Figure 15 shows the comparison between the calculated estimated coordinates results and the real location coordinates.
As can be seen from the figure, the distance between the true location coordinates and the estimated location coordinates is relatively close, and as h increases, the estimated location is closer to the true location coordinates; the points that are further away from the flat light have a larger error compared to the center of the point.
Commonly used metrics to evaluate the performance of indoor positioning techniques are accuracy, precision, complexity, and scalability. In this paper, accuracy is used as a performance metric for analysis. Accuracy refers to the degree of conformity between the estimated position coordinates and the true position coordinates under certain experimental conditions, and the Euclidean distance between the true coordinates and the estimated coordinates is usually used to express the magnitude of the systematic error. Let the true position coordinates be (x,y) and the estimated position coordinates be (x
0,y
0), then the localization error can be expressed as Equation (9).
In order to analyze the positioning results more clearly, the positioning error of each test point at different h values was calculated, and the results are shown in
Figure 16a. From the figure, it can be seen that the maximum positioning error of 10.59 cm and the minimum can reach 2.97 cm for h = 100 cm, which was obtained at the point (120, 120). When h = 40 cm, the maximum positioning error of 23.14 cm was obtained at the point (0, 180). As h decreases, the distance between the mobile terminal and the flat lamp increases, the accuracy may decrease when the corner point is identified, and the azimuth angle of the receiving end changes significantly, so the accuracy of the estimated position coordinates decreases.
The average error
eR is calculated at each point when the value of h is changed, where n is the number of measurements, and
n = 16 in this experiment. The calculation formula is Equation (10):
Figure 16b shows that the average error decreases as the distance between the transmitter and receiver decreases with increasing h, and the average error is negatively correlated with the value of h. The minimum value of the average error is 6.5 cm.
We have made some comparisons between the method proposed in this paper and existing single lamp VLP localization algorithms, as shown in
Table 3. Refs. [
26,
27,
28] all use a single circular lamp as the transmitting light source, and the processing at the transmitting end is very similar, relying on the flashing of the lamp to transmit information, which requires a large circuit laying cost.
However, their processing at the receiving end is different; improvements have been made, and the positioning accuracy has been improved (both are 3D positioning). The innovation of the method proposed in this paper is that no large-scale circuit modification is required, and the stability of the system is improved. Additionally, the positioning error of this positioning system is relatively small, and the positioning accuracy has been improved. At the same time, the above three methods require high-frequency flashing at the transmitter end, and this lighting environment is not conducive to activities such as shooting, which has certain limitations. The method proposed in this paper avoids this situation.
6. Conclusions
In this paper, we propose an indoor positioning algorithm based on flat panel light and angle sensor assistance, which contains fuzzy positioning and precise positioning. This LP-VLP system has an extremely low modification cost and deployment cost, and the receiver uses a cell phone as the receiver, which has certain practical value. In this paper, experiments are conducted based on this design, which show that the recognition rate is as high as 96.4% in fuzzy positioning and the average minimum error in precise positioning is 6.5 cm, which achieves centimeter-level positioning accuracy. It proves that this LP-VLP system has a certain feasibility.
However, this method has some shortcomings and areas that can be improved. For example, the location of each lamp is coded to create a graphic code, which requires that each graphic code is unique, and once damaged, it will be difficult to replace. To address this problem, we believe that we can use laser engraving on lamp shades to modify the flat panel lamp: when the flat panel lamp needs to be replaced, the original lamp shade can continue to be used, avoiding unnecessary waste. In the experiment, we realized the “pseudo-two-light positioning” algorithm and the expected positioning effect was achieved. In the future, we can also design the “pseudo-three-light positioning” and select three points on the flat lamp for calculations, to further improve the positioning accuracy.