Intelligent detection method of sodium acetate impurities based on machine vision

Through the intelligent detection method of sodium acetate impurities based on machine vision, the differences in contour paths and light and dark fluctuations in the surface image of sodium acetate are extracted and analyzed, and the problem of low accuracy in the detection of sodium acetate impurities in the prior art is solved, and more efficient impurity recognition and extraction are achieved.

CN118941537BActive Publication Date: 2025-03-21SHANDONG PROVINCE DINGXIN BIOLOGY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411014884.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2025-03-21
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

The prior art is less accurate when detecting impurities in sodium acetate through image segmentation, especially when the impurities are close to the color of sodium acetate, it is difficult to achieve effective extraction and detection.

Method used

Using the intelligent detection method of sodium acetate impurities based on machine vision, the surface image of sodium acetate is obtained, the contour paths in the abnormal areas are extracted, and the differences in light and dark fluctuations between the shadowed areas formed by the accumulation of sodium acetate impurities and sodium acetate are analyzed. Preliminary and secondary screening are performed to determine the impurity areas in sodium acetate.

Benefits of technology

It improves the detection accuracy of the impurity area of ​​sodium acetate, can more effectively identify and extract impurities in sodium acetate, and improves the accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118941537B_ABST
    Figure CN118941537B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to an intelligent detection method for sodium acetate impurities based on machine vision. The method obtains a sodium acetate surface image during the transmission process; performs preliminary extraction of abnormal areas in the sodium acetate surface image; extracts a contour path in the abnormal area; based on the contour path, analyzes the difference in light and dark fluctuation characteristics between the sodium acetate impurities and the shadow area formed by the accumulation of sodium acetate, determines a first impurity area suspected of having impurities from the abnormal area, and determines an impurity contour suspected of having impurities from the contour path; analyzes the direction and proportion of the impurity contour in the first impurity area, performs secondary screening on the first impurity area, and obtains a second impurity area; determines the impurity area in the sodium acetate according to the light and dark changes on the impurity contour in the second impurity area. The present invention improves the accuracy of detection of impurity areas in sodium acetate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a sodium acetate impurity intelligent detection method based on machine vision. Background Art

[0002] Sodium acetate is an important chemical substance with a wide range of uses and applications. It can be used as a raw material for the production of acetic acid and ethyl acetate, and can also be used as a food additive, such as a seasoning, flavoring agent, or meat preservative. During the preparation of sodium acetate, many of them undergo ion reactions or oxidation, and the body is relatively active. Once heavy metal elements are added, these are impurity ions, which will cause the sodium acetate lattice curve to be distorted and lose symmetry, causing effects. Sodium acetate is a colorless, transparent crystal or white powder. During its production process, polysodium acetate or acetate containing impurities will be produced, which may appear white with color difference or slightly colored.

[0003] At present, the common method for impurity detection of sodium acetate is to detect impurities in sodium acetate by chromatography. However, since the selection of chromatographic columns, detection conditions, etc. may have different applicability to different types of impurities, it is necessary to select a suitable method to ensure the selective detection of impurities, and if the peaks of different impurities overlap in the chromatogram, it may affect its analysis and quantification. Because sodium acetate is a transparent crystal or white powder, the impurity detection of sodium acetate can also be carried out by detecting the colored area in the captured image, and then roughly estimating the sodium acetate containing impurities by image segmentation. However, due to the existence of impurities with a color close to that of sodium acetate, it is difficult to extract and detect impurities in sodium acetate only by image segmentation, which will lead to low accuracy in impurity detection of sodium acetate. Summary of the invention

[0004] In order to solve the technical problem that it is difficult to extract and detect impurities in sodium acetate through image segmentation, which leads to low accuracy in impurity detection of sodium acetate, the purpose of the present invention is to provide an intelligent detection method for sodium acetate impurities based on machine vision. The technical solution adopted is as follows:

[0005] In a first aspect, an embodiment of the present invention provides a method for intelligent detection of sodium acetate impurities based on machine vision, the method comprising:

[0006] Acquire a surface image of sodium acetate during the conveying process of sodium acetate;

[0007] Preliminarily extracting the abnormal area in the sodium acetate surface image; extracting the contour path in the abnormal area;

[0008] Based on the contour path, analyzing the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurity and the sodium acetate accumulation, determining a first impurity area suspected of having impurities from the abnormal area, and determining an impurity profile suspected of having impurities from the contour path;

[0009] Analyzing the interval and abnormality of the impurity profile in the first impurity region, performing a secondary screening on the first impurity region to obtain a second impurity region;

[0010] The impurity region in the sodium acetate is determined based on the light and dark changes on the impurity contour in the second impurity region.

[0011] Further, based on the contour path, analyzing the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurity and the sodium acetate accumulation, determining a first impurity area suspected of having impurities from the abnormal area, and determining an impurity profile suspected of having impurities from the contour path, includes:

[0012] Based on the contour path, analyzing the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurities and the shadow area formed by the sodium acetate accumulation, and obtaining the abnormality degree of each contour path;

[0013] The contour path whose abnormality degree is not within the normal range is regarded as the impurity contour;

[0014] Determine the abnormal probability of the abnormal area based on the overall situation of the abnormal degree of different contour paths in the abnormal area;

[0015] An abnormal region whose abnormal probability does not fall within the normal range is regarded as a first impurity region.

