Method for evaluating oil stain grade of chinlon spinning cake based on machine vision
1. The method for evaluating the oil stain grade of the nylon spinning cake based on machine vision is characterized by comprising the following steps: the method realizes automatic oil stain grade evaluation by carrying out a series of processing on the acquired image of the nylon spinning cake, and specifically comprises the following steps:
firstly, obtaining a conversion ratio of pixel points to an actual area in a spinning cake image in a camera calibration mode, and storing the conversion ratio into a computer;
step (2), obtaining a spinning cake image with oil stains from the upper side of a spinning cake through an image acquisition platform;
step (3), transmitting the spinning cake image collected in the industrial camera to a computer through a built transmitter;
converting the image into a single-channel image on a computer, namely graying, then carrying out contrast enhancement on the grayed spinning cake image, and then removing noise by adopting filtering;
step (5), obtaining inner and outer circle regions of the spinning cake image through a random Hough circle detection algorithm, and setting a middle annular region as an interested region;
step (6) processing the region of interest by a self-adaptive threshold method so as to extract an oil stain region, calculating the number of pixel points of oil stains in all the oil stain regions, and converting the number of the pixel points of the oil stains into the oil stain area of the actual nylon spinning cake according to the conversion proportion obtained in the step (1);
and (7) outputting different oil stain defect grades of AA, A and B according to the industrial standard of chemical fiber filament package appearance on-line intelligent detection, and starting oil stain grade evaluation of the next spinning cake after outputting.
2. The machine vision-based chinlon oil stain rating method of claim 1, wherein the camera calibration in step 1 is specifically realized as follows:
1-1, firstly, adjusting the position of an industrial camera 2 and the brightness of a light ring, a focal ring and an annular light source 4 to ensure that a spinning cake 5 is clearly and completely visible in an image and has proper brightness
1-2, fixing the positions of the industrial camera 2 and the annular light source 4, so that the height H from the camera lens of the industrial camera 2 to the conveyor belt 8 is kept unchanged; because the height h of the greasy dirt spinning cake is unchanged, the distance d from the camera lens to the top of the spinning cake is kept unchanged, so that the unit can be ensured to be in the subsequent grade evaluation processArea S on actual spinning cake represented by pixel pointpKeeping the same;
1-3, the computer uses Hough circle detection algorithm to the received spinning cake image to obtain the number D of pixel points represented by the diameter of the spinning cakepxAnd obtaining the area S on the actual spinning cake represented by the unit pixel point through the known actual diameter D of the spinning cakepAnd stored in the computer.
3. The machine vision-based chinlon oil stain rating method according to claim 1 or 2, wherein the image acquisition platform in step 2 comprises a camera bellows, an annular light source, an industrial camera, an adjusting device, a transmitter and a fixed bracket; the camera bellows, the industrial camera and the annular light source are all arranged on the fixed support and are fixed in sequence from top to bottom; the industrial camera is movably fixed on the fixed bracket through the adjusting device, and the height of the industrial camera can be adjusted up and down; the industrial camera is used for acquiring images of the oil-contaminated spinning cakes to obtain spinning cake images; the conveyer is used for transmitting the formation of image picture of industry camera to the computer, and the spinning cake sets up on the conveyer belt, switches to next spinning cake through the drive of conveyer belt.
4. The machine vision-based chinlon oil stain rating method of claim 1, wherein the oil stain area in the step (6) is calculated as follows:
adjusting the position of the camera in advance according to the calibration process of the camera in the step (1), and keeping the distance d from the lens to the top of the spinning cake unchanged, thereby obtaining the actual area S represented by the unit pixel point through the following formulap:
Sp=(D/Dpx)2
Wherein D ispxExpressing the number of pixel points expressed by the diameter of the spinning cake; d represents the diameter of the spinning cake; then passes the conversion ratio SpAnd converting the oil stain pixel number into the oil stain area.
Background
The nylon is a different name of nylon, is one of three synthetic fibers, has the abrasion resistance higher than that of all other fibers, 10 times higher than that of cotton and 20 times higher than that of wool, is widely applied to various medical and knitted goods at present, such as bedding articles for manufacturing medical sutures, clothes, mosquito nets and the like, and is even applied to parts in the industries of machinery, chemical engineering and the like instead of metals such as copper and the like due to the abrasion resistance.
Nylon yarn is usually wound on a paper tube to form a nylon yarn cake, so that the nylon yarn cake is convenient to store and transport. In the production process of the nylon spinning cakes, due to the problems of processing technology, equipment failure, artificial contact in the transportation process and the like, the spinning cakes have various defects of poor forming of greasy dirt silk, net silk, broken silk, spinning cakes and the like. The greasy dirt on the spinning cake can not only affect the appearance quality of the spinning cake, but also can affect the subsequent processing into textiles. At present, most of domestic spinning cake oil stain defect detection and evaluation links of chinlon production enterprises adopt an artificial quality inspection mode, so that not only is interference caused by human factors, but also the efficiency is very low. In addition, the manual quality inspection mode is adopted, so that the automatic production degree of the whole enterprise is reduced, and the full process automation from production to detection and packaging and ex-warehouse cannot be completed. Therefore, an oil stain grade assessment method meeting the requirement of automatic production is urgently needed.
Disclosure of Invention
The invention aims to provide a machine vision-based oil stain grade evaluation method aiming at the oil stain grade evaluation of polyamide spinning cakes still manually performed by many enterprises at present.
The technical scheme of the invention is that the automatic oil stain grade evaluation is realized by carrying out a series of processing on the collected image of the nylon spinning cake, and the method specifically comprises the following steps:
and (1) firstly, obtaining the conversion ratio of pixel points and actual areas in the spinning cake image in a camera calibration mode, and storing the conversion ratio into a computer.
And (2) obtaining an image of the spinning cake with oil stains from the upper part of the spinning cake through an image acquisition platform.
And (3) transmitting the spinning cake image collected in the industrial camera to a computer through a built transmitter.
And (4) converting the image into a single-channel image on a computer, namely graying, then carrying out contrast enhancement on the grayed spinning cake image, and then removing noise by adopting filtering.
And (5) acquiring inner and outer circle regions of the spinning cake image through a random Hough circle detection algorithm, and setting the middle annular region as an interested region.
And (6) processing the region of interest by a self-adaptive threshold method so as to extract an oil stain region, calculating the number of pixel points of oil stains in all the oil stain regions, and converting the number of the pixel points of the oil stains into the oil stain area of the actual nylon spinning cake according to the conversion proportion obtained in the step (1).
And (7) outputting different oil stain defect grades of AA, A and B according to the industrial standard of chemical fiber filament package appearance on-line intelligent detection, and starting oil stain grade evaluation of the next spinning cake after outputting.
Further, the camera calibration in step 1 is specifically implemented as follows:
1-1, firstly, adjusting the position of an industrial camera 2 and the brightness of a light ring, a focal ring and an annular light source 4 to ensure that a spinning cake 5 is clearly and completely visible in an image and has proper brightness
1-2, the positions of the industrial camera 2 and the ring light source 4 are fixed so that the height H of the camera lens of the industrial camera 2 to the conveyor belt 8 remains constant. Because the height h of the greasy dirt spinning cake is unchanged, the distance d from the camera lens to the top of the spinning cake is kept unchanged, so that the area S on the actual spinning cake represented by the unit pixel point in the subsequent grade evaluation process can be ensuredpRemain unchanged.
1-3, the computer uses Hough circle detection algorithm to the received spinning cake image to obtain the number D of pixel points represented by the diameter of the spinning cakepxAnd obtaining the area S on the actual spinning cake represented by the unit pixel point through the known actual diameter D of the spinning cakepAnd stored in the computer.
Further, the image acquisition platform in the step 2 comprises a camera bellows, an annular light source, an industrial camera, an adjusting device, a transmitter and a fixed bracket; the camera bellows, the industrial camera and the annular light source are all arranged on the fixed support and are fixed in sequence from top to bottom; the industrial camera is movably fixed on the fixed bracket through the adjusting device, and the height of the industrial camera can be adjusted up and down; the industrial camera is used for acquiring images of the oil-contaminated spinning cakes to obtain spinning cake images; the transmitter is used for transmitting the image picture of the industrial camera to the computer, and the whole image acquisition platform is arranged on the conveyor belt.
Further, the oil stain area in the step (6) is calculated as follows:
adjusting the position of the camera in advance according to the calibration process of the camera in the step (1), and keeping the distance d from the lens to the top of the spinning cake unchanged, thereby obtaining the actual area S represented by the unit pixel point through the following formulap:
Sp=(D/Dpx)2
Wherein D ispxExpressing the number of pixel points expressed by the diameter of the spinning cake; d represents the diameter of the cake. Then passes the conversion ratio SpAnd converting the oil stain pixel number into the oil stain area.
The invention has the beneficial effects that:
according to the invention, a series of image processing methods are carried out on the oil stain spinning cake image, so that the automatic nylon oil stain grade evaluation is realized, the conventional artificial oil stain grade evaluation method can be effectively replaced, and the improvement of the automation degree of nylon enterprises is facilitated. The invention eliminates human factors by carrying out oil stain defect detection and grade evaluation on the nylon spinning cakes, improves the automation degree of nylon enterprises and promotes the development of intelligent manufacturing.
Drawings
FIG. 1 is a flow chart of the oil level assessment of an oil-stained spinning cake according to the present invention;
FIG. 2 is an exemplary diagram of a collected cake sample of the present invention;
FIG. 3 is a side view of the oil level assessment platform for an oil cake of the present invention;
FIG. 4 is a camera calibration schematic of the present invention;
Detailed Description
The invention is further illustrated by the following figures and examples.
As shown in fig. 1, it is a flow chart for evaluating the oil stain level of an oil stain spinning cake.
The method comprises the steps of firstly, acquiring a spinning cake image with oil stains from the upper side of a spinning cake by using an industrial camera through a pre-established image acquisition platform, transmitting the image to a computer through a transmitter, and further performing gray level conversion namely converting the image into a single-channel image due to the fact that the oil stains are greatly different from surrounding pixel points. The collected spinning cakes have textures and need further processing, and the method adopts a mode of firstly enhancing the contrast and then filtering.
The contrast enhancement method adopted by the invention is gamma conversion, and in order to keep the edge information of the spinning cake image, the adopted filtering processing mode is bilateral filtering. And then, extracting an area needing oil stain grade judgment, namely ROI, wherein the effective area of the spinning cake of the image collected from the upper part of the spinning cake is an annular area, so that the circle center and the radius of the inner circle and the outer circle are obtained by a random Hough circle detection mode. The random Hough circle detection is an improvement of the traditional Hough circle detection, the traditional Hough circle detection needs to project points (x, y) to three-dimensional spaces (a, b, r) (wherein a and b represent circle center positions, and r represents a radius), an accumulator needs a large space, the operand does not meet the real-time requirement of industrial detection, the random Hough circle detection selects three points in a random mode, and the three points can determine a circle, so that the memory consumption is reduced, and the calculation time is saved. The mode obtains the circle centers and the radiuses of the inner circle and the outer circle, and determines an annular detection area. Because the pixel point difference of the oil stain is very large, the invention adopts a threshold segmentation mode, namely the pixel point output of which the pixel value is larger than a certain threshold is 255, and the pixel point output of which the pixel value is lower than the certain threshold is 0. Because the pixel values of the processed spinning cake image are not uniformly distributed, the invention uses a self-adaptive threshold method to carry out threshold segmentation and carries out segmentation according to the local mean values of different areas. After threshold segmentation processing, oil stains (with a pixel value of 255) can be counted in the annular detection area, the oil stains are converted into actual areas through oil stain area conversion proportion stored in a computer, and the computer gives oil stain grades through the oil stain areas and outputs the oil stain grades.
As shown in fig. 2, is an exemplary diagram of a sample of a spinning cake. The image is a spinning cake image sample acquired by an industrial camera, the camera position needs to be adjusted in advance in the camera calibration process in the step (1), the distance d from the lens to the top of the spinning cake is kept unchanged, and therefore the actual area S represented by a unit pixel point is obtained through the following formulap:
Sp=(D/Dpx)2
Wherein the number of the pixel points A3 represented by the diameter of the spinning cake is recorded as DpxThe diameter of the cake is marked as D.
The collected spinning cake images are 2 concentric circles, so that the centers and the radiuses of the inner circle and the outer circle can be obtained by using random Hough circle detection in the step (5), the actual detection area of the spinning cake in the step (6) is an annular area A1, and pixel points in an irrelevant area A2 can be ignored in the process of pixel point statistics.
Fig. 3 is a side view of the oil level assessment platform of an oil cake, the whole oil level assessment platform device is encapsulated by a sound-proof camera bellows 1 to reduce the influence of ambient light and ambient noise because illumination has a great influence on image acquisition, illumination is replaced by an annular light source 4, before image acquisition, the position of an industrial camera needs to be adjusted by an industrial camera position adjusting device 3 so that a cake 5 is completely visible in an image, and then an aperture ring and a focus ring of an industrial camera 2 need to be adjusted so that the cake 5 is clear in the image and has proper brightness; after adjusting the industrial camera 2 and its position, the knob on the holder 7 is fixed and no further adjustment is performed in the subsequent image acquisition. The entire oil contamination level assessment platform can then be connected to an external computer via a conveyor 6, and for each cake 5 on a conveyor belt 8, an image of the top of the cake is acquired by the industrial camera 2 and sent to the external computer via the conveyor, and the external computer finally outputs an oil contamination level assessment result for one cake via the process represented in fig. 1.
Fig. 4 is a camera calibration schematic of an oil cake. In image measurement processes and machine vision applications, in order to determine the correlation between the three-dimensional geometric position of a point on the surface of an object in space and the corresponding point in the image, an aggregate model of camera imaging must be established, and the parameters of the aggregate model are the parameters of a camera. Under most conditions, the parameters must be obtained through experiments and calculation, and the process of solving the parameters is called camera calibration. Before a batch of oil-contaminated spinning cakes are graded, a camera calibration is required to be carried out, and a standard is selectedAnd (3) fixing the spinning cake, firstly, adjusting the position of the industrial camera 2 and the brightness of the aperture ring, the focus ring and the annular light source 4 by using the adjusting device 3 to ensure that the spinning cake 5 is clearly and completely visible in the image and has proper brightness, and then fixing the positions of the industrial camera 2 and the annular light source 4, namely the height H from the camera lens to the conveyor belt 8 in the figure is kept unchanged. Because the height h of the greasy dirt spinning cake is unchanged, the distance d from the camera lens to the top of the spinning cake 5 is kept unchanged, so that the area S on the actual spinning cake represented by the unit pixel point in the subsequent grade evaluation process can be ensuredpRemain unchanged. Therefore, the spinning cake image can be transmitted back to an external computer C1 from the dark box 1 through the transmitter 7, the computer C1 can use Hough circle detection to search the maximum circle radius in the image, and the number D of pixel points represented by the spinning cake diameter can be measuredpxThen, the worker gives the actual diameter D of the spinning cake, and S can be calculated in the mode of the inventionpAnd stored in the computer. In the subsequent grade evaluation process, no matter whether the actual diameter of the spinning cake changes or not, as long as the distance d from the camera lens to the top of the spinning cake is kept unchanged, the area S on the actual spinning cake represented by the unit pixel pointpIt is still applicable.
Example 1:
the diameter of the spinning cake is measured and calibrated to be 280mm, the diameter of the spinning cake in an image is measured to be 1900px through a Hough circle detection algorithm, the length of 1px of the spinning cake on the image corresponds to 0.147368mm in practice by being substituted into the formula provided by the invention, namely, the oil stain of 1px approximately represents 0.0217mm in practice2The area of oil contamination. For example, for a certain greasy dirt spinning cake, 565 pixel points judged as greasy dirt in the interested region are counted by the method of the invention, and the area of the greasy dirt is converted into 0.1227cm2According to the industry standard of chemical fiber filament package appearance on-line intelligent detection, the oil stain area of each tube is less than 1cm2The spinning cake of (a) is a class a defect, so the spinning cake is a class a greasy dirt.