A three-in-one automatic feeder control method and system
Through downsampling processing and information carrying amount analysis, the appropriate image is adaptively selected, which solves the problem of excessive calculation of loading flatness control of the three-in-one automatic feeder, and improves the efficiency and control accuracy of the feeding process.
Patent Information
- Application Number
- CN202410715021.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-06-04
AI Technical Summary
The existing three-in-one automatic feeder has too much calculation in the loading flatness control, resulting in low production efficiency in the feeding process.
By acquiring the original loading grayscale image and performing downsampling processing, the information carrying amount of each grayscale value is analyzed, and the evaluation index of the downsampling processing is determined based on the first evaluation factor and the second evaluation factor are used to adaptively select appropriate downsampling. The processed image is to reduce the amount of calculation and improve the efficiency of flatness detection.
It effectively reduces the calculation amount of feeding flatness detection, improves the efficiency of the feeding process, and improves the control efficiency and accuracy of the three-in-one automatic feeding machine.
Smart Images

Figure CN118736271B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a control method and system for a three-in-one automatic feeder. Background Art
[0002] A three-in-one automatic feeder usually refers to an automated device that integrates feeding, weighing and packaging functions. It can be used for automatic packaging of various granular, block or powdered materials and is widely used in food, chemical, pharmaceutical and other industries. Among them, feeding flatness is a very important factor. It not only ensures product quality, improves production efficiency and ensures the normal operation of equipment, but also uneven feeding may cause material jamming, blocking or tilting, thereby causing the production line to stop, adjust or repair, reducing production efficiency and capacity. Therefore, during the operation of the three-in-one automatic feeder, the machine needs to be controlled in real time to provide flat material feeding.
[0003] In the prior art, the flatness control of the feeding material is generally achieved through computer vision combined with related algorithms. For example, the gray level co-occurrence matrix is used to detect the flatness of the feeding material, and then feedback is given based on the detection results to control the feeding system of the automatic feeder. However, when using the gray level co-occurrence matrix to detect the flatness of the feeding material, it is necessary not only to analyze the collected feeding image pixel by pixel, but also to expand all the gray levels in the feeding image. The gray level traversal property is high, and the overall calculation amount is too large, resulting in low production efficiency during the feeding process. Summary of the invention
[0004] In order to solve the technical problem that the overall calculation amount of the above-mentioned feeding flatness control is too large, resulting in low production efficiency in the feeding process, the purpose of the present invention is to provide a three-in-one automatic feeder control method and system, and the technical solution adopted is as follows:
[0005] An embodiment of the present invention provides a three-in-one automatic feeder control method, the method comprising the following steps:
[0006] Obtain the original grayscale image of the material during the feeding process of the three-in-one automatic feeder, and then obtain the grayscale image of the material after several downsampling processes;
[0007] According to each gray value in the original gray image of the material, the uneven image characteristics of the material are analyzed to determine the information carrying amount corresponding to each gray value in the original gray image of the material;
[0008] Determine a first evaluation factor corresponding to the feeding grayscale image after each downsampling process according to each grayscale value in the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the information carrying amount corresponding to each grayscale value;
[0009] Determine the second evaluation factor corresponding to the feeding grayscale image after each downsampling process according to the similarity between the feeding grayscale images after two adjacent downsampling processes, the number of pixels of the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the sequence number of each downsampling process;
[0010] Determine the evaluation index of each downsampling process by combining the first evaluation factor and the second evaluation factor, and then determine the downsampling grayscale image of the feeding material corresponding to the maximum evaluation index;
[0011] According to the down-sampled feeding grayscale image corresponding to the maximum evaluation index, the feeding flatness of the three-in-one automatic feeder is detected, and the machine is controlled based on the feeding flatness.
[0012] Further, the analyzing the uneven image features of the feed material according to each grayscale value in the original feed material grayscale image and determining the information carrying amount corresponding to each grayscale value in the original feed material grayscale image includes:
[0013] Taking any gray value as the target gray value, determining each pixel point in the eight neighborhoods of each pixel point corresponding to the target gray value in the original feeding gray image, and recording each pixel point in the eight neighborhoods as a neighborhood pixel point;
[0014] According to the grayscale values of each pixel point corresponding to the target grayscale value in the original feeding grayscale image and its corresponding neighboring pixel points, the material texture of the original feeding grayscale image is analyzed to determine the texture obviousness corresponding to the target grayscale value;
[0015] According to the grayscale values of each pixel point corresponding to the target grayscale value in the original grayscale image and its corresponding neighboring pixel points, the distribution of the target grayscale value in the original grayscale image is analyzed to determine the degree of global distribution difference corresponding to the target grayscale value;
[0016] The ratio of the global distribution difference corresponding to the target gray value to the texture prominence is taken as the information carrying amount corresponding to the target gray value.
[0017] Further, the material texture of the original feeding grayscale image is analyzed according to the grayscale values of each pixel point corresponding to the target grayscale value in the original feeding grayscale image and its corresponding neighboring pixel points, and the texture obviousness corresponding to the target grayscale value is determined, including:
[0018] For any pixel corresponding to the target grayscale value, calculate the grayscale average value of all the neighboring pixels corresponding to the pixel, and use the grayscale average value as the representative value of the region;
[0019] Determine the difference in regional representative values between any two pixels corresponding to the target grayscale value, then calculate the average of all regional representative value differences, and perform an inverse operation on the average of all regional representative value differences to obtain the texture prominence corresponding to the target grayscale value.
[0020] Further, the method of analyzing the distribution of the target grayscale value in the original loading grayscale image according to the grayscale values of each pixel point corresponding to the target grayscale value in the original loading grayscale image and its corresponding neighboring pixel points, and determining the degree of global distribution difference corresponding to the target grayscale value includes:
[0021] The calculation formula for the global distribution difference degree corresponding to the nth gray value is:
[0022] In the formula, is the global distribution difference degree corresponding to the nth grayscale value in the original feeding grayscale image, g n is the nth grayscale value in the original grayscale image, M is the number of pixels corresponding to the nth grayscale value in the original grayscale image, m is the pixel sequence number corresponding to the nth grayscale value in the original grayscale image, b is the neighborhood pixel sequence number corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image, and B is the number of neighborhood pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image. is the gray value of the bth neighboring pixel corresponding to the mth pixel corresponding to the nth gray value in the original gray image, || is the absolute value function, It is the grayscale variance of all neighboring pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original feeding grayscale image.
[0023] Further, the determining of the first evaluation factor corresponding to the feeding grayscale image after each downsampling process according to each grayscale value in the original feeding grayscale image and the feeding grayscale image after each downsampling process and the information carrying amount corresponding to each grayscale value comprises:
[0024] For any downsampling process, the number of occurrences of each grayscale value in the original grayscale image in the original feeding grayscale image and the number of occurrences in the feeding grayscale image after the downsampling process are counted, the difference in the number of occurrences of the same grayscale value in different images is calculated, and then the product of the difference in the number of occurrences of the same grayscale value in different images and the corresponding information carrying amount of the corresponding grayscale value is calculated, and the average value of the products corresponding to all grayscale values is used as the first evaluation factor corresponding to the feeding grayscale image after the downsampling process.
[0025] Further, the method of determining the second evaluation factor corresponding to the feeding grayscale image after each downsampling process according to the similarity between the feeding grayscale images after two adjacent downsampling processes, the number of pixels of the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the sequence number of each downsampling process comprises:
[0026] For any downsampling process, determine the similarity between the grayscale image of the material after the downsampling process and the grayscale image of the material after the downsampling process before the downsampling process, and use the inverse proportional value of the similarity as the initial selection necessary factor corresponding to the grayscale image of the material after the downsampling process;
[0027] Determine a downsampling correction coefficient corresponding to the downsampling grayscale image of the material according to the number of pixels of the original material grayscale image and the material grayscale image after the downsampling processing;
[0028] The product of the downsampling correction coefficient and the initially selected necessary factor is used as the correction selected necessary factor corresponding to the feeding grayscale image after the downsampling process;
[0029] According to the sequence number of the downsampling process, determine the sampling layer number increase coefficient corresponding to the grayscale image of the material after the downsampling process;
[0030] The product of the necessary correction selection factor corresponding to the feeding grayscale image after the downsampling processing and the sampling layer number increase coefficient is used as the second evaluation factor corresponding to the feeding grayscale image after the downsampling processing.
[0031] Furthermore, the step of determining the sampling layer number increase coefficient corresponding to the grayscale image of the material after the downsampling process according to the sequence number of the downsampling process includes:
[0032] The calculation formula of the sampling layer increase coefficient corresponding to the grayscale image of the feed after the sth downsampling process is:
[0033] In the formula, α s is the sampling layer increase coefficient corresponding to the grayscale image of the feed after the s-th downsampling process, s is the sequence number of the s-th downsampling process, and e is a natural constant.
[0034] Further, the method of determining the downsampling correction coefficient corresponding to the downsampling grayscale image of the material according to the number of pixels of the original material grayscale image and the downsampling grayscale image of the material, comprises:
[0035] The calculation formula of the downsampling correction coefficient corresponding to the grayscale image of the material after the sth downsampling process is:
[0036] β s =1+eX X s ; In the formula, β s is the downsampling correction coefficient corresponding to the grayscale image after the sth downsampling process, e is a natural constant, X is the number of pixels in the original grayscale image, X s is the number of pixels of the grayscale image after the s-th downsampling process.
[0037] Furthermore, the method of detecting the feeding flatness of the three-in-one automatic feeder according to the feeding grayscale image after downsampling processing corresponding to the maximum evaluation index includes:
[0038] A grayscale co-occurrence matrix is obtained according to the down-sampled grayscale image of the material being fed corresponding to the maximum evaluation index; the eigenvalue of the grayscale co-occurrence matrix is determined by a feature extraction method; and the eigenvalue of the grayscale co-occurrence matrix is used as the flatness of the material being fed.
[0039] Furthermore, the step of combining the first evaluation factor and the second evaluation factor to determine the evaluation index for each downsampling process includes:
[0040] For any downsampling process, the ratio of the second evaluation factor and the first evaluation factor corresponding to the grayscale image of the material after the downsampling process is used as the evaluation index of the downsampling process.
[0041] Furthermore, the machine control based on the flatness of the feeding material includes:
[0042] The feeding flatness is input into a pre-built and trained classification model of the feeding flatness of the three-in-one automatic feeder to obtain the output result of the classification model. According to the output result, the three-in-one automatic feeder is controlled in combination with the control system of the three-in-one automatic feeder.
[0043] Furthermore, the training process of the classification model for the flatness of the feeding of the three-in-one automatic feeder includes:
[0044] Construct a classification model for the flatness of the material fed by the three-in-one automatic feeder; the structure of the classification model is a decision tree model;
[0045] Obtain multiple material flatness values corresponding to different control instructions as training data, and use different control instructions as label data;
[0046] The classification model is trained using the training data and label data to obtain a classification model for the flatness of feeding of the three-in-one automatic feeder.
[0047] An embodiment of the present invention further provides a three-in-one automatic feeder control system, including a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a three-in-one automatic feeder control method.
[0048] The present invention has the following beneficial effects:
[0049] The present invention provides a three-in-one automatic feeder control method and system, which relates to an image downsampling processing technology and is mainly used in the control field of feeders; by determining the information carrying amount corresponding to each grayscale value in the original feeding grayscale image, the uneven feeding characteristics of each grayscale value are quantified, which is used to subsequently evaluate the processing effect of each downsampling, which helps to improve the accuracy of the subsequent calculation of the first evaluation factor; when evaluating the processing effect of each downsampling, it is determined from two aspects, namely the first evaluation factor and the second evaluation factor, which can effectively enhance the reliability and reference of the evaluation index determined for each downsampling process. value; downsampling the original feeding grayscale image reduces the number of pixels of the original feeding image to a certain extent, which is beneficial to reduce the overall calculation amount of feeding flatness; and the image after downsampling processing, which is adaptively determined based on the evaluation index, can ensure that while losing a part of the pixels, the information loss degree of the original feeding grayscale image is within an acceptable range, and then the flatness of the material in the original feeding grayscale image can be efficiently calculated with less calculation amount, so as to achieve high-efficiency feeding in the feeding process, thereby improving the control efficiency and accuracy of the three-in-one automatic feeder. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] 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.
[0051] Figure 1 This is a flow chart of a three-in-one automatic feeder control method according to an embodiment of the present invention;
[0052] Figure 2 The flowchart is for determining the information carrying amount corresponding to the target gray value in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does 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.
[0054] 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.
[0055] The embodiment of the present invention provides a three-in-one automatic feeder control method, such as Figure 1 As shown, the following steps are included:
[0056] S1, obtaining an original grayscale image of the material being fed by the three-in-one automatic feeder during the feeding process, and then obtaining the grayscale image of the material being fed after several downsampling processes.
[0057] The first step is to obtain the original grayscale image of the material being fed by the three-in-one automatic feeder during the feeding process.
[0058] The main purpose of this embodiment is to perform a flatness test on the material during the feeding process of the three-in-one automatic feeder. Therefore, before performing the flatness test on the material, it is first necessary to collect the material feeding image of the three-in-one automatic feeder.
[0059] In the feeding process of the existing three-in-one automatic feeder, in order to detect the feeding flatness of the three-in-one automatic feeder through machine vision methods, a high-definition camera is added during the feeding process, and the high-definition camera can be used to collect the material feeding image of the three-in-one automatic feeder. Therefore, the material feeding image can be directly obtained through the material camera system of the three-in-one automatic feeder, and the material feeding image can be transmitted to the image processing system, in order to further process the obtained image.
[0060] In order to facilitate the subsequent analysis of the flatness of the feeding material, it is necessary to grayscale the collected feeding image to obtain the grayscaled feeding image, which is recorded as the original feeding grayscale image. Based on the original feeding grayscale image, the image features of the flatness or unevenness of the material can be extracted. The prefix is added to the feeding grayscale image to distinguish the images before and after the downsampling process. The original feeding grayscale image refers to the feeding grayscale image that has not been downsampled.
[0061] The second step is to obtain the grayscale image of the material after several downsampling processes.
[0062] When the three-in-one automatic feeder performs flatness detection on material loading, it is necessary to use the original loading grayscale image to generate the corresponding grayscale co-occurrence matrix. The grayscale co-occurrence matrix is expanded for all grayscale levels in the image. The overall grayscale traversal property is high, and the calculation amount of the overall flatness is large. The material loading process needs to be completed in a shorter time. The large amount of calculation has a certain impact on the efficiency of the feeding process, which in turn leads to low control efficiency of the three-in-one automatic feeder.
[0063] In order to achieve a more efficient feeding process, before using the gray level co-occurrence matrix to detect the flatness of the feeding material, the original feeding grayscale image is processed by adaptively selecting appropriate downsampling to reduce the number of pixels in the image and ensure the reduction of the overall flatness calculation amount. Therefore, the unloading grayscale image after multiple downsampling processes is first obtained, and then the appropriate unloading grayscale image after downsampling is determined based on the evaluation of the unloading grayscale image after each downsampling process.
[0064] This embodiment uses the Gaussian pyramid technology to perform several downsampling processes on the original grayscale image of the feed material, and can obtain the grayscale image of the feed material after each downsampling process. Among them, the downsampling process of the Gaussian pyramid is a prior art, which is not within the protection scope of the present invention and will not be elaborated in detail here. The number of downsampling can be set by the implementer according to the specific actual situation and is not specifically limited here.
[0065] S2, analyzing the uneven image features of the feed material according to each grayscale value in the original feed material grayscale image, and determining the information carrying amount corresponding to each grayscale value in the original feed material grayscale image.
[0066] The information carrying capacity refers to the performance of material unevenness at pixel points with the same grayscale value in the original feeding grayscale image. The information carrying capacity can be used to adaptively select the feeding grayscale image after downsampling. The adaptively selected image can ensure that the information loss of the original feeding grayscale image is within an acceptable range while ensuring the loss of a part of the pixels. This allows the subsequent detection of the material flatness in the original feeding grayscale image with less calculation, thereby achieving efficient feeding of the three-in-one automatic feeder.
[0067] Furthermore, the loss of pixels in the image for each downsampling process is half of the interval loss, and the amount of information carried by pixels corresponding to different grayscale values in the original feeding grayscale image is different. When the pixels lost by downsampling are pixels with less information, there is a small difference between the flatness obtained by using the downsampling grayscale image for feeding flatness detection and the flatness obtained by using the original feeding grayscale image, that is, the use of the downsampling grayscale image for feeding flatness detection has a small impact on the overall automatic feeding process and is within an acceptable range; otherwise, the opposite is true.
[0068] Therefore, this embodiment analyzes the uneven image features of the feed material based on each grayscale value in the original feed grayscale image, and quantifies the information carrying amount corresponding to each grayscale value. Each grayscale value refers to the grayscale value with different values in the original feed grayscale image. The calculation process of the information carrying amount corresponding to each grayscale value is the same. For the convenience of description, any grayscale value is used as an example to determine the information carrying amount, and any grayscale value is used as the target grayscale value, such as Figure 2 As shown, the step of determining the information carrying amount corresponding to the target gray value may include:
[0069] The first step is to determine each pixel point in the eight neighborhoods of each pixel point corresponding to the target grayscale value in the original feeding grayscale image, and record each pixel point in the eight neighborhoods as a neighborhood pixel point.
[0070] For the materials of the three-in-one automatic feeder, when there is no uneven feeding, affected by the illumination and the material's own texture characteristics, there are uniformly and regularly distributed texture areas in the original feeding grayscale image; when there is uneven feeding, affected by the illumination, the material's own texture and unevenness, there are not only uniformly and regularly distributed texture areas in the original feeding grayscale image, but also uneven areas other than the material's own texture areas, and the uneven areas have the characteristics of local grayscale differences. By analyzing the local grayscale differences outside the grayscale areas of the material's own texture, the information carrying capacity of the grayscale value is quantified. The specific calculation process is divided into two parts. The first part is the texture obviousness corresponding to different grayscale values in the original feeding grayscale image; the second part is the global distribution difference degree corresponding to different grayscale values in the original feeding grayscale image.
[0071] Before calculating the texture prominence and global distribution difference, first determine the pixels in the eight neighborhoods of each pixel corresponding to the target grayscale value in the original grayscale image. For ease of description, each pixel in the eight neighborhoods is recorded as a neighborhood pixel, each pixel has its corresponding neighborhood pixel, and the maximum number of neighborhood pixels corresponding to a single pixel is 8.
[0072] In the second step, according to the grayscale values of each pixel point corresponding to the target grayscale value in the original feeding grayscale image and its corresponding neighboring pixel points, the material texture of the original feeding grayscale image is analyzed to determine the texture obviousness corresponding to the target grayscale value.
[0073] The texture prominence refers to the degree to which the target grayscale value is affected by the material's own texture characteristics. The greater the degree of influence by the material's own texture characteristics, the more likely it is that each pixel point corresponding to the target grayscale value is formed by the material texture and illumination; the smaller the degree of influence by the material's own texture characteristics, the more likely it is that each pixel point corresponding to the target grayscale value is formed by the unevenness of the material and illumination. Therefore, the texture prominence is negatively correlated with the amount of information carried.
[0074] In the first sub-step, for any pixel corresponding to the target grayscale value, the grayscale average value of the pixel and all its corresponding neighboring pixels is calculated, and the grayscale average value is used as the region representative value.
[0075] In this embodiment, the grayscale values of the pixel and the neighboring pixels corresponding to the pixel are first added, and then divided by the total number of the pixel and its neighboring pixels, so as to obtain the grayscale average value of the pixel and all its corresponding neighboring pixels. For the convenience of description, the grayscale average value is used as the regional representative value, which can characterize the grayscale condition of the region formed by the pixel and its neighboring pixels.
[0076] The second sub-step is to determine the difference in regional representative values between any two pixels corresponding to the target grayscale value, and then calculate the average value of all regional representative value differences. The average value of all regional representative value differences is inverted to obtain the texture conspicuity corresponding to the target grayscale value.
[0077] In this embodiment, in order to quantify the degree to which the target grayscale value is affected by the material texture, that is, to determine the texture obviousness corresponding to the target grayscale value, it is necessary to analyze the grayscale differences between the regions corresponding to the pixels of the same grayscale value at different positions in the original grayscale image of the feeding material. The greater the grayscale difference, the less the target grayscale value is affected by the material texture, and the greater the impact of uneven feeding. Therefore, in order to quantify the texture obviousness corresponding to the target grayscale value, it is necessary to invert the average value of the differences in the representative values of all regions. For example, the exponential function e -x .
[0078] As an example, the calculation formula for the texture obviousness corresponding to the nth gray value can be:
[0079] In the formula, is the texture obviousness corresponding to the nth gray value in the original gray image, e is a natural constant, M is the number of pixels corresponding to the nth gray value in the original gray image, m is the pixel sequence number corresponding to the nth gray value in the original gray image, b is the neighborhood pixel sequence number corresponding to the mth pixel corresponding to the nth gray value in the original gray image, B is the number of neighborhood pixels corresponding to the mth pixel corresponding to the nth gray value in the original gray image, is the gray value of the mth pixel corresponding to the nth gray value in the original feeding gray image, is the gray value of the bth neighboring pixel corresponding to the mth pixel corresponding to the nth gray value in the original gray image. is the gray value of the m+1th pixel corresponding to the nth gray value in the original feeding gray image, is the gray value of the bth neighboring pixel corresponding to the m+1th pixel corresponding to the nth gray value in the original gray image, || is the absolute value function, is the regional representative value of the mth pixel corresponding to the nth gray value in the original feeding gray image, It is the area representative value of the m+1th pixel corresponding to the nth gray value in the original feeding gray image.
[0080] In the calculation formula of texture prominence, It represents the difference in regional representative values between any two pixels. The greater the difference in regional representative values, the worse the similarity of the corresponding regions of the two pixels with the same grayscale value, and the less obvious the texture features of the mth pixel and the m-1th pixel corresponding to the target grayscale value. In order to make the calculated value logical, the exponential function is used to Perform the inversion operation to obtain the texture visibility The larger it is, the more obvious the texture features of all pixels corresponding to the nth grayscale value in the original feeding grayscale image are.
[0081] The third step is to analyze the distribution of the target grayscale value in the original grayscale image according to the grayscale values of each pixel point corresponding to the target grayscale value in the original grayscale image and its corresponding neighboring pixel points, and determine the degree of global distribution difference corresponding to the target grayscale value.
[0082] When the grayscale difference between each pixel corresponding to the target grayscale value in the original grayscale image and its corresponding neighboring pixel points is larger and less regular, it means that the probability that all the pixels corresponding to the target grayscale value are uneven in the material feeding is greater, and the information carrying amount corresponding to the target grayscale value is higher; otherwise, the opposite is true. Therefore, the degree of global distribution difference corresponding to the target grayscale value is quantified by grayscale difference and neighborhood grayscale regularity, and the degree of global distribution difference is positively correlated with the information carrying amount.
[0083] As an example, the calculation formula for the global distribution difference degree corresponding to the nth gray value may be:
[0084] In the formula, is the global distribution difference degree corresponding to the nth grayscale value in the original feeding grayscale image, g n is the nth grayscale value in the original grayscale image, M is the number of pixels corresponding to the nth grayscale value in the original grayscale image, m is the pixel sequence number corresponding to the nth grayscale value in the original grayscale image, b is the neighborhood pixel sequence number corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image, and B is the number of neighborhood pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image. is the gray value of the bth neighboring pixel corresponding to the mth pixel corresponding to the nth gray value in the original gray image, || is the absolute value function, It is the grayscale variance of all neighboring pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original feeding grayscale image.
[0085] In the calculation formula of the global distribution difference degree, It can represent the difference between the grayscale values of all neighboring pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image and the nth grayscale value. The greater the difference between the grayscale value of the neighboring pixel and the target grayscale value, the greater the difference between the target grayscale value and its neighborhood grayscale in the original grayscale image, the worse the grayscale distribution law of the pixels in the neighborhood, the greater the possibility that the area formed by the target grayscale value and its neighborhood is an uneven feeding area, and the greater the information carrying amount corresponding to the target grayscale value; the grayscale distribution law is The larger the value is, the greater the dispersion of the neighborhood grayscale distribution is, and the less likely it is that the area formed by the target grayscale value and its neighborhood will appear as a material texture area.
[0086] In the fourth step, the ratio of the global distribution difference degree corresponding to the target gray value to the texture obviousness degree is used as the information carrying amount corresponding to the target gray value.
[0087] In this embodiment, in order to improve the quantification accuracy of the information carrying amount, the global distribution difference degree and the texture obvious degree are analyzed. Since the global distribution difference degree is positively correlated with the information carrying amount, and the texture obvious degree is negatively correlated with the information carrying amount, the ratio of the global distribution difference degree to the texture obvious degree is used as the information carrying amount corresponding to the target gray value.
[0088] S3, determining a first evaluation factor corresponding to the feeding grayscale image after each downsampling process according to each grayscale value in the original feeding grayscale image and the feeding grayscale image after each downsampling process and the information carrying amount corresponding to each grayscale value.
[0089] When the downsampling algorithm is used to process the original grayscale image of the feed material, pixels are generally lost in every other row. Therefore, under the premise of the operation mechanism of the downsampling algorithm, it is extremely important to select the appropriate downsampling grayscale image of the feed material. The reason is that if the downsampling times are too large, the image area after downsampling processing will be smaller, but it may also lose important information in the original grayscale image of the feed material, resulting in low accuracy of the subsequent flatness detection results, thereby affecting the accuracy of the flatness control of the feeder; if the downsampling times are too small, the overall information of the original grayscale image of the feed material can be greatly guaranteed, but the image area after downsampling processing is large, and the calculation amount of the grayscale co-occurrence matrix is not significantly reduced when calculating the flatness of the original grayscale image of the feed material, and the production efficiency in the feeding process is still relatively low.
[0090] Therefore, the effect of each downsampling processing of the feeding grayscale image is evaluated through the information carrying amount corresponding to each grayscale value in the original feeding grayscale image, the image features of the original feeding grayscale image and the feeding grayscale image after each downsampling processing, so as to obtain the most suitable downsampling times for the material in the feeding process of the current three-in-one automatic feeder. The effect evaluation of downsampling processing is mainly analyzed from two aspects, one is the first evaluation factor, and the other is the second evaluation factor. Both the first evaluation factor and the second evaluation factor can be used to evaluate the degree of information loss of the image about flatness after downsampling processing.
[0091] In this embodiment, for any downsampling process, the number of occurrences of each grayscale value in the original grayscale image in the original feeding grayscale image and the number of occurrences in the feeding grayscale image after the downsampling process are counted, and the difference in the number of occurrences of the same grayscale value in different images is calculated. Then, the product of the difference in the number of occurrences of the same grayscale value in different images and the corresponding information carrying amount of the corresponding grayscale value is calculated, and the average value of the products corresponding to all grayscale values is used as the first evaluation factor corresponding to the feeding grayscale image after the downsampling process.
[0092] As an example, the calculation formula of the first evaluation factor corresponding to the grayscale image of the material after the s-th downsampling process can be:
[0093] In the formula, XS s is the first evaluation factor corresponding to the grayscale image of the material after the sth downsampling process, n is the grayscale value sequence number corresponding to the original grayscale image of the material, N is the number of grayscale values corresponding to the original grayscale image of the material, F n is the number of occurrences of the nth grayscale value corresponding to the original grayscale image of the raw material, F s,n is the number of occurrences of the nth grayscale value corresponding to the original grayscale image in the grayscale image after the sth downsampling process, (F n -F s,n ) is the difference in the number of occurrences of the nth grayscale value corresponding to the original grayscale image and the grayscale image after the sth downsampling process, XX n It is the information carrying amount corresponding to the nth grayscale value corresponding to the original feeding grayscale image.
[0094] In the calculation formula of the first evaluation factor, F n -F s,n The larger the value, the greater the number of occurrences of the nth grayscale value in the original grayscale image is, which is much greater than the number of occurrences in the grayscale image after the sth downsampling process. The greater the difference in the number of occurrences, the greater the information carrying capacity XX corresponding to the nth grayscale value. nThe larger the nth grayscale value in the original grayscale image is, the more serious the loss of the pixel corresponding to the nth grayscale value in the sth downsampling process will be; analyze the information loss of each grayscale value in the image before and after downsampling, that is, If the information loss of each gray value in the image before and after the s-th downsampling process is relatively serious, the first evaluation factor corresponding to the loading gray image after the s-th downsampling process will be higher, and the possibility that the s-th downsampling process is an over-downsampling process will be greater. At this time, the data deviation obtained by using the unloading gray image after the s-th downsampling process for flatness calculation will be greater.
[0095] S4, determining a second evaluation factor corresponding to the feeding grayscale image after each downsampling process according to the similarity between the feeding grayscale images after two adjacent downsampling processes, the number of pixels of the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the sequence number of each downsampling process.
[0096] In this embodiment, the calculation process of the second evaluation factor corresponding to the grayscale image of the material after each downsampling process remains consistent. For the convenience of description, any downsampling process is taken as an example to determine the second evaluation factor. The specific implementation steps of determining the second evaluation factor of the grayscale image of the material after the downsampling process may include:
[0097] The first step is to determine the similarity between the grayscale image of the material after the downsampling process and the grayscale image of the material after the previous downsampling process, and use the inverse proportional value of the similarity as the initial selection necessary factor corresponding to the grayscale image of the material after the downsampling process.
[0098] There should be some difference between the grayscale images of the upper material after two adjacent downsampling processes. The reason is that when the difference between the grayscale image of the lower material after the s-th downsampling process and the grayscale image of the lower material after the s-1th downsampling process is small, it means that the necessity of the s-th downsampling process is poor. When calculating the flatness, the grayscale image of the lower material after the s-1th downsampling process can be directly used for processing. Therefore, by analyzing the similarity between the grayscale images of the upper material after two adjacent downsampling processes, the inverse proportional value of the similarity is used as the initial selection necessary factor corresponding to the grayscale image of the upper material after the s-th downsampling process, so as to quantify the necessary degree of selection of the grayscale image of the lower material after the s-th downsampling process. The smaller the similarity, the greater the possibility that the grayscale image of the lower material after the s-th downsampling process is selected as the final image.
[0099] In this embodiment, as an example, the calculation formula of the initial selection necessary factor corresponding to the grayscale image of the material after the s-th downsampling process can be:
[0100] In the formula, JGs is the initial selection necessary factor corresponding to the grayscale image of the material after the sth downsampling process, cos is the cosine similarity function, P s is the grayscale image of the material after the sth downsampling process, P s-1 It is the grayscale image of the cutting material after the s-1th downsampling process.
[0101] In the calculation formula for initially selecting necessary factors, the calculation of the similarity between two images can be achieved through the cosine similarity function. Of course, the similarity between two images can also be calculated through other calculation methods; the stronger the similarity between the feeding grayscale images after two downsampling processes, the less necessary it is to select the feeding grayscale image after the sth downsampling process.
[0102] In the second step, according to the number of pixels of the original grayscale image and the grayscale image after the downsampling process, the downsampling correction coefficient corresponding to the grayscale image after the downsampling process is determined; the product of the downsampling correction coefficient and the initially selected necessary factor is used as the correction selected necessary factor corresponding to the grayscale image after the downsampling process.
[0103] As the number of downsampling times increases, the number of pixels that can be lost in the grayscale image after downsampling processing becomes smaller, and the similarity between the grayscale images after two adjacent downsampling processes becomes higher and higher. In order to avoid the situation where the difference between the grayscale images after two adjacent downsampling processes becomes smaller and smaller due to the reduction in the number of pixels, the downsampling correction coefficient is used to perform fairness correction on each downsampling process.
[0104] As an example, the calculation formula of the downsampling correction coefficient corresponding to the grayscale image of the material after the s-th downsampling process can be:
[0105] In the formula, β s is the downsampling correction coefficient corresponding to the grayscale image after the sth downsampling process, e is a natural constant, X is the number of pixels in the original grayscale image, X s is the number of pixels of the grayscale image after the s-th downsampling process.
[0106] In the calculation formula of the downsampling correction coefficient, It indicates the proportion of the number of pixels of the grayscale image after the sth downsampling process in the original grayscale image. The larger it is, the larger the downsampling correction coefficient is. For two downsampling processes with large differences in the number of pixels but similar initial selection necessary factors, the necessity of selecting the image after the downsampling process with the smaller number of pixels should be appropriately reduced, and the necessity of selecting the image after the downsampling process with the larger number of pixels should be appropriately increased.
[0107] The third step is to determine the sampling layer number increase coefficient corresponding to the loading grayscale image after the downsampling process according to the sequence number of the downsampling process.
[0108] As the number of downsampling increases, compared with the original grayscale image, the amount of data processing for building the grayscale co-occurrence matrix or calculating the flatness of the grayscale co-occurrence matrix of the downsampled grayscale image becomes smaller and smaller. Therefore, it is necessary to use the sampling layer increase coefficient to increase the number of layers.
[0109] As an example, the calculation formula for the sampling layer number increase coefficient corresponding to the grayscale image of the material after the s-th downsampling process can be:
[0110] In the formula, α s is the sampling layer increase coefficient corresponding to the grayscale image of the feed after the s-th downsampling process, s is the sequence number of the s-th downsampling process, and e is a natural constant.
[0111] In the calculation formula of the sampling layer increase coefficient, the larger the downsampling process number, the more pixel loss of the original grayscale image after downsampling, the less the amount of calculation of the smoothness of the grayscale co-occurrence matrix obtained from the image, the greater the degree of evaluation compensation required, and the larger the sampling layer increase coefficient; adding 1 to the denominator of the fraction satisfies the function to ensure that e -s There is an upper limit, which conforms to the usual calculation logic.
[0112] In the fourth step, the product of the necessary correction selection factor corresponding to the feeding grayscale image after the downsampling processing and the sampling layer number increase coefficient is used as the second evaluation factor corresponding to the feeding grayscale image after the downsampling processing.
[0113] In this embodiment, the larger the second evaluation factor is, the better the overall information retention and the lower the degree of loss of the feeding grayscale image after the downsampling process compared with the original feeding grayscale image. The overall calculation amount is less when using the feeding grayscale image after the downsampling process to calculate the flatness of the feeding material. Compared with the images obtained by other downsampling processes, the flatness calculation corresponding to the downsampling process is more accurate.
[0114] S5, determining an evaluation index for each downsampling process by combining the first evaluation factor and the second evaluation factor, and then determining a grayscale image of the feed after the downsampling process corresponding to the maximum evaluation index.
[0115] In this embodiment, the larger the first evaluation factor is, the greater the degree of information loss is, so the first evaluation factor and the evaluation index are negatively correlated; and the larger the second evaluation factor is, the less the degree of information loss is, so the second evaluation factor and the evaluation index are positively correlated. Therefore, for each downsampling process, the ratio of the second evaluation factor to the first evaluation factor is calculated, and the ratio of the two evaluation factors is used as the evaluation index, so that the evaluation index of each downsampling process can be obtained.
[0116] The larger the evaluation index is, the more suitable the corresponding downsampling grayscale image of the unloaded material is for calculating the flatness of the current material. Therefore, the maximum evaluation index is selected from the evaluation indexes of multiple downsampling processes, and the downsampling grayscale image of the unloaded material corresponding to the maximum evaluation index is used as the final image for obtaining the grayscale co-occurrence matrix.
[0117] S6, detecting the feeding flatness of the three-in-one automatic feeder according to the feeding grayscale image after downsampling corresponding to the maximum evaluation index, and performing machine control based on the feeding flatness.
[0118] In this embodiment, a grayscale co-occurrence matrix is obtained according to the grayscale image of the material after downsampling corresponding to the maximum evaluation index; the eigenvalue of the grayscale co-occurrence matrix is determined by a feature extraction method; and the eigenvalue of the grayscale co-occurrence matrix is used as the flatness of the material. Among them, the implementation process of the grayscale co-occurrence matrix and the feature extraction method is a prior art, which is not within the protection scope of the present invention and will not be elaborated in detail here; the eigenvalue can be the contrast of the grayscale co-occurrence matrix, and the contrast is used to characterize the flatness of the material during the feeding process of the three-in-one automatic feeder.
[0119] Then, based on the material feeding flatness, the threshold analysis method is used to determine whether the material meets the flatness requirements during the current feeding process. If not, the feeding flatness is adjusted to achieve machine control.
[0120] The specific adjustment and control method can be: input the feeding flatness into the pre-built and trained classification model of the feeding flatness of the three-in-one automatic feeder to obtain the output result of the classification model; according to the output result, combined with the control system of the three-in-one automatic feeder, the three-in-one automatic feeder is controlled. Among them, the output result is the control instruction of the feeding flatness.
[0121] The training process of the classification model for the flatness of the three-in-one automatic feeder includes:
[0122] A classification model for the flatness of material feeding of a three-in-one automatic feeder is constructed; wherein the structure of the classification model can be a decision tree model.
[0123] Multiple material loading flatnesses corresponding to different control instructions are obtained as training data, and different control instructions are used as label data.
[0124] The classification model is trained using the training data and the label data to obtain a classification model for the flatness of the three-in-one automatic feeder. The implementation process of the classification model training is prior art and is not within the scope of protection of the present invention, and will not be elaborated on in detail here.
[0125] An embodiment of the present invention provides a three-in-one automatic feeder control system, comprising a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a three-in-one automatic feeder control method.
[0126] The present invention determines the information carrying amount corresponding to each grayscale value in the image by analyzing the uneven image features of the feeding, and then calculates the evaluation index for each downsampling process of the original feeding grayscale image according to the information carrying amount corresponding to each grayscale value in the original feeding grayscale image, and uses the evaluation index to adapt the number of downsampling times; the adaptively determined number of downsampling times can ensure that the information loss degree of the original feeding grayscale image is within an acceptable range while ensuring the loss of a part of the pixel points, and then the feeding flatness of the current material can be efficiently calculated with less calculation amount, so as to realize high-efficiency feeding in the feeding process, that is, to improve the production efficiency in the feeding process.
[0127] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A three-in-one automatic feeder control method, characterized in that: The following steps are involved: Obtain the original grayscale image of the material during the feeding process of the three-in-one automatic feeder, and then obtain the grayscale image of the material after several downsampling processes; According to each gray value in the original gray image of the material, the uneven image characteristics of the material are analyzed to determine the information carrying amount corresponding to each gray value in the original gray image of the material; Determine a first evaluation factor corresponding to the feeding grayscale image after each downsampling process according to each grayscale value in the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the information carrying amount corresponding to each grayscale value; Determine the second evaluation factor corresponding to the feeding grayscale image after each downsampling process according to the similarity between the feeding grayscale images after two adjacent downsampling processes, the number of pixels of the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the sequence number of each downsampling process; Determine the evaluation index of each downsampling process by combining the first evaluation factor and the second evaluation factor, and then determine the downsampling grayscale image of the feeding material corresponding to the maximum evaluation index; According to the down-sampled grayscale image of the feeding material corresponding to the maximum evaluation index, the feeding flatness of the three-in-one automatic feeder is detected, and the machine is controlled based on the feeding flatness; The method of analyzing the uneven image features of the feed material according to each grayscale value in the original feed material grayscale image and determining the information carrying amount corresponding to each grayscale value in the original feed material grayscale image includes: Taking any gray value as the target gray value, determining each pixel point in the eight neighborhoods of each pixel point corresponding to the target gray value in the original feeding gray image, and recording each pixel point in the eight neighborhoods as a neighborhood pixel point; According to the grayscale values of each pixel point corresponding to the target grayscale value in the original feeding grayscale image and its corresponding neighboring pixel points, the material texture of the original feeding grayscale image is analyzed to determine the texture obviousness corresponding to the target grayscale value; According to the grayscale values of each pixel point corresponding to the target grayscale value in the original grayscale image and its corresponding neighboring pixel points, the distribution of the target grayscale value in the original grayscale image is analyzed to determine the degree of global distribution difference corresponding to the target grayscale value; The ratio of the global distribution difference corresponding to the target gray value to the texture prominence is taken as the information carrying amount corresponding to the target gray value.
2. A three-in-one automatic feeder control method according to claim 1, characterized in that: The method of analyzing the material texture of the original feeding grayscale image according to the grayscale values of each pixel point corresponding to the target grayscale value in the original feeding grayscale image and its corresponding neighboring pixel points, and determining the texture obviousness corresponding to the target grayscale value includes: For any pixel corresponding to the target grayscale value, calculate the grayscale average value of all the neighboring pixels corresponding to the pixel, and use the grayscale average value as the representative value of the region; Determine the difference in regional representative values between any two pixels corresponding to the target grayscale value, then calculate the average of all regional representative value differences, and perform an inverse operation on the average of all regional representative value differences to obtain the texture prominence corresponding to the target grayscale value.
3. A three-in-one automatic feeder control method according to claim 1, characterized in that: The method of analyzing the distribution of the target grayscale value in the original grayscale image according to the grayscale values of each pixel point corresponding to the target grayscale value in the original grayscale image and its corresponding neighboring pixel points, and determining the degree of global distribution difference corresponding to the target grayscale value, includes: The calculation formula for the global distribution difference degree corresponding to the nth gray value is: In the formula, is the global distribution difference degree corresponding to the nth grayscale value in the original feeding grayscale image, g n is the nth grayscale value in the original grayscale image, M is the number of pixels corresponding to the nth grayscale value in the original grayscale image, m is the pixel sequence number corresponding to the nth grayscale value in the original grayscale image, b is the neighborhood pixel sequence number corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image, and B is the number of neighborhood pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original grayscale image. is the gray value of the bth neighboring pixel corresponding to the mth pixel corresponding to the nth gray value in the original gray image, || is the absolute value function, It is the grayscale variance of all neighboring pixels corresponding to the mth pixel corresponding to the nth grayscale value in the original feeding grayscale image.
4. A three-in-one automatic feeder control method according to claim 1, characterized in that: The method of determining the first evaluation factor corresponding to the feeding grayscale image after each downsampling process according to each grayscale value in the original feeding grayscale image and the feeding grayscale image after each downsampling process and the information carrying amount corresponding to each grayscale value comprises: For any downsampling process, the number of occurrences of each grayscale value in the original grayscale image in the original feeding grayscale image and the number of occurrences in the feeding grayscale image after the downsampling process are counted, the difference in the number of occurrences of the same grayscale value in different images is calculated, and then the product of the difference in the number of occurrences of the same grayscale value in different images and the corresponding information carrying amount of the corresponding grayscale value is calculated, and the average value of the products corresponding to all grayscale values is used as the first evaluation factor corresponding to the feeding grayscale image after the downsampling process.
5. A three-in-one automatic feeder control method according to claim 1, characterized in that: The method of determining the second evaluation factor corresponding to the feeding grayscale image after each downsampling process according to the similarity between the feeding grayscale images after two adjacent downsampling processes, the number of pixels of the original feeding grayscale image and the feeding grayscale image after each downsampling process, and the sequence number of each downsampling process comprises: For any downsampling process, determine the similarity between the grayscale image of the material after the downsampling process and the grayscale image of the material after the downsampling process before the downsampling process, and use the inverse proportional value of the similarity as the initial selection necessary factor corresponding to the grayscale image of the material after the downsampling process; Determine a downsampling correction coefficient corresponding to the downsampling grayscale image of the material according to the number of pixels of the original material grayscale image and the material grayscale image after the downsampling processing; The product of the downsampling correction coefficient and the initially selected necessary factor is used as the correction selected necessary factor corresponding to the feeding grayscale image after the downsampling process; According to the sequence number of the downsampling process, determine the sampling layer number increase coefficient corresponding to the grayscale image of the material after the downsampling process; The product of the necessary correction selection factor corresponding to the feeding grayscale image after the downsampling processing and the sampling layer number increase coefficient is used as the second evaluation factor corresponding to the feeding grayscale image after the downsampling processing.
6. A three-in-one automatic feeder control method according to claim 5, characterized in that: The step of determining the sampling layer number increase coefficient corresponding to the grayscale image of the material after the downsampling process according to the sequence number of the downsampling process comprises: The calculation formula of the sampling layer increase coefficient corresponding to the grayscale image of the feed after the sth downsampling process is: In the formula, α s is the sampling layer increase coefficient corresponding to the grayscale image of the feed after the s-th downsampling process, s is the sequence number of the s-th downsampling process, and e is a natural constant.
7. A three-in-one automatic feeder control method according to claim 5, characterized in that: The method of determining the downsampling correction coefficient corresponding to the downsampling grayscale image according to the number of pixels of the original feeding grayscale image and the feeding grayscale image after the downsampling processing comprises: The calculation formula of the downsampling correction coefficient corresponding to the grayscale image of the material after the sth downsampling process is: In the formula, β s is the downsampling correction coefficient corresponding to the grayscale image after the sth downsampling process, e is a natural constant, X is the number of pixels in the original grayscale image, X s is the number of pixels of the grayscale image after the s-th downsampling process.
8. A three-in-one automatic feeder control method according to claim 1, characterized in that: The method of detecting the feeding flatness of the three-in-one automatic feeder according to the feeding grayscale image after downsampling corresponding to the maximum evaluation index includes: A grayscale co-occurrence matrix is obtained according to the down-sampled grayscale image of the material being fed corresponding to the maximum evaluation index; the eigenvalue of the grayscale co-occurrence matrix is determined by a feature extraction method; and the eigenvalue of the grayscale co-occurrence matrix is used as the flatness of the material being fed.
9. A three-in-one automatic feeder control system, characterized in that: It comprises a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement a three-in-one automatic feeder control method as described in any one of claims 1-8.
Citation Information
Patent Citations
Concrete crack quick recognition method
CN108805855A
Rubber sealing ring surface defect detection method based on machine vision
CN111145165A