Chromatic aberration detection method and system for cigarette decoration

By using image processing and clustering algorithms to automatically detect color differences in cigarette packaging, this technology solves the problems of low detection accuracy and low efficiency in existing technologies, and achieves high-precision, real-time detection of cigarette packaging colors.

CN121121237APending Publication Date: 2025-12-12ZHENGZHOU TOBACCO RES INST OF CNTC +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511228514.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing methods for detecting the color of cigarette packaging rely on manual visual inspection and comparison with standard samples. These methods are easily affected by factors such as ambient light and viewing angle, resulting in low detection accuracy and efficiency, which cannot meet the needs of large-scale production.

Method used

Image processing algorithms are used to acquire cigarette packaging images. Color clusters are extracted through Gaussian filtering for noise reduction, morphological operations, Lab color space conversion, and clustering algorithms. Color differences are calculated using the CIEDE2000 color difference formula, and color compliance is automatically matched and judged.

Benefits of technology

It achieves high-precision, real-time detection of cigarette packaging colors, reduces the influence of human factors, improves detection efficiency and accuracy, ensures consistency and stability of results, and is suitable for complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121121237A_ABST
    Figure CN121121237A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of tobacco manufacturing and quality control, in particular to a color difference detection method and system for cigarette decoration. The method comprises the following steps: firstly, acquiring a cigarette decoration image, and preprocessing the cigarette decoration image to obtain a cigarette decoration image; extracting color information in the cigarette decoration image, and dividing color clusters; matching the clustering center points of the color clusters with the standard sample pixel points according to color differences and position distances between the clustering center points of the color clusters and the standard sample pixel points to obtain the standard sample pixel points matched with the clustering center points of the color clusters; comparing the clustering center points of the color clusters with the matched standard sample pixel points to obtain color differences; and comparing the color difference with a preset color difference threshold value, and judging whether the corresponding cigarette decoration is qualified or not. The color difference detection efficiency and accuracy of cigarette decoration are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of tobacco manufacturing and quality control, in particular to a cigarette decoration color difference detection method and system. BACKGROUND

[0002] In the tobacco industry, the color consistency of cigarette decoration is one of the important indicators of product quality. Cigarette decoration usually includes packaging boxes, labels, seals and other parts. The design and color of these decorations not only directly affect consumers' purchasing decisions, but also relate to brand image and market competitiveness. Therefore, it is crucial to ensure the color consistency and accuracy of cigarette decoration.

[0003] Currently, cigarette decoration color detection mainly relies on manual visual inspection, sample comparison and simple equipment detection methods. Among them, the sample comparison method is one of the most common methods, which compares the sample with the standard sample to judge the color difference. Although the operation is relatively simple and can provide a certain reference standard, this method also depends on the experience and judgment of the operator and is easily affected by environmental light, observation angle and other factors. In addition, the cost of sample preparation and maintenance is high. For complex color changes and subtle color differences, the sample comparison method often cannot provide accurate results.

[0004] Although the above methods can meet the basic needs of cigarette decoration color detection to some extent, there are still many limitations. First, the detection precision is low, the sample comparison method is easily affected by subjective factors, the detection result is not accurate, and there are still great limitations in complex color recognition. Second, the detection efficiency is low, the sample comparison method requires a lot of time and manpower, and is not suitable for large-scale production environment. The sample comparison method is greatly affected by environmental light, observation angle and other factors, resulting in unstable detection results. SUMMARY

[0005] In order to solve the above technical problems, the purpose of the present application is to provide a cigarette decoration color difference detection method and system, and the technical scheme adopted is as follows:

[0006] In a first aspect, the present application provides a cigarette decoration color difference detection method, which comprises:

[0007] Obtaining an image of the cigarette decoration, preprocessing the image of the cigarette decoration to obtain a cigarette decoration image;

[0008] Extracting color information in the cigarette decoration image and dividing color clusters;

[0009] According to the color difference and the position distance between the cluster center point of the color cluster and the sample pixel point, the cluster center point of the color cluster is matched with the sample pixel point, and the sample pixel point matched with the cluster center point of each color cluster is obtained.

[0010] The color difference is obtained by comparing the cluster center point of the color cluster with the matched sample pixel point, and the color difference is compared with a preset color difference threshold to determine whether the corresponding cigarette decoration is qualified.

[0011] Further, the image of the cigarette decoration is preprocessed to obtain a cigarette decoration image, including:

