LED array state extraction method combining edge detection and roundness analysis
By combining edge detection and roundness analysis technology, the LED array state is extracted, which solves the accuracy problem of traditional methods under ambient light interference and noise, and realizes efficient and robust LED array state extraction.
Patent Information
- Application Number
- CN202510031461.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-05-09
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional image processing methods are susceptible to ambient light interference when extracting the state of the LED array. Incorrect threshold setting will lead to incorrect LED state extraction, and are sensitive to noise, have high computational complexity, and are difficult to deal with irregular and different sizes of LED arrays.
Combining edge detection and roundness analysis techniques, edge images are obtained by performing edge detection on the original grayscale image, and then using connectivity domain analysis to calculate the center of mass coordinates, and using roundness analysis to separate the background and target LEDs, thereby extracting the contour and state of the target LED.
This method improves the accuracy and robustness of LED array state extraction, can maintain high performance and efficiency under complex environments and high noise interference, reduces bit error rate, and improves processing efficiency while ensuring real-time performance.
Smart Images

Figure CN119963587A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visible light camera communication technology, and in particular to a method for extracting LED array state by combining edge detection and roundness analysis. Background Art
[0002] The visible light camera communication system is a visible light communication system that uses an image sensor as a receiver, in which an LED array is usually used as a signal source to transmit data. In this system, accurately extracting the state of the LED array is the key to ensuring the normal operation of the system. Traditional image processing methods, such as binarization and Hough transform, can extract the state of the LED array in some cases, but they also have obvious defects. For example, the binarization method is easily interfered by ambient light, and improper threshold setting will lead to incorrect LED state extraction; Hough transform is sensitive to noise, has high computational complexity, and is difficult to process irregular and unevenly sized LED arrays. In addition, although the deep learning-based method has strong robustness, the amount of labeled data required for training is large and the computing resource consumption is high, which is not suitable for systems with high real-time performance. Therefore, it is urgent to study a method that can stably extract the state of the LED array under different environments while ensuring real-time performance.
[0003] The present invention combines edge detection and roundness analysis technology, which can effectively avoid the defects of traditional methods and improve the accuracy and robustness of LED array state extraction. In particular, the method is suitable for scenes where the interfering light source is non-circular, and can show higher performance and efficiency in complex environments and high noise interference. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a method for extracting the state of an LED array by combining edge detection and roundness analysis, so as to overcome the fact that the traditional image processing algorithm is easily affected by improper selection of the binarization threshold, thereby improving the robustness of the system. At the same time, under the premise of ensuring real-time performance, the processing efficiency is improved and the bit error rate is greatly reduced.
[0005] The solution adopted by the present invention to solve the technical problem is:
[0006] A method for extracting LED array state by combining edge detection and roundness analysis comprises the following steps:
[0007] Step 1), applying edge detection to the original grayscale image containing the target LED array to obtain an edge image L(x, y);
[0008] Step 2) Use connected domain analysis on the edge image L(x,y) to obtain the edge contour pixel set of each connected domain And calculate its centroid coordinates;
[0009] Step 3), based on the connected domain information obtained in step 2, the background and the target LED are further separated by circularity analysis, thereby extracting the outline of the target LED and determining its centroid coordinates (x, y);
[0010] Step 4), based on the centroid coordinates of the luminous LED obtained in step 3, the width W, height H and the spacing d between the horizontal and vertical LEDs of the target LED array area can be calculated. 1 ,d 2 And the coordinates (x min ,y min ),(x min ,y max ),(x max ,y min ),(x max ,y max );
[0011] Step 5), use an m×n matrix A to represent the on / off status of all LED lights in the target LED array area, where the matrix elements are 0 and 1, representing the off and on status of the LED respectively; take the element in the upper left corner of the matrix A as the coordinate origin, and combine the upper left corner (x min ,y min ) coordinates and the distance d between the horizontal and vertical LEDs in the target LED array area 1 ,d 2 , the position (u, v) of the LED in the light-emitting state in the matrix A can be determined, and the elements in the corresponding position are assigned 1, and the rest are assigned 0. Finally, the matrix A will form the original information code stream of the target LED array, thereby achieving the purpose of judging the state of the target LED array.
[0012] Advantages or beneficial effects of the present invention: By using edge detection, the influence of interfering light sources in the image edge extraction process is effectively eliminated, making the experimental environment of camera communication richer; then, combined with roundness analysis technology, the target and background contours are further separated to ensure accurate positioning of the LED array. This method overcomes the vulnerability of traditional image processing algorithms to improper selection of binarization thresholds and improves the robustness of the system. At the same time, while ensuring real-time performance, the processing efficiency is improved and the bit error rate is greatly reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a flow chart of a method for extracting LED array state by combining edge detection and roundness analysis in an embodiment;
[0014] Figure 2 is the edge detection result diagram;
[0015] Figure 3The centroid result of the LED emitting in the target LED array area;
[0016] Figure 4 The state result diagram of the LED array is finally determined by using this method, taking a rectangular LED array composed of 4×4 independently lit and extinguished LED lights as an example. DETAILED DESCRIPTION
[0017] The content of the present invention is further described below in conjunction with the drawings and embodiments, but the present invention is not limited thereto.
[0018] Example:
[0019] A method for extracting LED array status by combining edge detection and roundness analysis proposed by the present invention will be described below with reference to the accompanying drawings.
[0020] First, the target LED array is photographed with a camera to obtain the original image containing the array. The LED array consists of m rows and n columns, with a total of m×n independently controllable LED lights. The LED lights at the four corners are always on and used as positioning lights. First, the Canny edge detection is used to extract the contour of the LED image to reduce the influence of the binary threshold; then, the connected domain analysis is used to extract the centroid coordinates of each connected domain; secondly, the circularity analysis is used to further separate the background and target LEDs, so as to determine the centroid coordinates of the target LED; finally, the length and width of the target LED array area and the interval of each LED in the target LED array area can be calculated based on the centroid coordinates, and the state of each LED can be obtained by combining the centroid of each LED light in the luminous state, and the original information code stream is obtained.
[0021] In this embodiment, the target LED array area is a 4×4 rectangular array and the spacing between each LED is 3 cm. The LEDs at the four corners remain always on, and the external interference light is non-circular.
[0022] like Figure 1 The figure shows a general flow chart of an LED array state extraction method combining edge detection and roundness analysis of the present invention, which comprises the following steps:
[0023] Step (1), applying Canny edge detection to the original grayscale image f(x, y) containing the target LED array to obtain the edge image L(x, y), the specific process is as follows:
[0024] 1) Apply a Gaussian filter to filter the original grayscale image f(x,y) to obtain a smoothed image I(x,y).
[0025] 2) Calculate the gradient magnitude and direction of each pixel in the smoothed image I(x,y) obtained in the above steps. Here, the Sobel operator is used to calculate the x-direction gradient G xand the y-direction gradient G y , so that the amplitude G and direction θ of each pixel of the smoothed image I(x,y) can be calculated.
[0026] 3) Perform non-maximum suppression on the gradient amplitude to obtain the edge image I'(x,y).
[0027] 4) The high and low thresholds are adaptively calculated by combining the maximum entropy segmentation method and the OSTU algorithm, where the threshold obtained by the maximum entropy segmentation method is used as the high threshold and the threshold obtained by the OSTU algorithm is used as the low threshold. Subsequently, the edge image I'(x,y) is compared and screened according to the high threshold and the low threshold to obtain strong edge points and weak edge points.
[0028] a. Use the maximum entropy segmentation algorithm to solve the high threshold h i The details are as follows:
[0029] Assume that there is an assumed threshold value t, where 0≤t≤255, to divide the image into foreground and background: pixels with grayscale values in the range [0,t] constitute the background, and pixels with grayscale values in the range [t+1,255] constitute the foreground. The foreground entropy H can be obtained using the entropy formula a and background entropy H b , their sum represents the total entropy of the image H(t). The threshold t corresponding to the maximum image entropy H(t) is the high threshold h i .
[0030] b. Use the OSTU algorithm to solve the low threshold lo as follows:
[0031] Assume there is an assumed threshold k, where 0≤k≤h i , the image is divided into foreground and background. The pixels with grayscale values in [0, k] constitute the background, and the pixels with grayscale values in [k+1, hi] constitute the foreground. Based on these classifications, the mean value u of the background can be calculated respectively t and the mean u of the foreground k The set of pixel values with similar features or attributes is defined as a class, and the difference between image pixel values of different classes is defined as the inter-class variance σ 2 , can be obtained through the inter-class variance formula. Inter-class variance σ 2 The threshold k corresponding to the maximum is the low threshold lo.
[0032] c. If the pixel gradient amplitude of the edge image I'(x, y) is lower than the low threshold lo, the edge pixel is removed; if the pixel gradient amplitude of the edge image I'(x, y) is higher than the high threshold hi, the edge pixel is retained as a strong edge pixel; if the pixel gradient amplitude of the edge image I'(x, y) is higher than the low threshold lo and lower than the high threshold hi, the edge pixel is marked as a weak edge pixel and waits for the next step of processing.
[0033] 5) Filter the weak edge points and suppress the weak edge points that need to be removed; set the grayscale values of the strong edge points and the retained weak edge points to 255 to obtain a binary edge image L(x, y), such as Figure 2 shown.
[0034] Step 2) Use connected domain analysis on the edge image L(x,y) to obtain the edge contour pixel set of each connected domain And calculate its centroid coordinates;
[0035] Traverse each pixel of the edge image L(x,y) from top to bottom and from left to right. First, find the first pixel with a value of 255 and assign it a label label=1. Continue traversing the image until the next pixel with a value of 255 is encountered. At this time, check whether the pixel values of the upper and left neighboring pixels of the current pixel are both 0; if both are 0, assign a new label label=label+1 to the current pixel; if there are labeled pixels in the upper or left neighboring pixels, assign the neighboring label with a smaller label value to the current pixel, and use this label to update the larger label, and continue traversing the image until the traversal is completed. Pixels with the same label constitute a connected domain edge contour pixel set, while pixels with different labels belong to different contour sets. Then, the centroid formula is used to calculate the centroid coordinates (x,y) of each connected domain.
[0036] Step 3), according to the connected domain information obtained in step 2, perform roundness analysis on each connected domain. Roundness analysis is a geometric feature analysis method based on contour shape. The roundness value of the contour is calculated to quantify the degree of shape close to a circle. The closer the roundness value is to 1, the closer the contour shape is to a circle. Then, the roundness value is compared with the set threshold λ (0<λ≤1). If it is greater than the set threshold λ, the corresponding contour is the contour of the LED in the target LED array in the luminous state, and its centroid coordinates (x, y) can be obtained, such as Figure 3 shown.
[0037] The roundness is calculated as follows:
[0038]
[0039] Where Cir represents the roundness, S represents the area of each edge contour, C represents the perimeter, (xi ,y i ) represents the edge contour pixel set The row and column coordinates of any pixel.
[0040] Step 4), based on the target LED centroid coordinates (x, y) obtained in step (3), the coordinates (x, y) of the upper left corner, lower left corner, upper right corner, and lower right corner of the target LED array area can be determined. min ,y min )、(x min ,y max )、(x max ,y min )、(x max ,y max ), thereby calculating the width W, height H and the spacing d between the horizontal and vertical LEDs of the target LED array area 1 , d 2 ;
[0041] Step 5), use an m×n matrix A to represent the on / off status of all LED lights in the target LED array area, where the matrix elements are 0 and 1, representing the off and on status of the LED respectively; the element a in the upper left corner of the matrix A is 11 is the coordinate origin, combined with the upper left corner (x min ,y min ) coordinates and the distance d between the horizontal and vertical LEDs in the target LED array area 1 , d 2 , we can determine the position (u, v) of the LED in the light-emitting state in matrix A, and assign the element at the corresponding position to 1, and the rest to 0. Finally, matrix A will form the original information code stream of the target LED array, such as Figure 4 As shown, the purpose of determining the state of the target LED array is achieved; wherein the matrix A is expressed as follows:
[0042]
[0043] The position (u,v) of the LED in matrix A is calculated as follows:
[0044]
Claims
1. A method for extracting LED array state by combining edge detection and roundness analysis, characterized in that: The following steps are involved: Step 1), edge detection is applied to the original grayscale image containing the target LED array to obtain an edge image L(x, y). Step 2) Use connected domain analysis on the edge image L(x,y) to obtain the edge contour pixel set of each connected domain And calculate its centroid coordinates; Step 3), based on the connected domain information obtained in step 2, the background and the target LED are further separated by circularity analysis, thereby extracting the outline of the target LED and determining its centroid coordinates (x, y); Step 4), according to the centroid coordinates of the luminous LED obtained in step 3, the width W, height H of the target LED array area, the intervals d1 and d2 between the horizontal and vertical LEDs, and the coordinates (x) of the upper left corner, lower left corner, upper right corner, and lower right corner of the target LED array area can be calculated. min ,y min )、(x min ,y max )、(x max ,y min )、(x max ,y max ); Step 5), use an m×n matrix A to represent the on / off status of all LED lights in the target LED array area, where the matrix elements are 0 and 1, representing the off and on status of the LED respectively; take the element in the upper left corner of the matrix A as the coordinate origin, and combine the upper left corner (x min ,y min ) coordinates and the intervals d1 and d2 between the horizontal and vertical LEDs in the target LED array area, the position (u, v) of the LED in the light-emitting state in the matrix A can be determined, and the elements at the corresponding positions are assigned 1, and the rest are assigned 0. Finally, the matrix A will form the original information code stream of the target LED array, thereby achieving the purpose of determining the state of the target LED array.
2. The LED array state extraction method combining edge detection and roundness analysis according to claim 1, characterized in that: Step 1) includes: Edge detection is applied to the original grayscale image containing the target LED array to obtain the edge image L(x,y).
3. The LED array state extraction method combining edge detection and roundness analysis according to claim 1, characterized in that: Step 2) includes: Traverse each pixel of the edge image L(x,y) from top to bottom and from left to right. First, find the first pixel with a value of 255 and assign it a label label=1. Continue traversing the image until the next pixel with a value of 255 is encountered. At this time, check whether the pixel values of the upper and left neighboring pixels of the current pixel are both 0; if both are 0, assign a new label label=label+1 to the current pixel; if there are labeled pixels in the upper or left neighboring pixels, assign the neighboring label with a smaller label value to the current pixel, and use this label to update the larger label, and continue traversing the image until the traversal is completed. Pixels with the same label constitute a connected domain edge contour pixel set, while pixels with different labels belong to different contour sets. Then, the centroid formula is used to calculate the centroid coordinates (x,y) of the connected domain.
4. The LED array state extraction method combining edge detection and roundness analysis according to claim 1, characterized in that: Step 3) includes: Roundness analysis is a geometric feature analysis method based on contour shape. It quantifies the degree of shape close to a circle by calculating the roundness value of the contour. The closer the roundness value is to 1, the closer the contour shape is to a circle. Then, the roundness value is compared with the set threshold λ (0<λ≤1). If it is greater than the set threshold λ, the corresponding contour is the contour of the LED in the target LED array in the luminous state, and its centroid coordinates (x, y) can be obtained.
Citation Information
Patent Citations
Vision-based LED chip quality detection method
CN110490847A
OCC image decoding method based on connected domain centroid extraction
CN117459835A
Image processing apparatus, image processing method, and image processing program
JP2010245858A
Cited By
Light leakage detection method and system of LED light source, electronic equipment and storage medium
CN121655844A