[0016] Furthermore, based on the contour path, the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurities and the sodium acetate accumulation is analyzed to obtain the abnormality degree of each contour path, including:

[0017] For each contour path, the difference between the mean of the pixel value ratios of adjacent pixels on the contour path and the preset standard threshold is calculated as the abnormality weight;

[0018] The average value of the pixel value difference between adjacent pixels on the contour path is used as the initial abnormality parameter; the abnormality weight is used as the weight to weight the initial abnormality parameter to obtain the abnormality degree of the contour path.

[0019] Furthermore, the determining of the abnormal probability of the abnormal area based on the overall situation of the abnormality levels of different contour paths in the abnormal area includes:

[0020] The average of the abnormal degrees of different contour paths in the abnormal area is taken as the abnormal probability of the abnormal area.

[0021] Further, the analyzing the interval and abnormality of the impurity profile in the first impurity region and performing a secondary screening on the first impurity region to obtain the second impurity region includes:

[0022] Analyzing the interval and abnormality of the impurity profile in the first impurity region to obtain an effective path parameter of the first impurity region;

[0023] When the normalized effective path parameter is greater than or equal to a preset effective threshold, the corresponding first impurity region is marked as a second impurity region.

[0024] Furthermore, the analyzing the interval and abnormality of the impurity profile in the first impurity region to obtain the effective path parameter of the first impurity region includes:

[0025] Determine the profile dispersion of the impurity profile by taking the cumulative value of the spacing distance between adjacent impurity profiles in the first impurity region as the numerator and the number of adjacent impurity profiles in the first impurity region with a preset distance as the denominator;

[0026] The product of the accumulated value of the abnormality degree of the impurity profile in the first impurity region and the profile discreteness is used as the effective path parameter of the first impurity region.

[0027] Further, determining the impurity region in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity region includes:

[0028] merging adjacent impurity profiles in the second impurity region into the same group;

[0029] When the pixel values ​​between adjacent pixel points on the impurity contour decrease, the position where the pixel value decreases is marked;

[0030] When the mark positions on adjacent impurity profiles in the same group are adjacent, it is determined that the marks of different impurity profiles belong to the same impurity region;

[0031] Traverse all impurity profiles within the same group and determine the impurity area in sodium acetate.

[0032] Further, the extracting the contour path in the abnormal area includes:

[0033] The point with the smallest pixel value in the abnormal area is taken as the starting point, the point with the smallest pixel value in the eight neighborhoods of the starting point is taken as the first pixel point, the point with the smallest pixel value in the eight neighborhoods of the first pixel point except the starting point is taken as the second pixel point, and so on, until the edge of the abnormal area is searched, and the starting point, the first pixel point, the second pixel point, and the last pixel point searched are connected to obtain the peak bottom contour;

[0034] The direction from the point with the smallest pixel value on the peak bottom contour to the point with the largest pixel value on the edge of the abnormal area is taken as the path direction; multiple line segments with the path direction as the direction, the point on the peak bottom contour as the starting point, and the point on the edge of the abnormal area as the end point are determined as the contour path.

[0035] Furthermore, the preliminary extraction of abnormal areas in the sodium acetate surface image includes:

[0036] Threshold segmentation is performed on the sodium acetate surface image to segment out abnormal areas in the sodium acetate surface image.

[0037] Further, after determining the impurity region in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity region, the method further includes:

[0038] When the number of impurity regions in the sodium acetate is greater than a preset defective threshold, the quality of the sodium acetate is determined to be poor;

[0039] When the number of impurity regions in the sodium acetate is less than or equal to the preset defective threshold and greater than the preset medium threshold, the quality of the sodium acetate is determined to be medium;

[0040] When the number of impurity regions in the sodium acetate is less than or equal to a preset medium threshold, the quality of the sodium acetate is determined to be good.

[0041] In the second aspect, a sodium acetate impurity intelligent detection system based on machine vision is provided, and the system includes the following modules:

[0042] An acquisition module, used for acquiring a surface image of sodium acetate during the conveying process of sodium acetate;

[0043] A path extraction module is used to perform preliminary extraction of abnormal areas in the sodium acetate surface image; extract the contour path in the abnormal area;

[0044] an analysis module, configured to analyze the difference in light and dark fluctuation characteristics between the sodium acetate impurity and the shadow area formed by the accumulation of sodium acetate based on the contour path, determine a first impurity area suspected of having impurities from the abnormal area, and determine an impurity profile suspected of having impurities from the contour path;

[0045] A screening module, used for analyzing the interval and abnormality of the impurity profile in the first impurity region, performing a secondary screening on the first impurity region to obtain a second impurity region;

[0046] A determination module is used to determine the impurity area in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity area.

[0047] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, various possible embodiments of the first aspect are implemented.

[0048] In a fourth aspect, an embodiment of the present invention provides a computer program product, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.

[0049] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute various possible implementations of the first aspect.

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

