Milk powder category detection method and system based on image processing

By combining the importance and possible degree of text calibration in milk powder category detection, and using homography matrix and optical character recognition technology, the problem of insufficient accuracy of milk powder category detection in the existing technology is solved, achieving high accuracy and High robustness classification results.

CN119251216AInactive Publication Date: 2025-01-03SHAANXI YATAI DAIRY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411759483.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-01-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing milk powder category detection methods have many problems with identification errors or missed detection under complex lighting conditions, changes in label fonts or reflections on the surface of the can, and the comprehensive analysis ability of the text content, edge structure and pattern characteristics in the image is insufficient. It is difficult to meet the needs of high precision and high robustness classification.

Method used

By collecting milk powder jar images, feature points are extracted and the importance and possible text degree of text are calculated, key feature points are selected for perspective transformation, combined with homography matrix and adaptive binarization algorithm to extract text information, and optical character recognition technology is used to obtain optical character recognition technology. Make classification.

Benefits of technology

It significantly improves the accuracy of text extraction and the accuracy of classification model, enhances the robustness and adaptability of the system, and is suitable for complex packaging text recognition and classification tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251216A_ABST
    Figure CN119251216A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image data processing, in particular to a milk powder category detection method and system based on image processing. Calculating the character calibration importance degree of each feature point to represent the deviation degree of the feature points relative to the character region; calculating the character possibility degree of the feature points, and synthesizing the probability that the feature points belong to the character region in the image; defining the product of the character calibration importance degree and the character possible degree as the calibration necessity degree of the feature points; according to the method, feature points with calibration necessity higher than a set threshold value are screened out, a homography matrix is calculated through the feature points, character areas are extracted to recognize character information after perspective transformation, and the recognized character information is input into a classification model to complete automatic classification of milk powder categories. The problem that the accuracy is insufficient in the milk powder classification process is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and more specifically, to a method and system for detecting milk powder categories based on image processing. Background Art

[0002] With the rapid development of artificial intelligence and image processing technology, automatic classification methods based on visual information have been applied in industrial production. As an important food product, milk powder is usually labeled with brand, category, production date and other information on its packaging, which is an important basis for classification and traceability.

[0003] Traditional milk powder category detection methods mostly rely on manual inspection or grayscale image template matching-based algorithms. Although they can achieve basic classification functions in certain specific scenarios, they still have certain limitations. Especially in cases where lighting conditions are complex, label fonts change, or there is surface reflection on the can, relying solely on grayscale image template matching is prone to recognition errors or missed detections. In addition, with the diversification of the milk powder market, packaging label styles are becoming more and more complex. Existing methods have weak comprehensive analysis capabilities for text content, edge structures, and pattern features in images, making it difficult to meet the needs of high-precision, high-robustness classification.

[0004] The patent application document with application publication number CN118823397A discloses a method and system for visual recognition of milk powder packaging labels. The patent application document matches the grayscale image of the milk powder can with the existing template according to the correlation coefficient, completes the visual recognition of the milk powder can label, and improves the accuracy of the recognition of the label on the milk powder can. However, the above technical solution relies solely on the correlation coefficient of the grayscale image as the matching basis, and fails to fully consider the influence of other important features such as the text content and edge structure of the milk powder can label on the matching result, resulting in the problem of insufficient accuracy in the classification process of milk powder. Summary of the invention

[0005] In order to solve the problem of insufficient accuracy in the classification process of milk powder raised in the above background art, the present invention provides solutions in the following aspects.

[0006] In a first aspect, the present invention provides a method for detecting milk powder categories based on image processing, comprising: collecting an image of a milk powder can and extracting feature points of the milk powder can image; calculating the text calibration importance of the feature points, wherein the text calibration importance represents the degree of deviation of the feature points; calculating the first The text probability of feature points : ; In the formula, For the first The grayscale variance of all pixels in the set window centered at the feature point is To set the total number of closed edges in the window, Set the jth edge in the window chain code value, Set the jth edge in the window chain code value, To set the total number of edges within the window, is the total number of chain codes in the jth edge in the set window, is an empirical constant, and , is a linear normalization function; the product of the text possibility degree of each feature point and the text calibration importance is used as the calibration necessity of each feature point, and after the feature points with the calibration necessity higher than the set threshold are perspective transformed, the text information is extracted and input into the classification model to complete the classification of milk powder categories.

