A straw defect detection method and system based on visual recognition

Through visual recognition-based methods, the infrared detection images of straws are analyzed, and foreign object areas are identified and positioned, which solves the problems of low manual detection efficiency and poor accuracy, and the automation and efficiency of straw defect detection are achieved.

CN119269580BActive Publication Date: 2025-04-08NINGBO HOMELINK ECO ITECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411828712.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-08
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

In the existing straw production technology, manual detection of foreign matter inside the straw is low efficiency and easy to miss, resulting in poor defect detection effect.

Method used

Using a method based on visual recognition, by acquiring the infrared detection image of the straw, analyzing the chromaticity of the pixel points, identifying abnormal pixel points, forming a set of foreign object features, and determining the foreign object area.

Benefits of technology

The automation of straw defect detection is achieved, the detection efficiency and accuracy are improved, and the error rate of manual detection is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119269580B_ABST
    Figure CN119269580B_ABST
Patent Text Reader

Abstract

The present application relates to a straw defect detection method and system based on visual recognition, and relates to the field of straw production technology. The method includes obtaining an infrared detection image of the straw at a preset shooting point; obtaining the detection pixel chromaticity of each pixel in the infrared detection image, and defining the pixel whose detection pixel chromaticity is within the preset required chromaticity range as a normal pixel, and defining the pixel other than the normal pixel as an abnormal pixel; summarizing adjacent abnormal pixel points into the same preset initially empty pixel set; counting the abnormal pixel points in each pixel set to determine the number of set pixels; defining a pixel set whose number of set pixels is greater than a preset reference pixel number as a foreign body feature set, and determining the area constituted by the abnormal pixel points contained in the foreign body feature set as a foreign body area. The present application has the effect of improving the detection effect of straw defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of straw production technology, and in particular to a straw defect detection method and system based on visual recognition. Background Art

[0002] As people's environmental awareness increases, degradable materials are gradually becoming popular. Among them, degradable straws for milk tea and coffee are more representative products.

[0003] In the related technology, during the production process of degradable straws, the straws are output in continuous and uninterrupted long strips, and are cut into products of fixed length by a cutting device at the rear end of the output. The staff then conducts internal contamination inspection on the products to reduce the situation where straws with foreign objects inside are not inspected and packaged and shipped out of the factory.

[0004] In the above-mentioned related technologies, manual inspection of straws by staff is not only inefficient, but also may result in the human eye missing the presence of foreign matter, resulting in poor detection of straw defects. There is still room for improvement. Summary of the invention

[0005] In order to improve the detection effect of straw defect detection, the present application provides a straw defect detection method and system based on visual recognition.

[0006] In a first aspect, the present application provides a straw defect detection method based on visual recognition, which adopts the following technical solution:

[0007] A straw defect detection method based on visual recognition, comprising:

[0008] Acquire an infrared detection image of the straw at a preset shooting point, wherein the shooting point is located between the output rear end and the cutting device and is arranged at a plurality of intervals;

[0009] The detection pixel chromaticity of each pixel point is obtained in the infrared detection image, and the pixel points whose detection pixel chromaticity is within the preset required chromaticity range are defined as normal pixel points, and the pixel points other than the normal pixel points are defined as abnormal pixel points;

[0010] The adjacent abnormal pixels are grouped into the same preset initially empty pixel set;

[0011] Counting abnormal pixel points in each pixel set to determine the number of pixels in the set;

[0012] A pixel set whose pixel number is greater than a preset reference pixel number is defined as a foreign body feature set, and an area formed by abnormal pixel points included in the foreign body feature set is determined as a foreign body area.

[0013] Optionally, before the infrared detection image is acquired, the straw defect detection method based on visual recognition further includes:

[0014] Get the external environment brightness value of the shooting point;

[0015] When the external environment brightness value is not within the preset shooting requirement brightness range, determining whether the external environment brightness value is greater than an upper limit value of the shooting requirement brightness range;

[0016] If the external environment brightness value is greater than the upper limit of the required brightness range for shooting, the output backend is controlled to stop the output of the pipette;

[0017] If the external environment brightness value is not greater than the upper limit of the shooting required brightness range, then the required compensation brightness range is determined based on the shooting required brightness range and the external environment brightness value;

[0018] A unique compensation selection brightness is determined within the required compensation brightness range, and a fill light device preset at a shooting point is controlled to operate according to the compensation selection brightness.

[0019] Optionally, the step of determining a unique compensation selected brightness within the required compensation brightness range includes:

[0020] A detection interval with the current time point as the end point and a width of the preset detection duration is established on the preset time axis, and the external environment brightness value is extracted according to the preset unit duration in the detection interval, and the extracted external environment brightness value is defined as the detection brightness value;

[0021] Performing a difference calculation based on the detected brightness value at the current time point and the detected brightness value determined at a time point adjacent to the current time point to determine a changed brightness value;

[0022] Determine whether the changed brightness value is greater than the preset sudden change brightness value;

[0023] If the change brightness value is greater than the sudden change brightness value, the center value in the required compensation brightness range is used as the compensation selection brightness;

[0024] If the change brightness value is not greater than the sudden change brightness value, a brightness is randomly selected in the required compensation brightness range as the compensation selected brightness.

