Lamp LED automatic identification and chromaticity detection system and method based on visual identification

By combining visual recognition technology with traditional image processing and deep learning, automatic recognition and color detection of lamp LEDs can be achieved, solving the problems of low efficiency and high cost in existing technologies, improving detection efficiency and accuracy, and reducing enterprise detection costs. It is suitable for small and medium-sized enterprises.

CN120599360APending Publication Date: 2025-09-05CHANGZHOU XINGYU AUTOMOTIVE LIGHTING SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510714422.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

The existing technology for identifying and detecting the color of LED lamps is inefficient, manual detection can easily lead to missed detections and misjudgments, and specialized detection equipment is expensive, making it difficult to meet the needs of small and medium-sized enterprises.

Method used

A visual recognition-based automatic identification and colorimetry system for lamp LEDs is adopted, combining traditional image processing and deep learning technologies. Through image acquisition, preprocessing, LED identification and colorimetry detection modules, automatic LED position and colorimetry parameter detection is achieved. High-resolution industrial cameras and ordinary light sources are used in combination with software algorithms for detection.

Benefits of technology

It improves detection efficiency and accuracy, reduces costs, is suitable for small and medium-sized enterprises, is scalable, and can adapt to the detection needs of lamps of different types and specifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599360A_ABST
    Figure CN120599360A_ABST
Patent Text Reader

Abstract

The invention provides a lamp LED automatic identification and chromaticity detection system and method based on visual identification, and belongs to the technical field of visual identification. Comprising an image acquisition module, an image preprocessing module, an LED automatic identification module, a chromaticity detection module and a result output and judgment module. LED automatic positioning is realized by adopting a mode of combining traditional image processing and deep learning, an LED area is converted from an RGB space to a CIE XYZ space through a chromaticity detection module, a tristimulus value and a chromaticity coordinate are calculated, color temperature data of an LED is obtained based on the chromaticity coordinate through a black body locus, then LED chromaticity detection is completed, and finally LED position information and chromaticity data are output for qualification judgment. A visual identification technology and a chromaticity detection process are systematically integrated to form a complete automation link of data acquisition, preprocessing, identification, detection and result output. Compared with a low-efficiency mode of manual animation circle detection, the full-process automatic design is a fundamental innovation of a traditional detection mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual recognition technology, and in particular to a system and method for automatic identification and chromaticity detection of LEDs in lamps based on visual recognition. Background Art

[0002] During the production and testing of lighting fixtures, the identification and colorimetric testing of numerous LEDs is crucial for ensuring product quality. Currently, most companies rely on manual circling of LEDs in photographs to identify and perform related testing. This manual inspection method has numerous drawbacks, including low efficiency and visual fatigue from long hours, which can lead to missed inspections and misjudgments, ultimately impacting product quality and production efficiency. Furthermore, manual inspection requires a high level of experience from inspectors, and results can vary between inspectors, resulting in a lack of consistency and accuracy.

[0003] While there are some dedicated LED detection and analysis instruments on the market, these instruments are complex, expensive, and require a high level of user expertise and skills. They are primarily suitable for R&D departments of large enterprises, and are unaffordable for small businesses with limited technical resources and funding. Therefore, there is an urgent need for an efficient, accurate, and low-cost method and system for automatic LED identification and colorimetry.

[0004] The above problems are in urgent need of resolution. Summary of the Invention

[0005] The purpose of the present invention is to overcome at least one technical problem existing in the prior art and to provide a system and method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition.

[0006] On the one hand, an embodiment of the present invention provides a lamp LED automatic recognition and chromaticity detection system based on visual recognition, the system comprising: an image acquisition module, an image preprocessing module, an LED automatic recognition module, a chromaticity detection module and a result output and judgment module; the image acquisition module is used to acquire the original image information of the lamp LED; the image preprocessing module is used to perform denoising, contrast enhancement and image correction processing on the original image information of the lamp LED, and output the preprocessed lamp LED image information; the LED automatic recognition module is integrated with a traditional image processing recognition unit and a deep learning recognition unit; the traditional image processing recognition unit is used to perform coarse segmentation of the preprocessed lamp LED image information based on threshold segmentation, morphological operation and contour detection algorithm to obtain LED areas; the deep learning recognition unit is used to accurately identify the coarsely segmented LED area based on a pre-trained target detection model to obtain the position information of each LED; the chromaticity detection module is integrated with a color space conversion unit, a color coordinate calculation unit and a color temperature calculation unit; the color space conversion unit is used to convert the LED area image from RGB to CIE based on a preset conversion matrix XYZ color space is used to obtain tristimulus values; the color coordinate calculation unit is used to generate the color coordinates of each LED based on the tristimulus values; the color temperature calculation unit is used to generate the color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody trajectory; the result output and judgment module is used to visually store the position information of each LED, the color coordinates of each LED, and the color temperature corresponding to each LED, and automatically judge the eligibility of each LED based on preset standard data.

[0007] Furthermore, the image preprocessing module integrates an image denoising unit, an image enhancement unit and an image correction unit; the image denoising unit is used to perform denoising processing on the original image information of the lamp LED based on a Gaussian filtering algorithm to improve the clarity of the image; the image enhancement unit is used to perform image enhancement processing on the image information output by the image denoising unit based on a histogram equalization method to highlight the LED area in the original image information of the lamp LED; the image correction unit is used to calculate the image distortion parameters of the image information output by the image enhancement unit and perform geometric correction on it using an image correction function to ensure that the position and shape of the LED in the image are accurate.

