Cigarette quality detection method and system based on image detection

Through the image detection method, combined with grayscale value calculation, image preprocessing and feature extraction, the problem of difficult to detect multiple quality defects when cigarette plugs are put into the box in the prior art is solved, and the comprehensive and accurate cigarette plug quality detection is achieved. sex.

CN119477787APending Publication Date: 2025-02-18HUBEI CHINA TOBACCO INDUSTRY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410998818.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing cigarette post quality detection methods are difficult to effectively detect multiple quality defects when the cigarette post is put into the box, resulting in unqualified cigarette posts passing the test.

Method used

By acquiring the cigarette stick images, grayscale value calculation, image preprocessing, noise removal and feature extraction are performed, and stripe features, key area features, global texture features and target area features are detected to identify the cigarette sticks. appearance defects.

Benefits of technology

It realizes a comprehensive inspection of the quality of the cigarette stick when it is put into the box, avoiding the inspection of multiple defective cigarette sticks, and improving the accuracy and effectiveness of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477787A_ABST
    Figure CN119477787A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a cigarette quality detection method and system based on image detection, and the method comprises the steps: obtaining a cigarette image, calculating the gray value of the cigarette image, determining a corresponding image color based on the gray value, carrying out the image preprocessing of the cigarette image, and obtaining a binary black and white cigarette image; noise removal is carried out on the black and white cigarette image, image features are extracted, and the image features comprise stripe features, key area features, global texture features and target area features; performing feature detection based on the type of the image feature, determining a feature score corresponding to each feature detection result, determining whether the feature detection result is qualified based on a total score corresponding to the feature scores, and performing color channel verification on the cigarette image and determining a cigarette color detection result when the feature detection result is qualified; and determining a corresponding image template based on the cigarette type, comparing the cigarette image with the image template, and identifying the appearance defect of the cigarette image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of equipment cigarette production detection, and in particular to a cigarette quality detection method and system based on image detection. Background Art

[0002] In the cigarette production process, the packing step of cigarette cartons is the last step before cigarettes are put into storage. Before the cigarettes are put into boxes, it is necessary to detect various problems of the cigarettes, such as the connection between the cigarette rod and the filter, the trend of the stripes on the cigarettes, and the appearance of the cigarettes, etc. Better cigarette quality inspection can eliminate unqualified products on the assembly line, which is of vital importance to the development of the enterprise.

[0003] However, the current method for cigarette quality inspection usually uses image segmentation and feature comparison to inspect cigarette quality, and then determines whether the cigarette has quality problems based on the comparison results. However, in the actual production process, when the cigarettes are put into boxes, there may be cigarettes with multiple quality defects, but they do not reach the scope of cigarette quality problems. Summary of the invention

[0004] In view of the problems existing in the prior art, an embodiment of the present invention provides a cigarette quality detection method and system based on image detection.

[0005] The embodiment of the present invention provides a cigarette quality detection method based on image detection, comprising: Acquire a cigarette image, calculate a grayscale value of the cigarette image, determine a corresponding image color based on the grayscale value, and perform image preprocessing on the cigarette image to obtain a binary black-and-white cigarette image; Denoising the black and white cigarette image and extracting image features, wherein the image features include: stripe features, key area features, global texture features, and target area features; Perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result; The corresponding image template is determined based on the cigarette type, and the cigarette image is compared with the image template to identify appearance defects of the cigarette image.

[0006] In one embodiment, the method further comprises: comparing the stripe feature with the stripe template's stripe similarity, and determining a first feature score based on the stripe similarity; Detecting characteristic attributes of the key area features, and calculating a second characteristic score based on the characteristic attributes, wherein the key area features include a filter, a cigarette rod, and a filter overlap; Calculating the energy distribution of the texture based on the global texture feature, and comparing the difference between the energy distribution and a preset threshold, and determining a third feature score based on the comparison difference; Determine target area characteristics and target type requirements based on cigarette type, compare the target area characteristics with the target type requirements, and determine a fourth characteristic score based on the comparison result.

[0007] In one embodiment, the method further comprises: The scoring weight distribution is determined based on the cigarette type, and the total score corresponding to the cigarette image is calculated by combining the first feature score, the second feature score, the third feature score, the fourth feature score and the scoring weight distribution, and it is detected whether the total score meets the preset scoring requirements.