[0051] The present invention adopts the method of installing a camera above a sodium acetate finished product conveyor belt to obtain an image of the sodium acetate finished product, and firstly extracts an abnormal area in the sodium acetate surface image, the abnormal area is an area suspected of having impurities, which may contain impurities and a shadow area formed by the accumulation of sodium acetate, and the shadow area will affect the detection of impurities in the sodium acetate, so further, based on the contour path, the light and dark fluctuation characteristic difference between the sodium acetate impurities and the shadow area formed by the accumulation of sodium acetate is analyzed, and the first impurity area suspected of having impurities and the impurity profile suspected of having impurities are determined, and the first screening of the impurity area in the abnormal area is realized, and then the first impurity area is analyzed by using the distribution characteristics of the impurities and the shadow area, and the second screening is realized, and the light and dark changes of the impurity profile are combined to obtain the final impurity area in the sodium acetate. By analyzing the different characteristics between the impurities and the shadow area formed by the accumulation, the accuracy of the detection of the impurity area of ​​the sodium acetate is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only 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.

[0053] Figure 1 A method flow chart of a method for intelligent detection of sodium acetate impurities based on machine vision provided by one embodiment of the present invention;

[0054] Figure 2An image of the surface of sodium acetate during the conveying process provided by one embodiment of the present invention;

[0055] Figure 3 A method flow chart of a method for acquiring a first impurity region and an impurity profile provided by one embodiment of the present invention;

[0056] Figure 4 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation method, structure, characteristics and effects of the sodium acetate impurity intelligent detection method based on machine vision proposed by the present invention are described in detail as follows in combination with the accompanying drawings and preferred embodiments.

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

[0059] Among them, in the description of the embodiments of the present invention, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present invention, "multiple" refers to two or more than two.

[0060] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying 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 the features.

[0061] Unless defined otherwise, 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 belongs.

[0062] The embodiments of the present invention are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0063] The embodiment of the present invention provides a specific implementation method of a sodium acetate impurity intelligent detection method based on machine vision, which is applicable to the sodium acetate impurity detection scene. In this scene, a camera is used to obtain a surface image of sodium acetate during the conveying process of sodium acetate, wherein the camera is installed above the conveyor belt of the finished sodium acetate product. Since sodium acetate will produce more sodium acetate or acetate containing impurities during the production process, this impurity will have a color difference with the color of sodium acetate, and the presence of impurities will affect the quality of sodium acetate, resulting in a decrease in the quality of the produced sodium acetate. In order to solve the problem that it is difficult to extract and detect impurities in sodium acetate through image segmentation, which will lead to the problem of low accuracy when detecting impurities in sodium acetate. Therefore, it is necessary to obtain an image of the finished sodium acetate product, process the obtained image, and obtain a suspected impurity area in the image in combination with the pixel value change of adjacent pixels in the image, and analyze the obtained suspected area, and combine the color texture and other characteristics of the impurities to detect the impurities slightly covered in the suspected area and the impurities in the shadow part of the sodium acetate product accumulation, analyze whether there are impurities and the number of impurities, so as to achieve the purpose of detecting impurities in the finished sodium acetate product.

[0064] The specific scheme of the sodium acetate impurity intelligent detection method based on machine vision provided by the present invention is described in detail below with reference to the accompanying drawings.

[0065] See also Figure 1 , which shows a flow chart of the steps of a sodium acetate impurity intelligent detection method based on machine vision provided by an embodiment of the present invention, the method comprising the following steps:

[0066] Step S100, obtaining a surface image of sodium acetate during the conveying process.

[0067] When the factory produces sodium acetate, it will be transported to the packaging area via a conveyor belt for packaging. In order to obtain better detection results, the embodiment of the present invention installs a camera above the conveyor belt to obtain the unprocessed surface image of the finished sodium acetate product when it is transported on the conveyor belt. Among them, the unprocessed surface image is an RGB image. During transportation, the finished sodium acetate product is spread as thinly as possible to avoid excessive accumulation, which will cause more impurities to be covered at the bottom, thereby affecting the detection results.

[0068] The finished sodium acetate is in the form of white powder, which tends to accumulate and form peaks during the transportation process, with valleys between the peaks. Under the illumination of a fixed indoor light source, the backlit side of the peak forms a shadow, which forms a clear contrast between the light source and the part directly illuminated by the light source. In addition, although there is a color difference between the sodium acetate impurities and the main body, this color difference becomes difficult to distinguish when the impurities are in the shadow part.

[0069] Therefore, the embodiment of the present invention combines the color texture and other characteristics of the impurities to detect the impurities slightly covered in the suspected area and the impurities in the shadow part of the sodium acetate finished product accumulation, and analyzes whether there are impurities and the amount of impurities present.

[0070] The unprocessed surface image of sodium acetate during the conveying process is obtained by the camera, and the unprocessed surface image is grayed to obtain a gray image, which is recorded as the sodium acetate surface image. The sodium acetate surface image can also be directly obtained by using a gray camera during the conveying process of sodium acetate. Figure 2 , Figure 2 This is an image of the surface of sodium acetate during the transportation process.

[0071] Step S200, preliminarily extracting the abnormal area in the sodium acetate surface image; extracting the contour path in the abnormal area.

[0072] The impurities in the finished sodium acetate product have a color difference with the sodium acetate, which is generally easy to find. However, when the impurities are on the backlit side of the peak or in the valley area formed by the accumulation of sodium acetate, it is difficult to detect. Because the shadow area formed by the backlit side and the peak valley area are darker, the darker area formed overlaps with the sodium acetate impurities, which will affect the detection of sodium acetate impurities.