[0008] Furthermore, the preset conversion matrix is:

[0009]

[0010] Where (X, Y, Z) represents the tristimulus values ​​in the CIE XYZ color space, and R, G, B represent the red, green, and blue component values ​​in the color space.

[0011] Furthermore, the color coordinate calculation unit integrates a color coordinate calculation formula, including:

[0012]

[0013] Where (x, y) represents the color coordinates of an LED.

[0014] Furthermore, the color temperature calculation unit integrates a blackbody trajectory fitting unit, a trajectory point calculation unit, a distance measurement unit and a color temperature calculation subunit; the blackbody trajectory fitting unit is used to obtain a blackbody trajectory based on the McCall quadratic function fitting; the trajectory point calculation unit is used to map the color coordinates of each LED to the blackbody trajectory to obtain the corresponding trajectory point; the distance measurement unit is used to obtain the Euclidean distance between each LED color coordinate and the corresponding trajectory point based on the Euclidean distance calculation formula; the color temperature calculation subunit is used to determine whether the LED color coordinates are on the fitted blackbody trajectory based on the Euclidean distance between the LED color coordinates and the corresponding trajectory point. When the LED color coordinates are not on the fitted blackbody trajectory, the linear difference calculation formula is used to obtain the corresponding color temperature of the LED; when the LED color coordinates are on the fitted blackbody trajectory, the corresponding color temperature is obtained from the CIE standard data.

[0015] Furthermore, the blackbody trajectory fitting unit is used to obtain the blackbody trajectory based on the McCam quadratic function fitting, including:

[0016] McCam's quadratic function is y′=ax′ 2 +bx′+c;

[0017] The a, b and c are obtained by fitting the standard data points using the least squares method.

[0018] Furthermore, the color temperature calculation subunit is used to: when the LED color coordinates are not on the fitted blackbody trajectory, collect the trajectory points (x1′, y1′) and (x2′, y2′) of two adjacent temperature points T1 and T2; respectively calculate the distances d1 and d2 between the trajectory points of the two adjacent temperature points and the LED color coordinates; and calculate the color temperature corresponding to the LED using a linear difference calculation formula, wherein the linear difference calculation formula is:

[0019]

[0020] Furthermore, the chromaticity detection module is also integrated with a calibration unit, which is used to: while the image acquisition module is acquiring the original image information of the lamp LED, directly measure the tristimulus measurement values ​​and color coordinate measurement values ​​of the corresponding LED using a chromaticity measurement device; calculate a first deviation value between the tristimulus measurement value and the tristimulus value obtained by the color space conversion unit, and a second deviation value between the color coordinate measurement value and the color coordinate calculated by the color coordinate calculation unit; by comparing the first deviation value, the second deviation value and a preset deviation threshold, trace the error based on the comparison result; and adjust the corresponding system parameters based on the error tracing result.

[0021] Furthermore, the error tracing result includes: hardware error and algorithm error; when the error tracing result is a hardware error, the hardware parameters are adjusted; when the error tracing result is an algorithm error, the algorithm parameters are corrected, including: correcting the parameters in the preset conversion matrix and / or correcting the fitted blackbody trajectory.

[0022] In a second aspect, an embodiment of the present invention provides a method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition, which is applied to the above-mentioned automatic identification and chromaticity detection system for lamp LEDs based on visual recognition, and the method includes: collecting the original image information of the lamp LEDs; denoising, contrast enhancement and image correction processing of the original image information of the lamp LEDs, and outputting the preprocessed lamp LED image information; coarsely segmenting the preprocessed lamp LED image information based on threshold segmentation, morphological operation and contour detection algorithm to obtain LED areas; accurately identifying the coarsely segmented LED areas based on a pre-trained target detection model to obtain the position information of each LED; converting the LED area image from RGB to CIE XYZ color space based on a preset conversion matrix to obtain tristimulus values; generating color coordinates of each LED based on the tristimulus values; generating the color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody trajectory; visually storing the position information of each LED, the color coordinates of each LED and the color temperature corresponding to each LED, and automatically judging the eligibility of each LED based on preset standard data.

[0023] On the other hand, the present invention also provides a computer-readable storage medium, in which one or more instructions are stored, and the computer instructions are used to enable the computer to execute the above-mentioned method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition.

[0024] On the other hand, the present invention provides an electronic device comprising: a memory and a processor; the memory stores at least one program instruction; the processor loads and executes the at least one program instruction to implement the above-mentioned method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition.

[0025] The beneficial effects of the present invention are:

[0026] (1) Improve detection efficiency: Through the automated image acquisition, processing and analysis process, the detection time is greatly shortened. Compared with manual detection, the detection efficiency can be increased by several times, which can meet the detection needs of large-scale lamp production.

[0027] (2) Enhanced detection accuracy: Using advanced image processing and deep learning technologies, it can accurately identify the position of each LED and precisely detect its color parameters, reducing missed detections and misjudgments caused by visual fatigue and experience differences during manual inspections, and improving the consistency and accuracy of inspections.