[0007] The above technical solution combines the text calibration importance of feature points with the degree of text possibility, effectively screens out key feature points that are highly correlated with the text area and contribute significantly to image calibration, significantly improving the accuracy of calibration and the reliability of text extraction. It also uses the necessity of calibration as the criterion for screening, reducing the impact of interfering feature points on perspective transformation and text extraction, thereby enhancing the success rate of text recognition and the accuracy of the classification model.

[0008] Furthermore, the text calibration importance is: ; In the formula, For the The text calibration importance of feature points, For the The density of feature points, For the The horizontal coordinates of the feature points, For the The vertical coordinates of the feature points, For the first The average value of the horizontal coordinates of all feature points in the set window centered at the feature point. For the first The average value of the vertical coordinates of all feature points in the set window centered at the feature point. For the first The total number of feature points in the set window centered at feature points. To obtain the maximum value, is a linear normalization function.

[0009] The above technical solution comprehensively considers the local density and deviation of feature points through the calculation of text calibration importance, so that the selected key feature points have good geometric distribution characteristics and can play a significant role in image calibration; at the same time, the calibration importance in different scenes is ensured to be consistent through normalization processing, which improves the robustness of the algorithm. This method effectively reduces the dependence on low-value or noisy feature points, makes perspective transformation more accurate, provides a high-quality input basis for subsequent text extraction and classification tasks, and significantly improves the recognition accuracy and adaptability of the system.

[0010] Furthermore, the The density of the feature points is: The reciprocal of the average Euclidean distance from the feature point to the remaining feature points in the milk powder can image.

[0011] The above technical solution realizes a quantitative description of the local distribution of feature points. This density calculation method can effectively reflect the degree of aggregation of feature points in the image. The higher the density, the more likely the feature points are located in areas with rich information or significant features, while feature points in sparse areas are given smaller weights due to their low density, thereby reducing the impact of invalid or noise points on subsequent processing. This distance-based density characterization method is mathematically symmetrical and robust, and can show good adaptability in scenes with complex backgrounds or irregularly distributed feature points, further improving the calculation accuracy of the calibration necessity, and providing a more reliable basis for feature point screening, perspective transformation, and text extraction, thereby improving the efficiency and accuracy of overall image processing.

[0012] Furthermore, an area array camera or a CCD camera is used to collect images of the milk powder can.

[0013] Furthermore, the method also includes performing denoising, grayscale and edge detection processing on the milk powder can image.

[0014] The above technical solution not only improves the robustness of subsequent perspective transformation and text recognition, but also further improves the system's adaptability to complex image scenes, providing a reliable preliminary guarantee for the accurate classification of milk powder categories.

[0015] Furthermore, the Canny edge detection algorithm is used to identify the total number of closed edges within the set window.

[0016] Furthermore, the classification of the milk powder category is completed by: selecting feature points whose calibration necessity is higher than a set threshold, and calculating a homography matrix based on the feature points, performing a perspective transformation, enhancing the text contrast by using an adaptive binarization algorithm, and extracting the text area by combining a contour detection method; recognizing the extracted text area by using optical character recognition technology; and inputting the recognized text information into a classification model to complete the classification of the milk powder category.

[0017] The above technical solution improves the accuracy of perspective transformation by screening feature points with a calibration necessity higher than the set threshold, ensuring that the points involved in the calculation of the homography matrix have a high calibration contribution and text relevance, and can effectively correct the distortion of the milk powder can image caused by the surface or perspective deviation. The image after perspective transformation enhances the text contrast through an adaptive binarization algorithm, further highlighting the significance of the text area, while the text area extraction combined with the contour detection method accurately separates the text information from the background noise, reducing the interference of irrelevant information. Finally, optical character recognition technology can efficiently and accurately extract text content, input it into the classification model, and complete the accurate classification of milk powder categories based on the text information. Through multi-step optimization processing, this solution not only significantly improves the accuracy and efficiency of image text extraction, but also provides high-quality input data for milk powder category classification, ensuring the reliability and adaptability of the classification results, and is suitable for a variety of practical scenarios of complex packaging text recognition and classification.

[0018] In a second aspect, the present invention provides a milk powder category detection system based on image processing, comprising a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, any one of the above-mentioned milk powder category detection methods based on image processing is implemented.