[0073] The finished sodium acetate is in the form of white powder. When it is piled up on the conveyor belt, the shadows and valleys formed by the accumulated peaks, as well as the brightness difference between the sodium acetate impurity area and the flat sodium acetate finished product area that is not blocked by the peaks or covered with impurities, make it possible to distinguish these areas through threshold segmentation technology.

[0074] After obtaining multiple images of finished sodium acetate products being transported on a conveyor belt, graying the images and converting them into grayscale images to obtain sodium acetate surface images, peaks formed by impurities and sodium acetate accumulation are analyzed based on the sodium acetate surface images.

[0075] Since the shadow area formed when sodium acetate is accumulated and the sodium acetate impurities have obvious color difference compared with the finished sodium acetate product, and the pixel values ​​of these areas are usually darker, the area suspected of having impurities can be identified by analyzing the pixel values ​​of the pixels, that is, the abnormal area in the sodium acetate surface image is preliminarily extracted. The abnormal area is the area suspected of having impurities.

[0076] Threshold segmentation is performed on the sodium acetate surface image to segment out abnormal areas in the sodium acetate surface image. More specifically:

[0077] The multiple sodium acetate surface images obtained after processing are taken as a data set. Since sodium acetate is in the form of white powder and there is a color difference between impurities and sodium acetate, the maximum inter-class variance of the sodium acetate surface image is obtained as the threshold, and the sodium acetate surface image to be detected is subjected to threshold segmentation. The pixel value area less than the threshold is taken as the background, and the foreground and background of the sodium acetate surface image are obtained. The background is taken as the research area, that is, the abnormal area suspected of having impurities, that is, the abnormal area in the sodium acetate surface image is preliminarily extracted.

[0078] The image segmented by the threshold is used as a mask to be superimposed with the original sodium acetate surface image to obtain the pixel values ​​of the pixels in the abnormal area where impurities are suspected to exist.

[0079] The actual impurity area in the suspected impurity area is obtained by analyzing the difference characteristics between the sodium acetate impurity and the shadow area formed by the sodium acetate accumulation.

[0080] First, obtain the abnormal areas suspected of having impurities in the sodium acetate surface image. Since the shadow area of ​​the peak-shaped part formed by the accumulation of sodium acetate may contain sodium acetate impurities, and these impurities are difficult to accurately distinguish in the shadow by simple threshold segmentation technology, these suspected areas may indeed contain sodium acetate impurities, or may not contain sodium acetate impurities, which requires further analysis or verification.

[0081] The area suspected of having impurities that was screened after threshold segmentation is the backlit shadow area of ​​the sodium acetate finished product that is piled up in a peak shape. Since the position of the light source is fixed and the light intensity is always the same, the pixel values ​​of the pixels in this area are generally low, and the pixel values ​​of adjacent pixels are similar or the same. In the backlit shadow area of ​​the peak-shaped part, there is a slight difference in the grayscale value of the pixels generated by the bottom of the peak and the top of the peak. The top of the peak receives more light, forming the edge of the shadow area, which has a more obvious light-dark contrast than the shadow area formed at the bottom of the peak. Therefore, the pixel values ​​of the pixels from the shadow part formed at the bottom of the peak to the edge of the shadow formed at the top of the peak gradually increase, or the pixel values ​​gradually increase, because the brightness increases. Since the entire area is in the shadow, the pixel values ​​of these pixels are still lower than those of other non-shadow areas, but the similarity is higher.

[0082] Further, the contour path in the abnormal area is extracted, specifically: the point with the smallest pixel value in the abnormal area is taken as the starting point, the point with the smallest pixel value in the eight neighborhoods of the starting point is taken as the first pixel point, the point with the smallest pixel value in the eight neighborhoods of the first pixel point except the starting point is taken as the second pixel point, and so on, until the edge of the abnormal area is searched, the starting point, the first pixel point, the second pixel point, to the last pixel point searched out are connected to obtain the peak bottom contour; the direction from the point with the smallest pixel value on the peak bottom contour to the point with the largest pixel value on the edge of the abnormal area is taken as the path direction; multiple line segments with the path direction as the direction, the points on the peak bottom contour as the starting points, and the points on the edge of the abnormal area as the end points are determined as the contour path.

[0083] More specifically: First, determine the position of the pixel with the lowest pixel value in the abnormal area, and find the pixel with the smallest pixel value among its adjacent pixels through the eight-neighborhood search method, and mark the position of the pixel. Then, repeat this process, based on the marked pixel with the minimum pixel value, continue to search for the pixel with the smallest pixel value in its eight neighborhoods (excluding the marked pixels), and mark them until the search reaches the edge area. The line connected by all the marked pixels is the contour of the peak bottom, which is the peak bottom contour.

[0084] Then, find the pixel point with the largest pixel value on the edge of the abnormal area, and connect this point with the pixel point with the smallest pixel value on the peak bottom contour to form a vector from the minimum value point of the peak bottom contour to the maximum value point on the edge of the abnormal area. This vector is regarded as a path. After that, the direction of this path is used as the path direction, and tangents are made to all points on the peak bottom contour, and these tangents are extended to connect with the points on the edge area, so as to obtain the contour path set from all points on the peak bottom to the points on the edge of the area.

[0085] Step S300, based on the contour path, analyze the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurities and the sodium acetate accumulation, determine the first impurity area suspected of having impurities from the abnormal area, and determine the impurity contour of the suspected impurities from the contour path.