[0028] (3) Reduce costs: The present invention does not require the use of expensive special detection instruments. It only needs to be equipped with high-resolution industrial cameras and ordinary light sources and other equipment. Combined with software algorithms, it can realize automatic identification and color detection of LEDs, reducing the detection costs of enterprises. It is especially suitable for small and medium-sized enterprises.

[0029] (4) Strong scalability: The system's algorithms and models have certain scalability. By adjusting parameters and training new data sets, they can adapt to the detection needs of lamps of different types and specifications, and have broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The present invention will be further described below with reference to the accompanying drawings and examples.

[0031] Figure 1 1 is a schematic structural diagram of a lamp LED automatic identification and chromaticity detection system based on visual recognition provided by Example 1 of the present invention.

[0032] Figure 2 This is a flow chart of a method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition provided in Example 2 of the present invention.

[0033] Figure 3 This is a partial block diagram of an electronic device provided in Example 4 of the present invention. DETAILED DESCRIPTION

[0034] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the various operations as sequential processes, many of the operations therein can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0035] It should be understood that although the terms "first," "second," and the like may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used solely to distinguish one element from another. For example, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element, without departing from the scope of the exemplary embodiments. The term "and / or" as used herein includes any and all combinations of one or more of the listed associated items.

[0036] The present invention will now be described in detail with reference to the accompanying drawings. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.

[0037] Example 1

[0038] For ease of understanding, the invention concept is generally described before describing the embodiments of the present invention in detail: the present invention provides a method for automatic identification and chromaticity detection of LEDs in lamps based on visual recognition, including: using a high-resolution industrial camera to capture images of lamps; using methods such as Gaussian filtering or median filtering to denoise the captured images to remove random noise and salt and pepper noise in the images and improve image clarity; using histogram equalization technology to enhance the contrast of the images and make the LED areas more prominent; performing geometric correction on the captured images to eliminate image distortion caused by camera shooting angles or irregular lamp placement, and ensuring the accuracy of the position and shape of the LEDs in the images; a method based on traditional image processing: including threshold segmentation, morphological operations and contour detection, by setting an appropriate threshold to separate the LED area from the background, then processing the image through operations such as dilation and corrosion, and finally detecting the contour to determine the position and size of the LED; a method based on deep learning: first collecting a large number of images and annotating them, selecting a target detection model such as YOLO and Faster R-CNN for training, and then deploying the trained model into the detection system to detect the LED position in real time; chromaticity detection: color space conversion: converting the identified LED area image from the RGB color space to the CIE color space. XYZ color space: Based on the converted color space, the tristimulus values ​​(X, Y, Z) of each LED are calculated to obtain color coordinates (x, y) and color temperature and other chromaticity parameters. Combined with professional equipment such as imaging brightness colorimeter, the test results are calibrated and verified to improve the accuracy of colorimetric detection. The identified LED position information and colorimetric detection results are output to the display interface or stored in the database. The qualified LED is judged according to the preset colorimetric standard and the judgment result is output.

[0039] The specific implementation is as follows:

[0040] like Figure 1, which is a structural diagram of a lamp LED automatic identification and chromaticity detection system based on visual recognition provided by the present invention.

[0041] As an example, the system includes: an image acquisition module 1, an image preprocessing module 2, an LED automatic recognition module 3, a chromaticity detection module 4 and a result output and judgment module 5; the image acquisition module 1 is used to acquire the original image information of the lamp LED; the image preprocessing module 2 is used to denoise, enhance the contrast and perform image correction on the original image information of the lamp LED, and output the preprocessed lamp LED image information; the LED automatic recognition module 3 is integrated with a traditional image processing recognition unit 30 and a deep learning recognition unit 31; the traditional image processing recognition unit 30 is used to roughly segment the preprocessed lamp LED image information based on threshold segmentation, morphological operation and contour detection algorithm to obtain LED areas; the deep learning recognition unit 31 is used to accurately identify the roughly segmented LED area based on a pre-trained target detection model to obtain the position information of each LED; the chromaticity detection module 4 is integrated with a color space conversion unit 40, a color coordinate calculation unit 41 and a color temperature calculation unit 42; the color space conversion unit 40 is used to convert the LED area image from RGB to CIE based on a preset conversion matrix XYZ color space, to obtain tristimulus values; the color coordinate calculation unit 41 is used to generate the color coordinates of each LED based on the tristimulus values; the color temperature calculation unit 42 is used to generate the color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody trajectory; the result output and judgment module 5 is used to visualize and store the position information of each LED, the color coordinates of each LED, and the color temperature corresponding to each LED, and automatically judge the eligibility of each LED based on preset standard data.

[0042] In some feasible embodiments, the data acquisition module 1 includes a high-resolution industrial camera, a ring light source or a surface light source, and a detection platform for image acquisition. Specifically, a suitable high-resolution industrial camera is selected to ensure that the details of the LED are captured. An annular or surface light source is installed, and the brightness and angle are adjusted to ensure uniform lighting of the lamp. The lamp is placed on the detection platform, the camera position and focal length are adjusted, and parameters such as exposure time and gain are set to obtain a clear image. If necessary, multiple images are taken from multiple angles or under different exposure conditions. The high-resolution industrial camera can capture the detailed features of the LED to avoid recognition errors caused by insufficient pixels; the annular / surface light source is used to ensure uniform lighting, reduce shadows and reflections, and avoid uneven brightness in the LED area in the image, which affects the accuracy of subsequent segmentation and color detection; based on a stable detection platform and camera parameter adjustment, the position and shape consistency of the LED in the image can be guaranteed, which is convenient for subsequent batch processing.