[0012] The image of the cigarette decoration is denoised using a Gaussian filter, and the denoised image is subjected to morphological operation processing of erosion, dilation, opening operation and closing operation to obtain an intermediate image; the intermediate image is converted to Lab color space to obtain the cigarette decoration image.

[0013] Further, the color information in the cigarette decoration image is extracted to divide color clusters, including:

[0014] The pixel points in the cigarette decoration image are clustered based on the pixel values of the pixel points in the cigarette decoration image using a clustering algorithm to obtain a plurality of color clusters.

[0015] Further, according to the color difference and the position distance between the cluster center point of the color cluster and the sample pixel point, the cluster center point of the color cluster is matched with the sample pixel point, and the sample pixel point matched with the cluster center point of each color cluster is obtained, including:

[0016] Any sample pixel point is taken as a target sample pixel point, and the cluster center point of any color cluster is taken as a target cluster center point.

[0017] According to the color difference between the target cluster center point and the target sample pixel point, the color distance between the target cluster center point and the target sample pixel point is determined.

[0018] According to the position distance between the target cluster center point and the target sample pixel point, the position distance between the target cluster center point and the target sample pixel point is determined.

[0019] The color distance and the position distance are weighted and summed to obtain the comprehensive distance between the target cluster center point and the target sample pixel point.

[0020] The sample pixel point with the smallest comprehensive distance from the target cluster center point is selected as the sample pixel point matched with the target cluster center point.

[0021] The sample pixel point matched with the cluster center point of each color cluster is determined.

[0022] Furthermore, based on the color difference between the target cluster center point and the target standard pixel point, the color distance between the target cluster center point and the target standard pixel point is determined, including:

[0023] Using the Lab color difference calculation formula, the color difference between the target cluster center point and the target standard pixel point is calculated, thus obtaining the color distance between the target cluster center point and the target standard pixel point.

[0024] Furthermore, based on the positional distance between the target cluster center point and the target standard pixel point, the positional distance between the target cluster center point and the target standard pixel point is determined, including:

[0025] Using the Euclidean distance formula, the distance between the target cluster center point and the target standard pixel point is calculated, thus obtaining the positional distance between the target cluster center point and the target standard pixel point.

[0026] Furthermore, by comparing the cluster centers of the color clusters with the matching standard pixels, the color differences are obtained, including:

[0027] Using the CIEDE2000 color difference formula, the color difference between the cluster center point of the color cluster and the matching standard pixel point is calculated. Further, comparing the color difference with a preset color difference threshold to determine whether the corresponding cigarette packaging is qualified includes:

[0028] When the color difference exceeds a preset difference threshold, the corresponding cigarette packaging is deemed unqualified.

[0029] Secondly, a color difference detection system for cigarette packaging is provided, the system comprising the following modules:

[0030] The image acquisition module is used to acquire images of cigarette packaging and preprocess the images of cigarette packaging to obtain cigarette packaging images.

[0031] The first image detection module is used to extract color information from the cigarette packaging image and divide it into color clusters;

[0032] The second image detection module is used to match the cluster center point of the color cluster with the standard pixel point based on the color difference and positional distance between the cluster center point and the standard pixel point of the color cluster, so as to obtain the standard pixel point that matches the cluster center point of each color cluster.

[0033] The detection result determination module is used to compare the cluster center points of color clusters with the matching standard pixel points to obtain the color difference; compare the color difference with the preset color difference threshold to determine whether the corresponding cigarette packaging is qualified.

[0034] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the various possible implementations of the first aspect.

[0035] Fourthly, embodiments of the present invention provide a computer program product comprising: computer program code, which, when executed on a computer, causes the computer to perform the method described in the first aspect or any possible implementation thereof.

[0036] Fifthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the various possible implementations of the first aspect.

[0037] The embodiments of the present invention have at least the following beneficial effects:

[0038] The cigarette packaging color difference detection method of this invention can achieve high-precision, real-time detection of cigarette packaging colors. It is suitable for complex environments such as cigarette packaging, significantly improving detection efficiency and accuracy, reducing the influence of human factors, and ensuring the consistency and stability of detection results, thus providing important support for subsequent quality control and production management. Through traditional image processing algorithms and optimized data processing flows, this invention demonstrates excellent performance in both detection accuracy and real-time performance, possessing high practical value and promising prospects for widespread application. Furthermore, this invention uses traditional image processing algorithms to process input data, which, compared to deep learning methods, is faster, more real-time, less dependent on hardware, and less burdensome, making it more conducive to real-time deployment and application in the field. Attached Figure Description