[0025] Optionally, if the change brightness value is not greater than the sudden change brightness value, the straw defect detection method based on visual recognition further includes:

[0026] Combining the detected brightness values ​​in the current detection interval to determine a first brightness combination;

[0027] Establishing a historical interval with the current time point as the rear end point and a width of a preset historical duration on the time axis, defining a comparison interval with a width equal to the detection duration in the historical interval, and determining a second brightness combination according to the comparison interval;

[0028] Determine the combination similarity according to the first brightness combination and the second brightness combination, define the comparison interval corresponding to the combination similarity with the largest value as the similar interval, and construct a detection interval with a width of the preset detection time length with the rear end point of the similar interval as the front end point;

[0029] The difference calculation is performed based on the detected brightness value of the rear end point in the similar interval and the detected brightness value with the smallest value in the detection interval to determine the subsequent change brightness;

[0030] A subsequent compensation brightness range is determined based on the subsequent change brightness and the required compensation brightness range, and an intersection calculation is performed based on the subsequent compensation brightness range and the required compensation brightness range to determine a feasible compensation brightness range, and a brightness value is randomly selected in the feasible compensation brightness range as the compensation selected brightness.

[0031] Optionally, after the similar interval is determined, the straw defect detection method based on visual recognition further includes:

[0032] Determine whether there are at least two similar intervals;

[0033] If there are not at least two similar intervals, then determining a feasible compensation brightness range according to a subsequent compensation brightness range of the only similar interval;

[0034] If there are at least two similar intervals, randomly select any number of subsequent compensation brightness ranges and the required compensation brightness range from all subsequent compensation brightness ranges to form a brightness range set;

[0035] A brightness range set when each range in the brightness range set has an intersection that is not an empty set is defined as a valid range set, and the number of subsequent ranges is determined by counting the selected subsequent compensation brightness ranges in the valid range set;

[0036] The number of subsequent ranges with the largest values ​​is determined according to a preset sorting rule, and a feasible compensation brightness range is determined according to a brightness range set corresponding to the number of subsequent ranges.

[0037] Optionally, after the number of subsequent ranges is determined, the straw defect detection method based on visual recognition further includes:

[0038] Determine whether there are at least two subsequent range sets with the same number of maximum brightness ranges;

[0039] If there are not at least two largest brightness range sets with the same number of subsequent ranges, determining a feasible compensation brightness range according to the brightness range set corresponding to the largest number of subsequent ranges;

[0040] If there are at least two brightness range sets with the same number of subsequent ranges and the largest number, the brightness range set corresponding to the largest number of subsequent ranges is defined as the candidate range set, and the candidate compensation brightness range is determined according to the ranges in each candidate range set, and the simulation brightness value is randomly determined in the candidate compensation brightness range;

[0041] defining a subsequent compensation brightness range that is not within a single candidate range set as an outer brightness range of the candidate range set;

[0042] Determine a suitable value according to the simulated brightness value and each external brightness range, and perform mean calculation according to each suitable value determined under the same candidate range set to determine a mean suitable value;

[0043] The appropriate mean value with the largest value is determined according to the sorting rule, and the feasible compensation brightness range is determined according to the candidate range set corresponding to the appropriate mean value.

[0044] Optionally, after the foreign matter area is determined, the straw defect detection method based on visual recognition further includes:

[0045] Mark the foreign body location point on the preset straw length axis according to the foreign body area;

[0046] After the location of the foreign body is determined, a simulated cutting interval is constructed on the straw length axis according to a preset fixed length;

[0047] Determine whether a new foreign body position point appears in the simulated cutting interval;

[0048] If no new foreign object position point appears in the simulated cutting interval, the cutting position point is marked according to the foreign object position point and the preset avoidance distance;

[0049] If a new foreign body position point appears in the simulated cutting interval, the cutting interval is further constructed according to the new foreign body position point.

[0050] In the second aspect, the present application provides a straw defect detection system based on visual recognition, which adopts the following technical solution:

[0051] A straw defect detection system based on visual recognition, comprising:

[0052] An acquisition module, used to acquire infrared detection images of the straw at a preset shooting point, wherein the shooting point is located between the output rear end and the cutting device and is arranged at multiple intervals;

[0053] A processing module, connected to the acquisition module, for storing and processing information;

[0054] The processing module obtains the detection pixel chromaticity of each pixel in the infrared detection image, and defines the pixel whose detection pixel chromaticity is within the preset required chromaticity range as a normal pixel, and defines the pixel other than the normal pixel as an abnormal pixel;

[0055] The processing module summarizes the adjacent abnormal pixel points into the same preset initially empty pixel set;

[0056] The processing module counts abnormal pixel points in each pixel set to determine the number of pixels in the set;

[0057] The processing module defines a pixel set whose pixel number is greater than a preset reference pixel number as a foreign body feature set, and determines an area formed by abnormal pixel points included in the foreign body feature set as a foreign body area.

[0058] In summary, the present application includes at least one of the following beneficial technical effects:

[0059] In the production process of degradable straws, foreign matter defects inside the straws can be automatically detected by visual recognition, thereby improving the detection effect of straw defect detection;