[0043] In some feasible embodiments, the image preprocessing module 2 integrates an image denoising unit 20, an image enhancement unit 21, and an image correction unit 22. The image denoising unit 20 is configured to denoise the original image information of the lamp LED using a Gaussian filter algorithm to improve image clarity. The image enhancement unit 21 is configured to enhance the image information output by the image denoising unit using a histogram equalization method to highlight the LED area in the original image information of the lamp LED. The image correction unit 22 is configured to calculate image distortion parameters of the image information output by the image enhancement unit and perform geometric correction using an image correction function to ensure the accurate position and shape of the LED in the image. Specifically, the image denoising unit 20 is configured to denoise the captured image using a Gaussian filter function from the OpenCV library. For example, by setting the size of the Gaussian kernel and the size of the standard deviation, a convolution operation is performed on the image to remove random noise from the image. The image enhancement unit 21 is configured to perform contrast enhancement on the denoised image using a histogram equalization function from the OpenCV library. The image's grayscale distribution is adjusted to make the image's brightness more uniform and highlight the features of the LED area. Image correction unit 22 is used to perform geometric correction on the image by calculating the image's distortion parameters and using image correction functions in the OpenCV library. For example, a checkerboard calibration plate is used to obtain the camera's intrinsic parameters and distortion coefficients. The image is then corrected to eliminate image distortion caused by camera shooting angles or improper lamp placement.

[0044] In some feasible embodiments, the LED automatic recognition module 3 integrates a traditional image processing recognition unit 30 and a deep learning recognition unit 31. That is, the LED automatic recognition module 3 completes the recognition of the LED through the coarse processing of the traditional image processing recognition unit 30 combined with the fine processing of the deep learning recognition unit 31. Preferably, the traditional image processing method: undertakes the task of "rapid extraction of basic features", such as preliminary contour division of the LED area through threshold segmentation and morphological operations (erosion, expansion), or optimizes the image quality through pre-processing such as geometric correction and denoising. Its logic is to perform deterministic processing on the image based on preset rules (such as color threshold, shape features), which is suitable for processing scenes with strong regularity and clear features (such as contour recognition of LEDs of a single specification). Deep learning method: responsible for "complex feature adaptive learning", such as using models such as YOLO and Faster R-CNN to identify LEDs of different specifications and densely arranged, or automatically learning feature patterns in complex scenes such as uneven light and irregular placement through neural networks. The underlying principle is to allow the model to autonomously discover characteristic patterns through extensive data training. This makes it suitable for complex scenarios where traditional methods struggle to define rules (such as identifying a mixed array of LEDs with varying specifications). Specifically, traditional methods such as threshold segmentation and morphological operations perform preliminary image noise reduction and rough contour extraction, reducing redundant information and lowering the computational complexity of the deep learning model (e.g., pre-filtering non-LED areas to avoid misjudgment). However, because traditional methods rely on manually set thresholds (such as color thresholds), they are prone to missed detections or misjudgments when lighting conditions vary or LED specifications vary (e.g., LED color thresholds vary under varying brightness levels). Deep learning models, by learning from a large number of samples, can adapt to the characteristics of LEDs with varying lighting conditions and specifications, addressing the "fixed rules and poor adaptability" of traditional methods. Therefore, traditional methods first perform a coarse segmentation of the LED area, then feed the segmented area into the deep learning model for precise classification, improving recognition efficiency. For example, in scenarios with densely packed LEDs, traditional methods may lead to recognition errors due to overlapping contours. However, deep learning models can distinguish adjacent LEDs through feature learning, improving recognition accuracy. Specifically, in the LED automatic identification module 3, traditional image processing and deep learning are deployed in a complementary tool, interconnected processes, and logically coordinated. The former uses rules to solve basic tasks, while the latter uses data to overcome complex scenarios. Through technological integration, the two form an automated chain of "efficient identification + precise detection," jointly revolutionizing traditional manual inspection. This combination retains the accuracy and controllability of traditional methods while leveraging deep learning to expand scenario adaptability.

[0045] In some feasible implementations, since the RGB color space is significantly affected by the device (e.g., camera), while the CIE XYZ color space is an international standard color space that is device-independent and accurately reflects the color perceived by the human eye, facilitating subsequent colorimetric parameter calculations and standard comparisons, it is necessary to convert the LED area image from RGB to the CIE XYZ color space and obtain tristimulus values. Preferably, the conversion matrix preset in the color space conversion unit 40 is:

[0046]

[0047] Here, (X, Y, Z) represents the tristimulus values ​​in the CIE XYZ color space, and R, G, and B represent the red, green, and blue component values ​​in the color space. The tristimulus values ​​(X, Y, Z) are fundamental parameters in colorimetry. By calculating the color coordinates (x, y) and color temperature, the color characteristics of an LED can be quantified and compared with industry standards (such as color tolerance and color temperature range) to determine compliance.

[0048] In some feasible implementations, the color coordinate calculation unit integrates a color coordinate calculation formula, including: Where (x, y) represents the color coordinates of an LED.