[0008] In one embodiment, the method further comprises: The stripe features include X-shaped cross stripes at the oil seal paper bonding point and straight stripes at the filter tip and the edge of the cigarette rod. The normalized cross correlation between the stripe features and the stripe template is calculated: in, is the cigarette image, is the template image corresponding to the stripe template, and are the average grayscale values ​​of the cigarette image and the template image, is the position of the template image in the cigarette image.

[0009] In one embodiment, the method further comprises: The cigarette image is filtered, and the cigarette image is corrected by affine transformation, and edge information of the cigarette image is extracted by Laplace operator to complete image sharpening.

[0010] In one embodiment, the method further comprises: Acquire the original color of the cigarette image, set a color channel according to the original color, perform color analysis and color cross-validation on the cigarette image based on the color channel, and obtain a first cigarette color detection result; The embodiment of the present invention provides a cigarette quality detection system based on image detection, comprising: A preprocessing module, used to obtain a cigarette image, calculate a grayscale value of the cigarette image, determine a corresponding image color based on the grayscale value, and perform image preprocessing on the cigarette image to obtain a binary black-and-white cigarette image; A feature module, used to remove noise from the black and white cigarette image and extract image features, wherein the image features include: stripe features, key area features, global texture features, and target area features; A scoring module, used to perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result; The appearance module is used to determine the corresponding image template based on the cigarette type, compare the cigarette image with the image template, and identify the appearance defects of the cigarette image.

[0011] In one embodiment, the system further comprises: A first feature module, used for comparing the stripe similarity between the stripe feature and the stripe template, and determining a first feature score based on the stripe similarity; A second feature module is used to detect the feature attributes of the key area features and calculate a second feature score based on the feature attributes, wherein the key area features include the filter, the cigarette rod and the filter tip; A third feature module, configured to calculate an energy distribution of the texture based on the global texture feature, compare a difference between the energy distribution and a preset threshold, and determine a third feature score based on the comparison difference; The fourth feature module is used to determine the target area characteristics and target type requirements based on the cigarette type, compare the target area characteristics with the target type requirements, and determine the fourth feature score based on the comparison result.

[0012] An embodiment of the present invention provides an electronic device, including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in one or more embodiments.

[0013] An embodiment of the present invention provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned cigarette quality detection method based on image detection are implemented.

[0014] In view of the above, in one or more embodiments of the present specification, a cigarette image is obtained, the grayscale value of the cigarette image is calculated, and the corresponding image color is determined based on the grayscale value, and the cigarette image is preprocessed to obtain a binary black and white cigarette image; the black and white cigarette image is noise-removed, and image features are extracted, and the image features include: stripe features, key area features, global texture features, and target area features; feature detection is performed based on the type of image features, and the feature score corresponding to each feature detection result is determined, and whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, the color channel of the cigarette image is verified to determine the cigarette color detection result; the corresponding image template is determined based on the cigarette type, and the cigarette image is compared with the image template to identify the appearance defects of the cigarette image. In this way, when the cigarettes are packaged into boxes, the cigarette box situation can be detected, and then the quality of the cigarettes can be comprehensively judged by combining various features with quality inspection to avoid cigarettes with multiple defects from passing the quality inspection, and after completing the feature quality inspection, the overall quality of the cigarette package can be inspected. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 This is a flowchart of a cigarette quality detection method based on image detection provided in one embodiment of this specification.

[0017] Figure 2 It is a structural schematic diagram of a cigarette quality detection system based on image detection provided in one embodiment of this specification.

[0018] Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0019] The subject matter described herein will now be discussed with reference to example embodiments. It should be understood that the discussion of these embodiments is only to enable those skilled in the art to better understand and implement the subject matter described herein, and is not a limitation of the scope of protection, applicability or examples set forth in the claims. The functions and arrangements of the elements discussed can be changed without departing from the scope of protection of the contents of this specification. Various examples can omit, replace or add various processes or components as needed. For example, the described method can be performed in an order different from the described order, and various steps can be added, omitted or combined. In addition, the features described relative to some examples can also be combined in other examples.