[0086] When sodium acetate accumulates on the conveyor belt, the shadows and peaks and valleys formed by the peaks of the accumulation, as well as the large difference in brightness between the sodium acetate impurity area and the flat sodium acetate finished product area that is not blocked by the peaks or covered with impurities, have obvious color differences compared to the sodium acetate finished product, and the pixel values ​​of these areas are usually darker.

[0087] Therefore, on the basis of the analyzable contour path obtained in step S200, the peaks formed by the accumulation of impurities and sodium acetate are analyzed based on the sodium acetate surface image.

[0088] In some embodiments, the peak formed by the accumulation of impurities and sodium acetate is analyzed based on the sodium acetate surface image to determine the first impurity region suspected of having impurities and the impurity profile suspected of having impurities, that is, the above step S300 can be performed by Figure 3 The steps shown achieve:

[0089] Step S310, based on the contour path, analyzing the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurities and the shadow area formed by the sodium acetate accumulation, and obtaining the abnormality degree of each contour path.

[0090] Specifically: for each contour path, the difference between the mean of the pixel value ratios of adjacent pixel points on the contour path and a preset standard threshold is calculated as the abnormality weight; the average of the pixel value differences of adjacent pixel points on the contour path is used as the initial abnormality parameter; the initial abnormality parameter is weighted using the abnormality weight as the weight to obtain the abnormality degree of the contour path.

[0091] Step S320 , taking the contour path whose abnormality is not within the normal range as the impurity contour.

[0092] In the embodiment of the present invention, the preset normal range is (0, 0.3]. In other embodiments, the implementer can set it according to other actual conditions. Taking the first contour path as an example, F l is the abnormality degree of the lth contour path, when 0 <F l When ≤0.3, there is no sodium acetate impurity on the path l; otherwise, there may be sodium acetate impurities, and the corresponding profile path is taken as the impurity profile.

[0093] Step S330, determining the abnormal probability of the abnormal area based on the overall situation of the abnormality levels of different contour paths in the abnormal area.

[0094] As one embodiment of the present invention, the mean of the abnormality degrees of different contour paths in the abnormal area can be used as the abnormality probability of the abnormal area; as another embodiment of the present invention, the mode or median of the abnormality degrees of different contour paths in the abnormal area can also be used as the abnormality probability of the abnormal area.

[0095] As other embodiments of the present invention, the abnormality levels on all contour paths in all abnormal regions can also be traversed. If the abnormality levels on all contour paths are between 0 and 0.3, there is no sodium acetate impurity in the abnormal region. That is, when the overall abnormality levels of different contour paths in the abnormal region are all abnormal, the abnormal region is used as the first impurity region.

[0096] Step S340 , taking the abnormal region whose abnormal probability is not within the normal range as the first impurity region.

[0097] The normal range is the same as the normal range when screening the impurity profile. In the embodiment of the present invention, the normal range is preset to (0, 0.3], and in other embodiments, it can be set by the implementer according to other actual conditions.

[0098] Obtain the pixel values ​​of the pixel points on the path in the shadow area. From the above content, it can be seen that the pixel values ​​of adjacent pixel points on the lth contour path in the shadow area are similar and gradually increase. Therefore, by comparing the pixel values ​​of adjacent pixel points on the lth contour path, it can be determined whether the shadow area contains sodium acetate impurities.

[0099] Taking the lth contour path as an example, the calculation formula for the abnormality degree of the corresponding contour path is:

[0100]

[0101] Among them, F l is the abnormality degree of the lth contour path; n is the number of pixels on the lth contour path; x i is the pixel value of the i-th pixel on the l-th contour path; x i+1 is the pixel value of the i+1th pixel on the lth contour path; That is, the ratio of the pixel values ​​of the i-th and i+1-th pixels on the l-th contour path; is the abnormal weight; 1 is the preset standard threshold; count(i) is the number of times the pixel values ​​of adjacent pixels are different; is the initial abnormal parameter; α is a preset constant. The purpose is to avoid the situation where the denominator is 0. The value of the preset constant is as small as possible. In the embodiment of the present invention, the size of the preset constant can be set to 0.1. In other embodiments, the implementer can adjust the preset constant according to actual conditions. The value of the preset constant cannot be greater than 1.

[0102] In the calculation formula of abnormality degree, It reflects the brightness of adjacent pixels. When there is no sodium acetate impurity on the lth contour path, the pixel values ​​between adjacent pixels are more similar, so the corresponding The closer it is to 1. Because if it is the contour edge of the shadow area, it does not contain sodium acetate impurities. The value is close to or equal to 1, so The value should be close to 0; x i+1 -x i represents the difference between the pixel values ​​of adjacent pixels on the lth contour path. If the pixel values ​​of the pixels between adjacent pixels on the lth contour path gradually increase, then x i+1 -x i Should be 0; It represents the product of the absolute value of the difference between the average value of the ratio of the pixel values ​​between adjacent pixels on the lth contour path and 1, and the average value of the pixel value difference between adjacent pixels. When the pixel values ​​between adjacent pixels on the lth contour path are similar and gradually increase, The value is greater than and close to 0, If the value is close to 1, The value is between 0 and 1 and close to 1.