[0049] In some feasible embodiments, the color temperature calculation unit 42 integrates a blackbody trajectory fitting unit 420, a trajectory point calculation unit 421, a distance measurement unit 422 and a color temperature calculation subunit 423; the blackbody trajectory fitting unit 420 is used to obtain a blackbody trajectory based on the McCall quadratic function fitting; the trajectory point calculation unit 421 is used to map the color coordinates of each LED to the blackbody trajectory to obtain the corresponding trajectory point; the distance measurement unit 422 is used to obtain the Euclidean distance between each LED color coordinate and the corresponding trajectory point based on the Euclidean distance calculation formula; the color temperature calculation subunit 423 is used to determine whether the LED color coordinates are on the fitted blackbody trajectory based on the Euclidean distance between the LED color coordinates and the corresponding trajectory point. When the LED color coordinates are not on the fitted blackbody trajectory, the linear difference calculation formula is used to obtain the corresponding color temperature of the LED; when the LED color coordinates are on the fitted blackbody trajectory, the corresponding color temperature is obtained from the CIE standard data. The blackbody locus (BBL) is the continuous curve on the CIE chromaticity diagram that forms when an ideal blackbody is heated from a low temperature (approximately 1000K) to a high temperature (approximately 10,000K). This BBL is the benchmark for color temperature calculations, so the fitting process requires establishing an accurate mathematical model for the BBL.

[0050] To facilitate understanding of color temperature calculation, a specific example is provided here. Assume the LED to be tested is a white LED in a lighting fixture, and the color coordinates obtained by tristimulus calculation are (x = 0.312, y = 0.321).

[0051] First, the specific steps of fitting the blackbody trajectory are as follows (taking the McCam quadratic function as an example):

[0052] 1. Establish a blackbody radiation color coordinate database: Obtain the blackbody trajectory color coordinates at different temperatures from the CIE standard data, as shown in Table 1:

[0053] Table 1:

[0054] Temperature T(K) Corresponding to the x′ coordinate on the blackbody locus Corresponding to the y′ coordinate on the blackbody locus 2800 0.4562 0.4032 3000 0.4481 0.4075 4000 0.3805 0.3887 5000 0.3457 0.3587 6500 0.3127 0.3290 7000 0.3043 0.3196

[0055] 2. Select the fitting function and optimize the parameters

[0056] McCam quadratic function fitting: In the CIE 1931 colorimetric system, the relationship between the y′ coordinate and the x′ coordinate of the blackbody locus can be approximated by a quadratic function: y′ = ax′ 2 +bx′+c, where the parameters a, b, and c are obtained by fitting the standard data using the least squares method. Specifically, using the standard points with a temperature of 2800K-7000K as samples, the fitting function is calculated as: y′=-2.847x′ 2 +2.053x′+0.102.

[0057] 3. Fitting accuracy verification

[0058] Comparison with the standard trajectory: Substituting the standard x′ coordinate 0.3127 at a temperature of 6500K, the fitting function calculates y′ = 0.3289, with a deviation Δy′ = 0.0001 from the standard y′ = 0.3290, meeting the accuracy requirement of deviation < 1.0.

[0059] Secondly, the steps for color temperature calculation are as follows:

[0060] 1. Projection onto the blackbody locus:

[0061] Given the color coordinates of the LED to be measured (0.312, 0.321), we need to find the point on the blackbody locus that is closest to this point. Substitute x = 0.312 into the fitting function y' = -2.847x' 2 +2.053x′+0.102, the corresponding theoretical value of y on the trajectory is: y′=-2.847x′ 2 +2.053x′+0.102≈0.3288, that is, the trajectory point is (0.312, 0.3288).

[0062] 2. Distance metric (Euclidean distance):

[0063] Calculate the Euclidean distance between the test point (0.312, 0.321) and the trajectory point (0.312, 0.3288): It can be seen that the color coordinates of the LED to be tested are not on the blackbody locus. Since the point to be tested may not be on the locus, it is necessary to further compare the locus points of adjacent temperature points:

[0064] Temperature 6500K trajectory point: (0.3127, 0.3290), distance d1 from the test point:

[0065]

[0066] Temperature 7000K trajectory point: (0.3043, 0.3196), distance d2 from the test point:

[0067]

[0068] 3. Linear interpolation for color temperature:

[0069] The point to be measured is located between the trajectory points of 6500K (T1=6500) and 7000K (T2=7000), with the distances d1=0.0081 and d2=0.0078 respectively. Substituting into the interpolation formula: That is, the color temperature corresponding to the LED to be tested with the color coordinates (0.312, 0.321) is calculated to be 6754K.

[0070] The above-mentioned method of calculating color temperature by fitting the blackbody locus is based on Planck's radiation law and the CIE standard system. The blackbody locus is the color coordinate distribution of ideal blackbody radiation. Using this as a benchmark for color temperature calculation conforms to physical principles and industry standards, ensuring the scientific and authoritative nature of color temperature calculation. By selecting appropriate fitting functions (such as the McCam quadratic function or piecewise spline interpolation) and optimizing parameters (such as the least squares method), high-precision fitting can be achieved across different temperature ranges (low, medium, and high). Experimental calibration can further reduce deviations, meeting the accuracy requirements of different scenarios. In industrial scenarios, a pre-calculated trajectory point lookup table combined with interpolation can reduce the real-time computation load, improving calculation speed while maintaining accuracy, making this method suitable for both batch testing and real-time applications. This method is applicable from theoretical research to practical industrial testing (such as color temperature measurement of LEDs and lighting equipment). By projecting the color coordinates of the light source under test onto the blackbody locus and matching the closest point, the color temperature can be accurately inferred. This provides a standardized calculation method for light source color temperature calibration, making it widely applicable.