[0020] As used herein, the term "including" and its variations represent open terms, meaning "including but not limited to". The term "based on" means "based at least in part on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other definitions may be included below, whether explicit or implicit. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout the specification.

[0021] like Figure 1 As shown, an embodiment of the present invention provides a cigarette quality detection method based on image detection, comprising: Step S101, obtaining a cigarette image, calculating the grayscale value of the cigarette image, determining the corresponding image color based on the grayscale value, performing image preprocessing on the cigarette image, and obtaining a binary black-and-white cigarette image.

[0022] Specifically, in the process of cigarette manufacturing, after the cigarettes are rolled, it is necessary to perform quality inspection on the cigarettes that are about to be packaged into boxes after rolling. Then, the image of the cigarette packaging entering the cigarette pack is photographed by a shooting device. After the cigarette image (the image of the cigarette pack) is obtained, the average grayscale of the obtained cigarette image is calculated. When the current cigarette pack is determined to be an empty pack by the average grayscale, no further inspection is required. When the current cigarette pack is determined to be not an empty pack by the average grayscale, it is determined that the grayscale value corresponding to the current cigarette (cigarette pack) is more suitable for selecting a grayscale image or a color image for subsequent steps. After determining the image color, the corresponding cigarette image is determined, and then the cigarette image is preprocessed, wherein the preprocessing step may include a series of processing steps such as filtering, affine transformation, and sharpening, as well as binarization of the cigarette image to obtain a binarized black and white cigarette image. Among them, when binarizing the cigarette image, a threshold can be selected by the image color of the image itself, and the cigarette image is binarized by the image threshold to obtain a binarized black and white cigarette image.

[0023] Among them, the preprocessing steps in the cigarette image can include image filtering, including removing noise in the image by applying digital image processing technology, such as randomly appearing pixels or small irregular spots, so that the images of cigarette packs and cigarettes are clearer and smoother. Commonly used filtering methods include median filtering, Gaussian filtering, etc., which can help retain the edges of the image while reducing noise interference. Then, an affine transformation is used to correct the image, which can adjust the image's scaling, rotation, and translation to correct the image tilt or deformation caused by slight movement of the camera or object during the shooting process. Image sharpening is a process that can improve the contrast of image details and make the edges clearer. In cigarette quality detection, the Laplace operator, as a second-order derivative operator, can effectively identify sharp changes in the image, such as edges, and because of its simple calculation and less resources required, it has a fast processing speed and is suitable for high-speed detection scenarios that require real-time response.

[0024] Step S102, removing noise from the black and white cigarette image and extracting image features, the image features including: stripe features, key area features, global texture features, and target area features.

[0025] Specifically, after the cigarette image is binarized, the edge texture of the binarized image is very clear, but there are relatively many noise points. Therefore, the black and white cigarette image needs to be denoised. The noise removal method can remove smaller noise points through corrosion operation, and then remove larger noise points through median filtering, such as through a filter with a 16x16 and embedded 5x5 combined template. Then, the clarity of the denoised image is maintained through an expansion operation, thereby completing the noise removal. After removing the noise, the image features of the black and white cigarette images are extracted, where the image features include: stripe features, such as the X-shaped cross stripes at the oil seal paper bonding point, which are important signs for checking the packaging quality of cigarettes, and the straight stripes at the wrinkled edges of the filter and the cigarette rod, which reflect the flatness and packaging quality of the connection between the filter and the cigarette body; key area features, areas in cigarette packs that are prone to quality problems can be set as key areas, such as the filter, the cigarette rod and the filter joint, etc. The quality of these key parts can directly affect consumers' usage experience and perception of product quality; global texture features, global texture features are texture features of the entire cigarette image, which can identify whether there are abnormal textures or pollution that should not be there; target area features, the target area is ROI (Region of Interest), which is mainly for specific areas of different brands of cigarettes, usually customized according to different cigarette brands, so as to detect corresponding areas of different brands of cigarettes.

[0026] Step S103, perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result.

