OCC-based forward error correction coding and decoding method for vehicle-to-vehicle communication system
By adopting the forward error correction compilation and decoding method of QC-LDPC fast encoding and LBP decoding algorithm in the OCC system, the problem of high bit error rate in OCC technology is solved, the reliability of the communication system is improved, and it is suitable for inter-vehicle communication in autonomous driving scenarios.
Patent Information
- Application Number
- CN202411597721.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
AI Technical Summary
The existing OCC technology has a high bit error rate in visible light channels with large transmission interference, resulting in a reduced reliability of the communication system and cannot effectively solve the safety hazards of inter-vehicle communication in autonomous driving scenarios.
The forward error correction compilation and decoding method of vehicle-to-vehicle communication system is adopted, and the QC-LDPC fast encoding algorithm and LBP decoding algorithm are used to increase redundant information and perform error correction processing, reduce the system bit error rate and improve the reliability of the communication system.
It effectively reduces the bit error rate of the OCC system, improves the reliability of the communication system, and is suitable for inter-vehicle communication in autonomous driving scenarios, solving the problems of spectrum resource limitation and electromagnetic interference.
Smart Images

Figure CN119561556A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of visible light communication and intelligent transportation, and in particular relates to an OCC system image encoding and decoding method based on forward error correction code. Background Art
[0002] With the continuous improvement of global living standards, the continuous integration of new-generation information technology and the automotive industry has led to the vigorous development of the Intelligent Transportation System (ITS). Technologies such as artificial intelligence, big data, and the Internet of Things have injected new vitality into the automotive industry. As an important strategic point for the development of the automotive industry at this stage, autonomous driving technology has put forward more stringent requirements on the reliability of information transmission and anti-interference capabilities of the communication system. The data throughput, latency, and robustness of the communication system have a significant impact on personal safety during autonomous driving. In order to ensure personal safety during autonomous driving, it is necessary to coordinate and complement multiple communication technologies. When the autonomous driving scenario is applied to sections of urban traffic congestion, if the communication between vehicles is mainly based on radio frequency technology, it will be limited by spectrum resources and generate electromagnetic interference, resulting in increased latency and reduced reliability of the communication system, and there are many safety hazards.
[0003] Optical Camera Communication (OCC) is a wireless communication technology that uses LED light signals as information carriers at the transmitter end, free space as the transmission channel, and high-speed cameras as signal receivers. It transmits information through the brightness changes of LED lights at the transmitter end and real-time shooting and reception by high-speed cameras. Compared with communication technologies based on radio frequency, OCC has many advantages such as not occupying additional spectrum resources, no electromagnetic radiation, being green and environmentally friendly, and not interfering with other communication technologies.
[0004] Nowadays, the new energy vehicle industry is booming. Some car manufacturers rely on the visual algorithms of on-board cameras to simulate the role of human eyes in actual driving scenarios, and some car manufacturers use lidar as a sensor to assist in autonomous driving. It can be seen that the autonomous driving solution is not the only one. Compared with the first two assisted driving solutions, OCC uses car headlights or taillights as the carrier for information transmission, and uses on-board high-speed cameras as information receivers. The sending and receiving ends can be synchronized through the satellite timing system. There is no need to equip multiple like lidars, nor is there a need to collect massive traffic road data like pure visual algorithm solutions. OCC is more used in urban traffic congested sections to solve problems such as wireless communication occupying spectrum resources.
[0005] Although OCC technology has many advantages and is considered a potential technology for autonomous driving, it is still in the laboratory stage. Research on related technologies is not mature enough, and many algorithm applications are still in the computer simulation stage. In visible light channels with large transmission interference, only OOK modulation is used. When faced with some strong light interference or LED light failures that cannot transmit information, it will cause partial loss or misjudgment of transmitted information, resulting in an increase in the bit error rate and reduced reliability of the communication system. At present, research on OCC technology is more focused on decoding and tracking, and research on OCC coding technology needs to be deepened. Therefore, it is urgent to study a coding technology suitable for visible light communication to improve the reliability of the OCC system and reduce the bit error rate of the system. Summary of the invention
[0006] In order to overcome the problems existing in the prior art, the present invention provides a forward error correction encoding and decoding method for a vehicle-to-vehicle communication system based on OCC.
[0007] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions:
[0008] The forward error correction encoding and decoding method of the vehicle-to-vehicle communication system based on OCC first transmits the data source code to the transmitter encoder through the vehicle PC, and the QC-LDPC fast encoding algorithm is used to encode the obtained data source code, increase redundancy and obtain the encoding information, and then the target is driven by the amplification circuit to transmit the encoding information consisting of a row and b columns, that is, a×b LED lights that can light up and extinguish independently; the receiving end uses the sCMOS camera to shoot the target LED array in real time to obtain an image containing the LED light array, sets the image binarization threshold, and uses the edge image processing algorithm to obtain the center coordinates and average grayscale value of each LED light. After data preprocessing and normalization, it is transmitted to the receiving end decoder, and the LBP decoding algorithm is used to decode the processed data in real time, remove the check vector in the encoding information, and correct the bit errors caused by various interference factors during the transmission process, so as to reduce the system bit error rate and improve the system reliability. The specific steps of this method are as follows:
[0009] Step 1: Build a fast encoding algorithm
[0010] Process (1) constructs the check matrix H:
[0011] When using the check matrix H for fast coding, H·G T =0 equation to obtain the generator matrix G, then use the generator matrix G and the information source code to multiply to obtain the coded information, design a check matrix H with a quasi-bidiagonal structure, and set the LDPC code to a quasi-cyclic structure, so that the generator matrix G is no longer needed when performing LDPC coding, reducing the computational complexity;
[0012] The basis for constructing the check matrix is the basis matrix H b , expressed as:
[0013]
[0014] In the above formula, H b1 Corresponding to the information bit, H b2 Corresponding to the check bit, where H b1 It is necessary to ensure that the matrix does not have a four-ring structure;
[0015] H b2 In the above formula, it can be divided into h b and H' b2 Two parts:
[0016]
[0017] Afterwards, use p i,j To represent the permutation matrix, the basis matrix H b The expansion of p(H b ), the check matrix H of QC-LDPC is expressed as:
[0018]
[0019] The size of the permutation matrix is z×z, and the two subscripts m and n are represented by m=z×mb, n=z×nb. When generating the check matrix H, H b The element "1" in the matrix is replaced by the unit matrix, and the element "0" is replaced by the zero matrix. The size of the unit matrix and the zero matrix are both z×z. When the matrix H b After all elements in are replaced, its size becomes m×n; b The values before replacement are shifted to the identity matrix after replacement to obtain the check matrix H to be constructed;
[0020] Process (2) calculates the check vector based on the check matrix H and the information source code:
[0021] The fast encoding algorithm is implemented using the check matrix H obtained in process (1). The information source code vector is:
[0022] s=[s1 s2 … s k ]
[0023] The check vector is:
[0024] p=[p1 p2 … p M ]
[0025] Then the coded information vector is [sp], and its vector length is N=K+M, where K is the length of the information vector and M is the length of the check vector. The coding part can be divided into the following two parts:
[0026] First, the check equation H·c between the check matrix H and the coded information vector c is T =0, get the check vector p1 T ;
[0027] Secondly, according to the check vector p1 T Recursive calculation can get p2 T 、p3 T , and finally get p M T ; The specific implementation process is as follows:
[0028] From the verification equation H·c T =0, after expanding the check matrix and the coded information, we get:
[0029]
[0030] The matrix operation shift expansion is:
[0031]
[0032] Simplifying the above formula, we get p1 T for:
[0033]
[0034] According to the above formula, we can further get p1 T for:
[0035]
[0036] Then p1 T Substituting into the verification equation we get:
[0037]
[0038] Similarly, p1 T Substituting into the verification equation:
[0039]
[0040] And so on:
[0041]
[0042] We get p = [p1 p2 … p M ], the encoded information is represented as:
[0043] c=[s1 s2 … s4 p1 p2 … p3]
[0044] Then determine the verification equation H·c T =0 is true. In the simulation algorithm, modulo-2 addition is used, which is represented by XOR operation. When two binary bits are added, if the two binary values are the same, the result is 0; if they are different, the result is 1. When the matrix is multiplied, if a non-zero matrix is obtained and the check equation is not satisfied, it means that the encoding has failed and the check vector p needs to be regenerated for encoding until the check equation H·c is satisfied. T =0;
[0045] Step 2: Simulate the QC-LDPC fast coding algorithm to compare and determine various parameters to make it suitable for the OCC system:
[0046] Process (1) Setting different code lengths for data simulation:
[0047] In step 1, the check matrix H and the encoding method have been constructed. According to the different values of QC-LDPC code length in the IEEE802.16e standard, code lengths of 576, 960, 1152, 1536, 1920, and 2304 are selected for simulation. The shortest code length given in the standard is 576, and the longest code length is 2304. In order to control a single variable, other parameters such as code rate, signal-to-noise ratio, and normalization factor remain the same. According to the different code lengths, two groups are divided for comparison. The first three code lengths are short code groups, and the last three are long code groups. The influence of code length on bit error rate is simulated and observed. When the code rate is 1 / 2, the simulation finds that the bit error rate of code length 576 is not much different from that of other code lengths. The computational complexity of code length 576 during encoding is significantly reduced, and the communication coding delay is minimized, which is suitable for the OCC system. Finally, the code length suitable for the system is determined to be 576 through simulation.
[0048] Process (2) Simulate and compare the impact of different bit rates on the bit error rate of the visible light camera system:
[0049] In the QC-LDPC coding parameters of 802.16e, three code rate standards are provided, namely 1 / 2, 2 / 3, and 3 / 4; the three code rates correspond to different base matrices, and the coding operation complexity and error correction capability corresponding to different base matrices are different. In the fast coding algorithm, the value of the base matrix is changed in accordance with the QC-LDPC standard;
[0050] When the code rate R = 1 / 2:
[0051]
[0052] Matrix row length m H =12, column length n H=24, the code rate 1 / 2 represents the ratio of the length of the check vector in the coded information to the length of the information source code. The coding basis matrix is designed to ensure that the rows of the model matrix are arranged as [0, 2, 4, 11, 6, 8, 10, 1, 3, 5, 7, 9] so that the continuous rows will not intersect, thereby improving the decoding throughput and the computational efficiency in the layered decoding architecture. When the code rate is 1 / 2, the code length has little effect on the system reliability and can adapt to the code length with a small amount of computation.
[0053] When the code rate R = 2 / 3:
[0054]
[0055] Matrix row length m H =8, column length n H =24, code rate 2 / 3 represents the ratio of the length of the check vector in the coded information to the length of the source code of the information. The design of the coding basis matrix makes the model matrix rows arranged as [0,3,6,1,4,7,2,5], and the consecutive rows will not intersect. In some layered decoding architectures, it can be used to improve the decoding throughput; for short code groups with code lengths of 576, 960, and 1152, the bit error rate is relatively large, and the bit error rate is relatively high when the code rate is 2 / 3. The long code groups with code lengths of 1536, 1920, and 2304 have little effect on the bit error rate. The longer the code length, the greater the computational complexity and the greater the system delay. Therefore, code rate 2 / 3 is not suitable for the OCC system;
[0056] When the code rate R = 3 / 4:
[0057]
[0058] Matrix row length m H =6, column length n H =24;
[0059] After comparing the simulation results, it is found that the bit error rate of the coding is higher when the code rate is 3 / 4 and 2 / 3, which is only one order of magnitude lower than when no error correction coding is added, but the system delay increases by hundreds of times. When the code rate is 1 / 2, the bit error rate is reduced by 3 orders of magnitude, which has little effect on the system delay and is suitable for the OCC system. Therefore, the code rate is selected as 1 / 2;
[0060] Process (3) simulates and compares the impact of different normalization factor parameters on the system bit error rate:
[0061] Same as process (1) and process (2), only the value of the normalization factor parameter is changed to ensure the uniqueness of the variable. In order to simplify the simulation steps and improve the efficiency of the simulation, the parameters in process (1) and process (2) use the optimal values obtained by simulation. The code length is 576 and the code rate is 1 / 2. Gaussian white noise is added to the visible light communication system model to simulate the noise interference of the visible light channel, which simplifies the number of normalization factor simulations.
[0062] In simulation, the probability density function of Gaussian noise obeys the normal distribution of noise; Gaussian distribution, denoted by N(μ,σ 2 ), where μ is the mean (mathematical expectation) of the Gaussian distribution, σ 2 is the variance of the Gaussian distribution. When μ=0, σ 2 =1, the distribution is called the standard normal distribution; the one-dimensional probability density of the Gaussian distribution is expressed as:
[0063]
[0064] By comparing the bit error rates through simulation, the optimal normalization factor is obtained, which minimizes the system simulation bit error rate. The final simulation determines that the code length suitable for the system is 576, the code rate is 1 / 2, and the normalization factor is 0.8. When different iteration times are selected for simulation, the bit error rate shows an obvious upward trend from 1 to 5 rounds of iterative simulation. When the iteration number is 5 or more, the system bit error rate tends to be stable, so the iteration number is selected as 5;
[0065] Step 3: Apply canny edge detection and image processing to extract the average grayscale value of the LED light
[0066] Process (1) filters and binarizes the image:
[0067] First, after the receiving camera captures the image transmitted in real time by the transmitter, a complete QC-LDPC code group is obtained based on the position information of the LED light array at the frame header and frame tail. A complete code group contains 576 information bits and the code rate is 1 / 2, so the effective information is 288 bits. Salt and pepper filtering is performed on each group of images to remove the noise caused by ambient light interference and reflection of the matrix panel at the transmitter during the free space optical channel transmission process; then the denoised image is binarized, and the entire image is looped through. The number of pixels in the image is set to cnt, and the grayscale values of all pixels are accumulated to obtain sum, and the threshold for binary judgment is set. For each received image, the grayscale value greater than val is set to 255, and the grayscale value less than val is set to 0 according to the average grayscale value of the image, so that the grayscale value of the entire image is only 0 and 255, thereby realizing the binarization of the image:
[0068] Process (2) determines the position of each LED light in the image, performs an opening operation on the image, first erodes and then dilates it, and sets an 8×8 convolution kernel:
[0069]
[0070] The above convolution kernel is used to corrode the image, which is expressed as:
[0071]
[0072] The above expression is that B structure corrodes A. An origin needs to be defined in B. The process of B moving is consistent with the process of convolution kernel moving. When the origin of B is translated to the pixel (x, y) of the receiving end image A, if B is at (x, y) and is completely contained in the overlapping area of the receiving end image A, that is, the values of image A corresponding to the element positions with a value of 1 in B are all 1, then the pixel (x, y) corresponding to the output image is assigned a value of 1, otherwise it is assigned a value of 0; thus completing the image corrosion operation, the small corners of the LED lamp outline in the image can be eliminated, making the edge of the LED lamp smoother, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp;
[0073] Then, the receiving end image is dilated. Dilation will enlarge the target area, merge the background points that touch the target area into the target object, and expand the target boundary outward. It is expressed as:
[0074]
[0075] The above formula is expressed as expanding A with structure B, and translating the origin of structure element B to the image pixel (x, y) position. If the intersection of B and A at the image pixel (x, y) is not empty, that is, at least one of the image values corresponding to the element position of 1 in B is 1, then the pixel (x, y) corresponding to the output image is assigned 1, otherwise the value is assigned 0. In this way, the image expansion operation is completed, and the small holes inside the outline of the LED lamp can be eliminated, making the outline of the LED lamp fuller, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp;
[0076] After the opening operation is completed, the image is closed. Unlike the opening operation, the closing operation first dilates the receiving end image and then erodes it to achieve a further filtering effect.
[0077] Process (3) determines the center coordinates of each LED light:
[0078] Process (2) can filter out most of the small noise points in the image, but it is difficult to filter out some large noise points, such as the sunlight noise points reflected by the matrix panel at the transmitting end, by relying on process (2) alone. The canny edge detection algorithm is used to detect the contours of all light points in the image, and then the specific position of the center of each LED lamp is calculated based on the row and column spacing of the frame header and frame tail image and the first-order moment of the LED contour. The steps of the canny edge detection algorithm are as follows:
[0079] First, Gaussian blur is used for further denoising. The value of the center point of the denoising convolution kernel is determined by the mean value of the surrounding pixels. Then, the points at different positions in the convolution kernel are weighted according to the Gaussian distribution. The two-dimensional Gaussian distribution formula is as follows:
[0080]
[0081] Substitute the convolution kernel into the above two-dimensional Gaussian distribution formula according to the (x, y) coordinates, σ = 1, to obtain a convolution kernel with Gaussian distribution characteristics. The sum of the weights of all points in the convolution kernel is 1. The weight value of each point in the convolution kernel needs to be divided by the sum of the weights of all points to obtain the Gaussian convolution kernel for further denoising of the image.
[0082] To perform edge detection, image gradient information is required. The image edge is determined based on the image gradient amplitude and gradient direction. The Sobel operator is used to calculate the gradient amplitude and gradient direction of the image. The amplitude gradient and direction gradient are as follows:
[0083]
[0084] Among them, G x represents the horizontal gradient amplitude, G y Represents the vertical gradient amplitude, G is the gradient amplitude, and θ is the directional gradient. After obtaining the gradient amplitude and gradient direction of the image, the maximum value suppression operation is performed on the image edge. In non-maximum value suppression, the gradient direction is an undirected straight line, that is, both the positive and negative sides are the gradient direction, and the gradient direction is divided into four parts:
[0085] Vertical gradient direction: (0,22.5]∪(-22.5,0]∪(157.5,180]∪(-180,157.5];
[0086] 45° gradient direction: [22.5, 67.5) ∪ [-157.5, -112.5);
[0087] Horizontal gradient direction: [67.5, 112.5] ∪ [-112.5, -67.5];
[0088] 135° gradient direction: (112.5, 157.5] ∪ [-67.5, -22.5];
[0089] Then, double-threshold boundary tracking is performed. By selecting strong and weak thresholds, points with gradient amplitudes lower than the weak threshold are set to 0, and those greater than the strong threshold are retained and marked as 255. For points with gradient amplitudes greater than the weak threshold but less than the high threshold, it is determined whether there are points greater than the strong threshold in its 8-neighborhood. If so, the pixel is retained and the value is set to 255. If not, the value is set to 0.
[0090] After obtaining the outline of the LED light in the image, calculate the number of pixels with a value of 255 within the outline and set the threshold C value =80, less than C value The pixel value inside the contour is set to 0, which is greater than C valueThe pixel values within the outline remain unchanged, thereby removing the small noise points that were not filtered out by the previous filtering, and traversing the entire image to count the number of LED light outlines at the beginning and end of the frame L count , calculate the average distance of the LED lights in each column of the frame head and the average distance of each row of the frame tail, then calculate the first-order moment of the contour to obtain the center coordinates of the 8 LED lights in the first row [LED R_x1 ,LED R_y1 ],[LED R_x2 ,LED R_y2 ],…[LED R_x8 ,LED R_y8 ] and the center coordinates of the first row of 8 LED lights [LED L_x1 ,LED L_y1 ],[LED L_x2 ,LED L_y2 ],…[LED L_x8 ,LED L_y8 ], and then the center coordinates of the 64 LED lights are calculated from the average row and column distances obtained from the frame header and frame tail images. In the transmission of each complete QC-LDPC code group, that is, 9 images, the positions of the 64 lights are the same. According to the center coordinates of the LED lights and the average area of the LED light outlines at the frame header and frame tail, the average grayscale value of the pixels around each LED light area is calculated. The calculation radius is 30 pixels long. After the calculation is completed, the average grayscale value of the 64 LED light positions is obtained. According to the average grayscale value of the entire image, it is judged whether the LED light is on or off, and the effect of image filtering is judged. The number of bright ones is counted and recorded as M count , judge L count With M count Are they the same? If they are the same, it means that the number of LED lights is correctly judged. If they are different, it means that the number of LED lights is wrong. The image is filtered again; then the average grayscale value of the 64 LED lights is normalized to facilitate subsequent LBP decoding. The normalization formula is as follows:
[0091]
[0092] Among them, X norm is the value obtained after normalization, X max Indicates the maximum value of the average grayscale of the LED light in this frame image, X min represents the minimum value of the average grayscale, and X represents the unnormalized average grayscale value of the LED light. The above formula maps the original average grayscale value of [0,255] to [-1,1] to obtain the normalized average grayscale value, which is convenient for subsequent LBP decoding;
[0093] Step 4: Implementation of LBP decoding algorithm:
[0094] In step 2, various encoding and decoding parameters have been determined, and the number of LBP decoding iterations is set to 5. The normalized average grayscale value obtained in step 3 is decoded using a layered decoding method; SPA operation is performed on each layer. The steps are as follows:
[0095]
[0096] Checkpoint update:
[0097]
[0098] Variable node update:
[0099]
[0100] Posterior probability information update:
[0101]
[0102] Among them, d is the normalization factor, v j is the jth variable node, c i is the i-th check node, is the check node c i Passed to variable node v j Information, is the variable node v j Passed to the check node c i The information of the SPA algorithm is obtained by using the LBP algorithm. The check matrix H is divided into several sub-layers in the horizontal direction. Each layer is decoded by SPA separately. After decoding each layer, new check information is obtained. The check information of this layer is superimposed on the posterior information of the previous iteration as the updated posterior information of this round. The updated posterior information of the upper layer is used in the next decoding. The convergence speed of the LBP decoding algorithm is twice that of the SPA algorithm. Each check node is set as a separate layer. In each layer, the variable node is updated:
[0103]
[0104] Checkpoint update:
[0105]
[0106] The posterior probability update rule changes to:
[0107]
[0108] After each round of LBP decoding algorithm, the posterior information obtained is taken as 1 if it is less than 0, and as 0 if it is greater than 0, thus completing the binary conversion, and performing a modulo-2 addition operation on the obtained binary information and the check matrix H:
[0109]
[0110] If the above formula is established, it means that the decoding result is correct. If the result of the above formula is a non-zero matrix, there is a code error, and the decoding is wrong. Continue to perform LBP decoding on the obtained posterior information. According to the simulation of the number of iterations in step 2, the number of iterations is set to 5, that is, the maximum number of iterations of the LBP decoding algorithm is 5; after the iteration is completed, the posterior information is converted into binary information, thereby realizing the operation of LBP decoding, correcting the code errors that occur during the transmission process, reducing the system's bit error rate, and improving the reliability of the communication system. Compared with the prior art, the beneficial effects of the present invention are:
[0111] The present invention provides a forward error correction coding method for a vehicle-to-vehicle communication system based on OCC. First, a check matrix of a QC-LDPC fast coding algorithm is constructed through step one. According to the check matrix, an information source code can be directly encoded. Then, specific parameters of the coding algorithm are determined by simulation in step two to make it suitable for the OCC system. After the transmitting end sends the coded information through a visible light channel to the receiving end, the receiving end image is filtered, information recognition and other processing are performed to obtain an average grayscale value of an LED lamp in the image. After normalization, the LBP decoding algorithm in step four is performed. The check nodes and variable nodes are updated separately at each layer, thereby reducing the complexity of the algorithm and improving the decoding efficiency. Afterwards, the obtained a posteriori information is converted into binary information to complete the decoding, thereby reducing the system bit error rate and improving the reliability of information transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] The present invention will be further described below in conjunction with the accompanying drawings:
[0113] Figure 1 A schematic diagram of an OCC system application scenario provided by the present invention.
[0114] Figure 2 The present invention provides a forward error correction encoding and decoding method for a vehicle-to-vehicle communication system based on OCC
[0115] Overall flow chart.
[0116] Figure 3 The figure is a schematic diagram of base matrix displacement in the process of constructing the check matrix involved in step 1 of the method.
[0117] Figure 4 The schematic diagram of a complete QC-LDPC code group receiving end image obtained in step three of this method.
[0118] Figure 5 It is the binary source code information obtained after the LBP decoding algorithm in step 4 corrects the error of the LED average gray value. DETAILED DESCRIPTION
[0119] like Figure 2 The figure shows the overall flow chart of the forward error correction encoding and decoding method of the OCC-based vehicle-to-vehicle communication system of the present invention. The vehicle-mounted PC sends the information source code to the encoder for QC-LDPC fast encoding. The encoded information uses infrared light with a wavelength of 808nm as the information carrier and is photographed in real time by the receiving end camera through the free space optical channel. The photographed image is identified and processed to obtain the average grayscale value of each LED lamp. After normalization, the encoded information is transmitted to the decoder. The decoder performs a sum-product decoding algorithm on each layer of the check matrix through the LBP decoding algorithm. The a posteriori information obtained in this round can be used in the next round, which reduces the computational complexity and improves the decoding efficiency. After a maximum of 5 rounds of iteration, the a posteriori information is obtained, which is converted into binary according to the positive and negative values of the information. After judging whether the decoded information is correct according to the check equation, the decoding operation is completed, thereby reducing the system bit error rate and improving the reliability of communication.
[0120] like Figure 1 As shown, in this embodiment, in order to increase the transmission rate of communication and reduce the impact of external interference light sources on the overall communication performance, the target LED array area adopts an 8×8 infrared light source with a wavelength of 808nm, which is conducive to extracting the LED light ROI area and the average grayscale value. The spacing between the LED lights is 3cm, and the captured image pixels are 1024×1024.
[0121] The present invention is described in detail below in conjunction with the accompanying drawings:
[0122] Step 1: Build a fast encoding algorithm
[0123] Process (1) constructs the check matrix H:
[0124] When using the check matrix H for fast coding, H·G T =0 equation to obtain the generator matrix G, and then use the generator matrix G and the information source code to multiply to obtain the coded information. The advantage is that the operation process is simple, but the disadvantage is that there are a lot of matrix operations in the process, which will cause excessive system delay. A check matrix H with a quasi-bidiagonal structure is designed, and the LDPC code is set to a quasi-cyclic structure, so that the generator matrix G is no longer needed when performing LDPC encoding, avoiding a lot of matrix operations, greatly reducing the computational complexity of encoding, and can be directly encoded through the check matrix, which is conducive to the hardware implementation of encoding;
[0125] The basis for constructing the check matrix is the basis matrix H b , expressed as:
[0126]
[0127] In the above formula, H b1 Corresponding to the information bit, H b2 Corresponding to the check bit, where H b1 It is necessary to ensure that the matrix does not have a four-ring structure. The existence of a four-ring structure will seriously weaken the performance of the LDPC code and generate erroneous coding information during fast encoding. The four-ring structure needs to be reduced during construction;
[0128] H b2 In the above formula, it can be divided into h b and H' b2 Two parts:
[0129]
[0130] Afterwards, use p i,j To represent the permutation matrix, the basis matrix H b The expansion of p(H b ), the check matrix H of QC-LDPC is expressed as:
[0131]
[0132] The size of the permutation matrix is z×z, and the two subscripts m and n are represented by m=z×mb, n=z×nb. When generating the check matrix H, H b The element "1" in the matrix is replaced by the unit matrix, and the element "0" is replaced by the zero matrix. The size of the unit matrix and the zero matrix are both z×z. When the matrix H b After all elements in are replaced, its size becomes m×n; b The value before replacement is shifted to the identity matrix after replacement to obtain the check matrix H to be constructed, such as Figure 3 As shown;
[0133] Process (2) calculates the check vector based on the check matrix H and the information source code:
[0134] The fast encoding algorithm is implemented using the check matrix H obtained in process (1). The information source code vector is:
[0135] s=[s1 s2 … s k ]
[0136] The check vector is:
[0137] p=[p1 p2 … p M ]
[0138] Then the coded information vector is [sp], and its vector length is N=K+M, where K is the length of the information vector and M is the length of the check vector. The coding part can be divided into the following two parts:
[0139] First, the check equation H·c between the check matrix H and the coded information vector c is T =0, get the check vector p1 T ;
[0140] Secondly, according to the check vector p1 T Recursive calculation can get p2 T 、p3 T , and finally get p M T ; The specific implementation process is as follows:
[0141] From the verification equation H·c T =0, after expanding the check matrix and the coded information, we get:
[0142]
[0143] The matrix operation shift expansion is:
[0144]
[0145] Simplifying the above formula, we get p1 T for:
[0146]
[0147] According to the above formula, we can further get p1 T for:
[0148]
[0149] Then p1 T Substituting into the verification equation we get:
[0150]
[0151] Similarly, p1 T Substituting into the verification equation:
[0152]
[0153] And so on:
[0154]
[0155] We get p = [p1 p2 … p M ], the encoded information is represented as:
[0156] c=[s1 s2 … s4 p1 p2 … p3]
[0157] Then determine the verification equation H·c T =0 is true. In the simulation algorithm, modulo-2 addition is used, which is represented by XOR operation. When two binary bits are added, if the two binary values are the same, the result is 0; if they are different, the result is 1. When the matrix is multiplied, if a non-zero matrix is obtained and the check equation is not satisfied, it means that the encoding has failed and the check vector p needs to be regenerated for encoding until the check equation H·c is satisfied. T =0;
[0158] Step 2: Simulate the QC-LDPC fast coding algorithm to compare and determine various parameters to make it suitable for the OCC system:
[0159] Process (1) Setting different code lengths for data simulation:
[0160] In step 1, the check matrix H and the encoding method have been constructed. The OCC system has high requirements for delay and anti-interference ability of the communication system. The specific parameters of the encoding algorithm need to be determined to adapt to the OCC system. According to the different values of QC-LDPC code length in the IEEE802.16e standard, code lengths of 576, 960, 1152, 1536, 1920, and 2304 are selected for simulation respectively. The shortest code length given in the standard is 576 and the longest code length is 2304. In order to control a single variable, other parameters such as code rate, signal-to-noise ratio and normalization factor remain the same. According to the different code lengths, two groups are compared. The first three code lengths are short code groups and the last three are long code groups. The influence of code length on bit error rate is observed by simulation. When the code rate is 1 / 2, the bit error rate of code length 576 is not much different from that of other code lengths. The computational complexity of code length 576 during encoding is significantly reduced, and the communication coding delay is the smallest, which is suitable for the OCC system. Finally, the code length suitable for the system is determined to be 576 through simulation.
[0161] Process (2) Simulate and compare the impact of different bit rates on the bit error rate of the visible light camera system:
[0162] In the QC-LDPC coding parameters of 802.16e, three code rate standards are provided, namely 1 / 2, 2 / 3, and 3 / 4; the three code rates correspond to different base matrices, and the coding operation complexity and error correction capability corresponding to different base matrices are different. In the fast coding algorithm, the value of the base matrix is changed in accordance with the QC-LDPC standard;
[0163] When the code rate R = 1 / 2:
[0164]
[0165] Matrix row length m H=12, column length n H =24, the code rate 1 / 2 represents the ratio of the length of the check vector in the coded information to the length of the information source code. The coding basis matrix is designed to ensure that the rows of the model matrix are arranged as [0, 2, 4, 11, 6, 8, 10, 1, 3, 5, 7, 9] so that the continuous rows will not intersect, thereby improving the decoding throughput and the computational efficiency in the layered decoding architecture. When the code rate is 1 / 2, the code length has little effect on the system reliability and can adapt to the code length with a small amount of computation.
[0166] When the code rate R = 2 / 3:
[0167]
[0168] Matrix row length m H =8, column length n H =24, code rate 2 / 3 represents the ratio of the length of the check vector in the coded information to the length of the source code of the information. The design of the coding basis matrix makes the model matrix rows arranged as [0,3,6,1,4,7,2,5], and the consecutive rows will not intersect. In some layered decoding architectures, it can be used to improve the decoding throughput; for short code groups with code lengths of 576, 960, and 1152, the bit error rate is relatively large, and the bit error rate is relatively high when the code rate is 2 / 3. The long code groups with code lengths of 1536, 1920, and 2304 have little effect on the bit error rate. The longer the code length, the greater the computational complexity and the greater the system delay. Therefore, code rate 2 / 3 is not suitable for the OCC system;
[0169] When the code rate R = 3 / 4:
[0170]
[0171] Matrix row length m H =6, column length n H =24;
[0172] After comparing the simulation results, it is found that the bit error rate of the coding is higher when the code rate is 3 / 4 and 2 / 3, which is only one order of magnitude lower than when no error correction coding is added, but the system delay increases by hundreds of times. When the code rate is 1 / 2, the bit error rate is reduced by 3 orders of magnitude, which has little effect on the system delay and is suitable for the OCC system. Therefore, the code rate is selected as 1 / 2;
[0173] Process (3) simulates and compares the impact of different normalization factor parameters on the system bit error rate:
[0174] Same as process (1) and process (2), only the value of the normalization factor parameter is changed to ensure the uniqueness of the variable. In order to simplify the simulation steps and improve the efficiency of the simulation, the parameters in process (1) and process (2) use the optimal values obtained by simulation. The code length is 576 and the code rate is 1 / 2. Gaussian white noise is added to the visible light communication system model to simulate the noise interference of the visible light channel, which simplifies the number of normalization factor simulations.
[0175] In simulation, the probability density function of Gaussian noise obeys the normal distribution of noise; Gaussian distribution, denoted by N(μ,σ 2 ), where μ is the mean (mathematical expectation) of the Gaussian distribution, σ 2 is the variance of the Gaussian distribution. When μ=0, σ 2 =1, the distribution is called the standard normal distribution; the one-dimensional probability density of the Gaussian distribution is expressed as:
[0176]
[0177] By comparing the bit error rates through simulation, the optimal normalization factor is obtained, which minimizes the system simulation bit error rate. The final simulation determines that the code length suitable for the system is 576, the code rate is 1 / 2, the normalization factor is 0.8, and the number of iterations is 5. When different numbers of iterations are selected for simulation, the bit error rate shows an obvious upward trend from 1 to 5 rounds of iterative simulation. When the number of iterations is 5 or more, the system bit error rate tends to be stable, so the number of iterations is selected as 5;
[0178] Step 3: Apply canny edge detection and image processing to extract the average grayscale value of the LED light
[0179] Process (1) filters and binarizes the image:
[0180] like Figure 4 As shown, after the receiving camera captures the real-time transmitted image, the image is processed by salt and pepper filtering to remove the noise generated during the free space optical channel transmission. First, a complete QC-LDPC code group is obtained based on the LED light array position information at the frame header and frame tail. A complete code group contains 576 information bits, and the code rate is 1 / 2, so the effective information is 288 bits. Each group of images is processed by salt and pepper filtering to remove the noise generated by ambient light interference and reflection of the matrix panel at the transmitting end during the free space optical channel transmission; then the denoised image is binarized, and the entire image is looped through. Let the number of pixels in the image be cnt, and the grayscale values of all pixels are accumulated to obtain sum, and the threshold for binary judgment is set. For each image received, the grayscale value greater than val is set to 255 according to the average grayscale value of the image, and the grayscale value less than val is set to 0, so that the grayscale value of the entire image is only 0 and 255, thereby realizing the binarization of the image:
[0181] Process (2) determines the position of each LED light in the image, performs an opening operation on the image, first corrodes the image and then dilates it, and sets an 8×8 convolution kernel:
[0182]
[0183] The above convolution kernel is used to corrode the image. From the perspective of morphology, corrosion can make the target area smaller. In essence, it causes the boundary of the image to shrink, which can be used to eliminate small and meaningless targets. It is expressed as:
[0184]
[0185] The above expression is that B structure corrodes A. An origin needs to be defined in B. The process of B moving is consistent with the process of convolution kernel moving. When the origin of B is translated to the pixel (x, y) of the receiving end image A, if B is at (x, y) and is completely contained in the overlapping area of the receiving end image A, that is, the values of image A corresponding to the element positions with a value of 1 in B are all 1, then the pixel (x, y) corresponding to the output image is assigned a value of 1, otherwise it is assigned a value of 0; thus completing the image corrosion operation, the small corners of the LED lamp outline in the image can be eliminated, making the edge of the LED lamp smoother, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp;
[0186] Then, the receiving end image is dilated. Dilation will enlarge the target area, merge the background points that touch the target area into the target object, and expand the target boundary outward. This process is used to fill some holes in the target area and eliminate small particle noise contained in the target area, which is expressed as:
[0187]
[0188] The above formula is expressed as expanding A with structure B, and translating the origin of structure element B to the image pixel (x, y) position. If the intersection of B and A at the image pixel (x, y) is not empty, that is, at least one of the image values corresponding to the element position of 1 in B is 1, then the pixel (x, y) corresponding to the output image is assigned 1, otherwise the value is assigned 0. In this way, the image expansion operation is completed, and the small holes inside the outline of the LED lamp can be eliminated, making the outline of the LED lamp fuller, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp;
[0189] After the opening operation is completed, the image is closed. Different from the opening operation, the closing operation first dilates the receiving end image and then corrodes it, which can better eliminate the small protrusions and internal holes of the LED outline, and can reduce the noise left by the salt and pepper filter, making the LED outline fuller, which is conducive to subsequent edge detection and achieves the effect of further filtering;
[0190] Process (3) determines the center coordinates of each LED light:
[0191] Process (2) can filter out most of the small noise points in the image, but it is difficult to filter out some large noise points, such as the sunlight noise points reflected by the matrix panel at the transmitting end, by relying on process (2) alone. The canny edge detection algorithm is used to detect the contours of all light points in the image, and then the specific position of the center of each LED lamp is calculated based on the row and column spacing of the frame header and frame tail image and the first-order moment of the LED contour. The steps of the canny edge detection algorithm are as follows:
[0192] First, Gaussian blur is used for further denoising. The value of the center point of the denoising convolution kernel is determined by the mean value of the surrounding pixels. Then, the points at different positions in the convolution kernel are weighted according to the Gaussian distribution. The two-dimensional Gaussian distribution formula is as follows:
[0193]
[0194] Substitute the convolution kernel into the above two-dimensional Gaussian distribution formula according to the (x, y) coordinates, σ = 1, to obtain a convolution kernel with Gaussian distribution characteristics. The sum of the weights of all points in the convolution kernel is 1. The weight value of each point in the convolution kernel needs to be divided by the sum of the weights of all points to obtain the Gaussian convolution kernel for further denoising of the image.
[0195] To perform edge detection, image gradient information is required. The image edge is determined based on the image gradient amplitude and gradient direction. The Sobel operator is used to calculate the gradient amplitude and gradient direction of the image. The amplitude gradient and direction gradient are as follows:
[0196]
[0197]
[0198] Among them, G x represents the horizontal gradient amplitude, G y Represents the vertical gradient amplitude, G is the gradient amplitude, and θ is the directional gradient. After obtaining the gradient amplitude and gradient direction of the image, the maximum value suppression operation is performed on the image edge. In non-maximum value suppression, the gradient direction is an undirected straight line, that is, both the positive and negative sides are the gradient direction, and the gradient direction is divided into four parts:
[0199] Vertical gradient direction: (0,22.5]∪(-22.5,0]∪(157.5,180]∪(-180,157.5];
[0200] 45° gradient direction: [22.5, 67.5) ∪ [-157.5, -112.5);
[0201] Horizontal gradient direction: [67.5, 112.5] ∪ [-112.5, -67.5];
[0202] 135° gradient direction: (112.5, 157.5] ∪ [-67.5, -22.5];
[0203] Then, double-threshold boundary tracking is performed. By selecting strong and weak thresholds, points with gradient amplitudes lower than the weak threshold are set to 0, and those greater than the strong threshold are retained and marked as 255. For points with gradient amplitudes greater than the weak threshold but less than the high threshold, it is determined whether there are points greater than the strong threshold in its 8-neighborhood. If so, the pixel is retained and the value is set to 255. If not, the value is set to 0.
[0204] After obtaining the outline of the LED light in the image, calculate the number of pixels with a value of 255 within the outline and set the threshold C value =80, less than C value The pixel value inside the contour is set to 0, which is greater than C value The pixel values within the outline remain unchanged, thereby removing the small noise points that were not filtered out by the previous filtering, and traversing the entire image to count the number of LED light outlines at the beginning and end of the frame L count , calculate the average distance of the LED lights in each column of the frame head and the average distance of each row of the frame tail, then calculate the first-order moment of the contour to obtain the center coordinates of the 8 LED lights in the first row [LED R_x1 ,LED R_y1 ],[LED R_x2 ,LED R_y2 ],…[LED R_x8 ,LED R_y8 ] and the center coordinates of the first row of 8 LED lights [LED L_x1 ,LED L_y1 ],[LED L_x2 ,LED L_y2 ],…[LED L_x8 ,LED L_y8], and then the center coordinates of the 64 LED lights are calculated from the average row and column distances obtained from the frame header and frame tail images. In the transmission of each complete QC-LDPC code group, that is, 9 images, the positions of the 64 lights are the same. According to the center coordinates of the LED lights and the average area of the LED light outlines at the frame header and frame tail, the average grayscale value of the pixels around each LED light area is calculated. The calculation radius is 30 pixels long. After the calculation is completed, the average grayscale value of the 64 LED light positions is obtained. According to the average grayscale value of the entire image, it is judged whether the LED light is on or off, and the effect of image filtering is judged. The number of bright ones is counted and recorded as M count , judge L count With M count Are they the same? If they are the same, it means that the number of LED lights is correctly judged. If they are different, it means that the number of LED lights is wrong. The image is filtered again; then the average grayscale value of the 64 LED lights is normalized to facilitate subsequent LBP decoding. The normalization formula is as follows:
[0205]
[0206] Among them, X norm is the value obtained after normalization, X max Indicates the maximum value of the average grayscale of the LED light in this frame image, X min represents the minimum value of the average grayscale, and X represents the unnormalized average grayscale value of the LED light. The above formula maps the original average grayscale value of [0,255] to [-1,1] to obtain the normalized average grayscale value, which is convenient for subsequent LBP decoding;
[0207] Step 4: Implementation of LBP decoding algorithm:
[0208] In step 2, various encoding and decoding parameters have been determined, and the number of LBP decoding iterations is set to 5. The normalized average grayscale value obtained in step 3 is decoded, and a layered decoding method is adopted; the computational complexity and complexity of the probability domain BP algorithm are very high. The above-mentioned probability information of 0 and 1 is represented by the log-likelihood ratio, and the multiplication operation is converted into an addition operation to reduce the computational complexity. This decoding algorithm is called SPA, that is, the sum-product decoding algorithm. SPA operation is performed at each layer. The steps are as follows:
[0209]
[0210] Checkpoint update:
[0211]
[0212] Variable node update:
[0213]
[0214] Posterior probability information update:
[0215]
[0216] Where d is the normalization factor, v j is the jth variable node, c i is the i-th check node, is the check node c i Passed to variable node v j Information, is the variable node v j Passed to the check node c i The information of the SPA algorithm is obtained by using the LBP algorithm. The check matrix H is divided into several sub-layers in the horizontal direction. Each layer is decoded by SPA separately. After decoding each layer, new check information is obtained. The check information of this layer is superimposed on the posterior information of the previous iteration as the updated posterior information of this round. The updated posterior information of the upper layer is used in the next decoding. The convergence speed of the LBP decoding algorithm is twice that of the SPA algorithm. Each check node is set as a separate layer. In each layer, the variable node is updated:
[0217]
[0218] Checkpoint update:
[0219]
[0220] The posterior probability update rule changes to:
[0221]
[0222] After each round of LBP decoding algorithm, the posterior information obtained is 1 if it is less than 0, and 0 if it is greater than 0, thus completing the binary conversion, and performing a modulo-2 addition operation on the obtained binary information and the check matrix H:
[0223]
[0224] If the above formula is established, it means that the decoding result is correct. If the result of the above formula is a non-zero matrix, there is a code error and the decoding is wrong. Continue to perform LBP decoding on the obtained posterior information. According to the simulation of the number of iterations in step 2, the number of iterations is set to 5, that is, the maximum number of iterations of the LBP decoding algorithm is 5. After the iteration is completed, the posterior information is converted into binary information, thereby realizing the operation of LBP decoding, such as Figure 5As shown, the bit errors occurring during the transmission process are corrected, the bit error rate of the system is reduced, and the reliability of the communication system is improved. The bit errors during the transmission process are corrected by forward error correction coding, which can effectively improve the system reliability, does not occupy spectrum resources, is green and environmentally friendly, and has broad application prospects.
Claims
1. A forward error correction encoding and decoding method for a vehicle-to-vehicle communication system based on OCC, characterized in that: First, the data source code is transmitted to the transmitter encoder through the vehicle PC, and the QC-LDPC fast coding algorithm is used to encode the obtained data source code, increase redundancy and obtain the coded information, and then the target is driven by the amplification circuit to transmit the coded information, which is composed of a row and b columns, that is, a×b LED lights that can light up and extinguish independently; the receiving end uses the sCMOS camera to shoot the target LED array in real time to obtain an image containing the LED light array, set the image binarization threshold, and use the edge image processing algorithm to obtain the center coordinates and average grayscale value of each LED light. After data preprocessing and normalization, it is transmitted to the receiving end decoder, and the LBP decoding algorithm is used to decode the processed data in real time, remove the check vector in the coded information, and correct the bit errors caused by various interference factors during the transmission process, so as to reduce the system bit error rate and improve the system reliability. The specific steps of this method are as follows: Step 1: Build a fast encoding algorithm Process (1) Construct the check matrix H: When using the check matrix H for fast coding, H·G T =0 equation to obtain the generator matrix G, then use the generator matrix G and the information source code to multiply to obtain the coded information, design a check matrix H with a quasi-bidiagonal structure, and set the LDPC code to a quasi-cyclic structure, so that the generator matrix G is no longer needed when performing LDPC coding, reducing the computational complexity; The basis for constructing the check matrix is the basis matrix H b , expressed as: In the above formula, H b1 Corresponding to the information bit, H b2 Corresponding to the check bit, where H b1 It is necessary to ensure that the matrix does not have a four-ring structure; H b2 In the above formula, it can be divided into h b and H' b2 Two parts: Afterwards, use p i,j To represent the permutation matrix, the basis matrix H b The expansion of p(H b ), the check matrix H of QC-LDPC is expressed as: The size of the permutation matrix is z×z, and the two subscripts m and n are represented by m=z×mb, n=z×nb. When generating the check matrix H, H b The element "1" in the matrix is replaced by the identity matrix, and the element "0" is replaced by the zero matrix. The size of the identity matrix and the zero matrix are both z×z. When the matrix H b After all elements in are replaced, its size becomes m×n; b The values before replacement are shifted to the identity matrix after replacement to obtain the check matrix H to be constructed; Process (2) calculates the check vector based on the check matrix H and the information source code: The fast encoding algorithm is implemented using the check matrix H obtained in process (1). The information source code vector is: s=[s1 s2…s k ] The check vector is: p=[p1 p2…p M ] Then the coded information vector is [sp], and its vector length is N=K+M, where K is the length of the information vector and M is the length of the check vector. The coding part can be divided into the following two parts: First, the check equation H·c between the check matrix H and the coded information vector c is T =0, get the check vector p1 T ; Secondly, according to the check vector p1 T Recursive calculation can get p2 T 、p3 T , and finally get p M T ; The specific implementation process is as follows: From the verification equation H·c T =0, after expanding the check matrix and the coded information, we get: The matrix operation shift expansion is: Simplifying the above formula, we get p1 T for: According to the above formula, we can further get p1 T for: Then p1 T Substituting into the verification equation we get: Similarly, p1 T Substituting into the verification equation: And so on: We get p = [p1 p2…p M ], the encoded information is represented as: c=[s1 s2 … s4 p1 p … Λ p3] Then determine the verification equation H·c T =0 is true. In the simulation algorithm, modulo-2 addition is used, which is represented by XOR operation. When two binary bits are added, if the two binary values are the same, the result is 0; if they are different, the result is 1. When the matrix is multiplied, if a non-zero matrix is obtained and the check equation is not satisfied, it means that the encoding has failed and the check vector p needs to be regenerated for encoding until the check equation H·c is satisfied. T =0; Step 2: Simulate the QC-LDPC fast coding algorithm to compare and determine various parameters to make it suitable for the OCC system: Process (1) Setting different code lengths for data simulation: In step 1, the check matrix H and the encoding method have been constructed. According to the different values of QC-LDPC code length in the IEEE802.16e standard, code lengths of 576, 960, 1152, 1536, 1920, and 2304 are selected for simulation. The shortest code length given in the standard is 576, and the longest code length is 2304. In order to control a single variable, other parameters such as code rate, signal-to-noise ratio, and normalization factor remain the same. According to the different code lengths, two groups are divided for comparison. The first three code lengths are short code groups, and the last three are long code groups. The influence of code length on bit error rate is simulated and observed. When the code rate is 1 / 2, the simulation finds that the bit error rate of code length 576 is not much different from that of other code lengths. The computational complexity of code length 576 during encoding is significantly reduced, and the communication coding delay is minimized, which is suitable for the OCC system. Finally, the code length suitable for the system is determined to be 576 through simulation. Process (2) Simulate and compare the impact of different bit rates on the bit error rate of the visible light camera system: In the QC-LDPC coding parameters of 802.16e, three code rate standards are provided, namely 1 / 2, 2 / 3, and 3 / 4; the three code rates correspond to different base matrices, and the coding operation complexity and error correction capability corresponding to different base matrices are different. In the fast coding algorithm, the value of the base matrix is changed in accordance with the QC-LDPC standard; When the code rate R = 1 / 2: Matrix row length m H =12, column length n H =24, the code rate 1 / 2 represents the ratio of the length of the check vector in the coded information to the length of the information source code. The coding basis matrix is designed to ensure that the rows of the model matrix are arranged as [0, 2, 4, 11, 6, 8, 10, 1, 3, 5, 7, 9] so that the continuous rows will not intersect, thereby improving the decoding throughput and the computational efficiency in the layered decoding architecture. When the code rate is 1 / 2, the code length has little effect on the system reliability and can adapt to the code length with a small amount of computation. When the code rate R = 2 / 3: Matrix row length m H =8, column length n H =24, code rate 2 / 3 represents the ratio of the length of the check vector in the coded information to the length of the source code of the information. The design of the coding basis matrix makes the model matrix rows arranged as [0,3,6,1,4,7,2,5], and the consecutive rows will not intersect. In some layered decoding architectures, it can be used to improve the decoding throughput; for short code groups with code lengths of 576, 960, and 1152, the bit error rate is relatively large, and the bit error rate is relatively high when the code rate is 2 / 3. The long code groups with code lengths of 1536, 1920, and 2304 have little effect on the bit error rate. The longer the code length, the greater the computational complexity and the greater the system delay. Therefore, code rate 2 / 3 is not suitable for the OCC system; When the code rate R = 3 / 4: Matrix row length m H =6, column length n H =24; After comparing the simulation results, it is found that the bit error rate of the coding is higher when the code rate is 3 / 4 and 2 / 3, which is only one order of magnitude lower than when no error correction coding is added, but the system delay increases by hundreds of times. When the code rate is 1 / 2, the bit error rate is reduced by 3 orders of magnitude, which has little effect on the system delay and is suitable for the OCC system. Therefore, the code rate is selected as 1 / 2; Process (3) simulates and compares the impact of different normalization factor parameters on the system bit error rate: Same as process (1) and process (2), only the value of the normalization factor parameter is changed to ensure the uniqueness of the variable. In order to simplify the simulation steps and improve the efficiency of the simulation, the parameters in process (1) and process (2) use the optimal values obtained by simulation. The code length is 576 and the code rate is 1 / 2. Gaussian white noise is added to the visible light communication system model to simulate the noise interference of the visible light channel, which simplifies the number of normalization factor simulations. In simulation, the probability density function of Gaussian noise obeys the normal distribution of noise; Gaussian distribution, denoted by N(μ,σ 2 ), where μ is the mean (mathematical expectation) of the Gaussian distribution, σ 2 is the variance of the Gaussian distribution. When μ=0, σ 2 =1, the distribution is called the standard normal distribution; the one-dimensional probability density of the Gaussian distribution is expressed as: By comparing the bit error rates through simulation, the optimal normalization factor is obtained, which minimizes the system simulation bit error rate. The final simulation determines that the code length suitable for the system is 576, the code rate is 1 / 2, and the normalization factor is 0.
8. When different iteration times are selected for simulation, the bit error rate shows an obvious upward trend from 1 to 5 rounds of iterative simulation. When the iteration number is 5 or more, the system bit error rate tends to be stable, so the iteration number is selected as 5; Step 3: Apply canny edge detection and image processing to extract the average grayscale value of the LED light Process (1) filters and binarizes the image: First, after the receiving camera captures the image transmitted in real time by the transmitter, a complete QC-LDPC code group is obtained based on the position information of the LED light array at the frame header and frame tail. A complete code group contains 576 information bits and the code rate is 1 / 2, so the effective information is 288 bits. Salt and pepper filtering is performed on each group of images to remove the noise caused by ambient light interference and reflection of the matrix panel at the transmitter during the free space optical channel transmission process; then the denoised image is binarized, and the entire image is looped through. The number of pixels in the image is set to cnt, and the grayscale values of all pixels are accumulated to obtain sum, and the threshold for binary judgment is set. For each received image, the grayscale value greater than val is set to 255, and the grayscale value less than val is set to 0 according to the average grayscale value of the image, so that the grayscale value of the entire image is only 0 and 255, thereby realizing the binarization of the image: Process (2) determines the position of each LED light in the image, performs an opening operation on the image, first erodes and then dilates it, and sets an 8×8 convolution kernel: The above convolution kernel is used to corrode the image, which is expressed as: The above expression is that B structure corrodes A. An origin needs to be defined in B. The process of B moving is consistent with the process of convolution kernel moving. When the origin of B is translated to the pixel (x, y) of the receiving end image A, if B is at (x, y) and is completely contained in the overlapping area of the receiving end image A, that is, the values of image A corresponding to the element positions with a value of 1 in B are all 1, then the pixel (x, y) corresponding to the output image is assigned a value of 1, otherwise it is assigned a value of 0; thus completing the image corrosion operation, the small corners of the LED lamp outline in the image can be eliminated, making the edge of the LED lamp smoother, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp; Then, the receiving end image is dilated. Dilation will enlarge the target area, merge the background points that touch the target area into the target object, and expand the target boundary outward. It is expressed as: The above formula is expressed as expanding A with structure B, and translating the origin of structure element B to the image pixel (x, y) position. If the intersection of B and A at the image pixel (x, y) is not empty, that is, at least one of the image values corresponding to the element position of 1 in B is 1, then the pixel (x, y) corresponding to the output image is assigned 1, otherwise the value is assigned 0. In this way, the image expansion operation is completed, and the small holes inside the outline of the LED lamp can be eliminated, making the outline of the LED lamp fuller, which is convenient for subsequent edge detection to determine the center coordinates of the LED lamp; After the opening operation is completed, the image is closed. Unlike the opening operation, the closing operation first dilates the receiving end image and then erodes it to achieve a further filtering effect. Process (3) determines the center coordinates of each LED light: Process (2) can filter out most of the small noise points in the image, but it is difficult to filter out some large noise points, such as the sunlight noise points reflected by the matrix panel at the transmitting end, by relying on process (2) alone. The canny edge detection algorithm is used to detect the contours of all light points in the image, and then the specific position of the center of each LED lamp is calculated based on the row and column spacing of the frame header and frame tail image and the first-order moment of the LED contour. The steps of the canny edge detection algorithm are as follows: First, Gaussian blur is used for further denoising. The value of the center point of the denoising convolution kernel is determined by the mean value of the surrounding pixels. Then, the points at different positions in the convolution kernel are weighted according to the Gaussian distribution. The two-dimensional Gaussian distribution formula is as follows: Substitute the convolution kernel into the above two-dimensional Gaussian distribution formula according to the (x, y) coordinates, σ = 1, to obtain a convolution kernel with Gaussian distribution characteristics. The sum of the weights of all points in the convolution kernel is 1. The weight value of each point in the convolution kernel needs to be divided by the sum of the weights of all points to obtain the Gaussian convolution kernel for further denoising of the image. To perform edge detection, image gradient information is required. The image edge is determined based on the image gradient amplitude and gradient direction. The Sobel operator is used to calculate the gradient amplitude and gradient direction of the image. The amplitude gradient and direction gradient are as follows: Among them, G x represents the horizontal gradient amplitude, G y Represents the vertical gradient amplitude, G is the gradient amplitude, and θ is the directional gradient. After obtaining the gradient amplitude and gradient direction of the image, the maximum value suppression operation is performed on the image edge. In non-maximum value suppression, the gradient direction is an undirected straight line, that is, both the positive and negative sides are the gradient direction, and the gradient direction is divided into four parts: Vertical gradient direction: (0,22.5]Υ(-22.5,0]Υ(157.5,180]Υ(-180,157.5]; 45° gradient direction: [22.5, 67.5)Υ[-157.5, -112.5); Horizontal gradient direction: [67.5, 112.5]Υ[-112.5, -67.5]; 135° gradient direction: (112.5, 157.5]Υ[-67.5, -22.5]; Then, double-threshold boundary tracking is performed. By selecting strong and weak thresholds, points with gradient amplitudes lower than the weak threshold are set to 0, and those greater than the strong threshold are retained and marked as 255. For points with gradient amplitudes greater than the weak threshold but less than the high threshold, it is determined whether there are points greater than the strong threshold in its 8-neighborhood. If so, the pixel is retained and the value is set to 255. If not, the value is set to 0. After obtaining the outline of the LED light in the image, calculate the number of pixels with a value of 255 within the outline and set the threshold C value =80, less than C value The pixel value inside the contour is set to 0, which is greater than C value The pixel values within the outline remain unchanged, thereby removing the small noise points that were not filtered out by the previous filtering, and traversing the entire image to count the number of LED light outlines at the beginning and end of the frame L count , calculate the average distance of the LED lights in each column of the frame head and the average distance of each row of the frame tail, then calculate the first-order moment of the contour to obtain the center coordinates of the 8 LED lights in the first row [LED R_x1 ,LED R_y1 ],[LED R_x2 ,LED R_y2 ],…[LED R_x8 ,LED R_y8 ] and the center coordinates of the first row of 8 LED lights [LED L_x1 ,LED L_y1 ],[LED L_x2 ,LED L_y2 ],…[LED L_x8 ,LED L_y8 ], and then the center coordinates of the 64 LED lights are calculated from the average row and column distances obtained from the frame header and frame tail images. In the transmission of each complete QC-LDPC code group, that is, 9 images, the positions of the 64 lights are the same. According to the center coordinates of the LED lights and the average area of the LED light outlines at the frame header and frame tail, the average grayscale value of the pixels around each LED light area is calculated. The calculation radius is 30 pixels long. After the calculation is completed, the average grayscale value of the 64 LED light positions is obtained. According to the average grayscale value of the entire image, it is judged whether the LED light is on or off, and the effect of image filtering is judged. The number of bright ones is counted and recorded as M count , judge L count With M count Are they the same? If they are the same, it means that the number of LED lights is correctly judged. If they are different, it means that the number of LED lights is wrong. The image is filtered again; then the average grayscale value of the 64 LED lights is normalized to facilitate subsequent LBP decoding. The normalization formula is as follows: Among them, X norm is the value obtained after normalization, X max Indicates the maximum value of the average grayscale of the LED light in this frame image, X min represents the minimum value of the average grayscale, and X represents the unnormalized average grayscale value of the LED light. The above formula maps the original average grayscale value of [0,255] to [-1,1] to obtain the normalized average grayscale value, which is convenient for subsequent LBP decoding; Step 4: Implementation of LBP decoding algorithm: In step 2, various encoding and decoding parameters have been determined, and the number of LBP decoding iterations is set to 5. The normalized average grayscale value obtained in step 3 is decoded using a layered decoding method; SPA operation is performed on each layer. The steps are as follows: Checkpoint update: Variable node update: Posterior probability information update: Among them, d is the normalization factor, v j is the jth variable node, c i is the i-th check node, is the check node c i Passed to variable node v j Information, is the variable node v j Passed to the check node c i The information of the SPA algorithm is obtained by using the LBP algorithm. The check matrix H is divided into several sub-layers in the horizontal direction. Each layer is decoded by SPA separately. After decoding each layer, new check information is obtained. The check information of this layer is superimposed on the posterior information of the previous iteration as the updated posterior information of this round. The updated posterior information of the upper layer is used in the next decoding. The convergence speed of the LBP decoding algorithm is twice that of the SPA algorithm. Each check node is set as a separate layer. In each layer, the variable node is updated: Checkpoint update: The posterior probability update rule changes to: After each round of LBP decoding algorithm, the posterior information obtained is taken as 1 if it is less than 0, and as 0 if it is greater than 0, thus completing the binary conversion, and performing a modulo-2 addition operation on the obtained binary information and the check matrix H: If the above formula is established, it means that the decoding result is correct. If the result of the above formula is a non-zero matrix, there is a code error and the decoding error. Continue to perform LBP decoding on the obtained posterior information. According to the simulation of the number of iterations in step 2, the number of iterations is set to 5, that is, the maximum number of iterations of the LBP decoding algorithm is 5. After the iteration is completed, the posterior information is converted into binary information, thereby realizing the LBP decoding operation, correcting the code errors that occur during the transmission process, reducing the system's bit error rate, and improving the reliability of the communication system.