[0060] During the image acquisition process, the brightness of the external environment can be analyzed to compensate for the brightness, so that the acquired image is convenient for defect detection;

[0061] The positions of the foreign objects on the straw are analyzed to mark the positions that can be cut, thereby reducing the occurrence of subsequent invalid cutting. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 It is a flow chart of the straw defect detection method based on visual recognition.

[0063] Figure 2 It is a module flow chart of the straw defect detection method based on visual recognition. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-Figure 2 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0065] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

[0066] The present application embodiment discloses a straw defect detection method based on visual recognition, referring to Figure 1 ,The method flow of the straw defect detection method based on visual recognition includes the following steps:

[0067] Step S100: acquiring infrared detection images of the straw at preset shooting points, wherein the shooting points are located between the output rear end and the cutting device and are arranged at a plurality of intervals.

[0068] The shooting point is a position point between the output rear end and the cutting device. An infrared shooting device is installed on the shooting point, and the shooting device is facing the straw, so that the long straw output from the output rear end can be imaged in the process of moving to the cutting device. At the same time, in order to detect the straw 360°, at least three shooting points are generally set, and the three shooting points are spaced in the length direction of the straw, and the shooting devices on the shooting points are distributed in different directions of the straw, so that the shooting points can completely detect the entire straw; the infrared detection image is a straw tile image obtained by point cloud fusion of the images obtained by the devices at multiple shooting points.

[0069] Step S101: acquiring the detection pixel chromaticity of each pixel in the infrared detection image, defining the pixels whose detection pixel chromaticity is within a preset required chromaticity range as normal pixels, and defining the pixels other than the normal pixels as abnormal pixels.

[0070] The detected pixel chromaticity is the chromaticity value of the pixel. The required chromaticity range is the chromaticity value range of the pixel points that are determined by the staff to belong to the straw itself. Normal pixels and abnormal pixels are defined to distinguish different pixels for subsequent analysis.

[0071] Step S102: grouping adjacent abnormal pixel points into the same preset initially empty pixel set.

[0072] The pixel set is an empty set for collecting abnormal pixel points, where the method of summarizing abnormal pixel points is as follows: for example, there are three abnormal pixel points A, B, and C, where A is adjacent to B, B is adjacent to C, but A is not adjacent to C. Since B can be summarized into a pixel set with A and C at the same time, A, B, and C can be summarized into the same pixel set.

[0073] Step S103: Counting abnormal pixel points in each pixel set to determine the number of pixels in the set.

[0074] The number of pixels in a set is the total number of abnormal pixels in a pixel set.

[0075] Step S104: a pixel set whose pixel number is greater than a preset reference pixel number is defined as a foreign body feature set, and an area formed by abnormal pixel points included in the foreign body feature set is determined as a foreign body area.

[0076] The number of reference pixels is the minimum number of collective pixels set by the staff to determine the presence of foreign matter in the straw. When the number of collective pixels is greater than the number of reference pixels, it means that the currently detected abnormal pixel is caused by external foreign matter. At this time, it is defined as a clothing feature set to distinguish different pixel sets, so that the foreign matter area can be determined according to the foreign matter feature set, so as to effectively determine the foreign matter situation in the straw and realize intelligent detection of straw defects.

[0077] Before the infrared detection image is acquired, the straw defect detection method based on visual recognition also includes:

[0078] Step S200: Acquire the external environment brightness value of the shooting point.

[0079] The external environment brightness value is the brightness value of the external environment at the shooting point, and data can be acquired by installing a brightness sensor at the shooting point.

[0080] Step S201: When the external environment brightness value is not within the preset shooting requirement brightness range, determining whether the external environment brightness value is greater than an upper limit value of the shooting requirement brightness range.

[0081] The required shooting brightness range is the brightness range required when the external brightness does not affect the color difference of the image and affect the foreign body analysis. When the external environment brightness value is not within the required shooting brightness range, it means that there is an abnormal brightness outside and further analysis is required. The purpose of the judgment at this time is to know whether the outside is too bright, such as when there is a strong external light source directly irradiating the shooting point.

[0082] Step S2011: If the external environment brightness value is greater than the upper limit of the required shooting brightness range, the output back end is controlled to stop the pipette output.

[0083] When the external environment brightness value is greater than the upper limit of the required shooting brightness range, it means that the external environment is too bright. At this time, the image cannot be effectively analyzed, and the output of the back end for the long straw is stopped to reduce the occurrence of false straw detection.

[0084] Step S2012: If the external environment brightness value is not greater than the upper limit of the required shooting brightness range, a calculation is performed according to the required shooting brightness range and the external environment brightness value to determine the required compensation brightness range.

[0085] When the external environment brightness value is not greater than the upper limit value of the shooting requirement brightness range, it means that the external brightness is too low. At this time, the ambient brightness can be supplemented by a fill light device to ensure that the detection operation can proceed normally; the required compensation brightness range is the range of brightness that needs to be compensated in order to make the ambient brightness meet the image requirements. The upper and lower endpoints of the required brightness range are calculated by shooting the upper and lower endpoints of the required brightness range and the external environment brightness value respectively to determine the upper and lower endpoints of the required compensation brightness range.