[0103] Step S400 , analyzing the interval and abnormality of the impurity profile in the first impurity region, performing a secondary screening on the first impurity region to obtain a second impurity region.

[0104] In step S200, the abnormal regions suspected of containing impurities are obtained, and non-first impurity regions that may be shadow regions and first impurity regions that may contain impurities are screened out. These shadow regions are single, that is, they are only composed of backlight shadows generated by a peak-shaped portion formed after sodium acetate is accumulated, and there is no overlap between the shadow regions formed by other peak-shaped portions. Therefore, through the above steps, it is confirmed that such regions do not contain sodium acetate impurities.

[0105] However, when shadow areas formed by multiple peaks overlap, the pixel values ​​of the overlapping pixels will be lower. At the same time, if shadow areas formed by multiple peaks overlap, the sizes of these overlapping parts are random and irregular, which will have a certain impact on the detection of whether there is sodium acetate impurity in the shadow area. These affected areas are abnormal areas.

[0106] During the production process of sodium acetate, the impurities produced are small in size and have a color difference with sodium acetate. After grayscale processing, the pixel values ​​of the pixels in the area where the sodium acetate impurities are formed in the image are small. The peak-shaped part formed by the accumulation of sodium acetate contains the impurity area in the shadow area produced, and there is a difference between the impurity area and the overlapping area of ​​multiple shadow areas.

[0107] Analyze the interval and abnormality of the impurity profile in the first impurity region to obtain the effective path parameter of the first impurity region; when the normalized effective path parameter is greater than or equal to the preset effective threshold, mark the corresponding first impurity region as the second impurity region. In the embodiment of the present invention, the preset effective threshold is 0.5, and in other embodiments, the implementer adjusts the value according to the actual situation.

[0108] More specifically: the profile discreteness of the impurity profile is determined by taking the cumulative value of the spacing distances between adjacent impurity profiles in the first impurity region as the numerator and the number of adjacent impurity profiles in the first impurity region with a preset distance as the denominator; the product of the cumulative value of the abnormality degree of the impurity profile in the first impurity region and the profile discreteness is taken as the effective path parameter of the first impurity region.

[0109] It can be understood that the abnormal part in the shadow area is analyzed to obtain the number of paths occupied by the abnormal area. The more paths it occupies, the smaller the probability of being an impurity area, and vice versa. At the same time, the position a of the abnormal pixel point on the path is obtained through the previous step. k By comparing the Euclidean distances between abnormal pixels on adjacent abnormal paths, If the Euclidean distance between abnormal pixels on adjacent paths with abnormalities is close to 1, the suspected defects on the adjacent paths are in the same defect area, otherwise not.

[0110] Taking the kth first impurity region as an example, the calculation formula of the effective path parameter of the first impurity region is:

[0111]

[0112] Among them, P k is the effective path parameter of the kth first impurity region; m is the number of impurity profiles in the kth first impurity region; F m is the abnormality degree of the mth impurity profile in the kth first impurity region; is the spacing distance between the mth impurity profile and the m+1th impurity profile in the kth first impurity region; count(k) is the number of adjacent impurity profiles in the kth first impurity region whose distance is the preset distance; is the contour discreteness of the kth first impurity region. In the embodiment of the present invention, the preset distance is 1, and in other embodiments, it can be adjusted by the implementer according to actual conditions. Here, the preset distance is set to 1 in order to obtain the number of directly adjacent impurity contours.

[0113] The more adjacent the impurity contours are and the higher the similarity of the impurity contours is, the greater the probability that it is a shadow area, and the smaller the probability that there are impurities in the area. count(k) is the number of impurity contours with similar statistical paths and directly adjacent paths. The more the number of directly adjacent impurity contours occupied by a first impurity area and the longer the length of the abnormal part is, the lower the probability that it is an impurity area; otherwise, the greater the probability; It is the product of the sum of the abnormality degrees of the impurity profile in the first impurity region and the profile discreteness. The larger the value is, the greater the probability that the abnormal part is an impurity, and vice versa.

[0114] P k The value is normalized, and the preset effective threshold is 0.5. k When ≥0.5, sodium acetate impurities exist in the shaded area, and the path where the impurities exist is obtained.

[0115] Step S500, determining the impurity region in the sodium acetate according to the light and dark changes on the impurity contour in the second impurity region.

[0116] During the production of sodium acetate, impurities are randomly generated and randomly distributed, so the area where impurities exist may contain more than one impurity area.

[0117] Through step S400, a second impurity region where impurities exist and an impurity contour where impurities exist in the region are obtained. The impurity contour where impurities exist can be analyzed. There is an increasing relationship between the pixel values ​​of adjacent pixel points on the impurity contour. If the pixel values ​​of multiple adjacent pixel points decrease, impurities exist at the location, otherwise there are no impurities.

[0118] The location and quantity of the impurity regions can be obtained by judging whether the positions where the pixel values ​​of adjacent pixels on the adjacent impurity contours decrease are adjacent to each other and whether they belong to the same impurity region.

[0119] First, the impurity profiles with impurities in the acquired second impurity region are divided, and adjacent paths are merged into the same group, that is, adjacent impurity profiles in the second impurity region are merged into the same group.