[0071] In some feasible implementations, the chromaticity detection module 4 is further integrated with a calibration unit 43, which is used to: while the image acquisition module 1 is acquiring the original image information of the lamp LED, directly measure the tristimulus measurement value and color coordinate measurement value of the corresponding LED using a chromaticity measurement device; calculate the first deviation value between the tristimulus measurement value and the tristimulus value obtained by the color space conversion unit, and the second deviation value between the color coordinate measurement value and the color coordinate calculated by the color coordinate calculation unit; by comparing the first deviation value, the second deviation value and a preset deviation threshold, perform error tracing based on the comparison result; and adjust the corresponding system parameters based on the error tracing result. The error tracing result includes: hardware error and algorithm error; when the error tracing result is a hardware error, adjust the hardware parameters; when the error tracing result is an algorithm error, correct the algorithm parameters, including: correcting the parameters in the preset conversion matrix and / or correcting the fitted blackbody trajectory.

[0072] Preferably, since there may be algorithm calculation errors in the actual application process: for example, because the software calculation relies on the conversion formula from RGB to CIE XYZ, but the photosensitivity characteristics of the industrial camera, the spectral distribution of the light source and the standard colorimetry system are different (such as the spectral response of the camera sensor does not ideally match the CIE standard observer function), it may cause color space conversion deviation. For example: when the camera is not sensitive enough to red light, the X value calculated directly through RGB may be low, and professional equipment calibration is required. In addition, there are hardware system deviations: for example, the hardware parameters of the industrial camera and light source (such as camera white balance error, light source color temperature fluctuation) will affect the color authenticity of the image acquisition, and the colorimetric measurement equipment (such as imaging luminance colorimeter) itself is calibrated and can be used as a "benchmark" to correct hardware deviations. Therefore, it is very necessary to integrate a calibration unit 43 to calibrate the measurement results.

[0073] Specifically, during the calibration process, a sampling measurement method is used to sample the LEDs in the batch of lamps (for example, 5%-10% of the LEDs in each batch), or key locations (such as LEDs at edges and corners with uneven lighting) are selected for measurement. While the system is acquiring images, the colorimetric parameters of the corresponding LEDs are directly measured using a colorimetric measurement device to ensure that the measurement conditions (such as lighting and distance) are consistent and to avoid light source fluctuation errors caused by time differences. The tristimulus values ​​(X, Y, Z) and color coordinates (x, y) obtained by the colorimetric measurement device are matched one-to-one with the system's calculation results, and the deviation value is calculated. If the deviation value exceeds the set deviation threshold, the source of the error is analyzed, including: hardware-level: the camera white balance is not calibrated, the light source color temperature deviates from the standard value (for example, the required 6500K is actually 6800K); algorithm-level: the RGB to XYZ conversion matrix is ​​not optimized for the current camera's spectral response, or image preprocessing (such as denoising and contrast enhancement) introduces color distortion. If the deviation is caused by the camera or light source, recalibrate the camera white balance (e.g., photograph a 24-color chart and calculate a correction matrix) or replace the light source with a more stable color temperature. If the error is caused by the algorithm, optimize the parameters of the color space conversion formula based on the benchmark values ​​of the measurement device. For example, use the least squares method to fit a set of conversion matrices specific to the current camera, replacing the standard conversion matrix to reduce conversion errors. Alternatively, introduce a "color calibration branch" into the deep learning model, using the measurement device results as a supervisory signal to train the model to learn the mapping relationship from RGB to true color. More specifically, using an imaging luminance colorimeter to measure the LED color temperature of 6720K, the calculated value of 6754K deviates from the measured value by 34K, which is within the error range allowed for industrial testing (typically ±50K), verifying the effectiveness of the fitting method. If the error exceeds the range, the fitting accuracy can be optimized by adding standard data points (e.g., adding trajectory coordinates for 6600K and 6800K) or using cubic spline interpolation.

[0074] Preferably, a "device-algorithm" calibration database can be established to record the deviation patterns under different lamp types and lighting conditions. When a new batch of lamps is detected, the system can automatically call the corresponding calibration parameters to improve adaptability.