[0086] Step S202: determining a unique compensation selection brightness in the required compensation brightness range, and controlling a fill light device preset at the shooting point to operate according to the compensation selection brightness.

[0087] By determining a unique compensation selection brightness from the required compensation brightness range and controlling the fill light device to operate, the external environment can meet the image shooting requirements. At this time, the foreign body defect of the straw can be effectively determined. The method for determining the compensation selection brightness can be randomly determined from the required compensation brightness range, and can also be determined by the method of steps S300-S404.

[0088] The steps of determining a unique compensation selected brightness within the required compensation brightness range include:

[0089] Step S300: establishing a detection interval with the current time point as the end point and a width of a preset detection duration on a preset time axis, extracting the external environment brightness value according to the preset unit duration in the detection interval, and defining the extracted external environment brightness value as the detection brightness value.

[0090] The time axis is a coordinate axis formed by the combination of various time points. The coordinate axis points from the time points that have passed to the time points that have not yet arrived, and the time points that have passed in the coordinate axis are defined as the left side, where the left side is the front end; the detection duration is a recent short duration set by the staff, such as 1 hour. By constructing a detection interval, it is convenient to obtain and analyze the data within the detection duration; the unit duration is a fixed duration set by the staff that is less than the detection duration and is an integer multiple of the detection duration. Generally, the detection duration is 15 to 20 times the unit duration. The way to extract the external environment brightness value is to pick up the corresponding external environment brightness value at the time point with an interval of unit duration from one end point of the detection interval to the other end point, and define it as the detection brightness value to achieve the distinction between different external environment brightness values, which is convenient for subsequent analysis.

[0091] Step S301: performing a difference calculation based on the detected brightness value at the current time point and the detected brightness value determined at a time point adjacent to the current time point to determine a changed brightness value.

[0092] The change brightness value is the brightness change value of the external environment in the most recent unit time, and is determined by performing a difference calculation between two detected brightness values.

[0093] Step S302: Determine whether the changed brightness value is greater than a preset sudden change brightness value.

[0094] The sudden change brightness value is the minimum change brightness value that needs to be reached when the brightness changes in a way that does not conform to natural laws, and the purpose of the judgment is to find out whether there are external objects blocking the original light source in the external environment.

[0095] Step S3021: If the changed brightness value is greater than the sudden change brightness value, the center value in the required compensation brightness range is used as the compensation selected brightness.

[0096] When the changing brightness value is greater than the sudden change brightness value, it indicates that an external object blocks the light source. At this time, the center value of the required compensation brightness range is used as the compensation selection brightness to facilitate subsequent brightness adjustment.

[0097] Step S3022: If the changed brightness value is not greater than the sudden change brightness value, randomly select a brightness in the required compensation brightness range as the compensation selected brightness.

[0098] When the changing brightness value is not greater than the sudden change brightness value, it means that it complies with the natural change law of the external brightness. At this time, a brightness that meets the requirements is randomly selected as the compensation selected brightness.

[0099] If the change brightness value is not greater than the sudden change brightness value, the straw defect detection method based on visual recognition also includes:

[0100] Step S400: Determine a first brightness combination by combining the detected brightness values ​​in the current detection interval.

[0101] The first brightness combination is a combination obtained by combining the detected brightness values ​​determined in the detection interval according to the order of acquisition time.

[0102] Step S401: establishing a history interval with the current time point as the end point and a width of a preset history duration on the time axis, defining a comparison interval with a width equal to the detection duration in the history interval, and determining a second brightness combination according to the comparison interval.

[0103] The historical duration is the duration set by the staff for acquiring data on changes in external environment brightness under historical circumstances. A historical interval is established to facilitate the acquisition and analysis of data within the historical duration; a comparison interval is defined to facilitate the acquisition of brightness changes at each time point in the historical interval, so as to facilitate the determination of the second brightness combination. The method for determining the second brightness combination is the same as that for the first brightness combination, and will not be repeated here.

[0104] Step S402: Determine the combination similarity according to the first brightness combination and the second brightness combination, define the comparison interval corresponding to the combination similarity with the largest value as the similar interval, and construct a detection interval with a width of a preset detection time length with the rear end point of the similar interval as the front end point.

[0105] The combination similarity is a numerical value that reflects the similarity between two combinations. The larger the value, the more similar the two combinations are, that is, the more similar the brightness and changes of the external environment are. It can be obtained by calculating the difference between the data of the same position in the two combinations and then adding them all up to find the reciprocal; by defining a similar interval, the situation in which the brightness changes in the historical time period are closest can be determined. At this time, the subsequent brightness changes in the similar interval can be used to predict the subsequent brightness changes at the current time point; the detection duration is a fixed duration set by the staff. The detection interval is constructed to facilitate the acquisition and analysis of data within the detection duration.

[0106] Step S403: performing a difference calculation based on the detected brightness value of the rear end point in the similar interval and the detected brightness value with the minimum value in the detection interval to determine the subsequent change brightness.

[0107] The subsequent change brightness is the maximum brightness change value that will occur in the detection interval.