[0019] The beneficial effects of the present invention are: The present invention screens out the feature points that are crucial to calibration and text extraction by extracting feature points and combining the importance of text calibration with the possible degree of text, and uses homography matrix calculation and perspective transformation to correct image distortion, thereby improving the accuracy and stability of calibration; uses an adaptive binarization algorithm to enhance text contrast, and then uses optical character recognition technology and classification models to achieve efficient and accurate text recognition and classification. The present invention also enhances the feasibility and practicality of the system through the combined design of hardware and algorithms, and is suitable for milk powder can packaging detection and text recognition and classification tasks in similar complex image scenes, significantly improving the robustness, efficiency and adaptability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flow chart schematically showing a method for detecting milk powder categories based on image processing according to an embodiment of the present invention; Figure 2FIG. 4 is a block diagram schematically showing a structure of a milk powder category detection system based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0022] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0023] An embodiment of a method for detecting milk powder categories based on image processing.

[0024] like Figure 1 As shown, the flow chart of the method for detecting the type of milk powder based on image processing in an embodiment of the present invention comprises the following steps: S1: Collect the image of the milk powder can and extract the feature points of the image of the milk powder can.

[0025] In one embodiment, the outer packaging of the milk powder can can be imaged by an area array camera or a CCD camera. Both types of cameras are commonly used devices in the current industrial vision field. Among them, the area array camera has high resolution and imaging accuracy, and can fully capture the packaging details of the outside of the milk powder can, including patterns, text, edge features and other information; CCD cameras have lower image noise, higher photosensitivity and good dynamic range, and perform well under complex lighting conditions. They are particularly suitable for high-quality imaging of milk powder cans with strong surface reflections or complex patterns.

[0026] In another embodiment, the collected milk powder can image is subjected to preprocessing operations such as denoising, graying, and edge detection to enhance image quality and extract key structural information. Specifically, denoising can use Gaussian filtering, median filtering, or bilateral filtering techniques, and optimize for different noise types. For example, Gaussian filtering can effectively smooth random noise without significantly blurring the image edge, median filtering is particularly effective in suppressing salt and pepper noise, and bilateral filtering can retain both the edge and detail information of the image. This step can not only significantly improve the signal-to-noise ratio of the image, but also eliminate environmental interference during the acquisition process, such as slight uneven light or dust, and provide high-quality input data for subsequent processing.

[0027] Grayscale processing is a key step in channel compression of the original color image. By extracting the brightness information of the image and generating a single-channel grayscale image, it can significantly reduce the computational complexity while retaining the target structural features. This is especially important for industrial applications that need to process a large number of images. In addition, grayscale can also enhance the local contrast of the image, making the subtle text and edge features in the image more prominent, providing optimized input conditions for the subsequent edge detection link.

[0028] Edge detection is an important step in image analysis, and a variety of techniques can be used, such as the Canny algorithm and the Sobel operator. Taking the Canny algorithm as an example, it effectively extracts the most significant edge information in the image through gradient calculation and non-maximum suppression, and combines dual threshold processing to eliminate noise interference and improve the robustness of edge detection. This step can accurately locate the text contour, pattern boundary and key features of the can structure on the milk powder can packaging, ensuring the accuracy of subsequent feature point extraction, homography matrix calculation and target recognition. Through the optimization of the preprocessing link, not only the analyzability of the overall image is improved, but also more reliable data support is provided for subsequent classification and feature extraction based on image content, thereby achieving higher recognition rates and classification accuracy in complex actual scenarios.

[0029] S2: Calculate the text calibration importance and text possibility degree of the feature point.

[0030] In one embodiment, the text calibration importance is: ; In the formula, For the The text calibration importance of feature points, For the The density of feature points, For the The horizontal coordinates of the feature points, For the The vertical coordinates of the feature points, For the first The average value of the horizontal coordinates of all feature points in the set window centered at the feature point. For the first The average value of the vertical coordinates of all feature points in the set window centered at the feature point. For the first The total number of feature points in the set window centered at feature points. To obtain the maximum value, is a linear normalization function.

[0031] The calculation of the importance of text calibration mentioned above comprehensively considers the local density and deviation degree of the feature points, so that the selected key feature points have good geometric distribution characteristics and can play a significant role in image calibration.