[0120] Then, the pixel points on each impurity contour in the group are traversed to obtain the change in pixel value between adjacent pixel points on the path. When it is found that the pixel value between adjacent pixel points decreases, the position where the pixel value decreases is marked. It can also be directly understood that when the pixel value between adjacent pixel points on the impurity contour decreases, the position where the pixel value decreases is marked.

[0121] Then, the positions where the pixel values ​​of adjacent pixels on the impurity contours with impurities decrease are detected, and it is determined whether the pixels at the same positions on the adjacent impurity contours are adjacent. If the pixels are adjacent, it means that they belong to the same impurity region, otherwise, they are not in the same impurity region. It can also be directly understood that when the mark positions on the adjacent impurity contours in the same group are adjacent, it is determined that the marks of different impurity contours belong to the same impurity region.

[0122] When the impurities on two adjacent impurity contours do not belong to the same impurity, continue to traverse the impurity contour to find the position where the pixel value decreases between the next adjacent pixel points, and repeat the determination step until the impurity regions and the corresponding quantities on the impurity contour are obtained. That is, traverse all the impurity contours within the same group to determine the impurity regions in sodium acetate.

[0123] Traverse all the paths containing impurities in the screened impurity regions, and obtain the quantity and position information of the impurities in the suspected impurity regions in the image.

[0124] As a preferred embodiment of the present invention, after determining the impurity regions in sodium acetate according to the light and dark changes on the impurity contours in the second impurity region, the following determination regarding the quality of sodium acetate can also be performed:

[0125] When the number of impurity regions in sodium acetate is greater than the preset defective product threshold, it is determined that the quality of sodium acetate is poor; in the embodiments of the present invention, the preset defective product threshold is 7, and in other embodiments, the implementer adjusts this value according to the actual situation.

[0126] When the number of impurity regions in sodium acetate is less than or equal to the preset defective product threshold and greater than the preset medium threshold, it is determined that the quality of sodium acetate is medium; in the embodiments of the present invention, the preset medium threshold is 4, and in other embodiments, the implementer adjusts this value according to the actual situation.

[0127] When the number of impurity regions in sodium acetate is less than or equal to the preset medium threshold, it is determined that the quality of sodium acetate is good.

[0128] That is, the number G of the impurity regions of the backlight shadow of the sodium acetate piled up in a peak shape in the surface image of sodium acetate can be obtained. When G>7, the quality of this batch of sodium acetate is poor; when 4<G≤7, it is determined that the quality of sodium acetate is medium; in other cases, it is determined that the quality of sodium acetate is good, and the quality of this batch of sodium acetate is better.

[0129] The embodiments of the present invention provide an intelligent detection system for sodium acetate impurities based on machine vision. The system includes:

[0130] An acquisition module, configured to acquire the surface image of sodium acetate during the conveying process;

[0131] A path extraction module, configured to preliminarily extract the abnormal regions in the surface image of sodium acetate; extract the contour paths in the abnormal regions;

[0132] An analysis module, configured to analyze the difference in the light and dark fluctuation characteristics between the sodium acetate impurities and the shadow regions formed by the sodium acetate accumulation based on the contour paths, determine the first impurity regions suspected of having impurities from the abnormal regions, and determine the impurity contours suspected of having impurities from the contour paths;

[0133] A screening module, used for analyzing the interval and abnormality of the impurity profile in the first impurity region, performing a secondary screening on the first impurity region to obtain a second impurity region;

[0134] A determination module is used to determine the impurity area in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity area.

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

[0136] It should be noted that: the device provided in the above embodiment is only illustrated by 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 is divided into different functional modules to complete all or part of the functions described above. In addition, the shopping guide device provided in the above embodiment and the image extension method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0137] Figure 4 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 4 As shown, the computer device 600 includes: a memory 610, a processor 620, and a computer program 630 stored in the memory 610 and running on the processor 620, wherein when the processor 620 executes the computer program 630, the computer device can execute any of the sodium acetate impurity intelligent detection methods based on machine vision introduced above.

[0138] In addition, an embodiment of the present invention also protects a device, which 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 execute the sodium acetate impurity intelligent detection method based on machine vision provided by an embodiment of the present invention.

[0139] The embodiment of the present invention can divide the functional modules of the device according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0140] In the case of dividing each module according to each function, the device may also include a signal uploading module, a determining module, an adjusting module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.

[0141] It should be understood that the device provided in the embodiment of the present invention is used to execute the above-mentioned sodium acetate impurity intelligent detection method based on machine vision, and thus can achieve the same effect as the above-mentioned implementation method.

[0142] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to a device, the processing module may be used to control and manage the actions of the device. The storage module may be used to support the device to execute mutual program codes, etc. The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0143] In addition, the device provided in the embodiment of the present invention may specifically be a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute the sodium acetate impurity intelligent detection method based on machine vision provided in the above embodiment.

[0144] An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement the sodium acetate impurity intelligent detection method based on machine vision provided in the above embodiment.

[0145] An embodiment of the present invention also provides a computer program product. When the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement the sodium acetate impurity intelligent detection method based on machine vision provided in the above embodiment.

[0146] Among them, the device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present invention are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here. Through the description of the above implementation methods, technicians in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways.

[0147] The device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other divisions in actual implementation. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0148] It should also be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0149] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying 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.

[0150] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0151] The above contents are only specific implementation modes of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention.

Claims