[0039] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 A flowchart illustrating a method for detecting color difference in cigarette packaging according to an embodiment of the present invention;

[0041] Figure 2 This is a flowchart illustrating a method for obtaining standard pixels that match the target cluster center point, according to an embodiment of the present invention.

[0042] Figure 3This is a system block diagram of a color difference detection system for cigarette packaging provided in one embodiment of the present invention. Detailed Implementation

[0043] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following detailed description, in conjunction with the accompanying drawings and preferred embodiments, describes the specific implementation, structure, features, and effects of a color difference detection method and system for cigarette packaging proposed according to the present invention.

[0044] In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form.

[0045] In the description of the embodiments of the present invention, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present invention, "multiple" means two or more.

[0046] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0048] The embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0049] The following description, in conjunction with the accompanying drawings, details the specific scheme of the color difference detection method and system for cigarette packaging provided by this invention.

[0050] Please see Figure 1 The diagram illustrates a flowchart of a method for detecting color difference in cigarette packaging according to an embodiment of the present invention. The method includes the following steps:

[0051] Step S100: Obtain an image of cigarette packaging, and preprocess the image of cigarette packaging to obtain a cigarette packaging image.

[0052] Images of cigarette packaging were captured using a high-resolution true-color camera to ensure clarity and absence of noticeable distortion. The camera was placed in a fixed position, and the angle and distance of each shot were kept consistent to guarantee image uniformity.

[0053] When acquiring images of cigarette packaging, white balance correction and light source brightness adjustment are performed to ensure that the acquired images of cigarette packaging are clear and free of reflection.

[0054] The acquired images of cigarette packaging are subjected to denoising processing. Denoising processing can effectively reduce noise interference in the image and improve the accuracy of subsequent processing.

[0055] As an embodiment of the present invention, Gaussian filtering can be used to remove noise from an image, wherein the Gaussian filtering parameters are set as follows: kernel size: 3x3 or 5x5, standard deviation: 1.0 or 1.5.

[0056] As another embodiment of the present invention, median filtering can also be used to remove noise from the image.

[0057] Applying morphological operations, such as erosion, dilation, opening, and closing operations, to the denoised image can help remove small noise points or broken edges, thereby improving image quality and providing a better foundation for subsequent color analysis and feature extraction. In one embodiment of this invention, the structuring elements for the erosion and dilation operations can be set to 3×3 rectangles, with an iteration count of 2.

[0058] The image processed through morphological operations is used as an intermediate image. This intermediate image is then converted to the Lab color space to obtain the cigarette packaging image. In other words, the cigarette packaging image is a Lab image. Converting to the Lab color space facilitates the extraction of color information from the image. The RGB color space is suitable for handling linear color changes, while the Lab color space is better suited for handling non-linear color changes.

[0059] Step S200: Extract color information from the cigarette packaging image and divide it into color clusters.

[0060] Using a clustering algorithm, the pixels in the cigarette packaging image are clustered based on their pixel values ​​to obtain multiple color clusters.

[0061] In a preferred embodiment of the present invention, the K-means clustering algorithm is used to cluster the pixels in the cigarette packaging image to obtain multiple color clusters, thereby extracting the main color regions in the cigarette packaging image. The clustering algorithm can divide the color information in the image into several clusters, each cluster representing a main color region, thus improving the accuracy of color extraction.

[0062] Step S300: Based on the color difference and positional distance between the cluster center point and the standard pixel point of the color cluster, match the cluster center point and the standard pixel point of the color cluster to obtain the standard pixel point that matches the cluster center point of each color cluster.

[0063] After clustering, location and color information are used for comprehensive matching to compare color correspondences.

[0064] Specifically, for each cluster center, not only color information but also its position in the image is considered. Matching is performed by calculating a combined distance of positional distance and color difference. This allows for more accurate identification and comparison of colors in different regions, avoiding misjudgments due to differences in location.

[0065] Specifically, any standard pixel can be used as the target standard pixel, and the cluster center of any color cluster can be used as the target cluster center. The target standard pixel and the target cluster center are used as examples for analysis. Please refer to [link / reference]. Figure 2 , Figure 2 The flowchart shows the method for obtaining the standard pixels that match the target cluster center.

[0066] Step S310: Determine the color distance between the target cluster center point and the target standard pixel point based on the color difference between the target cluster center point and the target standard pixel point.