[0108] Step S404: performing calculation according to the subsequent change brightness and the required compensation brightness range to determine the subsequent compensation brightness range, performing intersection calculation according to the subsequent compensation brightness range and the required compensation brightness range to determine the feasible compensation brightness range, and randomly selecting a brightness value in the feasible compensation brightness range as the compensation selected brightness.

[0109] The subsequent compensation brightness range is the range obtained by calculating the upper and lower endpoints of the required compensation brightness range and the subsequent change brightness, that is, the brightness range of the external fill light device required when the subsequent minimum detection brightness value is met. The range can be narrowed by determining the feasible compensation brightness range through the intersection calculation of the subsequent compensation brightness range and the required compensation brightness range. At this time, the feasible compensation brightness range obtained can simultaneously meet the subsequent brightness changes. At this time, the compensation brightness is selected from the feasible compensation brightness range to determine that there is no need to adjust the brightness of the fill light device again in a short period of time.

[0110] After the approximate interval is determined, the straw defect detection method based on visual recognition also includes:

[0111] Step S500: Determine whether there are at least two similar intervals.

[0112] The purpose of the judgment is to find out whether there are multiple similar intervals that meet the requirements, so as to facilitate the analysis of subsequent intersection situations.

[0113] Step S5001: If there are not at least two similar intervals, a feasible compensation brightness range is determined according to a subsequent compensation brightness range of the only similar interval.

[0114] When there are not at least two similar intervals, it means that there is only one subsequent compensation brightness range and the required compensation brightness range for intersection calculation. At this time, normal analysis can be performed to determine the feasible compensation brightness range.

[0115] Step S5002: If there are at least two similar intervals, randomly select any number of subsequent compensation brightness ranges and required compensation brightness ranges from all subsequent compensation brightness ranges to form a brightness range set.

[0116] When there are at least two similar intervals, it means that there are multiple subsequent compensation brightness ranges that can be intersected, and further analysis is needed; the brightness range set is a set that includes subsequent compensation brightness ranges and required compensation brightness ranges. For example, there are three subsequent compensation brightness ranges XYZ, and the required compensation brightness range is defined as W, then the total brightness range set is XW, YW, ZW, XYW, XZW, YZW, and XYZW.

[0117] Step S501: defining a brightness range set in which each range in the brightness range set has an intersection that is not an empty set as a valid range set, and counting the selected subsequent compensation brightness ranges in the valid range set to determine the number of subsequent ranges.

[0118] When there is an intersection of the ranges in the brightness range set that is not an empty set, it means that a range that can select the compensation selection brightness can be generated. At this time, it is defined as a valid range set to distinguish different brightness range sets, which is convenient for subsequent analysis; the number of subsequent ranges is the number of subsequent compensation brightness ranges in the valid range set.

[0119] Step S502: determining the number of subsequent ranges with the largest values ​​according to a preset sorting rule, and determining a feasible compensation brightness range according to a brightness range set corresponding to the number of subsequent ranges.

[0120] The sorting rule is a method set by the staff to sort the size of values, such as the bubble method. The sorting rule can be used to determine the number of subsequent ranges with the largest value, that is, the intersection determined at this time can meet the range requirements in most cases. At this time, the brightness range set can be used to determine the feasible compensation brightness range.

[0121] After the number of subsequent ranges is determined, the straw defect detection method based on visual recognition also includes:

[0122] Step S600: Determine whether there are at least two maximum brightness range sets with the same number of subsequent ranges.

[0123] The purpose of the judgment is to find out whether there are multiple brightness range sets that meet the requirements, so as to determine the feasible compensation brightness range.

[0124] Step S6001: If there are not at least two largest brightness range sets with the same number of subsequent ranges, then determine a feasible compensation brightness range according to the brightness range set corresponding to the largest number of subsequent ranges.

[0125] When there are not at least two largest brightness range sets with the same number of subsequent ranges, it means that there is only one brightness range set that meets the requirements. In this case, the feasible compensation brightness range can be determined according to the brightness range set.

[0126] Step S6002: If there are at least two brightness range sets with the same number of subsequent ranges and the largest number, the brightness range set corresponding to the largest number of subsequent ranges is defined as an alternative range set, and alternative compensation brightness ranges are determined according to the ranges in each alternative range set, and the simulated brightness value is randomly determined in the alternative compensation brightness range.

[0127] When there are at least two brightness range sets with the same number of subsequent ranges and the largest number, it means that there are multiple brightness range sets that meet the requirements. At this time, they are defined as alternative range sets to distinguish different brightness range sets, which is convenient for subsequent analysis; the alternative compensation brightness range is the range obtained after intersection processing based on the ranges in the alternative range set, and the simulated brightness value is a random value in the alternative compensation brightness range.

[0128] Step S601: defining a subsequent compensation brightness range that is not within a single candidate range set as an external brightness range of the candidate range set.

[0129] An external brightness range is defined to distinguish different subsequent compensation brightness ranges for the convenience of subsequent analysis.

[0130] Step S602: determining a fitness value according to the simulated brightness value and each external brightness range, and performing an average calculation on each fitness value determined under the same candidate range set to determine an average fitness value.