[0075] In the above implementation, by systematically integrating visual recognition technology (combining traditional image processing with deep learning) and colorimetric detection processes (color space conversion, tristimulus value calculation), a complete automated link of "data acquisition-preprocessing-recognition-detection-result output" is formed. Compared with the inefficient mode of manual circle detection, this full-process automation design is a fundamental innovation in traditional detection methods. By combining traditional detection with deep learning: using traditional methods such as threshold segmentation and morphological operations and deep learning models such as YOLO and Faster R-CNN for LED recognition, taking into account both algorithm efficiency and adaptability to complex scenes (such as lamps of different specifications and dense LED arrangements). By setting color space conversion and professional equipment calibration: through the precise conversion formula from RGB to CIE XYZ, combined with the calibration of imaging luminance and colorimeter, the problem of inaccurate colorimetric parameters in traditional manual detection is solved, and the detection accuracy is improved. Furthermore, the problems of "missed detection and misjudgment due to visual fatigue" and "large differences in results between different detectors" in manual detection in the existing technology are overcome. This embodiment, through automated identification and standardized algorithms, increases detection efficiency several-fold, reduces human error, and achieves consistent and repeatable test results. Furthermore, it lowers the technical and cost barriers for small and medium-sized enterprises. Dedicated LED detection and analysis instruments on the market suffer from complex configuration and high costs. However, this embodiment, through the combination of industrial cameras, standard light sources, and software algorithms, significantly reduces hardware investment and operational complexity, enabling small and medium-sized enterprises to achieve high-precision detection and filling the technological gap in low-cost automated testing.

[0076] It is worth noting that all modules involved in this embodiment are logical units. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovations of this invention, this embodiment does not include units that are not closely related to solving the technical problems proposed by this invention. However, this does not mean that other units do not exist in this embodiment.

[0077] Example 2

[0078] See also Figure 2 , this embodiment provides a flow chart of a method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition.

[0079] As an example, the method is applied to the automatic identification and chromaticity detection system for lamp LEDs based on visual recognition described in Example 1, and the method includes:

[0080] S1. Collecting original image information of the LED lamp.

[0081] S2. Perform denoising, contrast enhancement, and image correction processing on the original image information of the lamp LED, and output pre-processed lamp LED image information.

[0082] S3. Based on threshold segmentation, morphological operation and contour detection algorithm, the pre-processed lamp LED image information is roughly segmented to obtain LED areas.

[0083] S4. Based on the pre-trained target detection model, the LED area after rough segmentation is accurately identified to obtain the position information of each LED.

[0084] S5. Convert the LED area image from RGB to CIE XYZ color space based on a preset conversion matrix to obtain tristimulus values.

[0085] S6. Generate color coordinates of each LED based on the tristimulus values.

[0086] S7. Generate a color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody locus.

[0087] S8. Visually store the position information of each LED, the color coordinates of each LED, and the color temperature corresponding to each LED, and automatically determine the eligibility of each LED based on preset standard data.

[0088] It is not difficult to find that this embodiment is a method example corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.

[0089] Example 3

[0090] An embodiment of the present invention further provides a storage medium storing a method for automatically identifying and detecting LEDs in a lamp based on visual recognition. When executed by a processor, the program implements the steps of the method described above. Because this storage medium incorporates all the technical solutions of all the aforementioned embodiments, it possesses at least all the beneficial effects brought about by the technical solutions of the aforementioned embodiments, and therefore will not be further elaborated upon here.

[0091] Example 4

[0092] See also Figure 3An embodiment of the present invention further provides an electronic device, comprising: a memory and a processor; the memory stores at least one program instruction; the processor loads and executes the at least one program instruction to implement the method for automatic identification and chromaticity detection of lamp LEDs based on visual recognition provided in Example 2.

[0093] The memory 702 and processor 701 are connected using a bus. The bus can include any number of interconnected buses and bridges, connecting various circuits of one or more processors 701 and memory 702. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and, therefore, are not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor 701 is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives data and transmits it to the processor 701.

[0094] The processor 701 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory 702 can be used to store data used by the processor 701 when performing operations.

[0095] The above is only an embodiment of the present invention. Common knowledge such as the known specific structures and characteristics in the scheme is not described in detail here. Ordinary technicians in the field are aware of all common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all existing technologies in the field, and have the ability to apply conventional experimental means before that date. Ordinary technicians in the field can improve and implement this scheme in combination with their own abilities under the inspiration given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several variations and improvements can be made, which should also be regarded as the scope of protection of the present invention. These will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.

Claims

1. A system for automatic identification and colorimetric detection of LED lamps based on visual recognition, characterized in that: The system includes: an image acquisition module, an image preprocessing module, an LED automatic identification module, a chromaticity detection module and a result output and judgment module; The image acquisition module is used to acquire the original image information of the lamp LED; The image preprocessing module is used to perform denoising, contrast enhancement and image correction on the original image information of the lamp LED, and output the preprocessed lamp LED image information; The LED automatic recognition module integrates a traditional image processing recognition unit and a deep learning recognition unit; The traditional image processing and recognition unit is used to roughly segment the pre-processed lamp LED image information to obtain LED areas based on threshold segmentation, morphological operation and contour detection algorithm; The deep learning recognition unit is used to accurately identify the roughly segmented LED area based on a pre-trained target detection model to obtain the position information of each LED; The chromaticity detection module integrates a color space conversion unit, a color coordinate calculation unit and a color temperature calculation unit; The color space conversion unit is used to convert the LED area image from RGB to CIE XYZ color space based on a preset conversion matrix to obtain tristimulus values; The color coordinate calculation unit is used to generate the color coordinates of each LED based on the tristimulus values; The color temperature calculation unit is used to generate a color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody locus; The result output and determination module is used to visually store the position information of each LED, the color coordinates of each LED and the color temperature corresponding to each LED, and automatically determine the eligibility of each LED based on preset standard data.