[0032] The said The density of the feature points is: The reciprocal of the average Euclidean distance from the feature point to the remaining feature points in the milk powder can image.

[0033] In another embodiment, the text calibration importance is: ; In the formula, For the The calibration importance of feature points, For the The density of feature points, For the The horizontal coordinates of the feature points, For the The vertical coordinates of the feature points, For the first The average value of the horizontal coordinates of all feature points in the set window centered at the feature point. For the first The average value of the vertical coordinates of all feature points in the set window centered at the feature point. For the first The total number of feature points in the set window centered at feature points. To obtain the maximum value, is the linear normalization function, For the The average Euclidean distance from the feature points to the remaining feature points in the milk powder can image, is the weight coefficient, by adjusting Feature points that contribute most to calibration can be retained preferentially, which helps to focus the calibration on the set window area and improve the overall calibration accuracy.

[0034] In one embodiment, the calculation The text probability of feature points : ; In the formula, For the first The grayscale variance of all pixels in the set window centered at the feature point is To set the total number of closed edges in the window, Set the jth edge in the window chain code value, Set the jth edge in the window chain code value, To set the total number of edges within the window, is the total number of chain codes in the jth edge in the set window, is an empirical constant, and , is a linear normalization function.

[0035] The above technical solution introduces a calculation formula for the degree of text possibility, comprehensively considers multiple factors such as grayscale variance, the number of closed edges, and chain code differences, so as to accurately evaluate the probability that the feature point belongs to the text area. Grayscale variance captures the local brightness changes of the image and enhances the sensitivity to the details of the text area; the number of closed edges reflects the integrity of the structure in the area, which helps to distinguish between text and background; chain code differences are used to measure the complexity of the edge, thereby effectively characterizing the text contour features. The results are standardized by a normalization function, which further improves the stability and applicability of the indicator. This solution comprehensively considers grayscale information, edge structure and geometric features in the calculation of the degree of text possibility, significantly improves the accuracy of text area screening, lays a solid foundation for subsequent classification tasks, and has strong robustness and practicality for text extraction under complex backgrounds.

[0036] S3: The product of the text possibility degree and the text calibration importance of each feature point is used as the calibration necessity of each feature point, and the feature points with a calibration necessity higher than a set threshold are subjected to perspective transformation.

[0037] The above threshold value may be set to 0.6, and of course, it may be determined according to actual conditions.

[0038] In one embodiment, the product of the text possibility of each feature point and the text calibration importance is used as the calibration necessity of the feature point, which comprehensively considers whether the feature point may belong to the text area and its contribution to the image calibration. By calculating the calibration necessity for all feature points and screening out feature points above the set threshold, key points with significant text features and calibration value can be effectively retained, reducing the impact of interference points or meaningless feature points on subsequent processing. The screened key feature points are further transformed in perspective to ensure that the geometric distortion of the text area in the image is fully corrected, providing accurate and reliable input for subsequent text extraction and recognition.

[0039] S4: Extract text information and input it into the classification model to complete the classification of milk powder categories.

[0040] The above classification model can be a support vector machine model or a random forest model.

[0041] In one embodiment, completing the classification of milk powder categories specifically includes the following steps: First, based on image processing and feature point analysis, select feature points with a calibration necessity higher than a set threshold to ensure that the selected feature points have high text relevance and calibration value. Subsequently, these feature points are used to calculate the homography matrix, and a perspective transformation is performed to correct the geometric distortion in the image, so that the text area on the surface of the originally curved or tilted milk powder can can be flattened and regularized for subsequent processing. The image after perspective transformation is contrast enhanced by an adaptive binarization algorithm to further highlight the significance of the text area, such as using an adaptive threshold method or an Otsu algorithm to ensure that the text and background can be effectively separated even under complex backgrounds. Then, in combination with a contour detection method, such as based on Canny edge detection or morphological operations, the text area in the image is accurately extracted to eliminate interference from non-text parts.

[0042] After the text area is extracted, optical character recognition technology is used to recognize the text information, and the recognized text information is input into the pre-trained classification model. The classification model accurately completes the task of classifying the milk powder category based on the brand, specifications, production date or other text information of the milk powder can.