[0131] The suitability value is a numerical value that reflects the degree of closeness between the selected simulated brightness value and the external brightness range. The larger the value, the more the selected simulated brightness value conforms to the external brightness range. It is determined by the inverse of the distance value between the simulated brightness value and the external brightness range. The mean suitability value is the average of the suitability values ​​between the selected simulated brightness value and each external brightness range.

[0132] Step S603: determining the largest suitable mean value according to the sorting rule, and determining a feasible compensation brightness range according to the candidate range set corresponding to the suitable mean value.

[0133] The sorting rule can be used to determine the largest average suitable value, that is, the currently determined simulation brightness value is more consistent with the remaining external brightness ranges. At this time, the feasible compensation brightness range can be determined using the candidate range set corresponding to the average suitable value.

[0134] After the foreign body area is determined, the straw defect detection method based on visual recognition also includes:

[0135] Step S700: marking the foreign matter location point on the preset straw length axis according to the foreign matter area.

[0136] The straw length axis is the linear axis in the length direction of the straw, and the foreign body position point is the position point of the determined foreign body area on the straw length axis. The foreign body position point can be determined by the left and right end points of the foreign body area on the straw length axis.

[0137] Step S701: after the foreign body position point is determined, a simulated cutting interval is constructed on the straw length axis according to a preset fixed length.

[0138] The fixed length is the required length of a single straw to be produced, and the simulated cutting interval is an interval of fixed length extending from the foreign body position point to the direction of the output rear end.

[0139] Step S702: determining whether a new foreign object position point appears in the simulated cutting interval.

[0140] The purpose of the judgment is to know whether the subsequent straws can be cut into straws that meet the requirements after the foreign matter at the foreign matter position is cut.

[0141] Step S7021: If no new foreign object position point appears in the simulated cutting interval, the cutting position point is marked according to the foreign object position point and the preset avoidance distance.

[0142] When no new foreign body position point appears in the simulated cutting interval, it means that the subsequent cutting meets the requirements. At this time, the foreign body position point can be used to move the avoidance distance in the direction of the output rear end to determine the cutting position point. The subsequent cutting device can perform cutting operations when the straw at the cutting position point moves to the corresponding cutting area; the avoidance distance is the distance set by the staff to avoid being affected by foreign objects during the cutting process.

[0143] Step S7022: If a new foreign object position point appears in the simulated cutting interval, the cutting interval is continuously constructed according to the new foreign object position point.

[0144] When a new foreign object position point appears in the simulated cutting interval, it means that even if the current foreign object position point is cut, the subsequent straws still cannot meet the usage requirements. Therefore, there is no need to determine the cutting position point to reduce the occurrence of invalid cutting by the subsequent cutting device, reduce the number of times the cutting device is used, and increase its service life.

[0145] Reference Figure 2 Based on the same inventive concept, an embodiment of the present invention provides a straw defect detection system based on visual recognition, comprising:

[0146] An acquisition module, used to acquire infrared detection images of the straw at a preset shooting point, wherein the shooting point is located between the output rear end and the cutting device and is arranged at multiple intervals;

[0147] A processing module, connected to the acquisition module, for storing and processing information;

[0148] The processing module obtains the detection pixel chromaticity of each pixel in the infrared detection image, and defines the pixel whose detection pixel chromaticity is within the preset required chromaticity range as a normal pixel, and defines the pixel other than the normal pixel as an abnormal pixel;

[0149] The processing module summarizes the adjacent abnormal pixel points into the same preset initially empty pixel set;

[0150] The processing module counts abnormal pixel points in each pixel set to determine the number of pixels in the set;

[0151] The processing module defines a pixel set whose number of set pixels is greater than a preset reference pixel number as a foreign body feature set, and determines an area formed by abnormal pixel points included in the foreign body feature set as a foreign body area;

[0152] Brightness analysis module, used to analyze and process the brightness of the external environment;

[0153] A compensation selection brightness determination module, used to determine a unique compensation selection brightness within a required compensation brightness range;

[0154] A range reduction and precision module is used to reduce the range of determining the compensation selection brightness;

[0155] A similar interval analysis module is used to analyze and process the situation where there are multiple similar intervals;

[0156] A brightness range set screening module is used to perform unique value screening on multiple brightness range sets that meet the requirements;

[0157] The cutting situation marking module marks the cuttable positions on the straw according to the position of the foreign matter.

[0158] Those skilled in the art can clearly 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. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

Claims