2. The automatic identification and chromaticity detection system for lamp LEDs based on visual recognition according to claim 1 is characterized in that: The image preprocessing module integrates an image denoising unit, an image enhancement unit and an image correction unit; The image denoising unit is used to perform denoising processing on the original image information of the lamp LED based on a Gaussian filtering algorithm to improve the clarity of the image; The image enhancement unit is used to perform image enhancement processing on the image information output by the image denoising unit based on a histogram equalization method, so as to highlight the LED area in the original image information of the lamp LED; The image correction unit is used to calculate the image distortion parameters of the image information output by the image enhancement unit and perform geometric correction on the image information using an image correction function to ensure that the position and shape of the LED in the image are accurate.

3. The automatic identification and color detection system for lamp LEDs based on visual recognition according to claim 1 is characterized in that: The preset conversion matrix is: Where (X, Y, Z) represents the tristimulus values ​​in the CIE XYZ color space, and R, G, B represent the red, green, and blue component values ​​in the color space.

4. The automatic identification and chromaticity detection system for lamp LEDs based on visual recognition according to claim 3 is characterized in that: The color coordinate calculation unit integrates a color coordinate calculation formula, including: Where (x, y) represents the color coordinates of an LED.

5. The automatic identification and chromaticity detection system for lamp LEDs based on visual recognition according to claim 1, characterized in that: The color temperature calculation unit integrates a blackbody trajectory fitting unit, a trajectory point calculation unit, a distance measurement unit and a color temperature calculation subunit; The blackbody trajectory fitting unit is used to obtain the blackbody trajectory based on McCam quadratic function fitting; The trajectory point calculation unit is used to map the color coordinates of each LED onto the blackbody trajectory to obtain a corresponding trajectory point; The distance measurement unit is used to obtain the Euclidean distance between each LED color coordinate and the corresponding trajectory point based on the Euclidean distance calculation formula; The color temperature calculation subunit is used to determine whether the LED color coordinates are on the fitted blackbody locus based on the Euclidean distance between the LED color coordinates and the corresponding trajectory point. When the LED color coordinates are not on the fitted blackbody locus, a linear difference calculation formula is used to obtain the color temperature corresponding to the LED; when the LED color coordinates are on the fitted blackbody locus, the corresponding color temperature is obtained from the CIE standard data.

6. The automatic identification and color detection system for lamp LEDs based on visual recognition according to claim 5, characterized in that: The blackbody trajectory fitting unit is used to obtain the blackbody trajectory based on the McCam quadratic function fitting, including: McCam's quadratic function is y′=ax′ 2 +bx′+c; The a, b and c are obtained by fitting the standard data points using the least squares method.

7. The automatic identification and color detection system for lamp LEDs based on visual recognition according to claim 5, characterized in that: The color temperature calculation subunit is used for: When the LED color coordinates are not on the fitted blackbody trajectory, the trajectory points (x1′, y1′) and (x2′, y2′) of two adjacent temperature points T1 and T2 are collected; Calculate the distances d1 and d2 between the trajectory points of two adjacent temperature points and the LED color coordinates respectively; The color temperature corresponding to the LED is calculated using a linear difference calculation formula, which is:

8. The automatic identification and color detection system for lamp LEDs based on visual recognition according to claim 1, characterized in that: The colorimetry detection module is also integrated with a calibration unit for: While the image acquisition module is acquiring the original image information of the LED of the lamp, a colorimetric measurement device is used to directly measure the tristimulus measurement values ​​and color coordinate measurement values ​​of the corresponding LED; Calculating a first deviation value between the tristimulus measurement value and the tristimulus value obtained by the color space conversion unit, and a second deviation value between the color coordinate measurement value and the color coordinate calculated by the color coordinate calculation unit; By comparing the first deviation value, the second deviation value and a preset deviation threshold, the error source is traced based on the comparison result; Adjust the corresponding system parameters based on the error tracing results.

9. The automatic identification and chromaticity detection system for lamp LEDs based on visual recognition according to claim 8, characterized in that: The error tracing results include: hardware error and algorithm error; When the error tracing result is hardware error, adjust the hardware parameters; When the error tracing result is an algorithm error, the algorithm parameters are corrected, including: correcting the parameters in the preset conversion matrix and / or correcting the fitted blackbody trajectory.

10. A method for automatic identification and color detection of LEDs in lamps based on visual recognition, applied to the automatic identification and color detection system for LEDs in lamps based on visual recognition according to any one of claims 1 to 9, characterized in that: The method comprises: Collecting original image information of the LED lamp; Performing denoising, contrast enhancement, and image correction processing on the original image information of the lamp LED, and outputting pre-processed lamp LED image information; Based on threshold segmentation, morphological operation and contour detection algorithm, the pre-processed lamp LED image information is roughly segmented to obtain LED areas; Based on the pre-trained target detection model, the LED area after rough segmentation is accurately identified to obtain the position information of each LED; Convert the LED area image from RGB to CIE XYZ color space based on a preset conversion matrix to obtain tristimulus values; generating color coordinates for each LED based on the tristimulus values; Generate a color temperature corresponding to each LED based on the color coordinates of each LED and a pre-fitted blackbody locus; The position information of each LED, the color coordinates of each LED and the color temperature corresponding to each LED are stored visually, and the eligibility of each LED is automatically determined based on preset standard data.