[0067] Using the Lab color difference calculation formula, the color difference between the target cluster center point and the target standard pixel point is calculated, thus obtaining the color distance between the target cluster center point and the target standard pixel point.

[0068] Taking the target cluster center point P1 as an example, with the Lab value of the target cluster center point P1 being (L1, a1, b1), and the target standard pixel point P2 as an example, with the Lab value of the target standard pixel point P2 being (L2, a2, b2):

[0069] The formula for calculating the color distance ΔE between the target cluster center point and the target standard pixel is:

[0070]

[0071] Step S320: Determine the positional distance between the target cluster center point and the target standard pixel point based on the positional distance between the target cluster center point and the target standard pixel point.

[0072] Using the Euclidean distance formula, the distance between the target cluster center and the target standard pixel is calculated, thus obtaining the positional distance between the target cluster center and the target standard pixel. It should be noted that the coordinates of the standard pixel are its coordinates within the standard cigarette packaging image.

[0073] Taking the coordinates of the target cluster center point P1 as (x1, y1) and the coordinates of the target sample pixel point P2 as (x2, y2) as an example:

[0074] The formula for calculating the distance d between the target cluster center point and the target standard pixel is:

[0075]

[0076] Step S330: The color distance and the position distance are weighted and summed to obtain the comprehensive distance between the target cluster center point and the target standard pixel point.

[0077] Finally, a comprehensive distance D is defined to perform matching, combining color difference and positional distance. The comprehensive distance is calculated by weighted summing of the color distance and positional distance between the target cluster center and the target sample pixel.

[0078] The formula for calculating the combined distance D between the target cluster center and the target standard pixel is: D = w c ·ΔE+w p ·d; where w c The weights for color distance; w p The weights are the location distances.

[0079] Typically, the weight w of color distance c It will be set to a weight w that is greater than the positional distance. p Higher, because color information is more important in color matching, in the embodiments of the present invention w c and w p The values ​​are set to 0.95 and 0.05 respectively. In other embodiments, the implementer may adjust these values ​​according to the actual situation.

[0080] Step S340: Select the standard pixel with the smallest comprehensive distance to the target cluster center point as the standard pixel that matches the target cluster center point.

[0081] For the target cluster center point, calculate the sum of distances between the target cluster center point and all standard pixels, and select the standard pixel point with the smallest sum of distances to the target cluster center point as the standard pixel point that matches the target cluster center point.

[0082] Through steps S310 to S340, for each color cluster, the standard pixel point matching the cluster center point of each color cluster can be obtained.

[0083] Step S400: Compare the cluster center points of the color clusters with the matching standard pixel points to obtain the color difference; compare the color difference with the preset color difference threshold to determine whether the corresponding cigarette packaging is qualified.

[0084] For each cluster center point of a color cluster and its matching standard pixel, the color value of the matching standard pixel is the standard color value. The extracted color information of the cluster center points is compared with the standard color value, and the color difference between the cluster center points and the matching standard pixels is calculated using the CIEDE2000 color difference formula. The CIEDE2000 color difference formula is a widely used method for calculating color differences and can accurately reflect the differences between colors.

[0085] The CIEDE2000 color difference formula is as follows:

[0086]

[0087] Where: ΔL ′ ΔC ′ ab ΔH ′ ab It is the color difference value, k L k C k H It is the weighting coefficient, S L S C S H It refers to color perception sensitivity, R T It is a rotation term; ΔE 2000 For color differences.

[0088] The calculated color difference is compared with a preset color difference threshold to determine whether the color is acceptable. The preset threshold can be adjusted according to actual needs to ensure the accuracy of the test results. When the color difference is greater than the preset difference threshold, the corresponding cigarette packaging is deemed unacceptable. When the color difference is less than or equal to the preset difference threshold, the corresponding cigarette packaging is deemed acceptable.

[0089] In a preferred embodiment of the present invention, the test results can be displayed to the operator through a user interface, including the color difference value and the pass / fail judgment result. The user interface should be user-friendly and easy for operators to view and operate. When a color deviation exceeds a preset threshold, the system will issue an alarm message and record the non-conforming product number. The alarm message can alert the operator through sound, light, etc., to ensure timely detection and handling of non-conforming products. The image data and test results are stored in a data storage module, which supports long-term storage and fast retrieval functions, recording the time, location, and operator information of each test for subsequent analysis and traceability. The data storage module can use a database or file system for storage to ensure data security and integrity. The data storage module should have data backup and recovery functions to prevent data loss. Simultaneously, the data storage module should support data export functions to facilitate data analysis and report generation by operators.