1. A straw defect detection method based on visual recognition, characterized in that: include: Acquire an infrared detection image of the straw at a preset shooting point, wherein the shooting point is located between the output rear end and the cutting device and is arranged at a plurality of intervals; The detection pixel chromaticity of each pixel point is obtained in the infrared detection image, and the pixel points whose detection pixel chromaticity is within the preset required chromaticity range are defined as normal pixel points, and the pixel points other than the normal pixel points are defined as abnormal pixel points; The adjacent abnormal pixels are grouped into the same preset initially empty pixel set; Counting abnormal pixel points in each pixel set to determine the number of pixels in the set; A pixel set whose number of set pixels is greater than a preset reference number of pixels is defined as a foreign body feature set, and an area formed by abnormal pixel points included in the foreign body feature set is determined as a foreign body area; Before the infrared detection image is acquired, the straw defect detection method based on visual recognition also includes: Get the external environment brightness value of the shooting point; When the external environment brightness value is not within the preset shooting requirement brightness range, determining whether the external environment brightness value is greater than an upper limit value of the shooting requirement brightness range; If the external environment brightness value is greater than the upper limit of the required brightness range for shooting, the output backend is controlled to stop the output of the pipette; If the external environment brightness value is not greater than the upper limit of the shooting required brightness range, then the required compensation brightness range is determined based on the shooting required brightness range and the external environment brightness value; Determine a unique compensation selected brightness within the required compensation brightness range, and control a fill light device preset at a shooting point to operate according to the compensation selected brightness; The steps of determining a unique compensation selected brightness within the required compensation brightness range include: A detection interval with the current time point as the end point and a width of the preset detection duration is established on the preset time axis, and the external environment brightness value is extracted according to the preset unit duration in the detection interval, and the extracted external environment brightness value is defined as the detection brightness value; Performing a difference calculation based on the detected brightness value at the current time point and the detected brightness value determined at a time point adjacent to the current time point to determine a changed brightness value; Determine whether the changed brightness value is greater than the preset sudden change brightness value; If the change brightness value is greater than the sudden change brightness value, the center value in the required compensation brightness range is used as the compensation selection brightness; If the change brightness value is not greater than the sudden change brightness value, a brightness is randomly selected in the required compensation brightness range as the compensation selected brightness; If the change brightness value is not greater than the sudden change brightness value, the straw defect detection method based on visual recognition further includes: combining the detection brightness values ​​in the current detection interval to determine a first brightness combination; Establishing a historical interval with the current time point as the rear end point and a width of a preset historical duration on the time axis, defining a comparison interval with a width equal to the detection duration in the historical interval, and determining a second brightness combination according to the comparison interval; Determine the combination similarity according to the first brightness combination and the second brightness combination, define the comparison interval corresponding to the combination similarity with the largest value as the similar interval, and construct a detection interval with a width of the preset detection time length with the rear end point of the similar interval as the front end point; The difference calculation is performed based on the detected brightness value of the rear end point in the similar interval and the detected brightness value with the smallest value in the detection interval to determine the subsequent change brightness; Calculate the subsequent compensation brightness range according to the subsequent change brightness and the required compensation brightness range, and perform intersection calculation according to the subsequent compensation brightness range and the required compensation brightness range to determine the feasible compensation brightness range, and randomly select a brightness value in the feasible compensation brightness range as the compensation selected brightness; After the approximate interval is determined, the straw defect detection method based on visual recognition also includes: Determine whether there are at least two similar intervals; If there are not at least two similar intervals, then determining a feasible compensation brightness range according to a subsequent compensation brightness range of the only similar interval; If there are at least two similar intervals, randomly select any number of subsequent compensation brightness ranges and the required compensation brightness range from all subsequent compensation brightness ranges to form a brightness range set; A brightness range set when each range in the brightness range set has an intersection that is not an empty set is defined as a valid range set, and the number of subsequent ranges is determined by counting the selected subsequent compensation brightness ranges in the valid range set; Determine the number of subsequent ranges with the largest value according to a preset sorting rule, and determine a feasible compensation brightness range according to a brightness range set corresponding to the number of subsequent ranges with the largest value; After the foreign body area is determined, the straw defect detection method based on visual recognition also includes: Mark the foreign body location point on the preset straw length axis according to the foreign body area; After the location of the foreign body is determined, a simulated cutting interval is constructed on the straw length axis according to a preset fixed length; Determine whether a new foreign body position point appears in the simulated cutting interval; If no new foreign object position point appears in the simulated cutting interval, the cutting position point is marked according to the foreign object position point and the preset avoidance distance; If a new foreign body position point appears in the simulated cutting interval, the cutting interval is further constructed according to the new foreign body position point.

2. The straw defect detection method based on visual recognition according to claim 1 is characterized in that: After the number of subsequent ranges is determined, the straw defect detection method based on visual recognition also includes: Determine whether there are at least two subsequent range sets with the same number of maximum brightness ranges; If there are not at least two largest brightness range sets with the same number of subsequent ranges, determining a feasible compensation brightness range according to the brightness range set corresponding to the largest number of subsequent ranges; If there are at least two brightness range sets with the same number of subsequent ranges and the largest number, the brightness range set corresponding to the largest number of subsequent ranges is defined as the candidate range set, and the candidate compensation brightness range is determined according to the ranges in each candidate range set, and the simulation brightness value is randomly determined in the candidate compensation brightness range; defining a subsequent compensation brightness range that is not within a single candidate range set as an outer brightness range of the candidate range set; Determine the appropriateness value according to the simulated brightness value and each external brightness range, and perform average calculation according to each appropriateness value determined under the same candidate range set to determine the average appropriateness value, wherein the appropriateness value is a value reflecting the degree of distance between the selected simulated brightness value and the external brightness range, and the larger the value is, the more the selected simulated brightness value conforms to the external brightness range, and is determined by the inverse of the distance value between the simulated brightness value and the external brightness range; The appropriate mean value with the largest value is determined according to the sorting rule, and the feasible compensation brightness range is determined according to the candidate range set corresponding to the appropriate mean value.

