A method, device, equipment and storage medium for detecting black foreign matter at the edge
By setting the monitoring area and door width, extracting the pixel edge lines at the edge of the glass fiber cloth surface and performing uneven brightness correction, the problem of the existing technology being unable to detect foreign matter at the edge of the glass fiber cloth surface is solved, and the accurate detection of the edge area of the glass fiber cloth surface and the accurate judgment of the position of the foreign matter is achieved, and product quality is improved.
Patent Information
- Application Number
- CN202311679610.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2043-12-07
AI Technical Summary
The foreign object detector of existing glass fiber multi-axial warp knitting machines cannot detect foreign objects at the edge of the cloth, resulting in false alarms and the impact of external lights in the detection area on the detection area.
By setting the monitoring area, the first door and the second door, the color image data of the fiberglass fabric surface is obtained, converted into grayscale image data, extract pixel edge lines, create a minimum external rectangle to determine the edge of the fabric surface, perform uneven brightness correction and threshold division, separate the non-connected area and judge its size. If the size exceeds the set, an alarm will be issued and the foreign object position will be output.
The identification and collection of the edge area of the glass fiber cloth surface is realized, the location of foreign objects is accurately judged, the foreign object content is reduced during the production process, and the production quality of glass fiber cloth is improved.
Smart Images