1. A method for intelligent detection of sodium acetate impurities based on machine vision, characterized in that: The method comprises the following steps: Acquiring a surface image of sodium acetate during the conveying process of sodium acetate; Preliminarily extracting the abnormal area in the sodium acetate surface image; extracting the contour path in the abnormal area; Based on the contour path, analyzing the difference in light and dark fluctuation characteristics between the shadow area formed by the sodium acetate impurity and the sodium acetate accumulation, determining a first impurity area suspected of having impurities from the abnormal area, and determining an impurity profile suspected of having impurities from the contour path; Analyzing the interval and abnormality of the impurity profile in the first impurity region, performing a secondary screening on the first impurity region to obtain a second impurity region; Determining the impurity region in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity region; Wherein, determining a first impurity region suspected of having impurities from the abnormal region, and determining an impurity profile suspected of having impurities from the profile path, comprises: based on the profile path, analyzing the difference in light and dark fluctuation characteristics between the shadow region formed by the sodium acetate impurities and the sodium acetate accumulation, and obtaining the abnormality degree of each profile path; taking the profile path whose abnormality degree does not fall within the normal range as the impurity profile; determining the abnormal probability of the abnormal region based on the overall situation of the abnormality degrees of different profile paths in the abnormal region; taking the abnormal region whose abnormality probability does not fall within the normal range as the first impurity region; The method for obtaining the abnormality degree of each contour path is as follows: for each contour path, the difference between the average of the pixel value ratios of adjacent pixel points on the contour path and a preset standard threshold is calculated as the abnormality weight; the average of the pixel value differences of adjacent pixel points on the contour path is used as the initial abnormality parameter; the initial abnormality parameter is weighted using the abnormality weight as the weight to obtain the abnormality degree of the contour path; The step of analyzing the interval and abnormality of the impurity profile in the first impurity region and performing secondary screening on the first impurity region to obtain the second impurity region includes: analyzing the interval and abnormality of the impurity profile in the first impurity region to obtain the effective path parameter of the first impurity region; when the normalized effective path parameter is greater than or equal to a preset effective threshold, marking the corresponding first impurity region as the second impurity region; Among them, the method for obtaining the effective path parameter of the first impurity region is: using the cumulative value of the spacing distance between adjacent impurity contours in the first impurity region as the numerator, and the number of adjacent impurity contours with a preset distance in the first impurity region as the denominator, to determine the contour discreteness of the impurity contour; taking the product of the cumulative value of the abnormality degree of the impurity contour in the first impurity region and the contour discreteness as the effective path parameter of the first impurity region.

2. The method for intelligent detection of sodium acetate impurities based on machine vision according to claim 1, characterized in that: Determining the abnormal probability of the abnormal area based on the overall situation of the abnormality degree of different contour paths in the abnormal area includes: The average of the abnormal degrees of different contour paths in the abnormal area is taken as the abnormal probability of the abnormal area.

3. The method for intelligent detection of sodium acetate impurities based on machine vision according to claim 1, characterized in that: The step of determining the impurity region in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity region comprises: merging adjacent impurity profiles in the second impurity region into the same group; When the pixel values ​​between adjacent pixel points on the impurity contour decrease, the position where the pixel value decreases is marked; When the mark positions on adjacent impurity profiles in the same group are adjacent, it is determined that the marks of different impurity profiles belong to the same impurity region; Traverse all impurity profiles within the same group and determine the impurity area in sodium acetate.

4. The method for intelligent detection of sodium acetate impurities based on machine vision according to claim 1, characterized in that: The extracting the contour path in the abnormal area comprises: The point with the smallest pixel value in the abnormal area is taken as the starting point, the point with the smallest pixel value in the eight neighborhoods of the starting point is taken as the first pixel point, the point with the smallest pixel value in the eight neighborhoods of the first pixel point except the starting point is taken as the second pixel point, and so on, until the edge of the abnormal area is searched, and the starting point, the first pixel point, the second pixel point, and the last pixel point searched are connected to obtain the peak bottom contour; The direction from the point with the smallest pixel value on the peak bottom contour to the point with the largest pixel value on the edge of the abnormal area is taken as the path direction; multiple line segments with the path direction as the direction, the point on the peak bottom contour as the starting point, and the point on the edge of the abnormal area as the end point are determined as the contour path.

5. The method for intelligent detection of sodium acetate impurities based on machine vision according to claim 1, characterized in that: The preliminary extraction of abnormal areas in the sodium acetate surface image includes: Threshold segmentation is performed on the sodium acetate surface image to segment out abnormal areas in the sodium acetate surface image.

6. The method for intelligent detection of sodium acetate impurities based on machine vision according to claim 1, characterized in that: After determining the impurity region in the sodium acetate according to the light and dark changes on the impurity profile in the second impurity region, the method further includes: When the number of impurity regions in the sodium acetate is greater than a preset defective threshold, the quality of the sodium acetate is determined to be poor; When the number of impurity regions in the sodium acetate is less than or equal to the preset defective threshold and greater than the preset medium threshold, the quality of the sodium acetate is determined to be medium; When the number of impurity regions in the sodium acetate is less than or equal to a preset medium threshold, the quality of the sodium acetate is determined to be good.

Citation Information

Patent Citations

  • Pattern edge track intelligent extraction method and application thereof

    CN110136155A

  • Method for detecting gel particles in PAN spinning solution

    CN113804592A