[0027] Specifically, feature detection is performed based on the type of image features, wherein feature detection includes: stripe features. The stripe feature detection can be performed by calculating the stripe similarity between the target stripe template and the target stripe template, and determining the first feature score based on the stripe similarity. Specific similarity measurement methods may include normalized cross-correlation coefficient (NCC), structural similarity index (SSIM), etc. If the calculated matching degree falls within a preset threshold range, it is considered that the stripe information of the cigarette meets the quality standard, otherwise, there may be poor packaging or production defects. When the similarity measurement method is the normalized cross-correlation coefficient (NCC) calculation method, the cross-correlation coefficient between the grayscale value of the target stripe template and the stripe area to be detected is calculated and normalized to obtain a value between -1 and 1, 1 indicates a complete match, -1 indicates a complete mismatch, and 0 indicates no correlation. The calculation formula includes: in, is the cigarette image, is the template image corresponding to the stripe template, and are the average grayscale values ​​of the cigarette image and the template image, is the position of the template image in the cigarette image.

[0028] Feature detection also includes: key area features, by detecting the feature attributes of the key area features, calculating the second feature score based on the feature attributes, wherein the feature attributes of the key area can be determined by the type of the key area. For example, when the key area is the joint between the cigarette rod and the filter, the width and straightness of the gap between the cigarette rod and the filter are the corresponding feature attributes. The second feature score is determined by comparing the feature attributes with the corresponding feature requirements; global texture features, calculating the energy distribution of the texture. The energy distribution of the image is usually reflected in the frequency domain characteristics of the image. The high-frequency part corresponds to the details and texture in the image, and the low-frequency part corresponds to the details and texture in the image. Large blocks of color or brightness changes in the image. In cigarette quality inspection, by calculating the spectral energy distribution of the image, especially the energy of the high-frequency part, abnormal texture information can be identified and the difference between the energy distribution and the preset threshold can be compared. The third feature score is determined based on the comparison difference; target area features. According to the cigarette type, irregular polygons can be flexibly drawn on the image to define the ROI. After determining the ROI, features are extracted specifically for possible defect types (such as spots, scratches, uneven color, etc.), and the ROI is compared with the requirements of the corresponding cigarette type. Based on the comparison results, it is determined whether the requirements are met, thereby determining the fourth feature score.

[0029] After determining the scores of the four features, the score weight distribution is determined based on the cigarette type, combining the first feature score, the second feature score, the third feature score, the fourth feature score and the score weight distribution. Among them, the score weight distribution can be set according to the tendency of the cigarette type. For example, the key area features and target area features are set to the highest weight, followed by the global texture features, and the stripe features are set to the lowest. Then, the total score corresponding to the cigarette image is calculated, and it is detected whether the total score meets the preset score requirements corresponding to the cigarette type.

[0030] In addition, when the feature detection results are qualified, the cigarette image (the cigarette package image containing the cigarette image) can be further detected, and the color channel of the cigarette image can be verified. Specifically, RGB (red, green, blue) or other applicable color channels (such as CMYK) can be separated from the original color image. Because different types of defects are more obvious in different color channels, for example, some stains are more prominent in the red channel, and scratches may be easier to identify in brightness or grayscale images, color channel verification can include two parts: first, obtain the original color of the cigarette image, and set the color channel according to the original color, perform color analysis on the cigarette image based on the color channel and color cross-validation to obtain the first cigarette color detection result; feature fusion of feature information of multiple color channels, and comprehensive judgment through recognition algorithms (such as template matching, deep learning models, etc.) to obtain the second cigarette color detection result.

[0031] Step S104, determining a corresponding image template based on the cigarette type, comparing the cigarette image with the image template, and identifying appearance defects of the cigarette image.

[0032] Specifically, when the feature detection result is qualified, the cigarette image (the cigarette package image containing the cigarette image) can also be detected, and a high-quality template image can be created based on the known qualified cigarette samples corresponding to the cigarette type. This includes the overall appearance of the cigarette, details in specific areas (such as the cigarette holder, cigarette body texture, etc.), and any brand-specific logos or design elements. The cigarette image is then compared with the image template to identify the appearance defects of the cigarette image. The comparison process can be performed through a template matching algorithm, the common ones being square difference matching, normalized cross correlation (NCC), template cross correlation, etc. Each algorithm has its own advantages, and it needs to be determined based on the characteristics of the cigarette image and the detection requirements.

