Visible light imaging communication decoding method, device, equipment and medium
Through image acquisition and feature extraction processing, a data section matrix is generated, which solves the problem that frame rate changes affect the decoding accuracy and improves the decoding accuracy of visible light communication information.
Patent Information
- Application Number
- CN202010987956.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2040-09-18
AI Technical Summary
In the existing visible light imaging communication, the fringe width is unpredictable due to the change in frame rate, and the decoding accuracy of traditional decoding methods is not high, which affects the accuracy of communication information decoding.
The image acquisition device is used to collect images of light source objects, and generate a set of features to be processed through feature extraction, including one-dimensional pixel matrix and light source object stripe features, perform binarization processing, and convert it into a data bit matrix using a preset decoding algorithm, and with The received byte header matrix matches, generating a data section matrix.
It effectively solves the problem of incorrect decoding caused by frame rate changes and improves the accuracy of decoding of visible light imaging communication information.
Smart Images

Figure CN112164072B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visible light communication, and in particular to a visible light imaging communication decoding method, device, equipment and medium. Background Art
[0002] Visible light communication is a communication method that uses light in the visible light band as an information carrier to directly transmit optical signals in the air. It is green and low-carbon, has no electromagnetic interference and is low-cost. It has high speed and high confidentiality, and is conducive to the rapid construction of a secure information space that is resistant to interference and interception. At present, most cameras in the visible light imaging communication process use a rolling shutter mechanism to convert binary information into stripe information. However, due to the inevitable impact of frame rate changes on cameras on the market, the width of the stripes changes unpredictably. Traditional information decoding methods are mostly based on decoding through interval sampling schemes based on the premise that the stripe width remains unchanged. Therefore, the decoding accuracy will be affected by frame rate changes, resulting in low accuracy in imaging communication information decoding during the actual application of visible light communication. Summary of the invention
[0003] Embodiments of the present invention provide a visible light imaging communication decoding method, apparatus, computer equipment and storage medium to solve the problem of low accuracy in decoding visible light imaging communication information.
[0004] A visible light imaging communication decoding method, comprising:
[0005] An image acquisition device is used to acquire images of the light source object at the transmitting end to generate an image to be processed;
[0006] Extracting features from the image to be processed to generate a feature set to be processed, wherein the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features;
[0007] Binarize the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix;
[0008] Using a preset decoding algorithm to transform the target pixel matrix to generate a data bit matrix;
[0009] A byte header matrix sent by the transmitting end is received, and the byte header matrix is matched with the data bit matrix to obtain a data node matrix.
[0010] A visible light imaging communication decoding device, comprising:
[0011] An image acquisition module is used to acquire images of the light source object at the transmitting end by using an image acquisition device to generate an image to be processed;
[0012] A feature extraction module is used to extract features from the image to be processed and generate a feature set to be processed, wherein the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features;
[0013] A binarization processing module, used for performing binarization processing on the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix;
[0014] A conversion module, used to convert the target pixel matrix using a preset decoding algorithm to generate a data bit matrix;
[0015] The matching module is used to receive the byte header matrix sent by the transmitting end, match the byte header matrix with the data bit matrix, and obtain a data node matrix.
[0016] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned visible light imaging communication decoding method when executing the computer program.
[0017] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the visible light imaging communication decoding method is implemented.
[0018] The above-mentioned visible light imaging communication decoding method, device, computer equipment and storage medium use an image acquisition device to acquire an image of a light source object at the transmitting end to generate an image to be processed; extract features from the image to be processed to generate a feature set to be processed, which includes a one-dimensional pixel matrix and stripe features of the light source object; binarize the one-dimensional pixel matrix according to the stripe features of the light source object to obtain a target pixel matrix; use a preset decoding algorithm to transform the target pixel matrix to generate a data bit matrix; receive the byte header matrix sent by the transmitting end, match the byte header matrix with the data bit matrix, and obtain a data node matrix; solve the problem of incorrect decoding caused by frame rate changes, thereby ensuring the accuracy of visible light imaging communication information decoding. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 is a schematic diagram of an application environment of a visible light imaging communication decoding method according to an embodiment of the present invention;
[0021] Figure 2 is an example diagram of a visible light imaging communication decoding method in one embodiment of the present invention;
[0022] Figure 3 is another example diagram of a visible light imaging communication decoding method according to an embodiment of the present invention;
[0023] Figure 4 is another example diagram of a visible light imaging communication decoding method according to an embodiment of the present invention;
[0024] Figure 5 is another example diagram of a visible light imaging communication decoding method according to an embodiment of the present invention;
[0025] Figure 6 is another example diagram of a visible light imaging communication decoding method according to an embodiment of the present invention;
[0026] Figure 7 is a principle block diagram of a visible light imaging communication decoding device in one embodiment of the present invention;
[0027] Figure 8 is another principle block diagram of a visible light imaging communication decoding device in one embodiment of the present invention;
[0028] Fig. 9 is another principle block diagram of a visible light imaging communication decoding device in one embodiment of the present invention;
[0029] Fig.10 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] The visible light imaging communication decoding method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the visible light imaging communication decoding method is applied in a visible light imaging communication decoding system, and the visible light imaging communication decoding system includes: Figure 1The transmitter and the receiver shown in the figure communicate with each other through a network to solve the problem of low accuracy of visible light imaging communication information decoding. The transmitter includes a computer, a controller, a driving circuit, a light source object and a power module, wherein the transmitter can use LED lights, candles, light bulbs, etc. as light source objects. The receiver can be a CMOS sensor camera carried by daily use devices, wherein the daily use devices include smart phones, laptops, tablet computers, handheld Internet devices, multimedia devices, wearable devices or other types of terminal devices.
[0032] In one embodiment, if Figure 2 As shown, a visible light imaging communication decoding method is provided, and the method is applied in Figure 1 The receiving end in FIG. 1 is taken as an example to illustrate the process, which includes the following steps:
[0033] S10: Use an image acquisition device to acquire an image of the light source object at the transmitting end to generate an image to be processed.
[0034] Among them, LED lamps, candles, light bulbs, etc. can be used as light source objects at the transmitting end. The light source object is preferably an LED lamp that is illuminating. In a specific embodiment, the controller at the transmitting end controls the LED driving circuit to drive the LED to emit a light signal.
[0035] The image acquisition device may be a device with image acquisition function such as a camera, a scanner or an image acquisition card. In this embodiment, the image acquisition of the light source object at the transmitting end is performed by using a CMOS sensor camera at the receiving end to record the LED light to capture the light signal, then extracting the image frame by frame, intercepting the stripe distribution area from the image, generating an average frame for the R channel, the G channel and the B channel respectively and normalizing them, and then cropping the picture in units of a limited number of stripes to obtain the image to be processed. The CMOS sensor camera has a rolling curtain effect, and the high-frequency flickering light source is recorded as a stripe image.
[0036] S20: Extract features from the image to be processed to generate a feature set to be processed, where the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features.
[0037] Specifically, the image to be processed is first masked to extract the shape of the light source object (LED) in the image to be processed, and then the pixel values of each row in the light source object (LED) shape are obtained, and the pixel average value of each row of pixels is calculated to form a one-dimensional pixel row matrix. It can be understood that the one-dimensional pixel row matrix is composed of the pixel average value of each row of pixels in the light source object (LED) shape. Further, the one-dimensional pixel matrix is shifted left and right, and the new pixel matrix obtained after the left and right shifts is subtracted from the original one-dimensional pixel matrix. If the subtraction is a positive digit, 1 is taken, otherwise 0 is taken, so as to obtain the left digit matrix after left shift and the right digit matrix after right shift. Finally, the left digit matrix and the right digit matrix are XORed to generate an XOR matrix. The coordinates with a value of 1 in the XOR matrix constitute the light source object stripe features, wherein the light source object stripe features are also called the one-dimensional pixel matrix peak and valley coordinates.
[0038] S30: Binarize the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix.
[0039] Specifically, the region of interest (ROI) between the peaks and valleys in the stripe features of the light source object is read step by step, and the maximum and minimum values of each region of interest (ROI) between the peaks and valleys are obtained; and the minimum value in each region of interest (ROI) is compared with the preset background threshold T min If the minimum value in the region of interest (ROI) is less than the preset background threshold Tmin, the minimum value is determined as the new background threshold of the region of interest (ROI). min The background threshold T can be customized and adjusted according to the actual situation (such as LED light intensity). In this embodiment, the background threshold T min The preferred setting is 20. Furthermore, the difference between the maximum and minimum values in each region of interest (ROI) is compared with a preset specific threshold D diff If the difference between the maximum and minimum values in the region of interest (ROI) is greater than the preset specific threshold D diff , then the mean of the maximum and minimum values in the region of interest (ROI) is binarized. Similarly, a specific threshold D diff You can customize the settings and adjustments according to the actual situation (such as LED light intensity); finally, use T threshold The global binarization process is performed on each region of interest as a threshold to process the unbinarized region of interest (ROI) to obtain the target pixel matrix. It should be noted that the target pixel matrix is also a one-dimensional pixel matrix. threshold is a threshold that can be customized according to actual conditions. thresholdThe threshold value can be sufficient as long as it can distinguish the dark stripes from the light stripes. threshold The threshold is generally twice the background threshold, that is, T threshold The threshold is preferably 40.
[0040] S40: Using a preset decoding algorithm to transform the target pixel matrix to generate a data bit matrix.
[0041] The preset decoding algorithm is a custom algorithm for converting a target pixel matrix into a data bit matrix. In this embodiment, the target pixel matrix is a one-dimensional pixel matrix, and the preset decoding algorithm is an algorithm for decoding one-dimensional pixels into digital bits.
[0042] Specifically, the number of consecutive identical pixels in the target pixel matrix is extracted to generate an initial integer string. For example, if the first pixel and the second pixel in the target pixel matrix are consecutively identical for two pixels, the sixth pixel, the seventh pixel, and the eighth pixel are consecutively identical for three pixels, the tenth pixel, the eleventh pixel, the twelfth pixel, and the thirteenth pixel are consecutively identical for four pixels, the twentieth pixel, the twenty-first pixel, the twenty-second pixel, the twenty-third pixel, and the twenty-fourth pixel are consecutively identical for five pixels, and the thirty-first pixel, the thirty-second pixel, the thirty-third pixel, the thirty-fourth pixel, the thirty-fifth pixel, and the thirty-sixth pixel are consecutively identical for six pixels, then the generated initial integer string is (2, 3, 4, 5, 6).
[0043] Then, the initial integer string is sorted from small to large, and the Nth value (i.e., the Nth largest value) in the initial integer string is used as the pixel width. Among them, N can be customized according to the actual situation. In this embodiment, since there is interference in the collected graphics to be processed, there may be a small number of small interference values in the initial integer string. After many experiments, it is found that the fifth largest value has a good effect, and further adjustments can be made for different graphics to be processed. Therefore, N is preferably 5, that is, the fifth largest value in the initial integer string is used as the pixel width. It should be noted that the pixel width in this embodiment is the pixel width represented by the binary bit.
[0044] Furthermore, each integer in the initial integer string is divided by the pixel width to obtain a target integer string; finally, the first pixel in the target integer string is identified; if the first pixel is high, the odd integers in the target integer string are recorded as the first value, and the even integers in the target integer string are recorded as the second value; the target first value and the target second value are combined to generate a data bit matrix. In addition, if the first pixel is low, the odd integers in the target integer string are recorded as the third value, and the odd integers in the target integer string are recorded as the fourth value; the third value and the fourth value are combined to generate a data bit matrix. For example: assuming that five rows of pixels represent a binary bit, that is, the pixel width represented by a binary bit is 5, white stripes are represented by 1, and black stripes are represented by 0. If there is a white stripe with 15 rows of pixels, then after rounding, it can be obtained that the stripe represents 3 binary bits (that is, the white stripe can be expressed as 3 1s (1,1,1)); if the white stripe is 11 rows of pixels, then after rounding, it can be obtained that the stripe represents 2 binary bits (that is, the white stripe can be expressed as 2 1s (1,1)); if there is a black stripe with a width of 24 pixels, then after rounding, it can be obtained that the black stripe represents 5 binary bits (that is, the black stripe can be expressed as 5 zeros (0,0,0,0,0)).
[0045] S50: Receive the byte header matrix sent by the transmitter, match the byte header matrix with the data bit matrix, and obtain the data node matrix.
[0046] Among them, the byte header matrix is pre-encoded at the transmitting end. The transmitting end assigns an ID data code to each light source object (LED lamp), and enables the light source object (LED lamp) to continuously transmit ID data information through high-speed light-dark conversion. In a specific embodiment, in order for the receiving end to obtain a complete ID data information, it is necessary to add a header in front of the ID data information to clearly distinguish it from the ID data code. The header is the byte header matrix here. For example. If the byte header matrix received from the transmitting end is 10101, and the data bit matrix obtained according to step S40 is ... 1100101010001110010101000 ..., then after matching the byte header matrix with the data bit matrix, two matching matrices 10101 can be obtained, and 00011100 between the two matching matrices is the data node matrix.
[0047] In a specific embodiment, the transmitter transmits ID data information at a fixed frequency, including a byte header matrix (header) and payload data (data node matrix), and the receiver needs to decode at a synchronized rate to improve the decoding accuracy. The rate of the transmitter is specifically expressed as a pixel width represented by a binary bit at the receiver, and there are problems such as interference and camera frame rate changes during the propagation process. Therefore, the value of the pixel width represented by a binary bit will change, and the existing sampling decoding will generate interference accumulation, thereby reducing the decoding rate. The receiving end decoding in this embodiment first needs to correctly decode the binary bit, and then obtain the data node matrix, that is, the payload data, by matching the byte header matrix. This embodiment determines the pixel width represented by a binary bit and further determines the number of binary bits represented by each stripe by rounding, which will better synchronize the transmitter rate and perform decoding.
[0048] In this embodiment, an image acquisition device is used to acquire an image of a light source object at a transmitting end to generate an image to be processed; feature extraction is performed on the image to be processed to generate a feature set to be processed, the feature set to be processed includes a one-dimensional pixel matrix and stripe features of the light source object; the one-dimensional pixel matrix is binarized according to the stripe features of the light source object to obtain a target pixel matrix; a preset decoding algorithm is used to transform the target pixel matrix to generate a data bit matrix; a byte header matrix sent by the transmitting end is received, and the byte header matrix is matched with the data bit matrix to obtain a data node matrix; the problem of incorrect decoding caused by frame rate changes is solved, thereby ensuring the accuracy of decoding of visible light imaging communication information.
[0049] In one embodiment, if Figure 3 As shown, feature extraction is performed on the image to be processed to generate a feature set to be processed, which specifically includes the following steps:
[0050] S201: Convert the image to be processed into a binary image.
[0051] Specifically, the image to be processed is converted into a binary image by setting the grayscale value of the pixel on the image to be processed to 0 or 255, that is, the entire image to be processed presents an obvious black and white effect, that is, the grayscale image of 256 brightness levels is selected by an appropriate threshold to obtain a binary image that can still reflect the overall and local features of the image. In a specific embodiment, the cvThreshold function and cvAdaptiveThreshold function in OpenCV can be used to realize the binarization of the image to be processed.
[0052] S202: Using a morphological closing algorithm to remove small connected areas in the binary image to obtain a target image.
[0053] Among them, the morphological closing algorithm is an algorithm for basic image transformation, which is only performed on binary images. In mathematical morphology, the closing operation is defined as dilation followed by erosion. Where and represent erosion and dilation respectively. The morphological closing algorithm has the functions of filling the area of small black holes in white objects, connecting adjacent objects, the same structural element, multiple iterative processing, and smoothing its boundaries without significantly changing its area.
[0054] In a binary image, the smallest unit is a pixel. Each pixel has 8 adjacent pixels around it. There are two common adjacency relationships: 4-adjacency and 8-adjacency. There are 4 points in 4-adjacency, namely up, down, left, and right. There are 8 points in 8-adjacency, including the points in the diagonal position. If pixel points A and B are adjacent, we say that A and B are connected. If A and B are connected, and B and C are connected, then A and C are connected. Therefore, connected points form a region, and disconnected points form different regions. Such a set of all connected points is called a connected region.
[0055] Specifically, using a morphological closing algorithm to remove small connected areas in a binary image means using a morphological closing algorithm to remove noise points in a binary image, for example, using a morphological closing algorithm to remove connected domains with small black areas in a binary image.
[0056] S203: Perform mask processing on the target image to obtain the shape of the light source object.
[0057] Specifically, the target image may be masked using image processing software, thereby extracting the shape of the light source object from the target image. In this embodiment, the shape of the light source object is a shape of an LED lamp.
[0058] S204: Process each row of pixel values in the light source object shape to obtain a one-dimensional pixel matrix.
[0059] Specifically, after the light source object shape is obtained according to step S203, the values of each row of pixels in the light source object shape are summed and averaged to form a one-dimensional row pixel matrix. Optionally, opencv and C++ code operations can be used to process each row of pixel values in the light source object shape to obtain a one-dimensional pixel matrix. For example, if the pixel values of the first row in the light source object shape are 30, 36, 30, 36, 36, 30, then the average value of the first row is 33, and so on. The average values of the pixels in each row can be 33, 56, 89, 145, 232, 123, 67, 34, 0, 0, 35, 76, so a 1*12 one-dimensional pixel matrix [33, 56, 89, 145, 232, 123, 67, 34, 0, 0, 35, 76] is formed.
[0060] S205: Smoothing the one-dimensional pixel matrix to obtain a left-shift matrix and a right-shift matrix.
[0061] Specifically, the one-dimensional pixel matrix is first smoothed, and the purpose of smoothing the one-dimensional pixel matrix is to eliminate the noise components in the one-dimensional pixel matrix. Optionally, the one-dimensional pixel matrix can be smoothed by using a mean filter method, a median filter method, a Gaussian filter method or a bilateral filter method. Further, the smoothed one-dimensional pixel matrix is left-shifted and right-shifted respectively, and the matrices obtained after the left-shift and right-shift processes are compared with the original one-dimensional pixel matrix (subtraction process). After the subtraction, if the digit is positive, 1 is taken, if it is a negative digit, 0 is taken, and the overflow part is directly taken as 0, and finally a left-shift matrix and a right-shift matrix are obtained respectively.
[0062] S206: Perform XOR processing on the left-shift matrix and the right-shift matrix to obtain the stripe characteristics of the light source object.
[0063] Specifically, the left shift matrix and the right shift matrix in step S205 are XORed, and the coordinates of 1 in the matrix obtained after the XOR processing are used as the peak and valley coordinates of the one-dimensional pixel matrix, which are also called the stripe features of the light source object.
[0064] In this embodiment, the image to be processed is converted into a binary image; a morphological closing algorithm is used to remove small connected areas in the binary image to obtain a target image; the target image is masked to obtain the shape of the light source object; each row of pixel values in the light source object shape is processed to obtain a one-dimensional pixel matrix; the one-dimensional pixel matrix is smoothed to obtain a left-shift matrix and a right-shift matrix; the left-shift matrix and the right-shift matrix are XOR-ed to obtain the stripe features of the light source object; thereby improving the reliability and accuracy of the obtained stripe features of the light source object.
[0065] In one embodiment, if Figure 4 As shown, the one-dimensional pixel matrix is binarized according to the stripe characteristics of the light source object to obtain the target pixel matrix, which specifically includes the following steps:
[0066] S301: Read the regions of interest between the peaks and troughs in the stripe characteristics of the light source object one by one, and obtain the maximum and minimum values in each region of interest.
[0067] Among them, the region of interest is also called ROI (region of interest). In machine vision and image processing, the area to be processed is outlined from the processed image in the form of a box, circle, ellipse, irregular polygon, etc., which is called the region of interest. In this embodiment, the area between the peak and the trough is determined as the region of interest. According to step S206, the coordinate values of the peak and the trough have been determined. Therefore, according to the coordinate values of the peak and the trough, the region of interest between the peak and the trough can be directly read one by one. Further, after the region of interest is determined, the maximum and minimum values in each region of interest are obtained.
[0068] S302: If the minimum value in the region of interest is less than a preset background threshold, the minimum value is determined as a target background threshold.
[0069] Among them, the preset background threshold Tmin is a threshold value that is pre-customized according to actual conditions. The preset background threshold can be customized and adjusted according to actual conditions (such as: LED light intensity). It should be noted that the preset background thresholds corresponding to different regions of interest may be the same or different. In the present embodiment, the background threshold Tmin is preferably set to 20. Specifically, after the minimum value in each region of interest is determined according to step S301, the minimum value in each region of interest is compared with the corresponding preset background threshold. If the minimum value in the region of interest is less than the preset background threshold, the minimum value is determined as the target background threshold. If the minimum value in the region of interest is less than the preset background threshold, the preset background threshold is directly determined as the target background threshold.
[0070] S303: If the difference between the maximum value and the minimum value in the region of interest is greater than a first threshold, obtain the mean value between the maximum value and the minimum value in the region of interest, and determine the region of interest as a target region of interest.
[0071] The first threshold is a preset specific threshold D diff Specific threshold D diffThe settings and adjustments can be customized according to the actual situation (such as LED light intensity). Specifically, the maximum and minimum values in each region of interest are subtracted to obtain the difference between the maximum and minimum values in each region of interest; then, the difference between the maximum and minimum values in each region of interest is compared with the first threshold value. If the difference between the maximum and minimum values in the region of interest is greater than the first threshold value, the mean between the maximum and minimum values in the region of interest is obtained, that is, the maximum and minimum values are added and the average value is taken as the mean between the maximum and minimum values in the region of interest, and the region of interest is determined as the target region of interest. If the difference between the maximum and minimum values in the region of interest is less than or equal to the first threshold value, the next region of interest is read.
[0072] S304: Perform binarization processing on the target region of interest.
[0073] Specifically, the target region of interest is binarized. Binarization of the target region of interest is to set the grayscale value of the pixel on the target region of interest to 0 or 255, that is, to present an obvious black and white effect to the entire target region of interest, that is, to obtain a binary image that can still reflect the overall and local features of the image by selecting a grayscale image of 256 brightness levels through an appropriate threshold. In a specific embodiment, the cvThreshold function and cvAdaptiveThreshold function in OpenCV can be used to implement the binarization of the target region of interest.
[0074] S305: Perform global binarization processing on each region of interest using a target threshold to obtain a target pixel matrix.
[0075] The target threshold is T, which can be customized according to the actual situation. threshold The target threshold can be set as long as it can distinguish dark stripes from light stripes; the target threshold is generally twice the background threshold, and the target threshold is preferably 40. Specifically, the target threshold is used to perform global binarization processing on each region of interest to process the region of interest that is not binarized in step S304, and obtain a target pixel matrix.
[0076] In this embodiment, the regions of interest between the peaks and troughs in the stripe characteristics of the light source object are read one by one, and the maximum and minimum values in each region of interest are obtained; if the minimum value in the region of interest is less than the preset background threshold, the minimum value is determined as the target background threshold; if the difference between the maximum and minimum values in the region of interest is greater than the first threshold, the mean between the maximum and minimum values in the region of interest is obtained, and the region of interest is determined as the target region of interest; the target region of interest is binarized; each region of interest is globally binarized using the target threshold to obtain a target pixel matrix; thereby ensuring the accuracy of the obtained target pixel matrix.
[0077] In one embodiment, if Figure 5 As shown, a preset decoding algorithm is used to transform the target pixel matrix to generate a data bit matrix, which specifically includes the following steps:
[0078] S401: Extract the number of consecutive identical pixels in the target pixel matrix and generate an initial integer string.
[0079] Specifically, the number of consecutive identical pixels in the target pixel matrix is extracted to generate an initial integer string. For example, the one-dimensional matrix is 11111100011111111111110000000; the six consecutive 1s are recorded as 6, and so on. Then this one-dimensional matrix can be converted into an integer string of (6 3 13 6).
[0080] S402: Use the Nth value in the initial integer string as the pixel width.
[0081] Specifically, after the initial integer string is generated, the initial integer string is first sorted from small to large, and then the Nth value in the initial integer string is used as the pixel width. Preferably, in this embodiment, since there is interference in the collected graphics to be processed, there may be a small number of small interference values in the initial integer string. After multiple experiments, it is found that the fifth largest value in the initial integer string has a good effect, and further adjustments can be made for different graphics to be processed. Therefore, N is preferably 5, that is, the fifth largest value in the initial integer string is used as the pixel width.
[0082] Furthermore, since each integer in the initial integer string generated according to S401 is a decimal number, after the pixel width is determined, the pixel width needs to be converted into a binary number, that is, the pixel width in this embodiment is the pixel width represented by a binary bit.
[0083] S403: Divide each integer in the initial integer string by the pixel width to obtain a target integer string.
[0084] Specifically, each integer in the initial integer string is divided by the pixel width and rounded to obtain the target integer string. For example, if the pixel width is 5 and the initial integer string is (5, 4, 6, 13, 16, 11, 6, 5, 4), each integer in the initial integer string is divided by the pixel width 5 and rounded to obtain the target integer string (1, 1, 1, 3, 3, 2, 1, 1, 1).
[0085] S404: Identify the first pixel in the target integer string.
[0086] S405: If the first pixel is at a high level, the odd-numbered integers in the integer string are recorded as the first value, and the even-numbered integers in the integer string are recorded as the second value.
[0087] S406: Combine the first value and the second value to generate a data bit matrix.
[0088] Specifically, after determining the target integer string, identify the first pixel in the target integer string. If the first pixel is at a high level, record the odd-numbered integers in the integer string as the first value (for example, record the integers at odd positions in the integer string as p 1s (p is the value of the odd-numbered integers), and record the even-numbered integers in the integer string as the second value (for example, record the integers at even positions in the integer string as q 1s (q is the value of the even-numbered integers)); finally, combine the first value and the second value to generate a data bit matrix.
[0089] Exemplarily, if the target integer string is (1,1,1,3,3,2,1,1,1), and the first pixel in the target integer string is a high level, then the odd-numbered integers in the integer string are recorded as p 1s (p is the value of the odd-numbered integer), and the integers in the even-numbered positions in the integer string are recorded as q 1s (q is the value of the even-numbered integer), the generated data bit matrix is (1,0,1,0,0,0,1,1,1,0,0,0,1,0,1).
[0090] In this embodiment, the number of consecutive identical pixels in the target pixel matrix is extracted to generate an initial integer string; the Nth value in the initial integer string is used as the pixel width; each integer in the initial integer string is divided by the pixel width to obtain the target integer string; the first pixel in the target integer string is identified; if the first pixel is a high level, the odd-numbered integers in the integer string are recorded as the first numerical value, and the even-numbered integers in the integer string are recorded as the second numerical value; the first numerical value and the second numerical value are combined to generate a data bit matrix; thereby ensuring the accuracy of the generated data bit matrix.
[0091] In one embodiment, if Figure 6As shown, after identifying the first pixel in the target pixel matrix, the visible light imaging communication decoding method further specifically includes the following steps:
[0092] S407: If the first pixel is at a low level, the odd-numbered integers in the integer string are recorded as the third value, and the odd-numbered integers in the integer string are recorded as the fourth value.
[0093] S408: Combine the third value and the fourth value to generate a data bit matrix.
[0094] Specifically, if the first pixel is at a low level, the odd-numbered integers in the integer string are recorded as the third value (for example, the integers at odd positions in the integer string are recorded as p zeros (p is the value of the odd-numbered integers), and the even-numbered integers in the integer string are recorded as the fourth value (for example, the integers at even positions in the integer string are recorded as q zeros (q is the value of the even-numbered integers)); finally, the third value and the fourth value are combined to generate a data bit matrix.
[0095] Exemplarily, if the target integer string is (1,1,1,3,3,2,1,1,1), and the first pixel in the target integer string is a low level, then the even-numbered integers in the integer string are recorded as p 1s (p is the value of the odd-numbered integers), and the integers in the odd positions of the integer string are recorded as q 1s (q is the value of the even-numbered integers), the generated data bit matrix is (0,1,0,1,1,1,0,0,0,1,1,1,0,1,0).
[0096] Exemplarily, if the target integer string is (1,1,1,3,3,2,1,1,1), and the first pixel in the target integer string is a high level, then the odd-numbered integers in the integer string are recorded as p 1s (p is the value of the odd-numbered integer), and the integers in the even-numbered positions in the integer string are recorded as q 1s (q is the value of the even-numbered integer), the generated data bit matrix is (1,0,1,0,0,0,1,1,1,0,0,0,1,0,1).
[0097] In this embodiment, if the first pixel is at a low level, the odd-numbered integers in the integer string are recorded as the third value, and the odd-numbered integers in the integer string are recorded as the fourth value; the third value and the fourth value are combined to generate a data bit matrix; thereby further ensuring the accuracy of the generated data bit matrix.
[0098] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0099] In one embodiment, a visible light imaging communication decoding device is provided, and the visible light imaging communication decoding device corresponds one-to-one to the visible light imaging communication decoding method in the above embodiment. Figure 7 As shown, the visible light imaging communication decoding device includes: an image acquisition module 10, a feature extraction module 20, a binarization processing module 30, a conversion module 40 and a matching module 50. The functional modules are described in detail as follows:
[0100] The image acquisition module 10 is used to acquire images of the light source object at the transmitting end by using an image acquisition device to generate an image to be processed;
[0101] A feature extraction module 20 is used to extract features from the image to be processed and generate a feature set to be processed, wherein the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features;
[0102] A binarization processing module 30 is used to perform binarization processing on the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix;
[0103] A conversion module 40, configured to convert the target pixel matrix using a preset decoding algorithm to generate a data bit matrix;
[0104] The matching module 50 is used to receive the byte header matrix sent by the transmitting end, match the byte header matrix with the data bit matrix, and obtain a data node matrix.
[0105] Preferably, if Figure 8 As shown, the feature extraction module 20 includes:
[0106] The first conversion unit 201 is used to convert the image to be processed into a binary image.
[0107] A removal unit 202, configured to remove small connected regions in the binary image using a morphological closing algorithm to obtain a target image;
[0108] The mask processing unit 203 is used to perform mask processing on the target image to obtain the shape of the light source object;
[0109] A first processing unit 204 is used to process each row of pixel values in the light source object shape to obtain a one-dimensional pixel matrix;
[0110] A smoothing processing unit 205 is used to perform smoothing processing on the one-dimensional pixel matrix to obtain a left-shift matrix and a right-shift matrix;
[0111] The XOR processing unit 206 is used to perform XOR processing on the left-shift matrix and the right-shift matrix to obtain light source object stripe features.
[0112] Preferably, if Fig. 9 As shown, the binarization processing module 30 includes:
[0113] A reading unit 301 is used to read the regions of interest between the crests and troughs in the light source object stripe feature one by one, and obtain the maximum value and the minimum value in each region of interest;
[0114] A first determining unit 302 is configured to determine the minimum value in the region of interest as a target background threshold when the minimum value is less than a preset background threshold;
[0115] A second determining unit 303 is configured to obtain a mean value between the maximum value and the minimum value in the region of interest when the difference between the maximum value and the minimum value in the region of interest is greater than a first threshold, and determine the region of interest as a target region of interest;
[0116] A first binarization processing unit 304 is used to perform binarization processing on the target region of interest;
[0117] The global binarization processing unit 305 is used to perform global binarization processing on each of the regions of interest using a target threshold value to obtain a target pixel matrix.
[0118] Preferably, the conversion module 40 comprises:
[0119] An extraction unit, used to extract the number of consecutive identical pixels in the target pixel matrix to generate an initial integer string;
[0120] a pixel width determination unit, configured to use the Nth value in the initial integer string as the pixel width;
[0121] a target integer string determination unit, configured to divide each integer in the initial integer string by the pixel width to obtain a target integer string;
[0122] an identification unit, configured to identify a first pixel in the target integer string;
[0123] A first recording unit is used to record the odd-numbered integers in the integer string as a first value and record the even-numbered integers in the integer string as a second value when the first pixel is at a high level;
[0124] The first combining unit is used to combine the first value and the second value to generate a data bit matrix.
[0125] Preferably, the conversion module 40 further includes:
[0126] A second recording unit is used to record the odd-numbered integers in the integer string as a third value and record the odd-numbered integers in the integer string as a fourth value when the first pixel is at a low level;
[0127] The second combining unit is used to combine the third value and the fourth value to generate a data bit matrix.
[0128] For the specific definition of the visible light imaging communication decoding device, please refer to the definition of the visible light imaging communication decoding method above, which will not be repeated here. Each module in the above-mentioned visible light imaging communication decoding device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data used by the visible light imaging communication decoding method in the above-mentioned embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a visible light imaging communication decoding method is implemented.
[0130] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the visible light imaging communication decoding method in the above embodiment is implemented when the processor executes the computer program. In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by the processor, the visible light imaging communication decoding method in the above embodiment is implemented.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0132] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0133] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A visible light imaging communication decoding method, characterized in that: include: An image acquisition device is used to acquire images of the light source object at the transmitting end to generate an image to be processed; Performing feature extraction on the image to be processed to generate a feature set to be processed, wherein the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features; wherein the light source object stripe features are the peak and valley coordinates of the one-dimensional pixel matrix; Binarize the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix; Using a preset decoding algorithm to transform the target pixel matrix to generate a data bit matrix; A byte header matrix sent by the transmitting end is received, and the byte header matrix is matched with the data bit matrix to obtain a data node matrix.
2. The visible light imaging communication decoding method according to claim 1, characterized in that: Extracting features from the image to be processed to generate a feature set to be processed includes: Convert the image to be processed into a binary image, A morphological closing algorithm is used to remove small connected regions in the binary image to obtain a target image; Performing mask processing on the target image to obtain the shape of the light source object; Processing each row of pixel values in the light source object shape to obtain a one-dimensional pixel matrix; Smoothing the one-dimensional pixel matrix to obtain a left-shift matrix and a right-shift matrix; The left-shift matrix and the right-shift matrix are XOR-ed to obtain light source object stripe features.
3. The visible light imaging communication decoding method according to claim 1, characterized in that: The binarization process is performed on the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix, including: Read the regions of interest between the crests and troughs in the stripe characteristics of the light source object one by one, and obtain the maximum value and the minimum value in each region of interest; If the minimum value in the region of interest is less than a preset background threshold, the minimum value is determined as a target background threshold; If the difference between the maximum value and the minimum value in the region of interest is greater than a first threshold, obtaining a mean value between the maximum value and the minimum value in the region of interest, and determining the region of interest as a target region of interest; Performing binarization processing on the target region of interest; A target threshold is used to perform global binarization processing on each region of interest to obtain a target pixel matrix.
4. The visible light imaging communication decoding method according to claim 1, characterized in that: The method of converting the target pixel matrix using a preset decoding algorithm to generate a data bit matrix includes: Extracting the number of consecutive identical pixels in the target pixel matrix to generate an initial integer string; Taking the Nth value in the initial integer string as the pixel width; Divide each integer in the initial integer string by the pixel width to obtain a target integer string; identifying a first pixel in the target integer string; If the first pixel is at a high level, the odd-numbered integers in the integer string are recorded as first values, and the even-numbered integers in the integer string are recorded as second values; The first value and the second value are combined to generate a data bit matrix.
5. The visible light imaging communication decoding method according to claim 4, characterized in that: After identifying the first pixel in the target pixel matrix, the visible light imaging communication decoding further includes: If the first pixel is at a low level, the odd-numbered integers in the integer string are recorded as a third value, and the odd-numbered integers in the integer string are recorded as a fourth value; The third value and the fourth value are combined to generate a data bit matrix.
6. A visible light imaging communication decoding device, wherein the decoding method is the visible light imaging communication decoding method according to any one of claims 1 to 5, characterized in that: include: An image acquisition module is used to acquire images of the light source object at the transmitting end by using an image acquisition device to generate an image to be processed; A feature extraction module is used to extract features from the image to be processed and generate a feature set to be processed, wherein the feature set to be processed includes a one-dimensional pixel matrix and light source object stripe features; A binarization processing module, used for performing binarization processing on the one-dimensional pixel matrix according to the stripe characteristics of the light source object to obtain a target pixel matrix; A conversion module, used to convert the target pixel matrix using a preset decoding algorithm to generate a data bit matrix; The matching module is used to receive the byte header matrix sent by the transmitting end, match the byte header matrix with the data bit matrix, and obtain a data node matrix.
7. The visible light imaging communication decoding device according to claim 6, characterized in that: The feature extraction module comprises: A first conversion unit is used to convert the image to be processed into a binary image. A removal unit, used for removing small connected areas in the binary image by using a morphological closing algorithm to obtain a target image; A mask processing unit, used for performing mask processing on the target image to obtain the shape of the light source object; A first processing unit, configured to process each row of pixel values in the light source object shape to obtain a one-dimensional pixel matrix; A smoothing processing unit, used for smoothing the one-dimensional pixel matrix to obtain a left-shift matrix and a right-shift matrix; The XOR processing unit is used to perform XOR processing on the left-shift matrix and the right-shift matrix to obtain the stripe characteristics of the light source object.
8. The visible light imaging communication decoding device according to claim 6, characterized in that: The binarization processing module comprises: A reading unit, used for reading the regions of interest between the crests and the troughs in the stripe characteristics of the light source object one by one, and obtaining the maximum value and the minimum value in each region of interest; A first determining unit, configured to determine the minimum value in the region of interest as a target background threshold when the minimum value is less than a preset background threshold; A second determining unit is configured to obtain a mean value between the maximum value and the minimum value in the region of interest when the difference between the maximum value and the minimum value in the region of interest is greater than a first threshold, and determine the region of interest as a target region of interest; A first binarization processing unit, used for performing binarization processing on the target region of interest; The global binarization processing unit is used to perform global binarization processing on each of the regions of interest using a target threshold value to obtain a target pixel matrix.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the visible light imaging communication decoding method as described in any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the visible light imaging communication decoding method as described in any one of claims 1 to 5 is implemented.