3. A straw defect detection system based on visual recognition, characterized in that: include: An acquisition module, used to acquire infrared detection images of the straw at a preset shooting point, wherein the shooting point is located between the output rear end and the cutting device and is arranged at multiple intervals; A processing module, connected to the acquisition module, for storing and processing information; The processing module obtains the detection pixel chromaticity of each pixel in the infrared detection image, and defines the pixel whose detection pixel chromaticity is within the preset required chromaticity range as a normal pixel, and defines the pixel other than the normal pixel as an abnormal pixel; The processing module summarizes the adjacent abnormal pixel points into the same preset initially empty pixel set; The processing module counts abnormal pixel points in each pixel set to determine the number of pixels in the set; The processing module defines a pixel set whose number of set pixels is greater than a preset reference pixel number as a foreign body feature set, and determines an area formed by abnormal pixel points included in the foreign body feature set as a foreign body area; Before the infrared detection image is acquired, the acquisition module acquires the external environment brightness value of the shooting point; The processing module determines whether the external environment brightness value is greater than the upper limit value of the shooting requirement brightness range when the external environment brightness value is not within the preset shooting requirement brightness range; If the external environment brightness value is greater than the upper limit of the brightness range required for shooting, the processing module controls the output backend to stop the output of the pipette; If the external environment brightness value is not greater than the upper limit value of the shooting required brightness range, the processing module calculates according to the shooting required brightness range and the external environment brightness value to determine the required compensation brightness range; the processing module determines a unique compensation selection brightness in the required compensation brightness range, and controls the fill light device preset at the shooting point to operate according to the compensation selection brightness; The steps of determining a unique compensation selected brightness within the required compensation brightness range include: The processing module establishes a detection interval with the current time point as the rear end point and a width of the preset detection duration on the preset time axis, and extracts the external environment brightness value according to the preset unit duration in the detection interval, and defines the extracted external environment brightness value as the detection brightness value; The processing module performs difference calculation based on the detected brightness value at the current time point and the detected brightness value determined at a time point adjacent to the current time point to determine the changed brightness value; The processing module determines whether the changed brightness value is greater than a preset sudden change brightness value; If the change brightness value is greater than the sudden change brightness value, the processing module uses the center value in the required compensation brightness range as the compensation selection brightness; If the change brightness value is not greater than the sudden change brightness value, the processing module randomly selects a brightness in the required compensation brightness range as the compensation selected brightness; If the changed brightness value is not greater than the sudden change brightness value, the processing module combines the detected brightness values ​​in the current detection interval to determine a first brightness combination; The processing module establishes a historical interval with the current time point as the rear end point and a width of a preset historical duration on the time axis, and defines a comparison interval with a width of the detection duration in the historical interval, and determines a second brightness combination according to the comparison interval; The processing module determines the combination similarity according to the first brightness combination and the second brightness combination, defines the comparison interval corresponding to the combination similarity with the largest value as the similar interval, and constructs a detection interval with a width of a preset detection time length with the rear end point of the similar interval as the front end point; The processing module performs difference calculation based on the detected brightness value of the rear end point in the similar interval and the detected brightness value with the smallest value in the detection interval to determine the subsequent change brightness; The processing module performs calculation according to the subsequent change brightness and the required compensation brightness range to determine the subsequent compensation brightness range, performs intersection calculation according to the subsequent compensation brightness range and the required compensation brightness range to determine the feasible compensation brightness range, and randomly selects a brightness value in the feasible compensation brightness range as the compensation selected brightness; After the similar intervals are determined, the processing module determines whether there are at least two similar intervals; If there are not at least two similar intervals, the processing module determines a feasible compensation brightness range according to a subsequent compensation brightness range of the only similar interval; If there are at least two similar intervals, the processing module randomly selects any number of subsequent compensation brightness ranges and the required compensation brightness range from all subsequent compensation brightness ranges to form a brightness range set; the processing module defines the brightness range set when there is an intersection of each range in the brightness range set that is not an empty set as a valid range set, and counts the selected subsequent compensation brightness ranges in the valid range set to determine the number of subsequent ranges; The processing module determines the number of subsequent ranges with the largest value according to a preset sorting rule, and determines a feasible compensation brightness range according to a brightness range set corresponding to the number of subsequent ranges with the largest value; After the foreign body area is determined, the processing module marks the foreign body position point on the preset straw length axis according to the foreign body area; After the location of the foreign body is determined, the processing module constructs a simulated cutting interval on the straw length axis according to a preset fixed length; The processing module determines whether a new foreign body position point appears in the simulated cutting interval; If no new foreign object position point appears in the simulated cutting interval, the processing module marks the cutting position point according to the foreign object position point and the preset avoidance distance; If a new foreign body position point appears in the simulated cutting interval, the processing module continues to construct the cutting interval according to the new foreign body position point.

Citation Information

Patent Citations

  • Real-time product defect positioning method

    CN110186929A

  • Image shooting method, shooting equipment, mobile terminal and medium

    CN112262564A