[0033] The embodiment of the present invention provides a cigarette quality detection method based on image detection, which obtains a cigarette image, calculates the gray value of the cigarette image, and determines the corresponding image color based on the gray value, performs image preprocessing on the cigarette image to obtain a binary black-and-white cigarette image; removes noise from the black-and-white cigarette image, and extracts image features, which include: stripe features, key area features, global texture features, and target area features; performs feature detection based on the type of image features, determines the feature score corresponding to each feature detection result, determines whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, performs color channel verification on the cigarette image to determine the cigarette color detection result; determines the corresponding image template based on the cigarette type, compares the cigarette image with the image template, and identifies the appearance defects of the cigarette image. In this way, when the cigarettes are packaged into boxes, the boxing situation of the cigarettes can be detected, and then the quality of the cigarettes can be comprehensively judged by combining various features to avoid cigarettes with multiple defects from passing the quality inspection.

[0034] See also Figure 2 , Figure 2 Schematic diagram of a cigarette quality detection system based on image detection provided in an embodiment of the present application. Figure 2 As shown, the system comprises: The preprocessing module S201 is used to obtain a cigarette pack image, calculate the grayscale value of the cigarette pack image, determine the corresponding image color based on the grayscale value, perform image preprocessing on the cigarette pack image, and obtain a binary black-and-white cigarette pack image; The feature module S202 is used to remove noise from the black and white cigarette pack image and extract image features, wherein the image features include: stripe features, key area features, global texture features, and target area features; Scoring module S203, used to perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette package image to determine the cigarette package color detection result; The appearance module S204 is used to determine the corresponding image template based on the cigarette type, compare the cigarette package image with the image template, and identify the appearance defects of the cigarette package image.

[0035] In one embodiment, the system further comprises: A first feature module, used for comparing the stripe similarity between the stripe feature and the stripe template, and determining a first feature score based on the stripe similarity; A second feature module is used to detect the feature attributes of the key area features and calculate a second feature score based on the feature attributes, wherein the key area features include the filter, the cigarette rod and the filter tip; A third feature module, configured to calculate an energy distribution of the texture based on the global texture feature, compare a difference between the energy distribution and a preset threshold, and determine a third feature score based on the comparison difference; The fourth feature module is used to determine the target area characteristics and target type requirements based on the cigarette type, compare the target area characteristics with the target type requirements, and determine the fourth feature score based on the comparison result.

[0036] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.

[0037] Each processing unit and / or module of the embodiments of the present application may be realized by an analog circuit that implements the functions described in the embodiments of the present application, or may be realized by software that executes the functions described in the embodiments of the present application.

[0038] See also Figure 3 , which shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, the electronic device can be used to implement Figure 1 The method in the embodiment shown. Figure 3 As shown, the electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .

[0039] The communication bus 302 is used to realize the connection and communication between these components.

[0040] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0041] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0042] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions and processes data of the terminal 300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a processor (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.

[0043] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may also be optionally at least one storage device located away from the aforementioned processor 301. As Figure 3 As shown, the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.

[0044] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the interactive application based on image generation stored in the memory 305, and specifically perform the following operations: obtain a cigarette image, calculate the grayscale value of the cigarette image, and determine the corresponding image color based on the grayscale value, perform image preprocessing on the cigarette image, and obtain a binary black-and-white cigarette image; remove noise from the black-and-white cigarette image, and extract image features, the image features include: stripe features, key area features, global texture features, and target area features; perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result; determine the corresponding image template based on the cigarette type, compare the cigarette image with the image template, and identify the appearance defects of the cigarette image.

[0045] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0046] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0047] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0048] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0049] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0050] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0051] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.

[0052] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0053] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. A cigarette quality detection method based on image detection, characterized in that: include: Acquire a cigarette image, calculate a grayscale value of the cigarette image, determine a corresponding image color based on the grayscale value, and perform image preprocessing on the cigarette image to obtain a binary black-and-white cigarette image; Denoising the black and white cigarette image and extracting image features, wherein the image features include: stripe features, key area features, global texture features, and target area features; Perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result; The corresponding image template is determined based on the cigarette type, and the cigarette image is compared with the image template to identify appearance defects of the cigarette image.

