Cylindrical pot surface defect detection method, system, controller and industrial computer
Through the combination of area array cameras and coaxial light source equipment, the problem of low efficiency and poor accuracy in detecting small defects on the surface of cylindrical pots is solved. 360° image collection and defect identification of the surface of highly reflective metal cylindrical pots are achieved, which improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202210278362.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-03-21
AI Technical Summary
Existing technology cannot accurately detect tiny defects on the surface of highly reflective metal cylindrical pots, and line scan cameras are inefficient and easy to miss when detecting cylindrical products, which cannot meet the demand for rapid and accurate online inspection.
Using an inspection method that combines an area array camera and a coaxial light source device, the product to be inspected is fixed through a rotating device so that the inspection surface is on the focal plane of the area array camera, and the coaxial light source is driven to provide uniform illumination and collect 360° high-quality images. And through the industrial computer, image recognition processing is performed, feature information is extracted, dimensionality reduction and classification processing are performed to identify defects.
It realizes the dynamic acquisition of 360° high-quality images of the surface of high-brightness reflective metal cylindrical pots, improves the detection rate of small-sized defects, accurately completes the classification and positioning of defects, and meets the detection needs of metal cylindrical pot products of different sizes.
Smart Images

Figure CN114705686B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of metal surface defect detection, and in particular to a cylindrical pot surface defect detection method, a controller, an industrial computer and a cylindrical pot surface defect detection system. Background Art
[0002] Pots and cookware need to be polished and sanded to maintain their beautiful and durable surfaces. In the production process, irregular polishing can easily lead to scratches, dents, ripples and other defects, while sanding can easily lead to surface defects such as scratches, wrinkles and browning. In the current production process, surface defect detection of pots and cookware is generally completed by manual visual inspection, which has low detection efficiency and is easily affected by subjective factors, resulting in missed detection. It is no longer suitable for the needs of small-batch and customized production of products during the digital transformation of enterprises.
[0003] With the rapid development of electronic technology, machine vision can achieve fast and high-precision detection of products through non-contact measurement. It has the characteristics of fast response speed, flexible operation and high detection accuracy. It has been widely used in engineering applications in 3C, semiconductor packaging, electronics and other fields.
[0004] In the fields of hardware, electronics, and steel, the products are all regular sheet structures with high flatness and uniform size specifications. The machine vision light source can evenly illuminate the inspection area of the product, making it easy for the image acquisition device to obtain high-quality images with obvious defect features, avoiding the increase in the complexity of the detection algorithm design due to uneven grayscale of the image in the inspection area. However, in the field of hardware tableware and kitchenware, pot products are composed of pot lids, pot ears, pot handles, etc., especially cylindrical pots as typical products of pot products. In the production process, different styles of pot bodies can be flexibly matched to achieve the production of multiple styles of pot products, but the cylindrical pot body has a wide variety of sizes and specifications, and it is necessary to frequently change production on the production line to adapt to the rapid production of different styles of products. Therefore, when using the visual inspection system for inspection, it is necessary to adapt to cylindrical pots of different curvature specifications and heights. In particular, the defects on the surface of the metal cylindrical pot after polishing and sanding are complex and varied, and the scratch defects are subtle. The scratch detection accuracy is required to be above 50 microns. The mirror reflection on the surface of the pot body is very obvious, which easily causes the image acquisition system to be seriously affected by ambient light. At present, when inspecting surface defects of cylindrical pots of different diameters, a line scan camera and a line light source are usually used to extract the surface features of the cylinder. This can avoid uneven lighting in the inspection area. However, when inspecting cylindrical products, the line scan camera needs to stitch multiple images to capture the complete cylindrical image. The image acquisition cycle is long and the efficiency is low. In addition, the line scan camera is expensive. The pits and protrusions in the cylindrical surface area captured are not obvious, and it is easy to miss obvious defect areas with abnormal cylindrical shapes, increasing the missed detection rate and false detection rate. Therefore, the visual inspection solution of the line scan camera and line light source combination cannot meet the requirements of online fast and accurate detection, and has never been put into practical use on the production line of cylindrical pots. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a cylindrical pot surface defect detection method, system, controller and industrial computer, which can accurately complete the classification of high-brightness reflective metal cylindrical pot surface defects.
[0006] In order to solve the above technical problems, the present invention provides a method for detecting surface defects of a cylindrical pot, comprising: fixing a product to be inspected on the rotating device, and making the detection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device; driving the coaxial light source device to provide lighting to the product to be inspected; driving the area array camera to perform image acquisition on the surface of the product to be inspected to generate a target image; driving the industrial computer to perform recognition processing on the target image to extract feature information of the target image; driving the industrial computer to perform dimensionality reduction and classification processing on the feature information to identify defects of the product to be inspected.
[0007] As an improvement of the above scheme, the rotating device is provided with a stage, a screw rod, a negative pressure generator, a die head mechanism and negative pressure air holes arranged on the stage, and the steps of fixing the product to be inspected on the rotating device and making the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device include: driving the robot to place the product to be inspected on the die head mechanism; driving the screw rod to adjust the position of the stage so that the inspection surface of the product to be inspected is on the focal plane of the area array camera; driving the negative pressure generator to generate negative pressure so that the product to be inspected is subjected to negative pressure through the negative pressure air holes and is fixed on the die head mechanism under the action of the negative pressure; driving the die head mechanism to rotate so that the product to be inspected rotates synchronously with the die head mechanism.
[0008] As an improvement of the above scheme, the step of driving the area array camera to capture images of the surface of the product to be inspected to generate a target image includes: the controller generates a trigger signal after receiving an incoming material signal and a negative pressure signal, wherein the incoming material signal is sent to the controller by the robot, and the negative pressure signal is sent to the controller by the rotating device; the controller sends the trigger information to the area array camera to drive the area array camera to capture the target image and send the target image to the industrial computer; the controller obtains a single acquisition completion signal, and determines whether the rotating device has rotated a preset angle according to the single acquisition completion signal, the single acquisition signal is sent to the controller by the area array camera after completing the acquisition of a single target image, and when the judgment is yes, the rotating device is driven to stop rotating and the area array camera is driven to stop capturing the target image, and when the judgment is no, the rotating device is driven to continue rotating and the area array camera is driven to continue capturing the target image.
[0009] As an improvement of the above scheme, the industrial computer performs recognition processing on the target image to extract the characteristic information of the target image, including the following steps: judging whether the target image meets the detection requirements; if the target image meets the detection requirements, performing median filtering on the target image; performing black hat operation on the target image after the median filtering to obtain defect contour information; performing opening operation on the target image after the black hat operation to eliminate interference information; performing binarization processing and connected domain analysis on the target image after the opening operation to generate a connected domain analysis result, the connected domain analysis result includes the number of connected domains and the centroid coordinates of each connected domain; using an edge detection algorithm to extract defect edges from the target image to generate an edge detection result; and extracting geometric features, grayscale features and invariant moment features on the target image based on the connected domain analysis result and the edge detection result.
[0010] As an improvement of the above scheme, the step of using an edge detection algorithm to extract defect edges from the target image to generate an edge detection result includes: using a Gaussian function to perform smoothing filtering on the target image; calculating the gradient value and direction angle of each pixel point in the target image after smoothing filtering to generate a gradient image; performing non-maximum suppression processing on the gradient image; and using double threshold screening to perform edge connection processing on the gradient image after non-maximum suppression processing.
[0011] As an improvement of the above scheme, the steps of driving the industrial computer to reduce the dimension and classify the feature information to identify the defects of the product to be inspected include: using principal component analysis to reduce the dimension of the feature information; and using a nonlinear support vector machine to classify the feature information after the dimension reduction process.
[0012] As an improvement of the above solution, the kernel function of the nonlinear support vector machine is a radial basis kernel function, and the expression of the radial basis kernel function is: K(x,x i ) = exp(-γ||x i -x j || 2 ), where γ is used to set the gamma parameter of the kernel function.
[0013] Correspondingly, the present invention also provides a controller, including: a rotation drive module, used to fix the product to be inspected on the rotating device, and make the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device; a light source drive module, used to drive the coaxial light source device to provide lighting to the product to be inspected; a camera drive module, used to drive the area array camera to capture images of the surface of the product to be inspected to generate a target image; an industrial computer drive module, used to drive the industrial computer to identify and process the target image to extract feature information of the target image, and drive the industrial computer to perform dimensionality reduction and classification processing on the feature information to identify defects of the product to be inspected.
[0014] As an improvement of the above scheme, the rotating device is provided with a stage, a screw, a negative pressure generator, a die head mechanism and a negative pressure air hole arranged on the stage, and the rotating drive module includes: a robot driving unit, used to drive the robot to place the product to be inspected on the die head mechanism; an adjustment driving unit, used to drive the screw to adjust the position of the stage so that the inspected surface of the product to be inspected is located on the focal plane of the area array camera; a negative pressure generating unit, used to drive the negative pressure generator to generate negative pressure, so that the product to be inspected is subjected to negative pressure through the negative pressure air hole and is fixed on the die head mechanism under the action of the negative pressure; a rotation driving unit, used to drive the die head mechanism to rotate so that the product to be inspected rotates synchronously with the die head mechanism.
[0015] As an improvement of the above scheme, the camera driving module includes: a trigger unit, which is used to generate a trigger signal after receiving an incoming material signal and a negative pressure signal, wherein the incoming material signal is sent by the robot to the controller, and the negative pressure signal is sent by the rotating device to the controller; a sending unit, which is used to send the trigger information to the area array camera to drive the area array camera to capture a target image and send the target image to the industrial computer; a control unit, which is used to obtain a single acquisition completion signal, and judge whether the rotating device has rotated a preset angle according to the single acquisition completion signal, and when it is judged to be yes, drive the rotating device to stop rotating and drive the area array camera to stop capturing the target image, and when it is judged to be no, drive the rotating device to continue rotating and drive the area array camera to continue capturing the target image, and the single acquisition signal is sent to the controller by the area array camera after completing the capture of a single target image.
[0016] Accordingly, the present invention also provides an industrial computer, comprising: an identification module, used to perform identification processing on a target image to extract feature information of the target image; a dimension reduction classification module, used to perform dimension reduction and classification processing on the feature information to identify defects of a product to be inspected;
[0017] The recognition module includes: a judgment unit, which is used to judge whether the target image meets the detection requirements; a filtering unit, which is used to perform median filtering on the target image when the target image meets the detection requirements; a black hat unit, which is used to perform black hat operation on the target image after the median filtering to obtain defect contour information; an opening operation unit, which is used to perform opening operation on the target image after the black hat operation to eliminate interference information; an analysis unit, which is used to perform binarization processing and connected domain analysis on the target image after the opening operation to generate a connected domain analysis result, and the connected domain analysis result includes the number of connected domains and the centroid coordinates of each connected domain; an edge extraction unit, which is used to extract defect edges from the target image using an edge detection algorithm to generate an edge detection result; a feature extraction unit, which is used to extract geometric features, grayscale features and invariant moment features on the target image according to the connected domain analysis result and the edge detection result.
[0018] Correspondingly, the present invention also provides a cylindrical pot surface defect detection system, comprising an area array camera, a coaxial light source device, a rotating device, a fixed frame, the above-mentioned controller and the above-mentioned industrial computer, the controller is respectively connected to the industrial computer, the area array camera, the coaxial light source device and the rotating device; the area array camera, the coaxial light source device and the rotating device are arranged in a straight line on the fixed frame in sequence, and the rotating device is arranged within the depth of field of the area array camera; the rotating device comprises a stage, a screw rod, a negative pressure generator, a reducer, a motor and a die head mechanism and a negative pressure air hole arranged on the stage, the motor is connected to the stage through the reducer to drive the stage to rotate, and the negative pressure generator is used to generate negative pressure and apply the negative pressure to the product to be inspected through the negative pressure air hole.
[0019] The implementation of the present invention has the following beneficial effects:
[0020] The present invention improves the acquisition efficiency of the industrial camera by using a highly efficient acquisition method through the coordination of a coaxial light source device, an array camera, and a rotating device. For a single detection object, there is no need to frequently start and stop the rotating mechanism, and the dynamic acquisition of a 360° cylindrical surface high-quality image of a high-brightness reflective metal cylinder can be achieved, which can meet the detection needs of metal cylindrical pots of different sizes. At the same time, the present invention adopts a coaxial light source lighting form, which can effectively overcome the uneven illumination phenomenon caused by the curved metal material of the cylindrical pot product itself, and improve the detection rate of tiny size defects.
[0021] Furthermore, the present invention can achieve the subtraction of corresponding pixel values of two images through the method of image black hat operation, so as to weaken the background part of the image and highlight the changed part of the image. The differential image can detect the outline of the surface defects of the highlighted reflective metal cylindrical pot, thereby extracting the target defect information; the present invention can quickly achieve the positioning and quantitative statistics of the surface defects of the highlighted reflective metal cylindrical pot through the method of connected domain analysis; the present invention adopts the PCA algorithm and the support vector machine SVM technology, which can accurately complete the classification of the surface defects of the highlighted reflective metal cylindrical pot. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of an embodiment of a method for detecting surface defects of a cylindrical pot according to the present invention;
[0023] Figure 2 It is a flow chart of fixing the product to be inspected on the rotating device in the present invention, and making the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device;
[0024] Figure 3 It is a flow chart of driving the area array camera to collect images of the surface of the product to be inspected to generate a target image in the present invention;
[0025] Figure 4It is a flow chart of the industrial computer in the present invention performing recognition processing on the target image to extract feature information of the target image;
[0026] Figure 5 It is a flow chart of driving the industrial computer to perform dimension reduction and classification processing on feature information in the present invention to identify defects of the product to be inspected;
[0027] Figure 6 It is a structural schematic diagram of a cylindrical pot surface defect detection system of the present invention;
[0028] Figure 7 It is a structural schematic diagram of the controller in the present invention;
[0029] Figure 8 It is a structural schematic diagram of the rotation drive module in the present invention;
[0030] Fig. 9 is a structural schematic diagram of a camera driving module in the present invention;
[0031] Fig.10 It is a structural schematic diagram of the industrial control computer in the present invention. DETAILED DESCRIPTION
[0032] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0033] See also Figure 1 , Figure 1 The flowchart of an embodiment of the cylindrical pot surface defect detection method of the present invention is shown, which comprises:
[0034] S101, fixing the product to be inspected on a rotating device, and making the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device.
[0035] It should be noted that the product to be inspected in the present invention may be a high-brightness reflective metal cylindrical pot, but is not limited thereto.
[0036] like Figure 6 As shown, the cylindrical pot surface defect detection system includes an area array camera, a coaxial light source device, a rotating device, a fixing frame, a controller and an industrial computer. The controller is connected to the industrial computer, the area array camera, the coaxial light source device and the rotating device respectively; the area array camera, the coaxial light source device and the rotating device are arranged in a straight line on the fixing frame in sequence, and the rotating device is arranged within the depth of field of the area array camera.
[0037] When the product to be inspected is fixed on the rotating device, it is necessary to ensure that the inspection surface of the product to be inspected is on the focal plane of the area array camera so that the area array camera can collect a clear surface image of the product to be inspected. At the same time, the product to be inspected is driven to rotate by the rotating device so that the area array camera can collect the outer surface of the product to be inspected in all directions.
[0038] S102, driving the coaxial light source device to provide lighting to the product to be inspected.
[0039] The coaxial light source equipment can provide uniform lighting for the products to be inspected, highlight the uneven surface of the object, overcome the interference caused by surface reflection, and be used to enable high-brightness cylindrical pot products with random processing textures to clearly display defect image characteristics, thereby improving the observability of surface defects and the accuracy of the machine vision inspection system.
[0040] S103, driving the area array camera to collect images of the surface of the product to be inspected to generate a target image.
[0041] Since the light source controller used with the coaxial light source has a trigger delay phenomenon, in order to avoid insufficient exposure time of the area array camera, the coaxial light source should be started before the area array camera collects images, that is, the coaxial light source equipment and the industrial area array camera need to be triggered and started in sequence to collect images of the surface of the product to be inspected. At the same time, since the area array camera adopts the global shutter working mode, the rotating device does not need to stop rotating before the area array camera collects images.
[0042] Preferably, the area array camera used in the present invention has a pixel of 5 million or more, and the area array camera supports the acquisition of high-definition images with a frame rate of 24fps and a resolution of 2592×1944 or more without motion blur, ensuring that the detection accuracy and detection system efficiency meet production requirements.
[0043] S104, driving the industrial computer to perform recognition processing on the target image to extract feature information of the target image.
[0044] After the area array camera captures the target image, the target image needs to be imported into the industrial computer for processing.
[0045] S105, driving the industrial computer to perform dimension reduction and classification processing on the feature information to identify defects of the product to be inspected.
[0046] It should be noted that the feature samples obtained by dimensionality reduction can be divided into an SVM training set and a test set, and then the defect content in the target image can be identified through the trained SVM model to complete the surface defect identification of the product to be inspected.
[0047] Therefore, the present invention can obtain high-quality cylindrical local images through the combined use of a rotating device and an area array camera; and combine recognition, dimensionality reduction and classification processing to realize automated surface defect detection of high-brightness light-reflecting metal cylindrical pot products, which can effectively determine the location of surface defects of the cylindrical pot products and information such as the type of defects.
[0048] Furthermore, the identified test results can be fed back to the host computer in real time, and the operator can view the test results through the display of the host computer. The test results include information such as product defect location, defect type, and defect rate. The host computer sorts the products according to the test results.
[0049] See also Figure 2 , Figure 2 The specific steps of fixing the product to be inspected on the rotating device and making the inspection surface of the product to be inspected on the focal plane of the area array camera and rotating synchronously with the rotating device in the present invention are shown, including:
[0050] S201, driving the robot to place the product to be inspected on the die head mechanism.
[0051] like Figure 6 As shown, the rotating device is provided with a loading platform, a spiral screw, a negative pressure generator, a die head mechanism and negative pressure air holes arranged on the loading platform.
[0052] S202, driving the screw rod to adjust the position of the stage so that the surface to be inspected of the product to be inspected is located on the focal plane of the area array camera.
[0053] When it is necessary to replace the product to be inspected with a different diameter, the fixing device used to fix the rotating device can be loosened first, and then the inspection surface of the product to be inspected can be automatically / manually moved to the focal plane of the area array camera through the screw rod, and the current position of the rotating mechanism can be fixed by the fixing device to prevent the rotating mechanism from moving forward and backward.
[0054] S203, driving the negative pressure generator to generate negative pressure, so that the product to be inspected is subjected to negative pressure through the negative pressure air hole and is fixed on the die head mechanism under the action of the negative pressure.
[0055] When the product to be inspected is placed on the die head mechanism, the negative pressure generator is started to generate negative pressure, and the product to be inspected is subjected to the negative pressure through the air holes and is fixed on the die head device of the rotating mechanism.
[0056] S204, driving the die head mechanism to rotate so that the product to be inspected rotates synchronously with the die head mechanism.
[0057] Furthermore, the product to be inspected is placed before the die head mechanism, and the surface of the product to be inspected can be cleaned to remove residual stains of the surface polishing wax, thereby improving the accuracy of the inspection.
[0058] Therefore, under the joint action of the robot, the die head mechanism, the screw rod, the negative pressure generator and the negative pressure pores, the present invention realizes the flexible replacement of the product to be inspected, with high safety and accuracy.
[0059] See also Figure 3 , Figure 3The specific steps of driving the area array camera to collect images of the surface of the product to be inspected to generate a target image in the present invention include:
[0060] S301, the controller generates a trigger signal after receiving an incoming material signal and a negative pressure signal.
[0061] Among them, the incoming material signal is sent to the controller by the robot, and the negative pressure signal is sent to the controller by the rotating device.
[0062] It should be noted that when the product to be inspected is placed on the rotating device, the robot will send a material incoming signal to the controller, and at the same time, the rotating device will also generate a negative pressure signal to the controller.
[0063] S302: The controller sends trigger information to the area array camera to drive the area array camera to capture a target image and send the target image to the industrial computer.
[0064] After the area array camera captures the target image, it sends the target image to the industrial computer through the gigabit communication line.
[0065] S303, the controller obtains a single acquisition completion signal, and determines whether the rotating device has rotated a preset angle according to the single acquisition completion signal.
[0066] It should be noted that after the area array camera triggers an action of capturing a target image (i.e., taking a photo), a single capture completion signal is generated and output to the controller. In other words, the single capture signal is sent to the controller after the area array camera completes the capture of a single target image.
[0067] In addition, when the area array camera collects the target image, the rotating device rotates continuously, so the area array camera can collect the complete outer surface pattern of the product to be inspected. Therefore, in order to avoid repeated photography, the rotation state of the rotating device needs to be judged.
[0068] S304: When the judgment is yes, the rotating device is driven to stop rotating and the area array camera is driven to stop collecting the target image.
[0069] If the rotating device has rotated 360°, it means that the area array camera can stop taking pictures, and the rotating device can also stop rotating.
[0070] S305: When the judgment is no, the rotating device is driven to continue rotating and the area array camera is driven to continue acquiring the target image.
[0071] If the rotating device does not rotate 360°, it means that the area array camera still needs to continue taking pictures, and the rotating device also needs to keep rotating.
[0072] Therefore, the present invention improves the acquisition efficiency of the area array camera by cooperating with the controller, the area array camera and the rotating device, and adopts an efficient acquisition method. For a single detection object, there is no need to frequently start and stop the rotating mechanism, and the dynamic acquisition of high-quality images of the 360° cylindrical surface of the high-brightness reflective metal cylinder can be achieved, which can meet the detection needs of metal cylindrical pots of different sizes. If necessary, multiple image acquisition stations can be set to improve the image acquisition efficiency of the image acquisition system for a single product. The overall structure is simple, maintenance is convenient, and it is easy to promote and popularize.
[0073] See also Figure 4 , Figure 4 The specific steps of the industrial computer in the present invention performing recognition processing on the target image to extract feature information of the target image include:
[0074] S401, determining whether the target image meets the detection requirements.
[0075] Determine whether the target image meets the detection requirements, that is, determine whether the spot area of the target image clearly reflects the surface information of the metal cylindrical pot. Specifically, (1) it can be determined through grayscale statistical information. When the number of high grayscale pixels reaches a preset value, it means that the target image has a highlight surface. (2) The image clarity of the cylindrical spot area is evaluated by the operator's subjective evaluation / through the clarity evaluation algorithm. When the clarity evaluation function reaches a preset value, it means that the target image has a clear highlight surface.
[0076] It should be noted that shallow scratches, pits, and protrusions in the cylindrical spot area of the high-brightness reflective metal cylindrical pot appear as low-brightness blocks in the image. Therefore, the area to be detected that can be located by the region of interest (ROI) method is the cylindrical spot area of the high-brightness reflective metal cylindrical pot.
[0077] S402: If the target image does not meet the detection requirements, the touch industrial display is driven to display an error message.
[0078] It should be noted that if the target image does not meet the detection requirements, an error message can be displayed on the touch industrial display to remind the operator to adjust the light source brightness / camera exposure time / die position.
[0079] S403: If the target image meets the detection requirements, median filtering is performed on the target image.
[0080] It should be noted that median filtering can not only remove isolated point noise, but also maintain the edge characteristics of the image; compared with Gaussian filtering, median filtering will not cause significant blurring of the image, and is more suitable for the surface detection image of the high-brightness reflective metal cylindrical pot in the present invention.
[0081] Therefore, the high-quality cylindrical image is the image of the area to be detected after filtering.
[0082] S404, performing a black hat operation on the target image after the median filtering process to obtain defect contour information.
[0083] The black hat operation method is used to perform a difference operation between the closing operation result of the image of the area to be detected and the image of the area to be detected, which is the black hat operation in the digital image morphological operation.
[0084] Therefore, the black hat operation can separate the patches with lower grayscale levels than the surrounding areas of the original image contour, thereby obtaining the patch contour with a relatively complete defect edge. In other words, the initially obtained product defect contour information is the image of the area to be detected after the black hat operation, and the initially obtained product defect image, compared with the image of the area to be detected, highlights the area darker than the area around the contour of the image of the area to be detected, that is, the defect area.
[0085] S405, performing an opening operation on the target image after the black hat operation to eliminate interference information.
[0086] The morphological opening operation is to corrode the image first and then dilate it. The opening operation can effectively eliminate small burrs, tiny bright spots and bright lines, remove isolated points outside the target, and smooth the boundaries and contours of larger objects.
[0087] S406, performing binarization processing and connected domain analysis on the target image after the opening operation to generate a connected domain analysis result.
[0088] The results of connected domain analysis include the number of connected domains and the centroid coordinates of each connected domain.
[0089] Connected domain analysis is performed on the binary image after grayscale binarization to find out the connected domains in the target image, mark the connected domains by the minimum bounding rectangle, calculate the centroid coordinates of each connected domain, and count the number of connected domains. Among them, the minimum bounding rectangle of the defect area is the centroid coordinates of the minimum bounding rectangle of the connected domain obtained by the connected domain analysis on the image of the area to be detected, and the minimum bounding rectangle of the defect area is the minimum area bounding rectangle with a rotation angle.
[0090] It should be noted that the connected domain is an image region composed of foreground pixels with the same pixel value and adjacent positions in the target image, wherein the centroid of the connected domain is the defect centroid, and the number of connected domains is the number of defects.
[0091] S407, using an edge detection algorithm to extract defect edges from the target image to generate an edge detection result.
[0092] Furthermore, the edge detection algorithm in the present invention is the Canny algorithm, which is a further refinement of the effects of operators such as Sobel and Prewitt and a more accurate positioning.
[0093] Specifically, the step of extracting defect edges from a target image using an edge detection algorithm to generate an edge detection result includes:
[0094] (1) Use Gaussian function to perform smoothing filtering on the target image.
[0095] Preferably, the present invention uses a 7×7 template as the filtering template of the Gaussian function, but is not limited thereto and can be adjusted according to actual conditions.
[0096] (2) Calculate the gradient value and direction angle of each pixel in the target image after smoothing filtering to generate a gradient image.
[0097] Calculate the gradient value and direction angle in the x and y directions for each pixel in the target image.
[0098] (3) Perform non-maximum suppression on the gradient image.
[0099] (4) Double threshold screening is used to perform edge connection processing on the gradient image after non-maximum suppression processing.
[0100] S408, extracting geometric features, grayscale features and invariant moment features on the target image according to the connected domain analysis results and edge detection results.
[0101] Geometric features are the basic features of the target image, which are used to describe the geometric shape properties of the defect, including the perimeter, area, rectangularity, circularity and density of the defect area;
[0102] Grayscale histogram is the probability statistics of grayscale distribution of image. Therefore, grayscale features can be obtained from its grayscale histogram. Specific grayscale features include grayscale average value, grayscale variance, energy, entropy, maximum grayscale value, minimum grayscale value and grayscale contrast amplitude of defect area.
[0103] The invariant moment feature is obtained by combining the second-order and third-order moments of the target image to obtain 7 invariant moments, which are invariant to rotation, scaling and translation.
[0104] Therefore, the connected domain analysis results and edge detection results obtained in steps S406 and S407 are fed back to the image of the area to be detected, and then the above-mentioned feature extraction is performed on the area to be detected.
[0105] Specifically, let f(x, y) represent the image data of the area to be detected, where x represents the horizontal coordinate of the image pixel, y represents the vertical coordinate of the image pixel, R is the plane area where the image is located, and Rx is the image horizontal coordinate set, R y is the image ordinate set, R d is the set of interest points of suspected defect targets in the image, R b is the boundary point set of the defect target, then the corresponding geometric feature description formula is as follows:
[0106] (1) The perimeter P of the defect area is the total number of pixels occupied by the outer contour of the defect:
[0107]
[0108] (2) The area S of the defect area is the sum of the pixels in the defect target area:
[0109]
[0110] (3) Rectangularity R of defect area t The length L of the longest side of the minimum circumscribed rectangle of the area l With the short side length L s Ratio of:
[0111] R t =L s / L l
[0112] Among them, the centroid coordinates of the defect area can be calculated through the above method and used to characterize the location of the defect.
[0113] (4) Circularity of defect area:
[0114]
[0115]
[0116]
[0117]
[0118] Among them, Rc is used to calculate the circularity, U r is the average distance from the center of gravity of the region to the boundary point, σ r is the mean square error from the center of gravity of the region to the boundary point; when the target boundary is a circle, the circularity of the target R c is 1, otherwise R c Greater than 1.
[0119] (5) Density C of defect area:
[0120] C=4π·S / P 2
[0121] When the defect area is circular, the density C of the area is 1, otherwise C is less than 1.
[0122] Correspondingly, the grayscale feature description formula is as follows:
[0123] The first-order grayscale histogram of an image is defined as:
[0124]
[0125] Where M is the total number of pixels in the statistical image area centered on pixel (i, j); N(b) represents the number of pixels with grayscale value b in the statistical image area; b is the grayscale quantization level, which has L levels. For surface defects, the statistical image area can extract the region of interest of the defect as R d The corresponding grayscale feature description formula is as follows:
[0126] (1) Grayscale average value
[0127]
[0128] (2) Grayscale variance v 2 :
[0129]
[0130] (3) Energy H P :
[0131]
[0132] (4) Entropy H E :
[0133]
[0134] (5) Grayscale contrast amplitude contrastG:
[0135] contrastG=maxG-minG
[0136] Among them, maxG is the maximum grayscale value, and minG is the minimum grayscale value:
[0137] maxG=max{f(i,j)}
[0138] minG=min{f(i,j)}
[0139] In addition, the invariant moment feature description formula is as follows:
[0140] Based on the image data f(x, y) of the area to be detected, the (p+q)-order moment m pq and the central moment u pq is defined as follows:
[0141]
[0142]
[0143] Among them, M, N are the length and width of the image respectively, and p, q = 0, 1, 2,….
[0144] The normalized central moment is defined as:
[0145]
[0146] Among them, p and q satisfy the condition p+q=2,3,….
[0147] The seven invariant moments are constructed by combining the second-order and third-order central moments, which are defined as follows:
[0148]
[0149] Therefore, the present invention first obtains the high-quality cylindrical image area to be detected by locating the area of interest, and then preliminarily obtains the product defect contour information through the black hat operation method, and uses morphological opening operation to eliminate interference such as small bright spots and bright lines, smooth the boundaries of larger objects, and then marks the connected domain of the binary image, calculates the defect centroid and counts the number of defects, and finally, uses the Canny algorithm to complete the extraction of the defect edge, realizes the positioning of the minimum circumscribed rectangle of the defect area and feature extraction; the entire recognition process is closely linked, and the feature extraction of the target image can be performed from multiple angles with high accuracy.
[0150] See also Figure 5 , Figure 5 The specific steps of driving the industrial computer to reduce the dimension and classify the feature information to identify the defects of the product to be inspected in the present invention include:
[0151] S501, using principal component analysis to perform dimensionality reduction processing on feature information.
[0152] In order to completely extract the feature information of the area to be detected, the industrial computer extracts features of the target image from multiple angles when performing recognition processing on the target image; since the dimension of the obtained feature vector is large, the computational burden of the classifier is increased, affecting the classification and recognition effect and efficiency, so it is necessary to reduce the dimension of the feature vector through feature selection.
[0153] It should be noted that feature selection, expressed in mathematical language, is to transform a high-dimensional feature vector into a low-dimensional feature vector through mapping, and this low-dimensional feature vector can retain most of the information of the high-dimensional feature vector. Accordingly, the present invention uses principal component analysis (PCA) to reduce the dimension of feature information, and the specific dimension reduction steps include:
[0154] (1) Calculate the covariance matrix of the image;
[0155] (2) Calculate the eigenvalues and eigenvectors of the covariance matrix;
[0156] (3) Calculate the principal component contribution rate and cumulative contribution rate;
[0157] (4) Calculate the principal component loads;
[0158] (5) Calculate the principal components.
[0159] S502: Using a nonlinear support vector machine to classify the feature information after the dimension reduction process.
[0160] It should be noted that the accuracy of classification depends on the selection of the classifier. The present invention utilizes a nonlinear support vector machine to identify defect content in a target image, thereby completing the classification of surface defects of a high-brightness reflective metal cylindrical pot.
[0161] The most critical part of nonlinear support vector machine is the selection of kernel function. Different kernel functions will give different results when defect classification is performed. The present invention adopts radial basis kernel function as the kernel function of the classifier in nonlinear support vector machine. Specifically, the expression of radial basis kernel function is:
[0162] K(x,x i ) = exp(-γ||x i -x j || 2 )
[0163] Among them, γ is used to set the gamma parameter of the kernel function.
[0164] In summary, the present invention has the following beneficial effects:
[0165] 1. The present invention improves the acquisition efficiency of industrial cameras by coordinating coaxial light source equipment, array cameras, and rotating devices, and adopts an efficient acquisition method. For a single detection object, there is no need to frequently start and stop the rotating mechanism, and it can achieve dynamic acquisition of high-quality images of the 360° cylindrical surface of a high-brightness reflective metal cylinder, which can meet the detection needs of metal cylindrical pots of different sizes;
[0166] 2. The present invention adopts a coaxial light source to effectively overcome the uneven illumination caused by the curved metal material of the cylindrical pot product itself, and improve the detection rate of tiny size defects;
[0167] 3. The present invention can achieve the subtraction of the corresponding pixel values of two images through the image black hat operation method, so as to weaken the background part of the image and highlight the changed part of the image. The differential image can detect the outline of the surface defect of the highlight reflective metal cylindrical pot, thereby extracting the target defect information;
[0168] 4. The present invention can quickly locate and count the surface defects of a high-brightness reflective metal cylindrical pot through the connected domain analysis method;
[0169] 5. The present invention adopts PCA algorithm and support vector machine SVM technology to accurately complete the classification of surface defects of high-brightness reflective metal cylindrical pots.
[0170] See also Figure 6 , Figure 6 The specific structure of the cylindrical pot surface defect detection system of the present invention is shown, which includes an array camera 1, a coaxial light source device 2, a rotating device 3, a fixing frame, a controller 4 and an industrial computer 5. The controller 4 is connected to the industrial computer 5, the array camera 1, the coaxial light source device 2 and the rotating device 3 respectively. Specifically:
[0171] The area array camera 1 , the coaxial light source device 2 , and the rotating device 3 are arranged in a straight line on a fixed frame in sequence, and the rotating device 3 is arranged within the depth of field of the area array camera 1 .
[0172] The area array camera 1 uses a soft trigger working mode to continuously collect images, and is connected to the communication interface of the industrial computer 5 through a highly flexible gigabit communication line to complete high-speed image data transmission. Preferably, the area array camera 1 used in the present invention has a pixel of more than 5 million, and the area array camera 1 supports the acquisition of high-definition images with a frame rate of 24fps and a resolution of more than 2592×1944 without motion blur, ensuring that the detection accuracy and detection system efficiency meet production requirements.
[0173] The rotating device 3 includes a stage 31, a screw 32, a negative pressure generator, a reducer 33, a motor 34, a die head mechanism 35 and a negative pressure air hole 36 arranged on the stage 31, and a ventilation duct 37 is embedded in the middle of the die head mechanism 35; the stage 31 is used to fix the reducer 33 and the motor 34, and the motor 34 is connected to the stage 31 through the reducer 33 to drive the stage 31 to rotate; the negative pressure air hole 36 is connected to the negative pressure generator, and the negative pressure generator is used to generate negative pressure and apply the negative pressure to the product 7 to be inspected through the negative pressure air hole 36; the forward and backward movement of the stage 31 can be adjusted by the screw 32, and accordingly, a hand wheel 38 can also be set on the screw 32 to facilitate manual adjustment of the screw 32; preferably, the motor 34 is a pulse servo motor 34, but it is not limited to this.
[0174] The coaxial light source device 2 includes a light source controller 21 and a coaxial light source 22, wherein the light source controller 21 includes a light source interface 211, an adjustment button 212, a digital tube display screen 213 and an RS232 serial port female socket 214, and the coaxial light source 22 includes an LED lamp bead 221, a diffusion lens 222, a spectroscopic lens 223, an inspection window 224 and a light exit window 225. In actual operation, the light source controller 21 can be provided with a lighting control signal through the adjustment button 212, and the light source control signal can be output to the coaxial light source 22 through the light source interface 211 to control the working mode and channel output value of the coaxial light source 22, and displayed through the digital tube display screen 213, wherein the digital tube display screen 213 displays the current operating channel from the first digit from the left and the numerical value corresponding to the current operation from the last three digits; at the same time, the light emitted by the LED lamp bead 221 can be sequentially irradiated to the product to be inspected 7 of the rotating device 3 through the diffusion lens 222, the spectroscopic lens 223 and the light exit window 225.
[0175] The controller 4 is provided with an RS485 port, a high-speed counter, an I / O module and an RS232 port; specifically, the controller 4 is connected to the industrial computer 5 through the RS232 port and communicates using the Modbus protocol, is connected to and communicates with the motor 34 through the RS485 port, and is connected to external sensing devices (such as negative pressure sensors, relays and limit switches, etc.) through the I / O module; in addition, the high-speed counter is connected to the pulse output line of the motor 34, and the product count will increase after the rotating device 3 rotates one circle. Preferably, the controller 4 is a programmable logic controller 4, but this is not limited to it.
[0176] The industrial computer 5 is equipped with necessary computer components such as a computer motherboard, a CPU, a gigabit image acquisition card, a memory stick, a solid state hard disk, etc., which are used to store the images collected by the area array camera 1 and identify the surface defect characteristics of the high-gloss cylindrical pot product in the image.
[0177] It should be noted that when the product to be inspected 7 is fixed on the rotating device 3, it is necessary to ensure that the inspection surface of the product to be inspected 7 is on the focal plane of the area array camera 1, so that the area array camera 1 can capture a clear surface image of the product to be inspected 7; at the same time, the product to be inspected 7 is driven to rotate by the rotating device 3, so that the area array camera 1 can capture the outer surface of the product to be inspected 7 in all directions; in addition, the coaxial light source device 2 can provide uniform lighting for the product to be inspected 7, highlight the uneven surface of the object, overcome the interference caused by surface reflection, and be used to enable the high-brightness cylindrical pot product with random processing texture to clearly display the defect image characteristics, thereby improving the observability of surface defects and the accuracy of the machine vision inspection system.
[0178] Furthermore, the cylindrical pot surface defect detection system also includes a touch industrial display 6 connected to the industrial computer 5, and the touch industrial display is used for human-machine interface display and touch control, and can display the image and recognition result collected by the area array camera 1 in real time. Among them, the recognition result includes information such as product defect location, defect type, and defect rate, and the host computer sorts the products according to the detection results.
[0179] The controller 4 and the industrial computer 5 are further described in detail below in conjunction with the specific drawings:
[0180] like Figure 7 As shown, the controller 4 includes a rotation driving module 41, a light source driving module 42, a camera driving module 43 and an industrial computer driving module 44. Specifically:
[0181] The rotation driving module 41 is used to fix the product 7 to be inspected on the rotating device 3 , and make the inspection surface of the product 7 to be inspected be on the focal plane of the area array camera 1 and rotate synchronously with the rotating device 3 .
[0182] The light source driving module 42 is used to drive the coaxial light source device 2 to provide lighting to the product to be inspected 7 .
[0183] The camera driving module 43 is used to drive the area array camera 1 to collect images of the surface of the product to be inspected 7 to generate a target image.
[0184] The industrial computer driving module 44 is used to drive the industrial computer 5 to perform recognition processing on the target image to extract feature information of the target image, and drive the industrial computer 5 to perform dimensionality reduction and classification processing on the feature information to identify defects of the product to be inspected 7.
[0185] It should be noted that, since the light source controller 21 used in conjunction with the coaxial light source 22 has a trigger delay phenomenon, in order to avoid insufficient exposure time of the area array camera 1, the coaxial light source 22 should be started before the area array camera 1 collects images, that is, the coaxial light source device 2 and the industrial area array camera are triggered and started in sequence to collect images of the surface of the product to be inspected 7. At the same time, since the area array camera 1 adopts the working mode of the global shutter, the rotating device 3 does not need to stop rotating before the area array camera 1 collects images.
[0186] like Figure 8 As shown, the rotation driving module 41 includes a robot driving unit 411, an adjustment driving unit 412, a negative pressure generating unit 413 and a rotation driving unit 414. Specifically:
[0187] The robot driving unit 411 is used to drive the robot to place the product 7 to be inspected on the die head mechanism 35 .
[0188] The adjustment drive unit 412 is used to drive the screw rod 32 to adjust the position of the stage 31 so that the surface to be inspected of the product to be inspected 7 is located on the focal plane of the area array camera 1. When it is necessary to replace the product to be inspected 7 with a different diameter, the fixing device used to fix the rotating device 3 can be loosened first, and then the surface to be inspected of the product to be inspected 7 can be automatically / manually moved to the focal plane of the area array camera 1 through the screw rod 32, and the current position of the rotating mechanism can be fixed by the fixing device to prevent the rotating mechanism from moving forward and backward.
[0189] The negative pressure generating unit 413 is used to drive the negative pressure generator to generate negative pressure, so that the product to be inspected 7 is subjected to negative pressure through the negative pressure air hole 36 and is fixed on the die head mechanism 35 under the action of the negative pressure. When the product to be inspected 7 is placed on the die head mechanism 35, the negative pressure generator is started to generate negative pressure, and the product to be inspected is subjected to negative pressure through the air hole and is fixed on the rotating mechanism die head device.
[0190] The rotation driving unit 414 is used to drive the die head mechanism 35 to rotate so that the product 7 to be inspected rotates synchronously with the die head mechanism 35 .
[0191] Therefore, the present invention realizes flexible replacement of the product 7 to be inspected under the joint action of the robot, the die head mechanism 35, the screw rod 32, the negative pressure generator and the negative pressure air hole 36, with high safety and accuracy.
[0192] like Fig. 9 As shown, the camera driving module 43 includes a trigger unit 431, a sending unit 432 and a control unit 433, specifically:
[0193] The trigger unit 431 is used to generate a trigger signal after receiving an incoming material signal and a negative pressure signal, wherein the incoming material signal is sent by the robot to the controller 4, and the negative pressure signal is sent by the rotating device 3 to the controller 4. It should be noted that when the product 7 to be inspected is placed on the rotating device 3, the robot will send an incoming material signal to the controller 4, and at the same time, the rotating device 3 will also generate a negative pressure signal to the controller 4.
[0194] The sending unit 432 is used to send trigger information to the area array camera 1 to drive the area array camera 1 to capture the target image and send the target image to the industrial computer 5. After the area array camera 1 captures the target image, it sends the target image to the industrial computer 5 through the gigabit communication line.
[0195] The control unit 433 is used to obtain a single acquisition completion signal, and determine whether the rotating device 3 has rotated a preset angle according to the single acquisition completion signal. When it is determined to be yes, the rotating device 3 is driven to stop rotating and the area array camera 1 is driven to stop acquiring the target image. When it is determined to be no, the rotating device 3 is driven to continue rotating and the area array camera 1 is driven to continue acquiring the target image. The single acquisition signal is sent to the controller 4 by the area array camera 1 after completing the acquisition of a single target image.
[0196] It should be noted that after the area array camera 1 triggers an action of capturing a target image (i.e., taking a photo), a single capture completion signal is generated and output to the controller 4. In other words, the single capture signal is sent to the controller 4 after the area array camera 1 completes the capture of a single target image.
[0197] In addition, when the area array camera 1 is collecting the target image, the rotating device 3 rotates continuously, so the area array camera 1 can collect the complete outer surface pattern of the product 7 to be inspected. Therefore, in order to avoid repeated photography, the rotation state of the rotating device 3 needs to be judged; if the rotating device 3 has rotated 360°, it means that the area array camera 1 can stop taking pictures, and the rotating device 3 can also stop rotating; if the rotating device 3 has not rotated 360°, it means that the area array camera 1 still needs to continue taking pictures, and the rotating device 3 also needs to keep rotating.
[0198] Therefore, the present invention improves the acquisition efficiency of the area array camera 1 by cooperating with the controller 4, the area array camera 1 and the rotating device 3, and adopts an efficient acquisition method. For a single detection object, there is no need to frequently start and stop the rotating mechanism, and dynamic acquisition of high-quality images of the 360° cylindrical surface of the high-brightness reflective metal cylinder can be achieved, which can meet the detection needs of metal cylindrical pots of different sizes. If necessary, multiple image acquisition stations can be set to improve the image acquisition efficiency of the image acquisition system for a single product. The overall structure is simple, maintenance is convenient, and it is easy to promote and popularize.
[0199] like Fig.10As shown, the industrial computer 5 includes an identification module 51 and a dimensionality reduction classification module 52, specifically:
[0200] The recognition module 51 is used to perform recognition processing on the target image to extract feature information of the target image.
[0201] The dimension reduction classification module 52 is used to perform dimension reduction and classification processing on the feature information to identify defects of the product to be inspected 7.
[0202] In order to completely extract the feature information of the area to be detected, the recognition module extracts features from multiple angles when performing recognition processing on the target image; since the feature vector obtained has a large dimension, it increases the computational burden of the classifier and affects the classification and recognition effect and efficiency, so it is necessary to reduce the dimension of the feature vector through feature selection. Accordingly, the present invention adopts principal component analysis (PCA) to reduce the dimension of the feature information.
[0203] In addition, the accuracy of classification depends on the selection of the classifier. The present invention uses a nonlinear support vector machine to identify the defect content in the target image, and can complete the surface defect classification of the high-brightness reflective metal cylindrical pot. Preferably, the present invention uses a radial basis kernel function as the kernel function of the classifier in the nonlinear support vector machine.
[0204] Therefore, the present invention can obtain a high-quality cylindrical local image through the combined use of the rotating device 3 and the area array camera 1; and combine the recognition, dimensionality reduction and classification processing to realize the automatic surface defect detection of the high-brightness light-reflecting metal cylindrical pot product, which can effectively determine the surface defect location and defect type of the cylindrical pot product and other information.
[0205] Further, the recognition module 51 includes a judgment unit 511, a filtering unit 512, a black hat unit 513, an open operation unit 514, an analysis unit 515, an edge extraction unit 516 and a feature extraction unit 517. Specifically:
[0206] The judgment unit 511 is used to judge whether the target image meets the detection requirements. To judge whether the target image meets the detection requirements, it is to judge whether the light spot area of the target image clearly reflects the surface information of the metal cylindrical pot. Specifically, (1) it can be determined through grayscale statistical information. When the number of high grayscale pixels reaches a preset value, it means that there is a highlight surface in the target image. (2) The image clarity of the cylindrical light spot area is evaluated by the operator's subjective evaluation / through the clarity evaluation algorithm. When the clarity evaluation function reaches a preset value, it means that there is a clear highlight surface in the target image.
[0207] It should be noted that if the target image does not meet the detection requirements, the judgment unit 511 drives the touch industrial display 6 to display an error message to remind the operator to adjust the light source brightness / camera exposure time / die head position.
[0208] The filtering unit 512 is used to perform median filtering on the target image when the target image meets the detection requirements. It should be noted that median filtering can not only remove isolated point noise, but also maintain the edge characteristics of the image; compared with Gaussian filtering, median filtering will not cause significant blurring of the image, and is more suitable for the surface detection image of the high-brightness reflective metal cylindrical pot in the present invention.
[0209] The black hat unit 513 is used to perform black hat operation on the target image after median filtering to obtain defect contour information. The black hat operation can separate the patches with lower grayscale than the surrounding area of the original image contour, thereby obtaining a patch contour with a relatively complete defect edge.
[0210] The opening operation unit 514 is used to perform an opening operation on the target image after the black hat operation to eliminate interference information. The morphological opening operation is to perform an operation of corroding and then dilating the image. The opening operation can effectively eliminate small burrs, small bright spots and bright lines, remove isolated points outside the target, and smooth the boundaries and contours of larger objects.
[0211] The analysis unit 515 is used to perform binarization processing and connected domain analysis on the target image after the opening operation to generate the connected domain analysis result, which includes the number of connected domains and the centroid coordinates of each connected domain. Connected domain analysis is performed on the binary image after grayscale binarization to find each connected domain in the target image, mark the connected domain by the minimum bounding rectangle, calculate the centroid coordinates of each connected domain, and count the number of connected domains. Among them, the positioning of the minimum bounding rectangle of the defect area is the centroid coordinate positioning of the minimum bounding rectangle of the connected domain obtained by the connected domain analysis on the image of the area to be detected, and the minimum bounding rectangle of the defect area is the minimum area bounding rectangle with a rotation angle.
[0212] The edge extraction unit 516 is used to extract defect edges from the target image using an edge detection algorithm to generate edge detection results. Further, the edge detection algorithm in the present invention is the Canny algorithm, which is a further refinement of the effects of operators such as Sobel and Prewitt and a more accurate positioning.
[0213] The feature extraction unit 517 is used to extract geometric features, grayscale features and invariant moment features on the target image according to the results of the connected domain analysis and the edge detection. Among them, the geometric features are the basic features of the target image, which are used to describe the geometric shape properties of the defects, including the perimeter, area, rectangularity, circularity and density of the defect area; the grayscale histogram is the probability statistics of the grayscale distribution of the image, so the grayscale features can be obtained from its grayscale histogram, and the specific grayscale features include the grayscale mean, grayscale variance, energy, entropy, maximum grayscale value, minimum grayscale value and grayscale contrast amplitude of the defect area; the invariant moment feature is obtained by combining the second-order and third-order moments of the target image to obtain 7 invariant moments, which have rotation, scaling and translation invariance.
[0214] Therefore, the present invention first obtains the high-quality cylindrical image area to be detected by locating the area of interest, and then preliminarily obtains the product defect contour information through the black hat operation method, and uses morphological opening operation to eliminate interference such as small bright spots and bright lines, smooth the boundaries of larger objects, and then marks the connected domain of the binary image, calculates the defect centroid and counts the number of defects, and finally, uses the Canny algorithm to complete the extraction of the defect edge, realizes the positioning of the minimum circumscribed rectangle of the defect area and feature extraction; the entire recognition process is closely linked, and the feature extraction of the target image can be performed from multiple angles with high accuracy.
[0215] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for detecting surface defects of a cylindrical pot, characterized in that: include: The product to be inspected is fixed on the rotating device, and the inspection surface of the product to be inspected is placed on the focal plane of the area array camera and rotates synchronously with the rotating device; Drive the coaxial light source equipment to provide lighting to the product to be inspected; Driving the area array camera to collect images of the surface of the product to be inspected to generate a target image; Driving the industrial computer to perform recognition processing on the target image to extract feature information of the target image; Driving the industrial computer to perform dimension reduction and classification processing on the feature information to identify defects of the product to be inspected; The rotating device is provided with a stage, a screw rod, a negative pressure generator, a die head mechanism and negative pressure air holes provided on the stage, and the steps of fixing the product to be inspected on the rotating device and making the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device include: driving the robot to place the product to be inspected on the die head mechanism; driving the screw rod to adjust the position of the stage so that the inspection surface of the product to be inspected is on the focal plane of the area array camera; driving the negative pressure generator to generate negative pressure so that the product to be inspected is subjected to negative pressure through the negative pressure air holes and is fixed on the die head mechanism under the action of the negative pressure; driving the die head mechanism to rotate so that the product to be inspected rotates synchronously with the die head mechanism; The step of driving the area array camera to capture images of the surface of the product to be inspected to generate a target image includes: the controller generates a trigger signal after receiving an incoming material signal and a negative pressure signal, wherein the incoming material signal is sent to the controller by the robot, and the negative pressure signal is sent to the controller by the rotating device; the controller sends the trigger signal to the area array camera to drive the area array camera to capture the target image and send the target image to the industrial computer; the controller obtains a single acquisition completion signal, and determines whether the rotating device has rotated a preset angle according to the single acquisition completion signal, the single acquisition completion signal is sent to the controller by the area array camera after completing the acquisition of a single target image, and when the judgment is yes, the rotating device is driven to stop rotating and the area array camera is driven to stop capturing the target image, and when the judgment is no, the rotating device is driven to continue rotating and the area array camera is driven to continue capturing the target image.
2. The cylindrical pot surface defect detection method according to claim 1, characterized in that: The step of the industrial computer performing recognition processing on the target image to extract feature information of the target image includes: Determining whether the target image meets the detection requirements; If the target image meets the detection requirements, median filtering is performed on the target image; Performing a black hat operation on the target image after the median filtering process to obtain defect contour information; Performing an open operation on the target image after the black hat operation to eliminate interference information; Performing binarization processing and connected domain analysis on the target image after the opening operation to generate a connected domain analysis result, wherein the connected domain analysis result includes the number of connected domains and the centroid coordinates of each connected domain; Using an edge detection algorithm to extract defect edges from the target image to generate an edge detection result; According to the connected domain analysis results and edge detection results, geometric features, grayscale features and invariant moment features are extracted on the target image.
3. The cylindrical pot surface defect detection method according to claim 2, characterized in that: The step of extracting defect edges from the target image using an edge detection algorithm to generate an edge detection result includes: Performing smoothing filtering on the target image using a Gaussian function; Calculating the gradient value and direction angle of each pixel in the target image after smoothing and filtering to generate a gradient image; Performing non-maximum suppression processing on the gradient image; Double threshold screening is adopted to perform edge connection processing on the gradient image after non-maximum suppression processing.
4. The cylindrical pot surface defect detection method according to claim 1, characterized in that: The step of driving the industrial computer to perform dimension reduction and classification processing on the feature information to identify defects of the product to be inspected includes: The principal component analysis method is used to reduce the dimension of feature information; Nonlinear support vector machine is used to classify the feature information after dimensionality reduction.
5. The cylindrical pot surface defect detection method according to claim 4, characterized in that: The kernel function of the nonlinear support vector machine is a radial basis kernel function, and the expression of the radial basis kernel function is: ,in, Used to set the kernel function parameter.
6. A controller, characterized in that: include: The rotation drive module is used to fix the product to be inspected on the rotating device, and make the inspection surface of the product to be inspected be on the focal plane of the area array camera and rotate synchronously with the rotating device; A light source driving module, used to drive the coaxial light source device to provide lighting to the product to be inspected; A camera driving module, used to drive the area array camera to collect images of the surface of the product to be inspected to generate a target image; An industrial computer driving module, used to drive the industrial computer to perform recognition processing on the target image to extract feature information of the target image, and drive the industrial computer to perform dimensionality reduction and classification processing on the feature information to identify defects of the product to be inspected; The rotating device is provided with a stage, a screw, a negative pressure generator, a die head mechanism and a negative pressure air hole arranged on the stage, and the rotating drive module comprises: a robot driving unit, used to drive the robot to place the product to be inspected on the die head mechanism; an adjusting driving unit, used to drive the screw to adjust the position of the stage, so that the surface to be inspected of the product to be inspected is located on the focal plane of the area array camera; a negative pressure generating unit, used to drive the negative pressure generator to generate negative pressure, so that the product to be inspected is subjected to negative pressure through the negative pressure air hole and is fixed on the die head mechanism under the action of the negative pressure; a rotating driving unit, used to drive the die head mechanism to rotate so that the product to be inspected rotates synchronously with the die head mechanism; The camera driving module includes: a trigger unit, which is used to generate a trigger signal after receiving an incoming material signal and a negative pressure signal, wherein the incoming material signal is sent by the robot to the controller, and the negative pressure signal is sent by the rotating device to the controller; a sending unit, which is used to send the trigger signal to the area array camera to drive the area array camera to capture a target image and send the target image to the industrial computer; a control unit, which is used to obtain a single acquisition completion signal, and judge whether the rotating device has rotated a preset angle according to the single acquisition completion signal, and when it is judged to be yes, drive the rotating device to stop rotating and drive the area array camera to stop capturing the target image, and when it is judged to be no, drive the rotating device to continue rotating and drive the area array camera to continue capturing the target image, and the single acquisition completion signal is sent to the controller by the area array camera after completing the acquisition of a single target image.
7. An industrial computer driven by the controller according to claim 6, characterized in that: include: A recognition module, used to perform recognition processing on a target image to extract feature information of the target image; A dimensionality reduction and classification module is used to reduce the dimension and classify the feature information to identify defects of the product to be inspected; The identification module comprises: A judging unit, used to judge whether the target image meets the detection requirements; A filtering unit, used for performing median filtering on the target image when the target image meets the detection requirements; A black hat unit, used for performing a black hat operation on the target image after the median filtering process to obtain defect contour information; An opening operation unit, used for performing an opening operation on the target image after the black hat operation to eliminate interference information; An analysis unit, used for performing binarization processing and connected domain analysis on the target image after the opening operation to generate a connected domain analysis result, wherein the connected domain analysis result includes the number of connected domains and the centroid coordinates of each connected domain; An edge extraction unit, used for extracting defect edges from the target image using an edge detection algorithm to generate an edge detection result; The feature extraction unit is used to extract geometric features, grayscale features and invariant moment features on the target image according to the connected domain analysis results and edge detection results.
8. A cylindrical pot surface defect detection system, characterized in that: It comprises an area array camera, a coaxial light source device, a rotating device, a fixing frame, the controller according to claim 6 and the industrial computer according to claim 7, wherein the controller is connected to the industrial computer, the area array camera, the coaxial light source device and the rotating device respectively; The area array camera, the coaxial light source device, and the rotating device are arranged in a straight line on the fixing frame in sequence, and the rotating device is arranged within the depth of field of the area array camera; The rotating device includes a stage, a screw, a negative pressure generator, a reducer, a motor, a die head mechanism and a negative pressure air hole arranged on the stage. The motor is connected to the stage through the reducer to drive the stage to rotate. The negative pressure generator is used to generate negative pressure and apply the negative pressure to the product to be inspected through the negative pressure air hole.