[0090] Please see Figure 3 As shown, Figure 3 This invention provides a system block diagram of a color difference detection system for cigarette packaging, which includes the following modules:

[0091] The image acquisition module is used to acquire images of cigarette packaging and preprocess the images of cigarette packaging to obtain cigarette packaging images.

[0092] The first image detection module is used to extract color information from the cigarette packaging image and divide it into color clusters;

[0093] The second image detection module is used to match the cluster center point of the color cluster with the standard pixel point based on the color difference and positional distance between the cluster center point and the standard pixel point of the color cluster, so as to obtain the standard pixel point that matches the cluster center point of each color cluster.

[0094] The detection result determination module is used to compare the cluster center points of color clusters with the matching standard pixel points to obtain the color difference; compare the color difference with the preset color difference threshold to determine whether the corresponding cigarette packaging is qualified.

[0095] Regarding standard cigarette packaging images and standard sample pixels, two detection modes are supported: standard sample entry mode and detection mode. In standard sample entry mode, the operator manually enters the number of colors and stores the results in the database. Specific steps include: capturing images of the standard sample using a high-resolution true-color camera; preprocessing the acquired standard sample images, including noise reduction and grayscale conversion, to obtain the standard cigarette packaging image; extracting color information from the standard cigarette packaging image and manually entering the number of colors; and storing the extracted color information and color counts in the database for use in subsequent detection modes.

[0096] In summary, the cigarette packaging color difference detection method of the present invention can achieve high-precision, real-time detection of cigarette packaging colors. It is suitable for complex environments such as cigarette packaging, significantly improving detection efficiency and accuracy, reducing the influence of human factors, and ensuring the consistency and stability of detection results, thus providing important support for subsequent quality control and production management. Through traditional image processing algorithms and optimized data processing flows, the present invention demonstrates excellent performance in both detection accuracy and real-time performance, possessing high practical value and promising prospects for widespread application. Furthermore, the present invention uses traditional image processing algorithms to process input data, which, compared to deep learning methods, is faster, more real-time, less dependent on hardware, and less burdensome, making it more conducive to real-time deployment and application in the field.

[0097] Optionally, the transmission medium can be a wired link, such as, but not limited to, coaxial cable, fiber optic cable and digital subscriber line, or a wireless link, such as, but not limited to, wireless Fidelity (WIFI), Bluetooth and mobile device networks.

[0098] It should be noted that the device provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above.

[0099] This invention provides a schematic diagram of the structure of a computer device. Exemplarily, the computer device includes: a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the computer device can perform any of the aforementioned methods for detecting color differences in cigarette packaging.

[0100] Furthermore, embodiments of the present invention also protect an apparatus that may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a color difference detection method for cigarette packaging provided by embodiments of the present invention.

[0101] In this embodiment of the invention, the device can be divided into functional modules according to the above method example. For example, each module can correspond to a separate function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and is only a logical functional division. In actual implementation, there may be other division methods.

[0102] When each module is divided according to its function, the device may also include a signal uploading module, a determination module, and an adjustment module. It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional descriptions of the corresponding functional modules, and will not be repeated here.

[0103] It should be understood that the apparatus provided in this embodiment of the invention is used to perform the above-described method for detecting color difference in cigarette packaging, and thus can achieve the same effect as the above-described implementation method.

[0104] When using integrated units, the device may include a processing module and a storage module. When applied to a device, the processing module can be used to control and manage the device's operations. The storage module can be used to support the device in executing program code, etc. The processing module may be a processor or a controller, which can implement or execute various exemplary logic blocks, modules, and circuits as described in this disclosure. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of Digital Signal Processing (DSP) and a microprocessor, etc., and the storage module may be a memory.

[0105] In addition, the device provided in the embodiments of the present invention may specifically be a chip, component or module. The chip may include a connected processor and a memory. The memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute the color difference detection method for cigarette packaging provided in the above embodiments.

[0106] This invention also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer, the computer executes the aforementioned method steps to implement the color difference detection method for cigarette packaging provided in the above embodiments.

[0107] This invention also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to achieve the color difference detection method for cigarette packaging provided in the above embodiments.

[0108] In this invention, the apparatus, computer-readable storage medium, computer program product, or chip provided in the embodiments are all used to execute the corresponding methods described above. Therefore, the beneficial effects they achieve can be referred to the beneficial effects in the corresponding methods described above, and will not be repeated here. Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by this invention, it should be understood that the disclosed apparatus and method can be implemented in other ways.