2. The cigarette quality detection method based on image detection according to claim 1, characterized in that: The performing feature detection based on the type of image features and determining a feature score corresponding to each feature detection result includes: comparing the stripe feature with the stripe template's stripe similarity, and determining a first feature score based on the stripe similarity; Detecting characteristic attributes of the key area features, and calculating a second characteristic score based on the characteristic attributes, wherein the key area features include a filter, a cigarette rod, and a filter overlap; Calculating the energy distribution of the texture based on the global texture feature, and comparing the difference between the energy distribution and a preset threshold, and determining a third feature score based on the comparison difference; Determine target area characteristics and target type requirements based on cigarette type, compare the target area characteristics with the target type requirements, and determine a fourth characteristic score based on the comparison result.

3. The cigarette quality detection method based on image detection according to claim 2, characterized in that: The determining whether the feature detection result is qualified based on the total score corresponding to the feature score also includes: The scoring weight distribution is determined based on the cigarette type, and the total score corresponding to the cigarette image is calculated by combining the first feature score, the second feature score, the third feature score, the fourth feature score and the scoring weight distribution, and it is detected whether the total score meets the preset scoring requirements.

4. The cigarette quality detection method based on image detection according to claim 2, characterized in that: The comparing the stripe feature with the stripe template for stripe similarity includes: The stripe features include X-shaped cross stripes at the oil seal paper bonding point and straight stripes at the filter tip and the edge of the cigarette rod. The normalized cross correlation between the stripe features and the stripe template is calculated: in, is the cigarette image, is the template image corresponding to the stripe template, and are the average grayscale values ​​of the cigarette image and the template image, is the position of the template image in the cigarette image.

5. The cigarette quality detection method based on image detection according to claim 1, characterized in that: The performing image preprocessing on the cigarette image comprises: The cigarette image is filtered, and the cigarette image is corrected by affine transformation, and edge information of the cigarette image is extracted by Laplace operator to complete image sharpening.

6. The cigarette quality detection method based on image detection according to claim 1, characterized in that: The color channel verification of the cigarette image to determine the cigarette color detection result includes: Acquire the original color of the cigarette image, set a color channel according to the original color, perform color analysis and color cross-validation on the cigarette image based on the color channel, and obtain a first cigarette color detection result; The feature information of multiple color channels is fused, and a comprehensive judgment is made through a recognition algorithm to obtain the second cigarette color detection result.

7. A cigarette quality detection system based on image detection, characterized in that: The system comprises: A preprocessing module, used to obtain a cigarette image, calculate a grayscale value of the cigarette image, determine a corresponding image color based on the grayscale value, and perform image preprocessing on the cigarette image to obtain a binary black-and-white cigarette image; A feature module, used to remove noise from the black and white cigarette image and extract image features, wherein the image features include: stripe features, key area features, global texture features, and target area features; A scoring module, used to perform feature detection based on the type of image features, determine the feature score corresponding to each feature detection result, determine whether the feature detection result is qualified based on the total score corresponding to the feature score, and when the feature detection result is qualified, perform color channel verification on the cigarette image to determine the cigarette color detection result; The appearance module is used to determine the corresponding image template based on the cigarette type, compare the cigarette image with the image template, and identify the appearance defects of the cigarette image.

8. The cigarette quality detection system based on image detection according to claim 7, characterized in that: The system further comprises: A first feature module, used for comparing the stripe similarity between the stripe feature and the stripe template, and determining a first feature score based on the stripe similarity; A second feature module is used to detect the feature attributes of the key area features and calculate a second feature score based on the feature attributes, wherein the key area features include the filter, the cigarette rod and the filter tip; A third feature module, configured to calculate an energy distribution of the texture based on the global texture feature, compare a difference between the energy distribution and a preset threshold, and determine a third feature score based on the comparison difference; The fourth feature module is used to determine the target area characteristics and target type requirements based on the cigarette type, compare the target area characteristics with the target type requirements, and determine the fourth feature score based on the comparison result.

9. An electronic device comprising a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by a processor.