[0043] The solution of the present invention realizes the accurate detection and classification of milk powder categories by constructing a complete technical process from image acquisition, preprocessing, feature point screening to classification and recognition. By introducing the calculation of text calibration importance and text possibility, high-value feature points are comprehensively screened using factors such as density and geometric deviation, the accuracy of perspective transformation is improved, and effective correction and extraction of text areas are ensured. The optical character recognition technology is combined with contour detection to enhance the accuracy of text recognition, and the extracted text information is efficiently mapped to the milk powder category through the classification model, providing an innovative solution for the automatic classification of complex curved surface packaging. The overall solution is systematic, intelligent and highly adaptable, which can significantly improve the efficiency and reliability of text recognition and classification of milk powder packaging, and has application prospects in industrial detection and automation scenarios.

[0044] Example of milk powder category detection system based on image processing: like Figure 2 As shown, a structural block diagram of a milk powder category detection system based on image processing according to an embodiment of the present invention includes a processor and a memory.

[0045] The present invention also provides a milk powder category detection system based on image processing. Figure 2 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for detecting the category of milk powder based on image processing according to the present invention is implemented.

[0046] The milk powder category detection system based on image processing also includes other components well known to those skilled in the art, such as a communication interface, and the configuration and functions of the components are known in the art, so they will not be described in detail here.

[0047] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.

[0048] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly defined.

[0049] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A method for detecting milk powder categories based on image processing, characterized in that: include: Collect milk powder can images and extract feature points of the milk powder can images; Calculating the text calibration importance of the feature point, where the text calibration importance represents the degree of deviation of the feature point; Calculate the The text probability of feature points : ; In the formula, For the first The grayscale variance of all pixels in the set window centered at the feature point is To set the total number of closed edges in the window, Set the jth edge in the window chain code value, Set the jth edge in the window chain code value, To set the total number of edges within the window, is the total number of chain codes in the jth edge in the set window, is an empirical constant, and , is a linear normalization function; The product of the text possibility degree of each feature point and the text calibration importance is used as the calibration necessity of each feature point. After the feature points with the calibration necessity higher than the set threshold are perspective transformed, the text information is extracted and input into the classification model to complete the classification of milk powder categories.

2. The method for detecting the type of milk powder based on image processing according to claim 1, characterized in that: The text calibration importance is: ; In the formula, For the The text calibration importance of feature points, For the The density of feature points, For the The horizontal coordinates of the feature points, For the The vertical coordinates of the feature points, For the first The average value of the horizontal coordinates of all feature points in the set window centered at the feature point. For the first The average value of the vertical coordinates of all feature points in the set window centered at the feature point. For the first The total number of feature points in the set window centered at feature points. To obtain the maximum value, is a linear normalization function.

3. The method for detecting the type of milk powder based on image processing according to claim 2, characterized in that: The said The density of feature points is: No. The reciprocal of the average Euclidean distance from the feature point to the remaining feature points in the milk powder can image.

4. The method for detecting the type of milk powder based on image processing according to claim 1, characterized in that: Use an area array camera or a CCD camera to capture images of milk powder cans.

5. The method for detecting the type of milk powder based on image processing according to claim 1, characterized in that: The method also includes performing denoising, grayscale and edge detection processing on the milk powder can image.

6. The method for detecting the type of milk powder based on image processing according to claim 1, characterized in that: The Canny edge detection algorithm is used to identify the total number of closed edges within the set window.

7. The method for detecting the type of milk powder based on image processing according to claim 1, characterized in that: The classification of the milk powder categories is as follows: Select feature points whose calibration necessity is higher than a set threshold, calculate a homography matrix based on the feature points, perform perspective transformation, use an adaptive binarization algorithm to enhance the text contrast, and extract the text area in combination with a contour detection method; Using optical character recognition technology to identify the extracted text area; The recognized text information is input into the classification model to complete the classification of milk powder categories.

8. The milk powder category detection system based on image processing is characterized in that: The invention comprises a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for detecting the category of milk powder based on image processing according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Character detection method and computer readable storage medium

    CN111027637A

  • Image processing method and system, equipment, medium and program product

    CN112612911A

  • Image processing method and device based on fuzzy detection

    CN113205467A

  • Failure inspection system in product manufacturing processes

    ES1258130U

  • Correcting device and method for perspective transformed document images

    US20080226171A1