[0109] The device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0110] It should also be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0111] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0112] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0113] The above content is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting color difference in cigarette packaging, characterized in that, The method includes the following steps: Acquire an image of cigarette packaging, preprocess the image of cigarette packaging, and obtain a cigarette packaging image; Extract color information from the cigarette packaging image and divide it into color clusters; Based on the color difference and positional distance between the cluster center point of the color cluster and the standard pixel point, the cluster center point of the color cluster is matched with the standard pixel point to obtain the standard pixel point that matches the cluster center point of each color cluster. By comparing the cluster center points of color clusters with the matching standard pixel points, the color difference is obtained; by comparing the color difference with the preset color difference threshold, it is determined whether the corresponding cigarette packaging is qualified.

2. The method for detecting color difference in cigarette packaging according to claim 1, characterized in that, The preprocessing of the cigarette packaging image to obtain the cigarette packaging image includes: The image of cigarette packaging is denoised using Gaussian filtering. Morphological operations such as erosion, dilation, opening, and closing are then performed on the denoised image to obtain an intermediate image. The intermediate image is then converted to the Lab color space to obtain the cigarette packaging image.

3. The method for detecting color difference in cigarette packaging according to claim 1, characterized in that, The step of extracting color information from the cigarette packaging image and dividing it into color clusters includes: Using a clustering algorithm, the pixels in the cigarette packaging image are clustered based on their pixel values ​​to obtain multiple color clusters.

4. The method for detecting color difference in cigarette packaging according to claim 1, characterized in that, The step of matching the cluster center point of the color cluster with the standard pixel point based on the color difference and positional distance between the cluster center point and the standard pixel point to obtain the standard pixel point that matches the cluster center point of each color cluster includes: Use any standard pixel as the target standard pixel, and use the cluster center of any color cluster as the target cluster center. Determine the color distance between the target cluster center point and the target standard pixel point based on the color difference between the target cluster center point and the target standard pixel point; The positional distance between the target cluster center point and the target standard pixel point is determined based on the positional distance between the target cluster center point and the target standard pixel point. The weighted sum of the color distance and the position distance is used to obtain the comprehensive distance between the target cluster center point and the target standard pixel point; Select the standard pixel with the smallest comprehensive distance to the target cluster center as the standard pixel that matches the target cluster center; Determine the standard pixel that matches the cluster center point of each color cluster.

5. The method for detecting color difference in cigarette packaging according to claim 4, characterized in that, The step of determining the color distance between the target cluster center point and the target standard pixel point based on the color difference between the target cluster center point and the target standard pixel point includes: Using the Lab color difference calculation formula, the color difference between the target cluster center point and the target standard pixel point is calculated, thus obtaining the color distance between the target cluster center point and the target standard pixel point.

6. The method for detecting color difference in cigarette packaging according to claim 4, characterized in that, The step of determining the positional distance between the target cluster center point and the target standard pixel point based on their positional distance includes: Using the Euclidean distance formula, the distance between the target cluster center point and the target standard pixel point is calculated, thus obtaining the positional distance between the target cluster center point and the target standard pixel point.

7. The method for detecting color difference in cigarette packaging according to claim 1, characterized in that, The color difference is obtained by comparing the cluster center points of the contrasting color clusters with the matching standard pixel points, including: Using the CIEDE2000 color difference formula, the color difference between the cluster center point of the color cluster and the matching standard pixel point is calculated.

8. The method for detecting color difference in cigarette packaging according to claim 1, characterized in that, The step of comparing color differences with a preset color difference threshold to determine whether the corresponding cigarette packaging is qualified includes: When the color difference exceeds a preset difference threshold, the corresponding cigarette packaging is deemed unqualified.

9. A color difference detection system for cigarette packaging, characterized in that, The system includes the following modules: The image acquisition module is used to acquire images of cigarette packaging and preprocess the images of cigarette packaging to obtain cigarette packaging images. The first image detection module is used to extract color information from the cigarette packaging image and divide it into color clusters; The second image detection module is used to match the cluster center point of the color cluster with the standard pixel point based on the color difference and positional distance between the cluster center point and the standard pixel point of the color cluster, so as to obtain the standard pixel point that matches the cluster center point of each color cluster. The detection result determination module is used to compare the cluster center points of color clusters with the matching standard pixel points to obtain the color difference; Compare the color difference with the preset color difference threshold to determine whether the corresponding cigarette packaging is qualified.