Figure CN117670840B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of glass fiber detection, and in particular to a method, device, equipment and storage medium for detecting edge black foreign matter. Background Art
[0002] During the production process of glass fiber cloth, it is woven by a multi-axial warp knitting machine. When the binding yarn is weaving the glass fiber, foreign matter may be woven into the glass fiber cloth surface. Foreign matter is generally black oil stains, tapes, mosquitoes and cable ties, etc. Foreign matter woven into the glass fiber cloth surface affects the flatness of the glass fiber cloth surface and the quality of the product.
[0003] In the prior art, foreign body detectors for glass fiber multi-axial warp knitting machines cannot detect foreign bodies at the edge of the fabric, because the edge of the fabric will sag, causing the image to appear black at that location, resulting in false alarms, and the bright white light outside the edge of the fabric in the detection area can also easily affect the judgment. The current processing method is to draw two widths at the edge of the image and not detect the part within the width area.
[0004] Therefore, having a method for detecting foreign matter on the edge of glass fiber cloth has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] In view of at least one of the above technical problems, the present invention provides a method, device, equipment and storage medium for detecting black foreign matter at the edge of glass fiber cloth by visual recognition.
[0006] According to a first aspect of the present invention, a method for detecting black foreign matter at an edge is provided, comprising the following steps:
[0007] S10: Setting a monitoring area, a first door width and a second door width, and acquiring color image data of the glass fiber cloth surface, wherein the first door width is located outside the glass fiber cloth surface, and the second door width is located on the glass fiber cloth surface;
[0008] S20: Convert the color image data into grayscale image data;
[0009] S30: extracting pixel edge lines in the grayscale image data, and then extracting the pixel edge lines into edge areas by using threshold segmentation;
[0010] S40: creating a minimum bounding rectangle in the horizontal direction of the edge area, and determining the edge of the cloth surface according to the bounding rectangle;
[0011] S50: extracting the area between the edge of the cloth and the second width in the grayscale image data, and outputting the extraction result as an area of interest;
[0012] S60: performing image smoothing and uneven brightness correction processing on the region of interest, and outputting the result as a smoothed image;
[0013] S70: performing threshold segmentation on the smoothed image, extracting pixels with grayscale values in the range of 0-185, and outputting the result as a segmented area;
[0014] S80: Separate the non-connected areas in the segmented area, determine the size of the non-connected areas, and if the size of the non-connected areas is larger than 8*8 pixels, issue an alarm and transmit the detected foreign body position information to the display screen.
[0015] In some embodiments of the present invention, in step S40, the column coordinates of the left border of the bounding rectangle are marked as column1, and the column coordinates of the right border of the bounding rectangle are marked as column2.
[0016] When the color image data acquired by the camera is the right edge of the glass fiber cloth, the column2 is the right edge of the glass fiber cloth;
[0017] When the color image data acquired by the camera is the left edge of the glass fiber cloth, the column1 is the left edge of the glass fiber cloth.
[0018] In some embodiments of the present invention, step S60 further includes the following steps:
[0019] S61: performing mean filtering on the region of interest using a 5*5 pixel mask to obtain a mean filtered image f(x, y);
[0020] S62: performing longitudinal mean filtering with a width of 10 pixels on the region of interest to obtain a longitudinal filtered image g(x, y);
[0021] S63: Divide the mean filtered image and the longitudinal filtered image to obtain a smoothed image. The division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, where mult is 300 and add is 0.
[0022] In some embodiments of the present invention, in step S30, extracting the pixel edge line further includes the following steps:
[0023] S31: performing Gaussian filtering on the grayscale image data to obtain initial processed image data;
[0024] S32: Calculate the gradient values g in the horizontal and vertical directions x (m, n)+g y (m, n), then calculate the magnitude of the gradient And the gradient direction
[0025] S33: performing non-maximum suppression on the pixel points on the initially processed image data, comparing the intensity of the current pixel gradient with the intensity of the two pixels above along the positive and negative gradient squares, if the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel point is retained as an edge point, otherwise the pixel point is suppressed;
[0026] S34: Perform dual threshold detection and edge connection, set the high threshold to 20, set the low threshold to 40, and judge the attribute of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold.
[0027] If the gradient value of a certain edge point is higher than the high threshold, it is set to 1 in the result;
[0028] If the gradient value of a certain edge point is lower than the low threshold, it is set to 0 in the result;
[0029] If the gradient value of a certain edge point is between the high threshold and the low threshold, the following judgment needs to be made:
[0030] Check the 8 neighboring points of a certain edge point to see if there is a point with a gradient value higher than the high threshold.
[0031] If it exists, it means that the edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0;
[0032] S35: Connect the edge points set to 1 in the result to form a pixel edge line.
[0033] According to a second aspect of the present invention, there is also provided a device for detecting black foreign matter at the edge, comprising:
[0034] Acquisition module: used to set the monitoring area, the first door width and the second door width, and obtain the color image data of the glass fiber cloth surface, wherein the first door width is located outside the glass fiber cloth surface, and the second door width is located on the glass fiber cloth surface;
[0035] Image processing module: used for converting the color image data into grayscale image data;
[0036] Edge extraction module: used to extract pixel edge lines in the grayscale image data, and then extract the pixel edge lines into edge areas by using threshold segmentation;
[0037] A cloth edge determination module is used to create a minimum bounding rectangle in the horizontal direction of the edge area, and determine the cloth edge according to the bounding rectangle;
[0038] A module for extracting a region of interest: used for extracting a region between the edge of the cloth and the second width in the grayscale image data, and outputting the extraction result as a region of interest;
[0039] Gray value correction module: used for performing image smoothing and uneven brightness correction processing on the region of interest, and outputting the result as a smoothed image;
[0040] Threshold segmentation module: used to perform threshold segmentation on the smoothed image, extract pixel points with grayscale values in the range of 0-185, and output the result as the segmented area;
[0041] Judgment module: used to separate the non-connected areas in the segmented area, judge the size of the non-connected areas, and if the size of the non-connected areas is larger than 8*8 pixels, an alarm is issued and the detected foreign body position information is transmitted to the display screen.
[0042] In some embodiments of the present invention, in the module for determining the edge of the cloth surface, the column coordinates of the left border of the circumscribed rectangle are marked as column1, and the column coordinates of the right border of the circumscribed rectangle are marked as column2.
[0043] When the color image data acquired by the camera is the right edge of the glass fiber cloth, the column2 is the right edge of the glass fiber cloth;
[0044] When the color image data acquired by the camera is the left edge of the glass fiber cloth, the column1 is the left edge of the glass fiber cloth.
[0045] In some embodiments of the present invention, the gray value correction module further includes the following units:
[0046] Mean filtering unit: used to perform mean filtering on the region of interest using a 5*5 pixel mask to obtain a mean filtered image f(x, y);
[0047] A longitudinal filtering unit is used to perform longitudinal mean filtering of the region of interest with a width of 10 pixels to obtain a longitudinal filtered image g(x,y);
[0048] Calculation unit: used to divide the mean filter image and the longitudinal filter image to obtain a smoothed image, the division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, where mult takes a value of 300 and add takes a value of 0.
[0049] In some embodiments of the present invention, in the edge extraction module, extracting the pixel edge line further includes the following units:
[0050] Filtering unit: used for performing Gaussian filtering on the grayscale image data to obtain initial processed image data;
[0051] Calculation unit: used to calculate the gradient value g in the horizontal and vertical directions x (m, n)+g y (m, n), then calculate the magnitude of the gradient And the gradient direction
[0052] A non-maximum suppression unit is used to perform non-maximum suppression on the pixel points on the initially processed image data, and compare the intensity of the current pixel gradient with the intensity of the two pixels above along the positive and negative gradient squares. If the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel point is retained as an edge point, otherwise the pixel point is suppressed;
[0053] Judgment unit: used for dual threshold detection and edge connection, setting the high threshold to 20 and the low threshold to 40, judging the attribute of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold,
[0054] If the gradient value of a certain edge point is higher than the high threshold, it is set to 1 in the result;
[0055] If the gradient value of a certain edge point is lower than the low threshold, it is set to 0 in the result;
[0056] If the gradient value of a certain edge point is between the high threshold and the low threshold, the following judgment needs to be made:
[0057] Check the 8 neighboring points of a certain edge point to see if there is a point with a gradient value higher than the high threshold.
[0058] If it exists, it means that the edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0;
[0059] Connecting unit: used to connect the edge points set to 1 in the result into pixel edge lines.
[0060] According to a third aspect of the present invention, there is also provided a device for detecting black foreign matter to the edge, comprising a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described above is implemented.
[0061] According to a fourth aspect of the present invention, there is also provided a storage medium for detecting black foreign matter to the edge, comprising a storage medium on which a computer program is stored, and the computer program implements the above method when executed by a processor.
[0062] The beneficial effects of the present invention are as follows: the present invention divides the edge of the glass fiber cloth into the first width and the second width by setting the first width and the second width, extracts the edge area by extracting the pixel edge line between the first width and the second width, and then performs threshold segmentation to extract the edge area, creates a minimum circumscribed rectangle in the horizontal direction of the edge area to determine the edge position of the cloth surface, performs uneven brightness correction processing on the area between the edge of the cloth surface and the second width, and finally performs threshold segmentation to separate the non-connected area and judge the size of the non-connected area. If the size exceeds the set size, an alarm is issued and the position of the foreign matter is output to the display screen. The present invention determines the edge area of the glass fiber cloth surface by extracting the pixel edge line and creating the minimum circumscribed rectangle, realizes the recognition and collection of the edge area of the glass fiber cloth surface, and then extracts the non-connected area containing foreign matter by correcting the uneven brightness to judge the specific position of the foreign matter, thereby realizing the detection of foreign matter in the edge area of the glass fiber cloth surface. The foreign matter content in the production process is reduced, and the production quality of the glass fiber cloth is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0064] Figure 1 It is a flowchart of the steps of the method for detecting black foreign matter at the edge in an embodiment of the present invention;
[0065] Figure 2 It is a schematic diagram of the structure of the black foreign matter detection device to the edge in an embodiment of the present invention;
[0066] Figure 3 It is a structural schematic diagram of a computer device for detecting black foreign matter at the edge in an embodiment of the present invention;
[0067] Figure 4 It is a grayscale image data diagram in the black foreign matter detection method to the edge in an embodiment of the present invention;
[0068] Figure 5 It is a diagram of the edge area in the method for detecting black foreign matter to the edge in an embodiment of the present invention;
[0069] Figure 6 This is a smoothed image diagram in the black foreign matter detection method to the edge in an embodiment of the present invention. DETAILED DESCRIPTION
[0070] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0071] like Figures 1 to 6 A method for detecting black foreign matter at the edge is shown.
[0072] S10: Setting a monitoring area, a first width, and a second width, and acquiring color image data of the glass fiber cloth surface, wherein the first width is located on the outside of the glass fiber cloth surface, and the second width is located on the glass fiber cloth surface. By setting a monitoring area above the edge of the glass fiber cloth, color image data of the edge area of the glass fiber cloth surface is collected, and the first width is set on the outside of the glass fiber cloth surface, and the second width is set on the glass fiber cloth surface, the area between the first width and the second width is collected and judged.
[0073] S20: Convert the color image data into grayscale image data by converting the color image data into grayscale image data, such as Figure 4 As shown, since the glass fibers, binding yarns and foreign objects on the glass fiber cloth have different gray values formed by the refraction of light, the difference in gray values between regions is used for screening and judgment.
[0074] S30: extracting pixel edge lines in the grayscale image data, and then extracting the pixel edge lines into edge areas using threshold segmentation, such as Figure 5 As shown, the range of grayscale image data is relatively large. By determining the edge position of the glass fiber cloth surface, the glass fiber cloth surface information within the edge is extracted, and the edge area is determined by threshold segmentation, and then the glass fiber cloth surface within the edge is screened and judged for foreign matter.
[0075] S40: Create a minimum bounding rectangle in the horizontal direction of the edge area, determine the edge of the cloth according to the bounding rectangle, and then create a minimum bounding rectangle for the edge area extracted by the above method, and one side of the created minimum bounding rectangle is the edge of the cloth. It should be pointed out here that when the glass fiber cloth on both sides is photographed and collected, the edges of the glass fiber cloth are different sides on the minimum bounding rectangle, and the edges need to be distinguished according to specific circumstances.
[0076] S50: Extract the area between the edge of the cloth and the second width in the grayscale image data, and output the extraction result as the region of interest. The edge of the glass fiber cloth is extracted by the above method. The area between the edge of the glass fiber cloth and the second width is extracted and output as the region of interest. The region of interest is the area of the glass fiber cloth.
[0077] S60: Perform image smoothing and uneven brightness correction on the region of interest, and output the result as a smoothed image, such as Figure 6 As shown, since there will be drooping parts on the glass fiber cloth surface, when the color image data is converted into grayscale image data, the grayscale value of the drooping part is darker as it is closer to the edge, and the lower the grayscale value is, false alarms may occur when foreign matter is directly screened. Therefore, the grayscale value of the area of interest can be leveled through image smoothing and uneven brightness correction.
[0078] S70: Perform threshold segmentation on the smoothed image, extract pixel points with grayscale values in the range of 0-185, output the result as the segmented area, perform threshold segmentation, and extract pixel points between 0-185 to extract the area containing foreign matter.
[0079] S80: Separate the non-connected areas in the segmented area, determine the size of the non-connected areas, and if the size of the non-connected areas is larger than 8*8 pixels, issue an alarm, and transmit the detected foreign body position information to the display screen. Segment the area containing the foreign body into non-connected areas, and determine whether the size of each part of the non-connected areas is larger than 8*8 pixels. If it is larger, issue an alarm, and transmit the foreign body position to the display screen.
[0080] like Figure 1 As shown, the present invention divides the edge of the glass fiber cloth into the first width and the second width by setting the first width and the second width, extracts the edge line of the pixel between the first width and the second width, and then performs threshold segmentation to extract the edge area, creates a minimum circumscribed rectangle in the horizontal direction of the edge area to determine the edge position of the cloth, performs uneven brightness correction processing on the area between the edge of the cloth and the second width, and finally performs threshold segmentation to separate the non-connected area and determine the size of the non-connected area. If the size exceeds the set size, an alarm is issued and the position of the foreign matter is output to the display screen. The present invention determines the edge area of the glass fiber cloth by extracting the pixel edge line and creating the minimum circumscribed rectangle, realizes the recognition and collection of the edge area of the glass fiber cloth, and then extracts the non-connected area containing foreign matter by correcting the uneven brightness to determine the specific position of the foreign matter, thereby realizing the detection of foreign matter in the edge area of the glass fiber cloth. The foreign matter content in the production process is reduced, and the production quality of the glass fiber cloth is improved.
[0081] In some embodiments of the present invention, in step S40, the column coordinates of the left border of the circumscribed rectangle are marked as column1, and the column coordinates of the right border of the circumscribed rectangle are marked as column2. When edge extraction is performed on the fiberglass cloth, the edge of the circumscribed minimum rectangle is first marked. When the color image data acquired by the camera is the right edge of the fiberglass cloth, column2 is the right edge of the fiberglass cloth; when the color image data acquired by the camera is the left edge of the fiberglass cloth, column1 is the left edge of the fiberglass cloth.
[0082] In some embodiments of the present invention, step S60 further includes the following steps:
[0083] S61: Use a 5*5 pixel mask to perform mean filtering on the region of interest to obtain a mean filtered image f(x, y), and smooth the image by mean filtering.
[0084] S62: Perform a longitudinal mean filter with a width of 10 pixels on the region of interest to obtain a longitudinal filtered image g(x, y), and obtain the horizontal background brightness change of the region of interest through the longitudinal mean filter.
[0085] S63: Divide the mean filter image and the longitudinal filter image to obtain a smoothed image. The division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, where mult is 300 and add is 0. The uneven brightness is corrected by division.
[0086] In some embodiments of the present invention, in step S30, extracting pixel edge lines further includes the following steps:
[0087] S31: Gaussian filtering is performed on the grayscale image data to obtain initially processed image data. The grayscale image data is denoised by Gaussian filtering. Noise may affect the accuracy of edge detection.
[0088] S32: Calculate the gradient values g in the horizontal and vertical directions x (m, n)+g y (m, n), then calculate the magnitude of the gradient And the gradient direction
[0089] S33: Perform non-maximum suppression on the pixel points on the initially processed image data, compare the current pixel gradient with the intensity of the two pixels along the positive and negative gradient squares, if the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel point is retained as an edge point, otherwise the pixel point is suppressed, and the edge of the grayscale image data is refined through non-maximum suppression.
[0090] S34: Perform dual threshold detection and edge connection, set the high threshold to 20, set the low threshold to 40, and judge the attribute of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold.
[0091] If the gradient value of an edge point is higher than the high threshold, it is set to 1 in the result;
[0092] If the gradient value of an edge point is lower than the low threshold, it is set to 0 in the result;
[0093] If the gradient value of an edge point is between the high threshold and the low threshold, the following judgment is required:
[0094] Check the 8 neighboring points of an edge point to see if there are points with gradient values higher than the high threshold.
[0095] If it exists, it means that a certain edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0.
[0096] By setting the high threshold and the low threshold, the gradient of a certain edge point is judged, and finally the edge points that are higher than the high threshold and connected to the high threshold are screened out.
[0097] S35: Connect the edge points set to 1 in the result to form pixel edge lines, and finally connect the edge points screened in the above manner to form pixel edge points.
[0098] Those skilled in the art should know that the embodiments of the present application can be provided as methods, devices, electronic devices or computer storage media products. Therefore, the embodiments of the present application can completely adopt hardware embodiments, embodiments combining hardware and software, or pure software embodiments. The test detection process data processing device in the embodiments of the present application is introduced below. The device embodiments below correspond to the method embodiments above. Those skilled in the art can understand the implementation process below based on the above description, and no detailed description is given here.
[0099] like Figure 2 The black foreign body detection device shown in the figure comprises:
[0100] Acquisition module: used to set the monitoring area, the first width and the second width, and obtain the color image data of the glass fiber cloth surface, wherein the first width is located outside the glass fiber cloth surface, and the second width is located on the glass fiber cloth surface;
[0101] Image processing module: used to convert color image data into grayscale image data;
[0102] Edge extraction module: used to extract pixel edge lines in grayscale image data, and then extract the pixel edge lines into edge areas using threshold segmentation;
[0103] Determine the edge module of the cloth surface: used to create a minimum bounding rectangle in the horizontal direction of the edge area, and determine the edge of the cloth surface according to the bounding rectangle;
[0104] Extraction module of region of interest: used to extract the region between the edge of the cloth and the second width in the grayscale image data, and the extraction result is output as the region of interest;
[0105] Gray value correction module: used to perform image smoothing and uneven brightness correction on the region of interest, and the result is output as a smooth image;
[0106] Threshold segmentation module: used to perform threshold segmentation on the smooth image, extract pixels with grayscale values in the range of 0-185, and output the segmented area;
[0107] Judgment module: used to separate the non-connected areas in the segmented area and judge the size of the non-connected areas. If the size of the non-connected area is larger than 8*8 pixels, an alarm will be issued and the detected foreign body position information will be transmitted to the display screen.
[0108] In some embodiments of the present invention, in the module for determining the edge of the cloth, the column coordinates of the left border of the circumscribed rectangle are marked as column1, and the column coordinates of the right border of the circumscribed rectangle are marked as column2.
[0109] When the color image data acquired by the camera is the right edge of the glass fiber cloth, column2 is the right edge of the glass fiber cloth;
[0110] When the color image data acquired by the camera is the left edge of the glass fiber cloth, column 1 is the left edge of the glass fiber cloth.
[0111] In some embodiments of the present invention, the gray value correction module further includes the following units:
[0112] Mean filter unit: used to perform mean filtering on the region of interest using a 5*5 pixel mask to obtain a mean filtered image f(x,y);
[0113] Longitudinal filtering unit: used to perform longitudinal mean filtering of the region of interest with a width of 10 pixels to obtain a longitudinal filtered image g(x,y);
[0114] Calculation unit: used to divide the mean filter image and the longitudinal filter image to obtain a smoothed image. The division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, where mult is 300 and add is 0.
[0115] In some embodiments of the present invention, in the edge extraction module, extracting pixel edge lines further includes the following units:
[0116] Filtering unit: used to perform Gaussian filtering on the grayscale image data to obtain the initial processed image data;
[0117] Calculation unit: used to calculate the gradient value g in the horizontal and vertical directions x (m, n)+g y (m, n), then calculate the magnitude of the gradient And the gradient direction
[0118] Non-maximum suppression unit: used to perform non-maximum suppression on the pixels on the initially processed image data, comparing the current pixel gradient with the intensity of the two pixels above along the positive and negative gradient squares. If the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel is retained as an edge point, otherwise the pixel is suppressed;
[0119] Judgment unit: used for dual threshold detection and edge connection, setting the high threshold to 20 and the low threshold to 40, judging the attributes of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold.
[0120] If the gradient value of an edge point is higher than the high threshold, it is set to 1 in the result;
[0121] If the gradient value of an edge point is lower than the low threshold, it is set to 0 in the result;
[0122] If the gradient value of an edge point is between the high threshold and the low threshold, the following judgment is required:
[0123] Check the 8 neighboring points of an edge point to see if there are points with gradient values higher than the high threshold.
[0124] If it exists, it means that a certain edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0;
[0125] Connection unit: used to connect the edge points set to 1 in the result into pixel edge lines.
[0126] In the following part of the embodiments of the present invention, the electronic device and computer storage medium embodiments in the embodiments of the present invention are introduced. The electronic device and computer storage medium embodiments in the following correspond to the method embodiments in the above. Those skilled in the art can understand the following implementation process based on the above description, which will not be described in detail here.
[0127] like Figure 3The structural diagram of the computer device provided in the embodiment of the present application is shown. A computer device 400 provided in the embodiment of the present application includes: a memory 420, a processor 410, and a computer program stored in the memory 420 and executable on the processor 410. When the processor 410 executes the computer program, the above method is implemented.
[0128] The embodiment of the present application further provides a storage medium 430 on which a computer program is stored. When the computer program is executed by the processor 410, the above method is implemented.
[0129] Among them, the storage medium 430 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0130] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. "Multiple" means two or more, unless otherwise clearly and specifically defined.
[0131] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0132] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0133] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0134] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can obtain instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0135] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0136] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0137] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A method for detecting black foreign matter at the edge, characterized in that: The steps include: S10: Setting a monitoring area, a first door width and a second door width, and acquiring color image data of the glass fiber cloth surface, wherein the first door width is located outside the glass fiber cloth surface, and the second door width is located on the glass fiber cloth surface; S20: Convert the color image data into grayscale image data; S30: extracting pixel edge lines in the grayscale image data. The grayscale image data has a large range. By determining the edge position of the glass fiber cloth surface, the glass fiber cloth surface information within the edge is extracted, and the edge area is determined by threshold segmentation. S40: creating a minimum bounding rectangle in the horizontal direction of the edge area, and determining the edge of the cloth surface according to the bounding rectangle; S50: extracting the area between the edge of the cloth and the second width in the grayscale image data, and outputting the extraction result as an area of interest; S60: performing image smoothing and uneven brightness correction processing on the region of interest, and outputting the result as a smoothed image; S70: performing threshold segmentation on the smoothed image, extracting pixels with grayscale values in the range of 0-185, and outputting the result as a segmented area; S80: separating the non-connected areas in the segmented area, determining the size of the non-connected areas, and if the size of the non-connected areas is larger than 8*8 pixels, giving an alarm, and transmitting the detected foreign body position information to the display screen; In step S40, the column coordinates of the left border of the bounding rectangle are marked as column1, and the column coordinates of the right border of the bounding rectangle are marked as column2. When the color image data acquired by the camera is the right edge of the glass fiber cloth, the column2 is the right edge of the glass fiber cloth; When the color image data acquired by the camera is the left edge of the glass fiber cloth, the column1 is the left edge of the glass fiber cloth.
2. The method for detecting black foreign matter at the edge according to claim 1, characterized in that: In step S60, the following steps are also included: S61: performing mean filtering on the region of interest using a 5*5 pixel mask to obtain a mean filtered image f(x, y); S62: performing longitudinal mean filtering with a width of 10 pixels on the region of interest to obtain a longitudinal filtered image g(x, y); S63: Divide the mean filtered image and the longitudinal filtered image to obtain a smoothed image, and the division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, where mult is 300 and add is 0.
3. The method for detecting black foreign matter at the edge according to claim 1, characterized in that: In step S30, extracting the pixel edge line further includes the following steps: S31: performing Gaussian filtering on the grayscale image data to obtain initial processed image data; S32: Calculate the gradient values in the horizontal and vertical directions , and then calculate the magnitude of the gradient And the gradient direction ; S33: performing non-maximum suppression on the pixel points on the initially processed image data, comparing the intensity of the current pixel gradient with the intensity of the two pixels above along the positive and negative gradient squares, if the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel point is retained as an edge point, otherwise the pixel point is suppressed; S34: Perform dual threshold detection and edge connection, set the high threshold to 20, set the low threshold to 40, and judge the attribute of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold. If the gradient value of a certain edge point is higher than the high threshold, it is set to 1 in the result; If the gradient value of a certain edge point is lower than the low threshold, it is set to 0 in the result; If the gradient value of a certain edge point is between the high threshold and the low threshold, the following judgment needs to be made: Check the 8 neighboring points of a certain edge point to see if there is a point with a gradient value higher than the high threshold. If it exists, it means that the edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0; S35: Connect the edge points set to 1 in the result to form a pixel edge line.
4. A device for detecting black foreign matter at the edge, characterized in that: include: Acquisition module: used to set the monitoring area, the first door width and the second door width, and obtain the color image data of the glass fiber cloth surface, wherein the first door width is located outside the glass fiber cloth surface, and the second door width is located on the glass fiber cloth surface; Image processing module: used for converting the color image data into grayscale image data; Edge extraction module: used to extract pixel edge lines in the grayscale image data. The grayscale image data has a large range. By determining the edge position of the glass fiber cloth surface, the glass fiber cloth surface information within the edge is extracted, and the edge area is determined by threshold segmentation; A cloth edge determination module is used to create a minimum bounding rectangle in the horizontal direction of the edge area, and determine the cloth edge according to the bounding rectangle; A module for extracting a region of interest: used for extracting a region between the edge of the cloth and the second width in the grayscale image data, and outputting the extraction result as a region of interest; Gray value correction module: used for performing image smoothing and uneven brightness correction processing on the region of interest, and outputting the result as a smoothed image; Threshold segmentation module: used to perform threshold segmentation on the smoothed image, extract pixel points with grayscale values in the range of 0-185, and output the result as the segmented area; Judgment module: used to separate the non-connected area in the segmented area, judge the size of the non-connected area, and if the size of the non-connected area is larger than 8*8 pixels, issue an alarm and transmit the detected foreign body position information to the display screen; In the module for determining the edge of the cloth surface, the column coordinates of the left border of the circumscribed rectangle are marked as column1, and the column coordinates of the right border of the circumscribed rectangle are marked as column2. When the color image data acquired by the camera is the right edge of the glass fiber cloth, the column2 is the right edge of the glass fiber cloth; When the color image data acquired by the camera is the left edge of the glass fiber cloth, the column1 is the left edge of the glass fiber cloth.
5. The device for detecting black foreign matter at the edge according to claim 4, characterized in that: The gray value correction module also includes the following units: Mean filtering unit: used to perform mean filtering on the region of interest using a 5*5 pixel mask to obtain a mean filtered image f(x, y); A longitudinal filtering unit is used to perform longitudinal mean filtering of the region of interest with a width of 10 pixels to obtain a longitudinal filtered image g(x,y); Calculation unit: used to divide the mean filtered image and the longitudinal filtered image to obtain a smoothed image, wherein the division formula is: h(x,y)=f(x,y) / g(x,y)*mult+add, wherein mult takes a value of 300 and add takes a value of 0.
6. The device for detecting black foreign matter at the edge according to claim 4, characterized in that: In the edge extraction module, extracting the pixel edge line also includes the following units: Filtering unit: used for performing Gaussian filtering on the grayscale image data to obtain initial processed image data; Calculation unit: used to calculate the gradient values in the horizontal and vertical directions , and then calculate the magnitude of the gradient And the gradient direction ; A non-maximum suppression unit is used to perform non-maximum suppression on the pixel points on the initially processed image data, and compare the intensity of the current pixel gradient with the intensity of the two pixels above along the positive and negative gradient squares. If the gradient intensity of the current pixel is the largest compared with the other two pixels, the pixel point is retained as an edge point, otherwise the pixel point is suppressed; Judgment unit: used for dual threshold detection and edge connection, setting the high threshold to 20 and the low threshold to 40, judging the attribute of the edge point according to the difference between the current edge point gradient value and the high threshold and the low threshold, If the gradient value of a certain edge point is higher than the high threshold, it is set to 1 in the result; If the gradient value of a certain edge point is lower than the low threshold, it is set to 0 in the result; If the gradient value of a certain edge point is between the high threshold and the low threshold, the following judgment needs to be made: Check the 8 neighboring points of a certain edge point to see if there is a point with a gradient value higher than the high threshold. If it exists, it means that the edge point is connected to the determined edge point, so it is set to 1 in the result, otherwise it is set to 0; Connecting unit: used to connect the edge points set to 1 in the result into pixel edge lines.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.
8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Method for quickly detecting raw grey cloth based on computer vision technology
CN108364291A
Mosquito detection method and device and storage medium
CN113837184A