A label detection method, system, and computer-readable storage medium
By acquiring ambient light data for brightness and color temperature correction, standard label images are generated, solving the problem of poor label detection accuracy in semi-open workshops and achieving highly accurate and stable label position detection.
Patent Information
- Application Number
- CN202611053089.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-08-25
AI Technical Summary
In the automated labeling process for laptops, existing detection algorithms struggle to accurately detect label positions in semi-open workshop environments. They are also susceptible to interference from ambient light, leading to poor detection accuracy, false detections, and production line downtime.
By acquiring ambient light brightness and color temperature data of the label to be attached, brightness and color temperature compensation coefficients are calculated to correct the label image, generating a standard label image, and morphological algorithms are used to detect the label position.
It improves the accuracy and stability of label detection, reduces the false detection rate, enhances the operational stability and efficiency of the production line, and avoids production line downtime and product scrap.
Smart Images

Figure CN122636601A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of visual inspection and positioning technology, specifically to a label detection method, system, and computer-readable storage medium. Background Technology
[0002] In the automated label application process for laptops, the position coordinates of the label in the world coordinate system within the original label image must be detected using industrial camera imaging combined with morphological algorithms. The accuracy of this detection directly determines the label application yield and production line efficiency. If the label image coordinate detection is inaccurate, it will lead to automatic application failure, affecting production efficiency and even damaging the product.
[0003] Due to limitations in robotic arm operating space and factory utilization, label inspection stations are mostly semi-open structures. Label imaging is easily affected by workshop lighting, natural light, and ambient equipment light sources, causing label image distortion and making it difficult for existing detection algorithms to accurately determine the label's position coordinates in the label image. Figure 1 (a) shows that the detection is correct and the positioning is accurate, while (b) shows that the positioning is deviated and the detection is incorrect due to the increased ambient light.
[0004] Current technologies primarily address these issues by using fixed lighting and manual parameter tuning, but manual tuning is inefficient and has a high failure rate. Some methods attempt dynamic lighting and HDR imaging techniques, but these either require additional programmable light source controllers, increasing costs, or only improve the static dynamic range of a single image. Existing image compensation methods rely solely on post-processing of the image itself or employ fixed, predefined compensation strategies, failing to eliminate lighting interference at its source and exhibiting insufficient detection robustness. Summary of the Invention
[0005] This application addresses the aforementioned technical problems existing in related technologies. The purpose of this application is to provide a label detection method, system, and computer-readable storage medium that can solve the technical problem that semi-open label application equipment is affected by dynamic fluctuations in ambient light in the workshop, leading to poor label detection accuracy, false detections, and consequently production line downtime and product scrapping.
[0006] According to a first aspect of this application, a label detection method is provided. The label detection method includes acquiring a first label image of a label to be affixed located on a label affixing device; determining a representative value of brightness and a representative value of color temperature corresponding to the ambient light of the label to be affixed; determining a brightness compensation coefficient based on the representative value of brightness and a target reference brightness; determining a color temperature compensation coefficient based on the representative value of color temperature and the target reference color temperature; correcting the first label image based on the brightness compensation coefficient and the color temperature compensation coefficient to determine a standard label image; and determining the position detection result of the label based on the standard label image.
[0007] According to a second aspect of this application, a label detection system is provided. The system includes: an image acquisition device configured to acquire a first label image of a label to be applied located on a label application device; multiple light sensors respectively disposed outside each corner of the detection field of view of the image acquisition device, used to acquire brightness data and color temperature data of the ambient light where the label to be applied is located; and a processor configured to acquire the first label image, brightness data, and color temperature data, and determine a representative brightness value and a representative color temperature value based on the brightness data and color temperature data; determine a brightness compensation coefficient based on the representative brightness value and a target reference brightness; determine a color temperature compensation coefficient based on the representative color temperature value and the target reference color temperature; correct the first label image based on the brightness compensation coefficient and the color temperature compensation coefficient to determine a standard label image; and determine the position detection result of the label based on the standard label image.
[0008] According to a third aspect of this application, a computer-readable storage medium is provided having instructions stored thereon, wherein when executed by a processor, the instructions perform the steps of the tag detection method as described in various embodiments of this application.
[0009] Compared with related technologies, the beneficial effects of the embodiments of this application are as follows: The label detection method provided in this application determines the representative values of brightness and color temperature of the ambient light corresponding to the location of the label to be attached. Based on the representative values of brightness and the target reference brightness, a brightness compensation coefficient is determined. Based on the representative values of color temperature and the target reference color temperature, a color temperature compensation coefficient is determined. The original first label image is then corrected for brightness and color temperature using the brightness compensation coefficient and the color temperature compensation coefficient to obtain a standard label image. The position of the label image in the world coordinate system is determined based on the standard label image. Thus, before using morphological algorithms to detect the position of the label to be attached in the label image, brightness and color temperature correction corrects the acquired first label image to be attached to a standard label image under stable standard lighting conditions. Based on this standard label image, the accuracy and stability of detecting the position of the label to be attached in the world coordinate system can be improved.
[0010] Brightness and color temperature correction of the original first label image can effectively reduce image distortion problems such as overexposure, shadows, and color casts caused by ambient light fluctuations. This helps reduce the computational complexity of subsequent visual inspection, steadily improves the accuracy of label coordinate detection, and reduces label mis-detection and misalignment caused by lighting disturbances. Furthermore, it ensures the stability and reliability of detection results under various workshop lighting conditions, improves the operational stability and production efficiency of the label application production line, and avoids production line downtime and product scrap caused by mis-detection.
[0011] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above description and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0012] In drawings that are not necessarily drawn to scale, the same reference numerals may describe similar parts in different views. Similar reference numerals with different letter suffixes may indicate different examples of similar components. The drawings generally illustrate various embodiments by way of example rather than limitation, and are used together with the specification and claims to illustrate the disclosed embodiments. Such embodiments are illustrative and exemplary, and are not intended to be exhaustive or exclusive embodiments of the method, apparatus, or non-transitory computer-readable medium having instructions for implementing the method.
[0013] Figure 1 The diagram illustrates how changes in ambient light cause the label position detection on a laptop to fail: (a) Detection is correct under normal lighting conditions; (b) When the ambient light intensifies, image features change, leading to an error in the detection.
[0014] Figure 2 A flowchart illustrating a label detection method according to an embodiment of this application is shown.
[0015] Figure 3 A schematic diagram showing the arrangement of a light sensor according to an embodiment of this application is provided.
[0016] Figure 4 This diagram illustrates yet another flowchart of a label detection method according to an embodiment of the present application.
[0017] Figure 5 A schematic diagram of the structure of a label detection system according to an embodiment of this application is shown. Detailed Implementation
[0018] To enable those skilled in the art to better understand the technical solutions of this application, the application will be described in detail below with reference to the accompanying drawings and specific embodiments. The embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific examples, but these are not intended to limit the scope of this application.
[0019] The terms "first," "second," and similar words used in this application do not indicate any order, quantity, or importance, but are merely used for distinction. The terms "including" or "comprising," etc., used in this application mean that the element preceding the word encompasses the elements listed after the word, and do not exclude the possibility of encompassing other elements. In this application, the arrows shown in the figures for each step are merely examples of the execution order, not limitations. The technical solution of this application is not limited to the execution order described in the embodiments. The steps in the execution order can be combined, broken down, or rearranged, as long as the logical relationship of the executed content is not affected.
[0020] All terms used in this application (including technical or scientific terms) have the same meaning as understood by one of ordinary skill in the art to which this application pertains, unless otherwise specifically defined. It should also be understood that terms defined in general dictionaries should be interpreted as having meanings consistent with their meanings in the context of the relevant art, and not as idealized or highly formalized, unless expressly defined herein. Technologies and equipment known to one of ordinary skill in the art may not be discussed in detail, but where appropriate, such technologies and equipment should be considered part of the specification.
[0021] Figure 2 A flowchart illustrating a tag detection method according to an embodiment of this application is provided. In this flowchart, the arrows shown from step S201 to step S206 are merely examples of the execution order and not limitations. The technical solution of this application is not limited to the execution order described in the embodiments. The steps in the execution order can be combined, decomposed, or their order can be changed, as long as the logical relationship of the execution content is not affected. For example, step S201 can be executed first, followed by step S202, or step S202 can be executed first, followed by step S201.
[0022] In step S201, a first label image is obtained located on the label application device.
[0023] The labels to be affixed can be various identification stickers that need to be pasted onto the surface of the target part during the product manufacturing stage, including product model labels, energy efficiency labels, environmental protection labels, 3C certification labels, anti-counterfeiting labels, QR code traceability labels, serial number labels, brand logo labels, and warning labels. The label material can be paper, matte silver PET, PVC, etc., and this application does not specifically limit the label type or material.
[0024] The target component may include a variety of items such as laptops, screens, keyboards, power banks, mice, speakers, hard drives, and packaging boxes, and is not limited thereto.
[0025] The label application equipment can be an automated device that can pick up labels and automatically apply them, such as a robotic arm automatic labeling machine, a collaborative robot labeling workstation, a gantry sliding table labeling machine, or a multi-station turntable labeling machine, and there is no limitation on this.
[0026] The first label image is determined based on the position of the label to be applied on the operating end of the label applying device. The operating end on the label applying device can be used for negative pressure gripping and stable fixing of the label to be applied. The operating end is preferably a vacuum suction cup at the end of a robotic arm, but multiple sets of small negative pressure suction nozzles or other negative pressure adsorption execution structures can also be used, and there is no limitation on this.
[0027] Specifically, taking the label attaching device as a robotic arm as an example, the vacuum suction cup at the end of the robotic arm picks up the label to be attached, and the label is temporarily adsorbed on the vacuum suction cup for subsequent attachment to the surface of the target part.
[0028] In some embodiments of this application, an image acquisition device can be used to acquire an image of the first label to be attached. The image acquisition device can be any imaging device with high-definition image acquisition function, such as an industrial camera, a high-definition camera module, or an intelligent vision camera, and there is no limitation thereto.
[0029] Specifically, the image acquisition device can capture an image of the first label to be attached after receiving the signal that the target item is in place, so as to obtain the original image data of the label. The original image data of the label contains a timestamp to facilitate subsequent data alignment.
[0030] For example, on an automated production line for labeling the A-side of a laptop computer, a label peeling mechanism can be positioned on one side of the production line, with a robotic arm positioned between the label peeling mechanism and the workpiece conveyor. A vacuum suction cup, serving as the operating end, is mounted at the end of the robotic arm. An industrial camera is fixed to a bracket on one side of the production line with its lens pointing vertically downwards. After the label peeling mechanism separates a single label to be applied, the robotic arm drives the vacuum suction cup to move to the label position to complete the negative pressure adsorption gripping. Subsequently, the robotic arm, carrying the suction cup with the label adsorbed, moves to the field of view directly below the industrial camera and hovers briefly. The industrial camera then triggers an image capture, acquiring the original first label image on the suction cup, and sends the acquired first label image to a processing device that performs visual inspection.
[0031] In step S202, the representative values of brightness and color temperature corresponding to the ambient light of the area where the label to be attached is located are determined.
[0032] In some embodiments, the brightness and color temperature data of the ambient light where the label to be attached is located are obtained, and representative values of brightness and color temperature are determined.
[0033] In some embodiments, luminance data and color temperature data of the ambient light where the label to be attached is located can be collected based on multiple light sensors, and the light sensors can be arranged near the image acquisition device. For example, all the light sensors can be fixedly assembled on the bracket or housing supporting the image acquisition device, or the light sensors can be respectively arranged around the acquisition station of the image acquisition device or around the operation end, etc. There is no specific limitation on this, as long as the light sensors can collect the real ambient light information of the label shooting area without obstruction, and the light sensors themselves do not block the shooting field of view of the image acquisition device and do not form obstruction or reflection interference in the first label image for imaging.
[0034] Specifically, the light sensors can collect ambient light information at a preset time interval. The preset time interval can be 100ms, 120ms, 130ms or 140ms, and there is no limitation on this and it can be set by oneself. For example, the light sensors can collect ambient light information every 100ms, and based on the ambient light information, parse and output multiple groups of original luminance data and color temperature data.
[0035] A unified clock synchronization signal can be set for each light sensor, and the light sensors trigger the collection of ambient light information according to the clock synchronization signal, so as to ensure that each light sensor can achieve consistent collection time and avoid generating a time difference.
[0036] As a preferred embodiment, the multiple light sensors are respectively arranged outside each corner point of the detection field of view of the image acquisition device, wherein each light sensor is distributed in a surrounding manner based on the center of the detection field of view of the image acquisition device.
[0037] Specifically, as Figure 3 shown, the image acquisition device is a camera 301, and light sensors 302 can be respectively arranged outside each corner point of the detection field of view of the camera 301, wherein each of the light sensors 302 is arranged in a surrounding manner with the detection field of view of the camera 301 as the center.
[0038] Among them, the detection field of view of the camera 301 refers to the effective visible area where the camera 301 images the label adsorbed by the robotic arm. The light sensors 302 can be arranged at the outer edges close to the four corner points of the detection field of view. The detection direction of the light sensors 302 is parallel to the optical axis of the camera 301, and each light sensor 302 maintains a fixed industrial safety distance from the corner point. For example, the light sensors 302 are arranged at a position offset 40mm outside the corner point. There is no limitation on the number of the light sensors 302 arranged. For example, it can also be set to 6 or 8.
[0039] By positioning each light sensor 302 close to the detection field of the camera 301, full-area ambient light acquisition is achieved, ensuring a high degree of match between the acquired ambient light information and the actual ambient light in the tag's imaging. Simultaneously, positioning each light sensor 302 outside the corners of the camera 301's detection field of view avoids imaging interference and interference from the robotic arm's operation, improving the reliability and stability of the acquired data.
[0040] In some embodiments of this application, multiple sets of brightness data collected by multiple light sensors are filtered and weighted to obtain a representative brightness value; multiple sets of color temperature data collected by multiple light sensors are filtered and weighted to obtain a representative color temperature value.
[0041] For example, when four light sensors are respectively arranged at the four outer corners of the field of view of the image acquisition device, each light sensor synchronously collects ambient light brightness data and color temperature data. The processing device obtains four sets of brightness and color temperature data, and can perform a first-order low-pass timing filter on each set of brightness and color temperature data to filter out data jitter and abnormal jump values caused by interference such as instantaneous occlusion by personnel and light flicker. Then, it sets weights according to the light influence of the corresponding work area of each light sensor, and performs a weighted summation operation based on each weight to obtain the representative values of brightness and color temperature.
[0042] In some embodiments of this application, when the ambient light brightness data and color temperature data are collected based on multiple light sensors, the brightness data and color temperature data from the multiple light sensors are obtained, and the brightness data and color temperature data are filtered to determine the filtered first brightness value and first color temperature value.
[0043] Furthermore, after acquiring brightness and color temperature data from the multiple light sensors, abnormal data can be removed. For example, if the brightness data... L t or color temperature data T t Data exceeding the threshold range is considered abnormal and discarded. Abnormal data removal processes can eliminate outliers caused by momentary interference from the light acquisition equipment, personnel obstruction, equipment reflections, or sudden changes in the production line's light source (such as extremely high or low brightness data momentarily).
[0044] In some embodiments, the filtering process may include time series filtering using methods such as sliding window averaging filtering, first-order low-pass filtering, second-order low-pass filtering, exponential moving average filtering, or median filtering.
[0045] Specifically, after removing outlier data, time series filtering methods can be used to smooth the collected brightness and color temperature data. For example, the brightness data can be filtered using formula (1): (1- α ) Formula (1).
[0046] In formula (1), α Represents the filter coefficients (0 < α ≤1), used to reflect the response characteristics of the filter output to changes in the input. α The larger the value, the faster the filter output responds to changes in illumination, but the ability to suppress transient noise and local fluctuations weakens. α The smaller the value, the better the smoothing effect of the filter output on noise and short-term fluctuations, but the weaker the ability to track changes in illumination and the slower the response speed. Therefore, as a preferred embodiment, in order to achieve a balance between response speed and smoothness, the... α Set it to 0.2. L t Indicates the current time t Brightness data (unit: lx). This represents the first brightness value after filtering at the current moment. This represents the first brightness value after filtering at the previous moment.
[0047] For example, the color temperature data can be filtered using formula (2): (1- α ) Formula (2).
[0048] In formula (2), the same applies as in formula (1). α Represents the filter coefficients (0 < α ≤1), preferably, the α Set to 0.2, T t This represents the color temperature data (unit: K) at the current time t. This represents the first color temperature value after filtering at the current moment. This represents the first color temperature value after filtering at the previous moment.
[0049] Wherein, the acquisition time point of the previous moment is earlier than the current moment. For example, if the image acquisition device acquires images at a time interval of 100ms, and the current moment is the 500ms, then the corresponding previous moment is the 400ms. This is only used as an example for illustration.
[0050] In other words, based on the brightness and color temperature data acquired by each light sensor at the current moment, and the filtered first brightness and first color temperature values from the previous moment, time-series filtering and smoothing processes are performed to determine the filtered first brightness and first color temperature values at the current moment.
[0051] The luminance and color temperature data are smoothed by time-series filtering using formulas (1) and (2) respectively, to obtain the effective first luminance and first color temperature values at the current moment. In this way, jitter and high-frequency noise in the illumination data can be suppressed, resulting in smooth and gradually changing effective illumination parameters.
[0052] In some embodiments, a weighted fusion process is performed based on the preset brightness weights of each light sensor and the first brightness value at the current moment to determine the representative brightness value; a weighted fusion process is performed based on the preset color temperature weights of each light sensor and the first color temperature value at the current moment to determine the representative color temperature value.
[0053] Specifically, the representative brightness value can be determined by weighted fusion processing according to formula (3): L env ( t )= , Formula (3).
[0054] In formula (3), L env ( t () represents the brightness value at the current time t. w i This represents the preset brightness weight of the i-th light sensor, and N represents the number of light sensors. This represents the first brightness value of the i-th light sensor at the current moment after filtering.
[0055] The representative value of color temperature can be determined by weighted fusion processing according to formula (4): T env ( t )= , Formula (4).
[0056] In formula (4), T env(t) This represents the color temperature value at the current time t. This represents the preset color temperature weight for the i-th light sensor, and N represents the number of light sensors. This represents the first color temperature value after filtering at the current moment of the i-th light sensor.
[0057] Among them, the brightness representative value obtained after weighted fusion L env ( t ) and color temperature representative value T env(t) It eliminates local differences and local ambient light interference, and can represent the ambient light level of the label at the current moment.
[0058] Returning to the embodiment of this application, in step S203, a brightness compensation coefficient is determined based on the representative brightness value and the target reference brightness.
[0059] The target reference brightness can be a standard brightness value set in advance during the equipment calibration stage and stored in the system. It corresponds to the ideal standard working conditions of uniform lighting, no direct sunlight, no equipment obstruction, and stable light without fluctuations at the label shooting station. It can also be a standard brightness value measured in a standard workshop environment with uniform and stable lighting and no extra light interference before the equipment leaves the factory. For example, the target reference brightness can be 27500 lx.
[0060] Specifically, the brightness compensation coefficient can be determined based on the ratio of the target reference brightness to the representative brightness value. Alternatively, multiple lighting intervals can be pre-divided according to the brightness level. First, determine which interval the current representative brightness value falls into. Different intervals are matched with different correction ratios. Then, the ratio of the target reference brightness to the representative brightness value is multiplied by the corresponding interval correction ratio to obtain the brightness compensation coefficient. The brightness is amplified and enhanced in low-light intervals, and the brightness is weakened in high-light intervals.
[0061] This is merely an example and does not constitute a limitation on any specific solution.
[0062] For example, the brightness compensation coefficient can be calculated according to formula (5): Formula (5).
[0063] In formula (5), k t This represents the brightness compensation factor, used for pixel scaling of the image. L ref This represents the target reference brightness, which can be set based on experience. This represents a small constant to avoid division by zero (usually 10). -6 (or smaller) β The nonlinear control coefficients are used to adjust the linear or nonlinear strength of the compensation response; preferably, they are set to... β= Version 1.1 can amplify the brightening effect in low-light scenes and moderately reduce the darkening effect in bright scenes, making the label texture and character details clearer in low light, without loss of detail in highlight areas, and making the image transition more natural.
[0064] Among them, the brightness compensation coefficient is used to characterize the overall deviation of the current ambient brightness from the target reference brightness, so as to realize the adaptive adjustment of the overall brightness of the image.
[0065] In formula (5), a small constant is introduced to make the brightness representative value obtained by fusing multiple light sensors more accurate. L env ( t When the value approaches 0, it can avoid calculation errors and abnormal program interruptions caused by a denominator of 0, and ensure that the brightness compensation coefficient is stable and calculable throughout the process.
[0066] Based on target reference brightness L ref Representative value of brightness L env ( t The ratio of ) can quantify the deviation between the current ambient brightness and the standard brightness, enabling adaptive pixel scaling correction to compress brightness in strong light and brighten the image in weak light.
[0067] In step S204, the color temperature compensation coefficient is determined based on the color temperature representative value and the target reference color temperature.
[0068] The target reference color temperature can be a standard color temperature value that has been pre-collected and stored by the device in a standard calibration environment with uniform illumination and no interference from other light sources.
[0069] Specifically, the color temperature compensation coefficient can be determined based on the difference between the representative color temperature value and the target reference color temperature. For example, the sign of the difference can be used to distinguish the warm or cool tone of the ambient light, and then the corresponding color temperature compensation coefficient can be calculated by combining the magnitude of the absolute value of the difference. If the difference is greater than zero, it means that the current ambient light color temperature is higher than the target reference color temperature, and the environment is cool. The larger the absolute value of the difference, the more serious the cool tone shift, and a color temperature compensation coefficient that tends to increase the gain of the red and green channels is generated accordingly. If the difference is less than zero, it means that the current ambient light color temperature is lower than the target reference color temperature, and the environment is warm. The larger the absolute value of the difference, the more serious the warm tone shift, and a color temperature compensation coefficient that tends to increase the gain of the blue channel is generated accordingly.
[0070] Alternatively, during the calibration phase before the equipment leaves the factory, various real-world lighting scenarios in the workshop can be simulated, including different conditions such as warm light, cool light, mixed natural light, and multiple light sources superimposed. Stable representative color temperature values for each scenario are collected using multiple light sensors. Then, color correction parameters are adjusted one by one for the label images captured in each scenario until the image colors are free of color cast and the label text and color blocks are accurately reproduced. The optimal set of correction parameters is then used as the color temperature compensation coefficient for the corresponding color temperature. All collected representative color temperature values are bound to the matched color temperature compensation coefficients to generate a complete color temperature mapping table, which is then stored. Finally, based on the representative color temperature value, the preset color temperature mapping table is quickly traversed to find the color temperature compensation coefficient that matches the current representative color temperature value.
[0071] For example, the color temperature compensation coefficient can be calculated according to formula (6): Formula (6).
[0072] in, g R This represents the color temperature compensation coefficient for the red channel. g B This represents the color temperature compensation coefficient for the blue channel. g R and g B Used to correct image color cast T ref Indicates the target reference color temperature. η R and η B These represent the color temperature adjustment coefficients for the red channel and blue channel, respectively. These can be customized based on the workshop environment. For example... η R and η B They can be set to 0.95 and 0.98 respectively.
[0073] In this way, dynamic adaptive correction based on ambient light source can be achieved, and color deviation of light at different times and work positions can be automatically compensated, reducing visual inspection errors caused by light disturbances.
[0074] In step S205, the first label image is corrected based on the brightness compensation coefficient and the color temperature compensation coefficient to determine the standard label image.
[0075] In other words, a brightness compensation coefficient is used to adjust the overall brightness of the original first label image, while a color temperature compensation coefficient is used to adjust the gain of the RGB three channels of the first label image, correcting color cast issues caused by the warm or cool ambient light. This eliminates image distortion caused by real-time fluctuations in workshop ambient light from both brightness and color perspectives. Through joint brightness and color temperature correction, the actual on-site captured first label image, which is subject to stray light interference, is corrected to a pre-calibrated stable standard lighting scene to generate a standardized standard label image, effectively improving distortion defects such as overexposure, local shadows, and yellow / blue tint. Thus, based on the standard label image, the accurate position coordinates of the label in the world coordinate system can be obtained, guiding the labeling operation and improving both labeling accuracy and efficiency.
[0076] In some embodiments of this application, the first label image is converted to a color space to obtain a first luminance component and a first chrominance component; the first luminance component is luminance corrected using the luminance compensation coefficient to determine a second luminance component; and an inverse color space conversion is performed based on the second luminance component and the first chrominance component to obtain a luminance-corrected second label image.
[0077] The first label image is stored in the RGB color space by default. Specifically, the original first label image can be converted to the YUV color space to obtain the first luminance component Y( ). x , y ) and the first chromaticity component U( x , y ), V( x , y ).
[0078] For example, the RGB image I( x , y )={R( x , y ),G( x , y ),B( x , y Convert to YUV color space:
[0079] In formula (7), Y( x , y ) is the image pixel ( x , y The first luminance component at point U( x , y ), V( x , y R( is the first chromaticity component) x , y ), G(x , y ), B ( x , y ) is the RGB pixels of the first label image ( x , y The pixel values of the red, green, and blue channels at ().
[0080] Using the brightness compensation coefficient to adjust the first brightness component Y( x , y Linear scaling is performed to obtain the second luminance component Y' after luminance compensation. x , y Specifically, as shown in formula (8): Y'( x , y =clip( k t ,Y( x , y ),0,255) formula (8).
[0081] In formula (8), k t Y( is the brightness compensation coefficient) x , y () represents the first luminance component.
[0082] The second luminance component Y' after luminance compensation x , y ) and the first chromaticity component U( x , y ), V( x , y After inverse color space conversion, the image is restored to RGB to obtain the second label image after brightness compensation. Specifically, the image restoration can be performed according to formula (9):
[0083] In some embodiments of this application, the color temperature compensation coefficient is used to perform color temperature correction on the R and G channels of the second label image to determine the color temperature corrected third label image.
[0084] Specifically, the color temperature compensation coefficient of the red channel can be used separately. g R The color temperature compensation coefficient of the blue channel g B Gain adjustment is performed on the second label image after brightness compensation to obtain the third label image after color temperature compensation.
[0085] For example, color temperature gain can be adjusted according to formula (10):
[0086] In some embodiments of this application, a gamma correction coefficient negatively correlated with the brightness compensation coefficient is determined based on the brightness compensation coefficient; the first label image is corrected based on the brightness compensation coefficient, the color temperature compensation coefficient, and the gamma correction coefficient.
[0087] The gamma correction coefficient can be used for non-linear contrast adjustment of the image, compensating for the shortcomings of linear brightness correction. The gamma correction coefficient is negatively correlated with the brightness compensation coefficient. This means that when the brightness compensation coefficient is small and the image is darkened, the gamma correction coefficient automatically increases, compressing highlights and restoring lost texture details in reflective areas of the label. Conversely, when the brightness compensation coefficient is large and the image is brightened, the gamma correction coefficient automatically decreases, gently brightening dark areas and suppressing noise.
[0088] It is understandable that by correcting the first label image through the brightness compensation coefficient and the color temperature compensation coefficient, the original image affected by ambient light interference can be corrected into an ideal image under standard brightness and standard color temperature, which can greatly reduce or even completely eliminate image distortion caused by light intensity and ambient color shift, reduce the interference of light disturbance on visual detection results, and effectively improve the detection accuracy of label positioning.
[0089] Furthermore, by jointly correcting the first label image based on the brightness compensation coefficient, color temperature compensation coefficient, and gamma compensation coefficient, the dark details of the label image can be further improved and the bright areas can be suppressed, thereby significantly improving the recognition accuracy and stability of the label image detection under fluctuating illumination.
[0090] In some embodiments, the gamma correction coefficient is determined based on the ratio of a reference gamma value to a brightness compensation coefficient. The reference gamma value may be a fixed reference constant preset under standard lighting conditions. The gamma compensation coefficient can make the corrected image more stable while correcting the brightness deviation caused by ambient light.
[0091] Specifically, the gamma correction coefficient can be calculated according to formula (11): Formula (11).
[0092] in, γ Indicates the gamma correction factor. γ 0 represents the reference gamma value, for example γ 0 represents 1.0.
[0093] In some embodiments of this application, the gamma correction coefficients are used to perform gamma correction on the RGB three channels of the third label image to determine the standard label image.
[0094] Specifically, the color temperature compensated third label image is subjected to nonlinear transformation using the gamma correction coefficient to perform gamma correction, resulting in a gamma-corrected standard label image. Specifically, gamma correction can be performed according to formula (12):
[0095] In other words, after brightness and color temperature correction is performed on the first label image, dynamic gamma correction is then performed on the RGB three channels to improve the details in the dark areas of the image and suppress the bright areas.
[0096] Thus, by performing brightness, color temperature, and gamma correction on the first label image to obtain a standard label image, the imaging interference caused by ambient light fluctuations can be effectively eliminated. This corrects the original first label images collected under different environments to the image quality collected under standard lighting conditions, thereby improving the accuracy of detecting the pixel coordinates of the label to be attached in the corrected standard label image.
[0097] Returning to the embodiment of this application, in step S206, the position detection result of the label is determined based on the standard label image.
[0098] In other words, after determining the standard label image, the label pixel coordinates of the standard label image are converted into coordinates in the world coordinate system, thereby determining the position coordinates of the label to be attached in the standard label image, so as to accurately attach the label based on the position detection results of the determined label to be attached.
[0099] Specifically, after obtaining a standard label image through calibration, morphological algorithms can be used to accurately extract the outline of the label to be attached from the standard label image to obtain the label pixel coordinates. Combined with the transformation matrix obtained from the pre-completed camera calibration and hand-eye calibration, the pixel coordinates corresponding to the label in the standard label image are converted layer by layer into three-dimensional spatial coordinates in the world coordinate system required for the motion control of the label attaching device. This facilitates accurate label attaching and avoids label attaching failure due to ambient light disturbance.
[0100] For example, Figure 4 Another flowchart for laptop label detection is shown to verify the effectiveness of the method provided in the embodiments of this application. In this embodiment, 2,300 labels are tested.
[0101] In step S401, the system is initialized for hardware debugging, parameter preset, and coordinate system calibration. In step S402, ambient light is collected using a light sensor. Then, step S403 extracts brightness data, and step S404 extracts color temperature data. Next, step S405 removes abnormal data and performs time-series filtering and smoothing (as in step S406). In step S407, data processing and analysis are performed based on the collected ambient light brightness and color temperature data to determine representative brightness and color temperature values. In step S408, brightness compensation coefficients and color temperature compensation coefficients are calculated. In step S410, gamma correction coefficients are calculated based on the brightness compensation coefficients for subsequent gamma correction processing. Step S412 is triggered when the camera receives the label from the robotic arm and enters its detection field of view. The camera collects the original first label image, and then step S409 is executed, where brightness compensation coefficients and color temperature compensation coefficients are used for compensation processing to obtain the third label image after brightness and color temperature compensation. Then, continue to execute step S411, perform gamma correction processing on the third label image after brightness and color temperature compensation to obtain a standard label image, continue to execute step S413, obtain the position coordinates of the label in the world coordinate system based on the standard label image, and then execute step S414 to determine whether to continue detection. If the determination result is no, the detection ends. If the determination result is yes, continue to execute step S402, update the light sensor data, and perform subsequent dynamic image compensation processing on the ambient light signal collected at the next moment.
[0102] Verification has shown that the label detection accuracy of the method provided in this embodiment, which performs label position detection based on the corrected standard label image, is as high as 99.4%. It is evident that the label visual detection method provided in this application embodiment can significantly improve the label detection accuracy.
[0103] In some embodiments of this application, a label visual inspection system is provided, such as Figure 5The label visual inspection system 500 includes an image acquisition device 501, multiple light sensors 502, and a processor 503. The image acquisition device 501 is configured to acquire a first label image of the label to be applied on a label application device. The multiple light sensors 502 are respectively located outside the detection field of view of the image acquisition device to acquire brightness and color temperature data of the ambient light surrounding the label. The processor 503 is configured to acquire the first label image, brightness data, and color temperature data; determine representative brightness and color temperature values based on the brightness and color temperature data; determine a brightness compensation coefficient based on the representative brightness value and a target reference brightness; determine a color temperature compensation coefficient based on the representative color temperature value and the target reference color temperature; correct the first label image based on the brightness compensation coefficient and the color temperature compensation coefficient to determine a standard label image; and determine the label position detection result based on the standard label image. This significantly improves the accuracy and stability of label position detection and positioning.
[0104] It should be noted that the steps of the label detection method described in each embodiment of this application are also applicable here.
[0105] The processor can be a processing device that includes one or more general-purpose processing devices, such as a microprocessor, a central processing unit (CPU), a graphics processing unit (GPU), etc. More specifically, the processor can be a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, a processor that runs other instruction sets, or a processor that runs a combination of instruction sets. The processor can also be one or more special-purpose processing devices, such as application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), system-on-a-chip (SoCs), etc.
[0106] This application describes various operations or functions that can be implemented as software code or instructions, or defined as software code or instructions. Such content can be directly executable source code or differential code (“incremental” or “patch” code) (“object” or “executable” form). The software code or instructions can be stored in a computer-readable storage medium and, when executed, can cause a machine to perform the described functions or operations, and include any mechanism for storing information in a machine-accessible form, such as recordable or non-recordable media (e.g., read-only memory (ROM), random access memory (RAM), disk storage media, optical storage media, flash memory devices, etc.).
[0107] The exemplary methods described in this application can be implemented, at least in part, by a machine or computer. In some embodiments, a computer-readable storage medium stores instructions thereon, wherein, when executed by a processor, the instructions perform the steps of the tag detection methods as described in the various embodiments of this application.
[0108] Implementations of such methods may include software code, such as microcode, assembly language code, high-level language code, etc. Various software programming techniques can be used to create various programs or program modules. For example, program parts or program modules can be designed using or with the aid of Java, Python, C, C++, assembly language, or any known programming language. One or more of such software parts or modules can be integrated into a computer system and / or a computer-readable medium. Such software code may include computer-readable instructions for performing various methods. This software code can form part of a computer program product or a computer program module. Furthermore, in the example, the software code may be tangibly stored on one or more volatile, non-transitory, or non-volatile tangible computer-readable media, for example, during execution or at other times. Examples of such tangible computer-readable media may include, but are not limited to, hard disks, removable disks, removable optical discs (e.g., optical discs and digital video discs), magnetic tape cassettes, memory cards or memory sticks, random access memory (RAM), read-only memory (ROM), etc.
[0109] Furthermore, although exemplary embodiments have been described herein, their scope includes any and all embodiments based on this application that have equivalent elements, modifications, omissions, combinations (e.g., schemes involving intersections of various embodiments), adaptations, or alterations. Elements in the claims will be interpreted broadly based on the language used in the claims and are not limited to the examples described in this specification or during the implementation of this application, which will be interpreted as non-exclusive. Therefore, this specification and examples are intended to be considered illustrative only, and the true scope and spirit are indicated by the following claims and the full scope of their equivalents.
[0110] The above description is intended to be illustrative and not restrictive. For example, the above examples (or one or more of them) can be used in combination with each other. Other embodiments can be used by those skilled in the art when reading the above description. Furthermore, in the above detailed description, various features may be grouped together to simplify the application. This should not be construed as an intention that a disclosed feature not claimed is necessary for any claim. Rather, the subject matter of the application may be less than all the features of a particular disclosed embodiment. Thus, the claims are incorporated herein by reference as examples or embodiments, wherein each claim is an independent, separate embodiment, and these embodiments are contemplated as being able to be combined with each other in various combinations or arrangements. The scope of this application should be determined by reference to the appended claims and the full scope of their equivalents.
[0111] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A label detection method, characterized in that, The label detection method includes: Acquire a first label image located on the label application device; Determine the representative values of brightness and color temperature corresponding to the ambient light where the label to be affixed is located; The brightness compensation coefficient is determined based on the representative brightness value and the target reference brightness; The color temperature compensation coefficient is determined based on the representative color temperature value and the target reference color temperature. The standard label image is determined by correcting the first label image based on the brightness compensation coefficient and the color temperature compensation coefficient. The location detection result of the label is determined based on the standard label image.
2. The label detection method according to claim 1, characterized in that, The label detection method further includes: Based on the brightness compensation coefficient, a gamma correction coefficient that is negatively correlated with the brightness compensation coefficient is determined; The first label image is corrected based on the brightness compensation coefficient, color temperature compensation coefficient, and gamma correction coefficient.
3. The label detection method according to claim 1 or 2, characterized in that, Correcting the first label image based on the brightness compensation coefficient includes: The first label image is converted to a color space to obtain a first luminance component and a first chrominance component; The first luminance component is corrected using the luminance compensation coefficient to determine the second luminance component; The second label image after brightness correction is obtained by performing inverse color space conversion based on the second luminance component and the first chrominance component.
4. The label detection method according to claim 1, characterized in that, Correction based on color temperature compensation coefficient includes: The color temperature compensation coefficient is used to correct the color temperature of the R and G channels of the second label image to determine the color temperature corrected third label image.
5. The label detection method according to claim 2, characterized in that, Correction based on the gamma correction coefficient includes: The standard label image is determined by performing gamma correction on the RGB three channels of the third label image using the gamma correction coefficients.
6. The label detection method according to claim 1, characterized in that, Determining the representative values of brightness and color temperature corresponding to the ambient light where the label to be attached is located includes: in the case of collecting brightness and color temperature data of the ambient light based on multiple light sensors, Brightness data and color temperature data from the plurality of light sensors are acquired, and the brightness data and color temperature data are filtered to determine the filtered first brightness value and first color temperature value. The representative brightness value is determined by weighted fusion processing based on the preset brightness weights of each light sensor and the first brightness value at the current moment; The representative color temperature value is determined by weighted fusion processing based on the preset weights of the color temperature of each light sensor and the first color temperature value at the current moment.
7. The label detection method according to claim 6, characterized in that, When using an image acquisition device to capture an image of the first label to be affixed, The plurality of light sensors are respectively disposed outside each corner of the detection field of view of the image acquisition device, wherein each light sensor is distributed in a ring around the center of the detection field of view of the image acquisition device.
8. The label detection method according to claim 6, characterized in that, The filtering process includes: Based on the brightness and color temperature data acquired by each light sensor at the current moment, and the filtered first brightness and first color temperature values from the previous moment, time series filtering and smoothing processes are performed to determine the filtered first brightness and first color temperature values at the current moment.
9. A label detection system, characterized in that, The system includes: An image acquisition device configured to acquire an image of a first label to be affixed on a label affixing device; Multiple light sensors, each positioned outside the detection field of view of the image acquisition device, are used to collect brightness and color temperature data of the ambient light surrounding the label to be attached; and The processor, which is configured as Acquire the first label image, brightness data, and color temperature data, and determine the representative values of brightness and color temperature based on the brightness data and color temperature data; The brightness compensation coefficient is determined based on the representative brightness value and the target reference brightness; The color temperature compensation coefficient is determined based on the representative color temperature value and the target reference color temperature. The standard label image is determined by correcting the first label image based on the brightness compensation coefficient and the color temperature compensation coefficient. The location detection result of the label is determined based on the standard label image.
10. A computer-readable storage medium having instructions stored thereon, wherein, when executed by a processor, the instructions perform the steps of the tag detection method as claimed in any one of claims 1-8.