A method and device for defect judgment of pipe flaring based on positive light images
By measuring and detecting the size and defects of the pipe flaring online based on positive light images, the problem of inability to detect abnormal pipe flaring in time in the prior art is solved, and the reliability of the production process and product quality are improved.
Patent Information
- Application Number
- CN202211012578.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-04-28
- Filing Date
- 2022-08-23
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-08-23
AI Technical Summary
The prior art lacks a method that can measure the size of the pipe flaring on the line and detect flaring defects, resulting in unqualified quality of the pipe and economic losses.
Using the method of judging the flaring defect of the pipe based on positive light images, the pipe is transported to the above the background plate by pushing the plate to determine whether the temporal and spatial parameters of the urging plate meet expectations, collect positive light images, perform position correction and graphic data generation, and determine whether the graphic data of the flaring segment is within the safe parameter range.
Accurate dimensional measurement and defect detection of pipe flaring are realized, the reliability of the production process is improved, and the production of unqualified products is avoided.
Smart Images

Figure CN115494065B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of detection technology, and particularly relates to a method and device for defect judgment of pipe flaring based on orthophoto images. Background Art
[0002] Pipes generally refer to plastic pipes extruded by hot pressing after mixing polyvinyl chloride resin with stabilizers, lubricants, etc. After the pipe is flared, it can be used to connect two pipes, eliminating the need for a transition pipe, thus greatly reducing production costs and construction costs. The pipe flaring process generally involves inserting a high-temperature iron rod into one end of the pipe to achieve the effect of flaring the end of the pipe.
[0003] However, when connecting two pipes by flaring, there are extremely high requirements for the depth, width, angle, and quality of the flare. Once these indicators do not meet the requirements, problems will occur in the connection between the pipes, and the produced pipes will be unusable.
[0004] The flaring production line is prone to producing unqualified pipes due to problems such as incorrect setting of flaring equipment parameters and equipment abnormalities. Currently, there is a lack of a technology that can online measure the flaring size of pipes and detect flaring defects, resulting in the inability to detect pipe flaring abnormalities in a timely manner. This is likely to cause accidents where a large number of unqualified pipes are processed by the flaring production line, causing huge economic losses to the manufacturer. Summary of the Invention
[0005] To overcome the deficiencies and problems of the prior art, the present invention provides a method and device for defect judgment of pipe flaring based on orthophoto images.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A method for defect judgment of pipe flaring based on orthophoto images, comprising:
[0008] Transporting the pipe to above the background board through a push plate;
[0009] Judging whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters. If not, do not collect the pipe image captured by the camera under orthophoto as the orthophoto image. If so, collect the pipe image captured by the camera under orthophoto as the orthophoto image;
[0010] Performing position correction on the orthophoto image, and obtaining the orthophoto flared section graphic in the orthophoto image after position correction;
[0011] Generating flared section graphic data according to the orthophoto flared section graphic;
[0012] Judging whether the flared section graphic data is within the range of safe flared section graphic parameters. If not, it is determined that the pipe has defects.
[0013] Preferably, in the step of determining whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters, and if not, not collecting the image of the pipe taken by the camera under positive light as the positive light image, it specifically includes:
[0014] Set the trigger area;
[0015] Determine whether the current position of the push plate is within the trigger area, and if not, do not collect the positive light image.
[0016] Preferably, when the current position of the push plate is within the trigger area, further, the following steps are further included:
[0017] Collect the mis-trigger time;
[0018] Determine whether the mis-trigger time collected by the processor is less than the first preset time, and if so, do not collect the positive light image.
[0019] Preferably, when the mis-trigger time is not less than the first preset time, further, the following steps are further included:
[0020] Collect the delay trigger time;
[0021] Determine whether the collected delay trigger time is less than the second preset time, and if so, do not collect the positive light image.
[0022] Preferably, in the step of determining whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters, and if not, not collecting the image of the pipe taken by the camera under positive light as the positive light image, it specifically includes:
[0023] Collect the trigger interval time;
[0024] Determine whether the collected trigger interval time is less than the third preset time, and if so, do not collect the positive light image.
[0025] Preferably, in the step of determining whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters, and if not, not collecting the image of the pipe taken by the camera under positive light as the positive light image, it specifically includes:
[0026] Calculate the positive light duration;
[0027] Determine whether the calculated positive light duration is less than the safety time, and if so, do not collect the positive light image.
[0028] Preferably, the flare section graphic data includes the ratio of the gray abnormal area in the flare section, the color mean value, and the color standard deviation.
[0029] Preferably, the step of generating the flare section graphic data according to the positive light flare section graphic specifically includes:
[0030] The steps of generating the flare section graphic data according to the positive light flare section graphic specifically include:
[0031] Convert the positive light flare section graphic into a grayscale image;
[0032] Perform blob analysis on the grayscale image converted from the positive light flare section graphic and generate the ratio of the grayscale abnormal area;
[0033] Perform color analysis on the positive light flare section graphic and generate the color mean and color standard deviation.
[0034] Preferably, determine whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters. If not, do not collect the pipe image captured by the camera under backlight as the backlight image. If so, collect the pipe image captured by the camera under backlight as the backlight image.
[0035] Preferably, when the positive light image and the backlight image are collected, the following steps are further included:
[0036] Obtain the flare contour on the backlight image through the edge finding method, match the flare contour with the first flare template, and generate the matching displacement and matching angle;
[0037] Perform position correction on the flare contour according to the matching displacement and matching angle to obtain the backlight flare section area, perform position correction on the positive light image according to the matching displacement and matching angle, and obtain the positive light flare section graphic from the position-corrected positive light image according to the backlight flare section area.
[0038] Preferably, the edge finding method specifically includes the following steps:
[0039] Segment the backlight image into several sub-regions;
[0040] Perform edge point extraction processing on each sub-region in the direction from white pixel points to black pixel points;
[0041] Successively store the edge points of the first group of extracted different horizontal coordinate components into different edge point sets;
[0042] Successively compare the edge points extracted from the remaining all groups with the edge points extracted from the first group, and put the edge points that meet the condition that the absolute value of the difference between the horizontal coordinate components of the corresponding edge points between the two groups is less than the set threshold into the corresponding edge point sets established in the previous step. Each edge point set is the left edge information of each pipe, and the horizontal coordinate is the X-axis.
[0043] Preferably, when collecting the pipe image captured by the camera under backlight as the backlight image, the following steps are further included:
[0044] The processor obtains the pusher profile in the backlight image;
[0045] The processor compares the pusher profile with the standard pusher profile to generate a matching degree;
[0046] The processor determines whether the matching degree is not greater than the safety matching degree. If it is not greater, the processor determines that the pipe is in an abnormal position.
[0047] If it is greater, the processor obtains the matching angle of the current pusher profile according to the pusher profile and the standard pusher profile.
[0048] The processor determines whether the matching angle is less than the safety matching angle. If it is not less, the processor determines that the pipe is in an abnormal position. If it is less, the processor determines that the pipe is in a normal position.
[0049] Preferably, when the front light image is collected, the following steps are further included:
[0050] Perform distortion correction processing on the front light image.
[0051] Preferably, the step of performing distortion correction processing on the front light image specifically includes:
[0052] Collect the calibration plate image;
[0053] Perform distortion correction on the calibration plate image and generate a distortion calibration file;
[0054] Perform distortion correction on the front light image according to the distortion calibration file.
[0055] The present invention also provides a defect judgment device for pipe flaring based on the front light image, which is implemented by using the above-mentioned defect judgment method for pipe flaring based on the front light image, and includes:
[0056] A background board, which is used as the background in the pipe image captured by the camera;
[0057] A pusher, which is used to convey the pipe above the background board;
[0058] A light source, which is used to shine light on the front of the pipe as the front light;
[0059] A camera, which is used to capture an image on the front of the pipe;
[0060] A processor, which is used to convey the pipe above the background board through the pusher. If the current space-time parameters of the pusher meet the expected space-time parameters, the processor collects the pipe image captured by the camera under the front light as the front light image, performs position correction on the front light image, obtains the front light flaring section graph in the position-corrected front light image, generates flaring section graph data according to the front light flaring section graph, and determines that the pipe has a defect if the flaring section graph data is not within the range of the safe flaring section graph parameters.
[0061] Preferably, it further includes a photoelectric switch for detecting the position of the push plate.
[0062] Preferably, the triggering area of the photoelectric switch is located above the background plate.
[0063] Preferably, the background plate is white and light-transmissive.
[0064] Preferably, the push plate can slide horizontally above the background plate.
[0065] Preferably, the camera and the front light source are arranged above the background plate, and the back light source is arranged below the background plate.
[0066] The prominent and beneficial technical effects of the present invention compared with the prior art are:
[0067] (1) In the present invention, the graphic data of the flaring section can be generated according to the front light image of the flaring section of the pipe, and the type and degree of defects in the flaring section can be accurately judged according to the graphic data of the flaring section.
[0068] (2) In the present invention, the graphic data of the flaring section is generated by using the front light image. The front light image has the characteristic of clear color expression, which improves the accuracy of detecting the graphic data of the flaring section.
[0069] (3) In the present invention, by setting the mis-triggering time, delay triggering time and interval triggering time of the photoelectric switch, and setting the position detection of the push plate, the system misprocessing that may occur during the feeding process is avoided. Therefore, the present invention has the advantage of reliable operation. Description of the Drawings
[0070] Figure 1 is a schematic flow chart of the steps of the method for judging defects in pipe flaring based on the front light image of the present invention;
[0071] Figures 2-1 to 2-8 is a schematic diagram of the physical objects of the defect types of each pipe of the present invention;
[0072] Figures 3-1 to 3-8 is a schematic diagram of the front light image of the defect types of each pipe of the present invention;
[0073] Figures 4-1 to 4-7 is a schematic diagram of the backlight image of the defect types of each pipe of the present invention;
[0074] Figure 5 is a schematic structural diagram of the device for judging defects in pipe flaring based on the front light image of the present invention;
[0075] Figure 6 is a schematic structural diagram of the present invention applied with the device for judging defects in pipe flaring based on the front light image;
[0076] Figure 7 It is a schematic flow chart of the steps for detecting the position of the pushing plate in the present invention;
[0077] Figure 8 It is a schematic flow chart of the steps for detecting the non-expanded section of the pipe in the present invention;
[0078] Figure 9 It is a schematic flow chart of the steps for the edge finding method in the present invention;
[0079] Figure 10 It is a schematic flow chart of the steps for the edge point processing method in the present invention;
[0080] Figure 11 It is a schematic flow chart of the steps for the straight line fitting method in the present invention;
[0081] Figure 12 It is a schematic flow chart of the steps for detecting under positive light in the present invention;
[0082] Figure 13 It is a schematic flow chart of the steps for detecting under backlight in the present invention;
[0083] In the figure: 1 - background plate, 2 - pushing plate, 3 - front light source, 4 - back light source, 5 - camera, 6 - processor, 7 - photoelectric switch, 8 - pipe, 81 - expanded section, 82 - non-expanded section. Specific embodiments
[0084] For the convenience of those skilled in the art to understand, the present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0085] It should be noted that when the pipe is processed through the expansion production line, an expanded section is formed at the end of the pipe. The expanded section can be used to insert the root of another pipe, so as to connect the two pipes together, avoiding the use of an adapter pipe to connect the two pipes. The design of the expanded section greatly reduces the costs in aspects such as production, assembly, and construction. The pipe after being processed through the expansion production line also includes a non-expanded section, and the non-expanded section and the expanded section are connected in sequence.
[0086] As Figures 2-1 to 2-8 shown, according to the feedback from the pipe manufacturer and on-site research on the expansion production line, it is found that the defect types of pipe expansion include: (1) Figure 2-1 , the end of the expanded section of the pipe shows abnormal protrusion or bending; (2) Figure 2-2 in, the surface of the expanded section of the pipe is scalded and damaged; (3) Figure 2-3 in, the depth of the expanded section of the pipe is not within the tolerance range, and there are problems of being too short or too long in depth; (4) Figure 2-4 in, the pipe is not expanded; (5) Figure 2-5Among them, the front end face of the flared section of the pipe is uneven, and the uneven end face includes concave faces, convex faces, and irregular shapes; (6) Figure 2-6 Among them, the flared section of the pipe is in a retracted state; (7) Figure 2-7 Among them, the pipe is not flared, and the pipe body is flattened. (8) Figure 2-8 Among them, there are obvious color differences and uneven surface colors in the flared section of the pipe.
[0087] In order to detect the defects of the flared pipe and sort out the pipes with defects, such as Figure 1 As shown, this embodiment provides a method for judging the defects of the flared pipe based on the front light image, which is executed by using a device for judging the defects of the flared pipe based on the front light image provided by the present invention, and it includes the following steps:
[0088] S1: Convey the pipe to above the background board through a push plate;
[0089] S2: Judge whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters. If they meet, collect the pipe image taken by the camera under the front light as the front light image and the pipe image taken by the camera under the backlight as the backlight image; if they do not meet, do not collect the pipe image taken by the camera under the front light as the front light image and the pipe image taken by the camera under the backlight as the backlight image;
[0090] S3: Perform distortion correction processing on the front light image and the backlight image;
[0091] S4: Calculate the graphic data of the non-flared section in the backlight image;
[0092] S5: Judge whether the graphic data of the non-flared section is within the range of the safe non-flared section graphic parameters. If it is not within the range, it is determined that the pipe has defects;
[0093] S6: Obtain the flared contour on the backlight image through the edge search method, match the flared contour with the first flared template, and generate the matching displacement and matching angle;
[0094] S7: Correct the position of the flared contour according to the matching displacement and matching angle to obtain the backlight flared section area, correct the position of the front light image according to the matching displacement and matching angle, and obtain the front light flared section graphic in the position-corrected front light image according to the backlight flared section area;
[0095] S8: Generate the flared section graphic data according to the backlight flared section area and the front light flared section graphic;
[0096] S9: Judge whether the flared section graphic data is within the range of the safe flared section graphic parameters. If it is not within the range, it is determined that the pipe has defects.
[0097] In the present invention, based on the images of the unflared section and the flared section of the pipe, the unflared section graphic data and the flared section graphic data can be generated. According to the unflared section graphic data, the types and degrees of defects in the unflared section can be accurately judged, and according to the flared section graphic data and the data obtained from the unflared section, the types and degrees of defects in the flared section can be accurately judged.
[0098] In the present invention, the positive light image and the backlight image are jointly used to generate the flared section graphic data. The positive light image has clear color expression but unclear contour, and the backlight image has clear contour but cannot display the surface information of the pipe. By combining the above images and utilizing their respective advantages to generate the flared section graphic data, the accuracy of the flared section graphic data detection is improved.
[0099] In the present invention, distortion correction processing is performed on the positive light image and the backlight image, thereby eliminating the distortion caused by the imaging system of the camera and improving the image restoration degree.
[0100] In the above step of conveying the pipe to the upper part of the background board by the push plate, the processor can control the motor to drive the push plate to convey the pipe to the upper part of the background board. When the push plate conveys the pipe to the upper part of the background board, if the push plate is also located above the background board, the camera can capture the image with the pipe and the push plate.
[0101] When judging whether the current space-time parameters of the push plate conform to the expected space-time parameters, the following steps are further included:
[0102] Set the trigger area;
[0103] Judge whether the current position of the push plate is within the trigger area. If not, the positive light image and the backlight image are not collected.
[0104] Among them, the current space-time parameters of the push plate include the current position of the push plate, and the expected space-time parameters include the trigger area. The trigger area is the sensing area of the photoelectric switch. The trigger area is set above the background board by the photoelectric switch. The processor is electrically connected to the photoelectric switch, and data communication can be carried out between the photoelectric switch and the processor. When the current position of the push plate is not within the trigger area, the push plate has not conveyed the pipe to the upper part of the background board, the photoelectric switch does not generate a trigger signal, and the processor does not receive the trigger signal of the photoelectric switch. When the processor does not receive the trigger signal, the images captured by the camera are not collected as the positive light image and the backlight image. The trigger signal refers to the part where the edge jumps in the level signal generated by the photoelectric switch.
[0105] When the current position of the push plate is within the trigger area, further, the following steps are included:
[0106] The processor collects the mis-trigger time;
[0107] The processor determines whether the mis-trigger time collected by the processor is less than the first preset time. If it is less, the front light image and the backlight image are not collected.
[0108] Among them, the current spatio-temporal parameters of the push plate include the mis-trigger time, and the expected spatio-temporal parameters include the first preset time. Since when the push plate just triggers the photoelectric switch, the push plate is very likely not to be stable above the background plate. In order to let the camera take pictures of the push plate in a stable state, the processor needs to determine whether the mis-trigger time is less than the first preset time. The mis-trigger time refers to the time that the trigger signal remains when the photoelectric switch is triggered, and the time that the trigger signal remains is the mis-trigger time. The first preset time refers to the minimum reasonable time required for the push plate to stop stably when the photoelectric switch is triggered, and the first preset time can be preset in the processor. In actual use, if the current position of the push plate is within the trigger area, the photoelectric switch generates a trigger signal. If the processor receives the trigger signal, the time that the trigger signal remains is collected as the mis-trigger time. If the mis-trigger time collected by the processor is less than the first preset time, it is very likely that the push plate has not yet stopped stably above the background plate, and the processor does not collect the front light image and the backlight image. If the mis-trigger time is not less than the first preset time, the push plate has stopped stably above the background plate.
[0109] If the mis-trigger time is not less than the first preset time, further, the following steps are also included:
[0110] The processor collects the delay trigger time;
[0111] The processor determines whether the collected delay trigger time is less than the second preset time. If it is less, the backlight image and the front light image are not collected.
[0112] Among them, the current spatio-temporal parameters of the push plate include the delay trigger time, and the expected spatio-temporal parameters include the second preset time. Since the pipe may still not be stable above the background plate after the push plate stops stably above the background plate, in order to avoid collecting an image of the pipe when it is not stable as the backlight image, the processor needs to determine whether the delay trigger time is less than the second preset time. The delay trigger time refers to the time that the trigger signal remains after the mis-trigger time reaches the first preset time, and the difference between the time that the trigger signal remains and the first preset time is the delay trigger time. The second preset time refers to the minimum reasonable time required for the pipe to stop stably above the background plate after the push plate stops stably above the background plate, and the second preset time can be preset in the processor. In actual use, when the mis-trigger time reaches the first preset time, the processor collects the delay trigger time, and the processor determines whether the collected delay trigger time is less than the second preset time. If the delay trigger time is less than the second preset time, it is very likely that the pipe is not stable above the background plate at this time, and the processor does not collect the image captured by the camera as the backlight image. If the delay trigger time is not less than the second preset time, the pipe has stopped stably above the background plate.
[0113] In addition, the step of determining whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters further includes the following steps:
[0114] The processor collects the trigger interval time;
[0115] The processor determines whether the collected trigger interval time is less than the third preset time. If it is less, the backlight image and the front light image are not collected.
[0116] Among them, the current spatio-temporal parameters of the push plate include the trigger interval time, and the expected spatio-temporal parameters include the third preset time. Since after the system finishes detecting a batch of pipes, the pipes of this batch need to be bundled after being unloaded, and after the pipes of this batch are bundled, the next batch of pipes will be loaded. Therefore, the system needs to leave enough bundling time between the unloading of the previous batch of pipes and the loading of the next batch of pipes. The loading of the pipes refers to the pipes being transported above the background board, and the unloading of the pipes refers to unloading the pipes from above the background board. In order to enable the system to leave enough bundling time between the unloading of the previous batch of pipes and the loading of the next batch of pipes, the processor needs to determine whether the trigger interval time is less than the third preset time. The trigger interval time refers to the time interval between the previous triggering of the photoelectric switch and the next triggering of the photoelectric switch, corresponding to the time interval between the unloading of the previous batch of pipes and the loading of the next batch of pipes. The third preset time refers to the minimum reasonable time interval between the unloading and bundling of the previous batch of pipes and the loading of the next batch of pipes, and the third preset time can be preset in the processor in advance. In actual use, when the previous batch of pipes is unloaded and the next batch of pipes is loaded, the processor collects the trigger interval time. If the trigger interval time collected by the processor is less than the third preset time, it is very likely that the detected pipes have not been unloaded or bundled in time. At this time, the processor does not collect the backlight image and the front light image, that is, the system does not detect the next batch of pipes, avoiding the problem of detecting the next batch of pipes before the previous batch of pipes is bundled or the pipes not being unloaded in time. If the trigger interval time collected by the processor is not less than the third preset time, the previous batch of pipes has been unloaded and bundled.
[0117] In addition, when judging whether the current spatio-temporal parameters of the push plate meet the expected spatio-temporal parameters, the following steps are also included:
[0118] The processor calculates the front light duration;
[0119] The processor determines whether the calculated front light duration is less than the safety time. If it is less, the front light image is not collected.
[0120] Among them, the current space-time parameters of the push plate include the positive light duration, and the expected space-time parameters include the safety time. Since there are problems with the unstable light intensity when the backlight source is just turned off and the front light source is just turned on, in order to avoid the problem of unstable light intensity affecting the images captured by the camera, the processor needs to determine whether the positive light duration is less than the safety time. The positive light duration refers to the time when the front light source is turned on and the backlight source is turned off. The safety time refers to the minimum reasonable time required for the light intensity to become stable after the front light source is turned on and the backlight source is turned off, and the safety time can be preset in the processor. In actual use, the processor first controls the front light source to turn on and the backlight source to turn off, and then calculates the positive light duration based on the time when the front light source is turned on and the backlight source is turned off. If the positive light duration calculated by the processor is not less than the safety time, the light intensities of the front light source and the backlight source become stable. If the positive light duration calculated by the processor is less than the safety time, the light intensities of the front light source and the backlight source are unstable. At this time, the processor does not collect positive light images to avoid the processor collecting images affected by the unstable light intensities of the front light source and the backlight source.
[0121] In this embodiment, both the front light source and the backlight source use white-light LED lights, and the safety time is 10 ms.
[0122] In this implementation manner, the processor first collects backlight images and then collects positive light images. When the push plate conveys the pipe above the background board, the processor controls the backlight source to be in the on state and the positive light source to be in the off state.
[0123] In summary, in the step of collecting the pipe image captured by the camera under backlight as the backlight image, it specifically includes:
[0124] If the current position of the push plate is within the trigger area, the mis-trigger time is not less than the first preset time, the delay trigger time is not less than the second preset time, and the trigger interval time is not less than the third preset time, then collect the pipe image captured by the camera under backlight as the backlight image.
[0125] When the processor finishes collecting the pipe image captured by the camera as the backlight image, it controls the backlight source to turn off and the front light source to turn on. When the backlight source is turned off and the front light source is turned on, the processor proceeds to the step of collecting the pipe image captured by the camera under positive light as the positive light image.
[0126] In summary, in the step of collecting the pipe image captured by the camera under positive light as the positive light image, it specifically includes:
[0127] If the current position of the push plate is within the trigger area, the mis-trigger time is not less than the first preset time, the delay trigger time is not less than the second preset time, the trigger interval time is not less than the third preset time, and the positive light duration is not less than the safety time, then the pipe image captured by the camera under positive light is collected as the positive light image.
[0128] In the present invention, by setting the mis-trigger time, delay trigger time, and interval trigger time of the optoelectronic switch, and by detecting the position of the push plate and the positive light duration, the system misprocessing that may occur during the feeding process is avoided. Therefore, the present invention has the advantage of reliable operation.
[0129] As Figures 3-1 to 3-8 shown, the positive light image refers to the image of the pipe captured by the camera when the front light source is on and the back light source is off. The image captured under positive light alone can clearly show the surface information such as the color and texture of the foreground, but it is not easy to distinguish the outline of the foreground. The surface information of the foreground in the positive light image can be used to detect whether there are defects such as hot breakage and color difference on the surface of the pipe.
[0130] As Figures 4-1 to 4-7 shown, the backlight image refers to the image of the pipe captured when the front light source is off and the back light source is on. The backlight image captured under backlight alone can clearly show the outline of the foreground. The outline of the foreground in the backlight image can be used to detect whether the size of the pipe exceeds the tolerance, whether the end face is deformed, and whether there is retraction and other defects.
[0131] The foreground in this embodiment includes the pipe and the push plate. The background includes the background board. In order to better distinguish the foreground and background from the positive light image and the backlight image. The background board is a translucent white, both the front light source and the back light source emit white light, the front light source is fixed above the background board, the back light source is fixed below the background board, and the camera is fixed above the background board so that the camera can use the background board as the background every time it takes a picture. Neither the pipe nor the push plate is white, and there is a large color difference from the background board. Specifically, the colors of the pipe include red, yellow, green, and blue, and the color of the push plate includes black, so that the camera can capture an image with a greater difference between the foreground and the background.
[0132] As Figure 7 shown, after the step of the processor collecting the pipe image captured by the camera under backlight as the backlight image, in order to ensure the accuracy of the position of the pipe transported above the background board, it can be judged by detecting whether the position of the push plate is accurate after the pipe is transported above the background board. Specifically, when collecting the pipe image captured by the camera under backlight as the backlight image, the following steps are further included:
[0133] The processor obtains the push plate contour in the backlight image;
[0134] The processor compares the pusher profile with the standard pusher profile to generate a matching degree;
[0135] The processor determines whether the matching degree is not greater than the safety matching degree. If it is not greater than, the processor determines that the pipe is in an abnormal position.
[0136] If it is greater than, the processor obtains the matching angle of the current pusher profile according to the pusher profile and the standard pusher profile.
[0137] The processor determines whether the matching angle is less than the safety matching angle. If it is not less than, the processor determines that the pipe is in an abnormal position. If it is less than, the processor determines that the pipe is in a normal position.
[0138] Among them, the processor obtains the pusher profile in the backlight image means that the processor first processes the backlight image into a grayscale image, and then obtains the pusher profile in the grayscale image. In the grayscale image converted from the backlight image, the background is white, the pusher, as the foreground in the backlight image, is black, and the junction between the pusher and the background shows a gradual change from black to white. In order to obtain an accurate pusher profile in the grayscale image, the edge of the pusher is obtained in the grayscale image through an edge search method, and then the edge of the pusher is processed through edge point processing to obtain the pusher profile.
[0139] Since there is a problem that the pusher profile obtained by the processor may not be the pusher when the processor uses the edge straight line search method to obtain the pusher profile in the backlight image, the processor determines whether the matching degree is not greater than the safety matching degree and determines whether the matching angle is not less than the safety matching angle. The matching degree refers to the similarity between the shape of the pusher profile and the shape of the standard pusher profile. The safety matching degree refers to the minimum value allowed for the matching degree, and the safety matching degree can be preset in the processor. The standard pusher profile refers to the profile indicating the pusher in the backlight image collected when the pusher accurately conveys the pipe above the background board during normal use, and the standard pusher profile can be preset in the processor. In actual use, if the matching degree is not greater than the safety matching degree, it proves that the foreground indicated by the pusher profile is unlikely to be the pusher or the pusher has a large deviation, and thus it is determined that the pipe is in an abnormal position; if the matching degree is greater than the safety matching degree, it proves that the shape of the pusher profile and the shape of the standard pusher profile are more similar; if the matching degree is greater than the safety matching degree, it proves that the foreground indicated by the pusher profile is basically the pusher. Therefore, the processor determines that this pusher profile is the pusher, and then executes the step of the processor obtaining the matching angle according to the pusher profile and the standard pusher profile. And.
[0140] Since the processor needs to verify whether the pusher plate in the backlight image is offset, the processor needs to determine whether the matching angle is less than the safety matching angle. The matching angle refers to the degree of coincidence between the position of the pusher plate contour and the position of the standard pusher plate contour. The safety matching angle refers to the maximum value allowed for the matching angle, and the safety matching angle can be preset in the processor. If the matching angle is not less than the safety matching angle, the pusher plate has a significant position offset, and the processor determines that the pusher plate is in an abnormal position. When it is determined that the pusher plate is in an abnormal position, the processor aborts the defect detection of the pipe and triggers an alarm, thereby reminding the user to handle the problem and avoiding affecting subsequent detections. The smaller the matching angle is compared with the safety matching angle, the closer the position of the pusher plate contour is to the position of the standard pusher plate contour. If the matching angle is less than the safety matching angle, the processor determines that the pusher plate is in a normal position, the pusher plate has not had a position offset or only has a minor position offset, and then the processor determines that the pipe is in a normal position. If the processor determines that the pipe is accurately conveyed above the background plate, distortion correction processing is performed on the front light image and the backlight image.
[0141] In the step where the processor performs distortion correction processing on the front light image and the backlight image, due to the influence of the imaging system of the camera, the captured images have image distortion. The distortion of the front light image and the backlight image includes radial distortion and perspective distortion. In order to improve the accuracy of subsequent graphic data detection of the flared section of the pipe, the above image distortion needs to be eliminated.
[0142] In this embodiment, the step of performing distortion correction processing on the front light image and the backlight image specifically includes:
[0143] The processor collects the image of the calibration plate placed above the background plate captured by the camera as the calibration plate image;
[0144] The processor performs distortion correction on the calibration plate image and generates a distortion calibration file;
[0145] The processor performs distortion correction on the front light image and the backlight image according to the distortion calibration file.
[0146] Among them, the height of the calibration plate above the background plate is the same as the height of the pipe above the background plate, thereby avoiding errors caused by different heights of the calibration plate and the pipe. The processor performing distortion correction on the calibration plate image means that the processor adjusts the horizontal and vertical spacings between the individual checkerboards in the calibration plate image to be substantially the same. In the distortion-corrected calibration plate image, the horizontal and vertical spacings between its individual checkerboards are substantially the same, and the ratio of the pixel spacing of each checkerboard to the actual physical spacing of the checkerboard is generated, and this ratio is the distortion calibration file. The processor performs distortion correction on the front light image and the backlight image according to the distortion calibration file, thereby obtaining the front light image and the backlight image with eliminated distortion.
[0147] Before the pipe is processed by the flaring production line, it may have defects itself. Such defects include that its own pipe diameter exceeds the dimensional tolerance. To detect such defects, the processor calculates the graphic data of the unflared section in the backlight image, and then determines whether the graphic data of the unflared section is within the range of safe unflared graphic parameters. In this step, the graphic data of the unflared section refers to the graphic data used to indicate the unflared section of the pipe in the backlight image. The unflared graphic data includes the pipe diameter of the unflared section of the pipe and the quantity of the pipes. The range of safe unflared section graphic parameters includes the dimensional tolerance of this type of pipe and the range where the quantity is greater than 0. By determining whether the graphic data of the unflared section is within the range of safe unflared graphic parameters, the processor can determine whether there are dimensional defects and whether there are pipes in the backlight image of the pipe before flaring, so as to eliminate the defective products of this part and determine whether there are pipes to be detected in this system.
[0148] As Figure 8 shown, the steps for the processor to calculate the graphic data of the unflared section in the backlight image, determine whether the graphic data of the unflared section is within the range of safe unflared section graphic parameters, and if not, determine that the pipe has defects, specifically include:
[0149] The processor obtains the edge straight lines of the unflared section in the backlight image through the edge search method;
[0150] The processor determines the pipe diameter and the quantity of the pipes according to the edge straight lines of the unflared section;
[0151] The processor determines that the quantity of the pipes is 0. If it is 0, it determines that the pipe triggers the alarm;
[0152] The processor determines whether the pipe diameter of the unflared section is not within the dimensional tolerance of the pipe. If not, it triggers the alarm.
[0153] The distance between the edge straight lines of adjacent unflared sections is the pipe diameter of the unflared section. The processor calculates the distance between the edge straight lines of the unflared section to determine the pipe diameter of the unflared section. The number of edge straight lines of the unflared section is twice the quantity of the pipes. The processor calculates the number of edge straight lines of the unflared section to determine the quantity of the pipes. Since the quantity of the pipes is a natural number, the processor determines whether there are pipes in the backlight image by determining whether the quantity of the pipes is 0, and then determines whether to trigger the alarm. Since there is a dimensional tolerance for the pipes in the backlight image, the dimensional tolerance can be preset in the processor. The processor determines whether the pipe diameter of the unflared section is not within the dimensional tolerance to determine whether there are defects in the pipes in the backlight image, and then determines whether to trigger the alarm.
[0154] In this embodiment, in the backlight image, the pipe graphic is vertical, and the unflared section in the pipe graphic is located in the lower half of the pipe graphic. The processor determines the number of pipes by detecting the number of edge lines of the unflared section in the backlight image, and determines the pipe diameter of the unflared section by detecting the spacing between the edge lines of the unflared section in the backlight image. Thus, this method can perform defect detection on multiple pipes at one time.
[0155] To eliminate the interference of other contours in the backlight image, the length of the edge line of the unflared section to be searched is constrained, and it is required to be not less than a certain threshold. For example, this threshold can be 500 pixel lengths. The processor determines whether the length of the obtained edge line is not less than 500 pixels. If it is not less than, it determines that the edge line is the edge line of the unflared section. If it is less than, it determines that the edge line is not the edge line of the unflared section.
[0156] Since the backlight image is taken with the backlight source turned on and the front light source turned off, the graphic indicating the unflared section in the backlight image is black, and the graphic indicating the background board is also black. Therefore, the edge finding method is used to obtain the edge lines of the unflared section in the order from black to white and from white to black respectively. Among them, the number of edge lines of the unflared section obtained in the order from white to black is used to determine the number of pipes, and the edge lines of the unflared section obtained in the order from white to black and from black to white can be used to determine the pipe diameter.
[0157] If the number of pipes is 0, the alarm is triggered to prompt the user that there are no pipes in this detection. The system records this detection and waits for the next batch of pipes to be loaded. If the number of pipes is not 0, the alarm is not triggered, and the system remains normal. If the pipe diameter of the unflared section is not within the dimensional tolerance of the pipe, the processor triggers the alarm to prompt the user that there is a problem that other models of pipes are mixed in during this detection or the quality of the pipes themselves is defective. If the pipe diameter of the unflared section is within the dimensional tolerance of the pipe, the alarm is not triggered, and the system starts the next step of work.
[0158] The above system starting the next step of work specifically means that the processor obtains the flared contour in the backlight image.
[0159] Among them, the flared contour refers to the contour of the flared section graphic in the backlight image. The processor can obtain the flared contour on the backlight image by the edge finding method.
[0160] As Figure 9 shown, in this embodiment, the edge finding method specifically includes the following steps:
[0161] Divide the backlight image into several sub-regions;
[0162] For each sub-region, edge points are extracted in the direction from white pixel points to black pixel points.
[0163] The edge points with different horizontal coordinate components extracted in the first group are sequentially stored in different edge point sets.
[0164] The edge points extracted in the remaining groups are sequentially compared with the edge points extracted in the first group. The edge points that meet the condition that the absolute value of the difference in the horizontal coordinate components of the corresponding edge points between the two groups is less than the set threshold are put into the corresponding edge point sets established in the previous step. Each edge point set is the left edge information of each pipe, and the horizontal coordinate is the X-axis.
[0165] According to the above steps, edge detection can also be performed on the pusher plate and the unflared section in the backlight image.
[0166] As Figure 10 shown, the method for edge point processing specifically includes the following steps:
[0167] Perform projection processing on the sub-region to generate projection lines, calculate the average concentration of each projection line, and obtain the projection line average concentration waveform.
[0168] Perform differential processing on the projection line average concentration waveform to obtain a differential waveform.
[0169] Filter the differential waveform to filter out peaks smaller than the set threshold.
[0170] Find the projection waveform points corresponding to each peak in the filtered differential waveform, and then find the corresponding sub-regions in the detection area according to each projection waveform point. The number of rows of each sub-region is the same as the number of rows of the detection area, and the number of columns is 2.
[0171] For each of the above sub-regions, traverse each row in ascending order of the vertical coordinate, compare the two columns in each row, and the row corresponding to the largest absolute value of the difference is the vertical coordinate of the required edge point. The horizontal coordinate of the required edge point is the average value of the horizontal coordinate components corresponding to the two columns of the sub-region, and the vertical coordinate is the Y-axis.
[0172] In the above, the projection processing refers to vertical scanning relative to the detection direction.
[0173] In this embodiment, in order to improve the contrast between the pipes and the background in the backlight image, the following steps are further included:
[0174] Perform sharpening processing and exclusive OR operation processing on the backlight image.
[0175] Among them, the processor sharpens the backlight image to increase the clarity of its edges, making the transition band of the contour edge narrower, thereby enhancing the contrast of the backlight image. In addition, due to the situation where more than two pipes are close to or even in contact with each other, through the sharpening process, the edges of the above-mentioned close pipes can be separated, facilitating the extraction of the flaring contours of the close pipes respectively. Then, an exclusive OR operation is performed on the sharpened backlight image and the original image to further improve the contrast between the pipe edge and the background. The background image after the exclusive OR operation can be used to obtain the edge straight line of the non-flared section, the flaring contour, or the edge straight line of the non-flared section and the flaring contour on the backlight image.
[0176] If the processor obtains the flaring contour, it matches the flaring contour with the first flaring template and generates a matching displacement and a matching angle.
[0177] Among them, the first flaring template can be preset in the processor. Since the flaring widths of pipes of the same model vary little, the same first flaring template can be used for matching.
[0178] If the processor generates a matching displacement and a matching angle, the processor corrects the position of the flaring contour according to the matching displacement and the matching angle and obtains the backlight flared section area.
[0179] Among them, the processor corrects the position of the flaring contour according to the matching position and the matching angle means that the processor rotates and translates the flaring contour according to the matching displacement and the matching angle, so as to adjust and set the flaring contour at the position where the backlight flared section area can be obtained.
[0180] If the processor generates the backlight flared section area, a matching displacement, and a matching angle, the processor corrects the position of the frontlight image according to the matching displacement and the matching angle.
[0181] Among them, the processor's correction of the position of the frontlight image according to the matching displacement and the matching angle specifically means that the processor rotates and translates the frontlight image according to the matching displacement and the matching angle, so as to adjust and set the frontlight image at the position where the frontlight flared section pattern can be obtained according to the backlight flared section area.
[0182] If the processor receives the position-corrected frontlight image, the processor obtains the frontlight flared section pattern according to the backlight flared section area.
[0183] Among them, the frontlight flaring pattern refers to the pattern indicating the flared section of the pipe on the frontlight image.
[0184] In the step where the processor generates the flared section pattern data according to the backlight flared section area, the following steps are specifically included:
[0185] The processor uses the straight line fitting method for the backlight flared section area to generate the edge straight line of the flared section;
[0186] The processor matches the second flaring template on the backlight flaring section area and generates matching point information;
[0187] The processor generates flaring section graphic data based on the flaring section edge straight lines and the matching point information.
[0188] Among them, the flaring section edge straight lines include the left edge line, the right edge line, and the upper edge line of the backlight flaring section area. The left edge line and the right edge line are respectively the edge lines of the sides of the flaring section, and the upper edge line is the edge line on the end face of the flaring section. The second flaring template refers to a frame-shaped area. The upper edge line of the second flaring template basically coincides with the upper edge line of the backlight flaring section area. The lower edge line of the second flaring template basically coincides with the left edge line of the backlight flaring section area. The right edge line of the second flaring template basically coincides with the right edge line of the backlight flaring section area. Thus, the lower edge line of the second flaring template is basically located on the boundary line between the flaring section and the non-flaring section. The matching point information refers to the midpoint of the lower edge line of the second flaring template. The graphic data calculated based on the flaring section edge straight lines and the matching point information includes the depth, width, straightness, and angle of the flaring section. The depth of the flaring section is the distance between the matching point information and the upper edge line of the backlight flaring section area. The width of the depth of the flaring section is the distance between the left edge line and the right edge line of the backlight flaring section area. The straightness of the flaring section refers to the fitting degree between the flaring section edge straight lines and the corresponding edges of the backlight flaring section area. The angle of the flaring section refers to the included angle between each flaring section edge straight line.
[0189] In another embodiment, the processor can also obtain the depth of the flaring section by the following steps:
[0190] The processor uses a straight line fitting method for the backlight flaring section area to generate flaring section edge straight lines, and the flaring section edge straight lines include the left edge line, the right edge line, and the upper edge line;
[0191] The processor generates a detection frame on the left edge line. The left edge line is located within the corresponding detection frame. The length of the detection frame is equal to the length of the left edge line plus 100 pixels. The lower end position of the detection frame is 100 pixels lower than the lower end position of the left edge line. The width of the detection frame is 2 pixels;
[0192] The processor obtains edge pixels from top to bottom within the detection frame through an edge detection method, and generates a mutation value and a pixel size based on the edge pixels. The mutation value refers to the brightness difference between the pixel point on the left side of the edge pixel and the pixel point on the right side of the edge pixel. The pixel size refers to the length of the continuous edge pixels;
[0193] The processor determines whether the mutation value of the edge pixel is within the mutation threshold. If it is not, the edge pixel is filtered out; if it is, the edge pixel is retained. Since the detection frame intercepts part of the pipeline itself, there may be a problem that the pixels on the pipeline itself have brightness fluctuations and are thus acquired as edge pixels by the processor. Therefore, the processor needs to filter out the edge pixels selected due to brightness fluctuations. When the mutation value of the edge pixel is within the mutation threshold, if the processor determines that the edge pixel is not a pixel with brightness fluctuation on the pipeline itself, the edge pixel is retained. When the mutation value of the edge pixel is not within the mutation threshold, if the processor determines that the edge pixel is a pixel with brightness fluctuation on the pipeline itself, the edge pixel is filtered out. The mutation threshold is a constant and can be preset in the processor;
[0194] The processor determines whether the pixel size of the above-retained edge pixel is greater than the filtering size. If it is greater, the edge pixel is retained; if it is not greater, the edge pixel is filtered out. Since there may be black dots in the background within the detection frame, the processor needs to filter out these black dots selected as edge pixels. When the pixel size of the above-retained edge pixel is greater than the filtering size, the processor determines that the edge pixel is not a black dot on the background and retains the edge pixel. When the pixel size of the above-retained edge pixel is not greater than the filtering size, the processor determines that the edge pixel is a black dot on the background and filters out the edge pixel. The filtering size is a constant and can be preset in the processor;
[0195] The processor calculates the mutation score of the edge pixel according to a mathematical model, and obtains the edge pixel corresponding to the maximum mutation score among the edge pixels as the left-edge strong mutation point. The mathematical model is where M is the mutation score, L is the mutation value of the edge pixel, n1 is the weight coefficient, the range of n1 is (0, 1), h is the pixel size of the edge pixel, and H is the length of the corresponding detection frame. In this embodiment, n1 is 0.5;
[0196] Based on the above steps, the processor processes the right-edge line and obtains the right-edge line strong mutation point;
[0197] The processor obtains a fitting line for the left-edge line strong mutation point and the right-edge line strong mutation point through a line fitting method, and calculates the midpoint of the fitting line;
[0198] The processor calculates the distance between the midpoint of the fitting line and the upper-edge line, and the above distance is the depth of the flared section.
[0199] The step of generating the flared section graphic data according to the positive-light flared section graphic specifically includes:
[0200] The processor converts the positive-light flared section graphic into a grayscale image;
[0201] The processor performs blob analysis on the grayscale image converted from the positive light flare section pattern and generates the ratio of the grayscale abnormal area.
[0202] The processor performs color analysis on the positive light flare section pattern and generates the color mean and color standard deviation.
[0203] Among them, the positive light flare section pattern is a color RGB pattern. The grayscale abnormal area is used to indicate the area of thermal damage on the pipe flare section. There is a grayscale difference between the grayscale value of the thermally damaged area on the pipe flare section and the intact part of the pipe flare section. The ratio of the grayscale abnormal area refers to the ratio of the grayscale abnormal area to the entire pipe flare section pattern. The graphic data calculated by the processor based on the positive light flare section includes the ratio of the grayscale abnormal area, the color mean, and the color standard deviation of the flare section. The ratio of the grayscale abnormal area, the color mean, and the color standard deviation are surface information data in the flare section graphic data.
[0204] The flare section graphic data specifically includes the depth, width, angle, the difference between the distance between the two ends of the flare section head and the flare section width, the ratio of the grayscale abnormal area, the color mean, and the color standard deviation of the flare section. Among them, the depth of the flare section refers to the distance between the head and the end of the flare section, the width of the flare section refers to the pipe diameter of the flare section, and the angle of the flare section refers to the angle of each end angle of the flare section.
[0205] The safety flare section graphic parameter range specifically includes the depth range, width range, angle range, difference range, ratio of the grayscale abnormal area range, color mean range, and color standard deviation range of the safety flare section.
[0206] The steps for the processor to determine whether the flare section graphic data is within the safety flare section graphic parameter range specifically include the following steps:
[0207] The processor determines whether the depth of the flare section is within the safety flare section depth range. If not, it determines that the pipe has a defect, thus enabling the processor to detect defects such as the depth of the flare section being too short, too long, or the flare section not being flared.
[0208] The processor determines whether the width of the flare section is within the safety flare section width range. If not, it determines that the pipe has a defect, thus enabling the processor to detect defects such as the width of the flare section being too narrow, too wide, or not being flared. The processor determines whether the angle of the flare section is within the safety flare section angle range. If not, it determines that the pipe has a defect, thus enabling the processor to detect defects such as the end of the pipe flare section showing abnormal protrusions or bends.
[0209] The processor determines whether the difference between the distances at both ends of the flared section head and the width of the flared section is within the difference range of the safe flared section. If it is not within, it determines that the pipe has a defect, thus enabling the processor to detect the defect of the retraction of the flared section of the pipe.
[0210] Among them, the difference between the distances at both ends of the flared section head and the width of the flared section refers to the difference between the distance between the two end points of the flared section head and the width in the graphic data of the flared section. The distance between the two end points of the flared section head means that one end point of the flared section head is the intersection of the upper edge line and the left edge line, and the other end point of the flared section head is the intersection of the upper edge line and the right edge line. The width in the graphic data of the flared section is the distance between the upper edge line and the lower edge line. If the above difference exceeds the safe difference range, it is determined that there is a defect of flared section retraction in this flared section. If the above difference is within the safe difference range, it is determined that there is no defect of flared section retraction in this flared section.
[0211] The processor determines whether the ratio of the gray abnormal area of the flared section is not within the ratio range of the gray abnormal area of the safe flared section. If it is not within, it determines that the pipe has a defect, thus enabling the processor to detect the defect of hot breakage in the flared section.
[0212] The processor determines whether the color mean value of the flared section is within the color mean value range of the safe flared section. If it is not within, it determines that the pipe has a defect, thus enabling the processor to detect the defect of color abnormality in the flared section. Among them, the color mean value of the safe flared section can adopt the color mean value of the unflared section.
[0213] The processor determines whether the color difference of the flared section is within the color difference range of the safe flared section. If it is not within, it determines that the pipe has a defect, thus enabling the processor to detect the defect of different colors in the flared section.
[0214] In this embodiment, when the processor determines that the graphic data of the unflared section is within the range of the graphic parameters of the safe unflared section and the graphic data of the flared section is within the range of the graphic parameters of the safe flared section, the following steps are further included:
[0215] If both are within, it is determined that the pipe has no defect.
[0216] As Figure 11 shown, in the step of generating the edge straight line of the flared section by using the straight line fitting method for the backlight flared section area, the specific straight line fitting method includes:
[0217] P1: Obtain the ROI area information of the fitting straight line;
[0218] Among them, the ROI region information refers to the set of information of each pixel point within the ROI region. The pixel point information includes the brightness and hue of the pixel point. The ROI region refers to a frame-shaped region, and the edge of the flared section region is located within this frame-shaped region. The overall size of the ROI region is 2 * 100 pixels.
[0219] P2: Obtain the point set in the ROI region information according to the edge threshold and the polarity parameter;
[0220] Among them, the edge threshold refers to the reasonable value range of the pixel point. The processor determines whether the information of each pixel point is within the edge threshold and the polarity parameter. If so, it obtains the pixel point and generates a point set. The point set refers to the set of pixel points whose pixel point information is greater than the edge threshold and the polarity parameter.
[0221] P3: Calculate the average value of the abscissa and ordinate of the above point set;
[0222]
[0223]
[0224] Among them, X1...X n refers to the abscissa of each point set, N refers to the number of point sets, refers to the average value of the abscissa of the point set, Y1...Y n refers to the ordinate of each point set, refers to the average value of the ordinate of the point set.
[0225] P4: Calculate the sum result of the abscissa and the sum result of the ordinate of the point set;
[0226]
[0227]
[0228] Among them, X1...X n refers to the abscissa of each point set, N refers to the number of point sets, refers to the sum result of the abscissa of the point set, Y1...Y n refers to the ordinate of each point set, refers to the average value of the ordinate of the point set.
[0229] P5: Calculate the sum of the squares of the abscissa of the point set;
[0230]
[0231] Among them, X1 2 ...X n 2Refers to the square of the abscissa of each point set. Refers to the sum of the squares of the abscissas of the point set.
[0232] P6: Calculate the sum of the products of the abscissa and ordinate of the point set.
[0233]
[0234] Among them, X1Y 1+ X2Y2 + X3Y3 +... + X n Y n Refers to the product result of the abscissa and ordinate of each point set. Refers to the result of the sum of the products of the abscissa and ordinate.
[0235] P7: Use the above calculation results to obtain the intercept a and slope b of the straight line.
[0236]
[0237]
[0238] Among them, b refers to the slope of the straight line, and a refers to the intercept of the straight line. Refers to the average value of the ordinates of the point set. Refers to the average value of the abscissas of the point set.
[0239] P8: Fit the straight line Y = aX + b, where Y refers to the ordinate of the point set and X refers to the abscissa of the point set.
[0240] P9: Obtain the distance from the point set to the straight line according to the distance formula from a point to a straight line.
[0241] P10: Calculate the average value N1 and standard deviation N2 of the distance from the point set to the straight line.
[0242] P11: Statistically analyze the percentage of the point set with a distance within N1 ± 3 * N2 as the fitting degree of the straight line.
[0243] P12: When the fitting degree of the straight line is lower than 0.7, remove the points outside the range and re-enter step P3 to fit the straight line.
[0244] The processor determines the fitting straight line with a fitting degree of not less than 0.7 as the edge straight line of the flared section.
[0245] To sum up, the following introduces the detection process of the present invention under backlight and the detection process under front light.
[0246] As Figure 12 shown, the steps of the detection process under front light include:
[0247] M1: Correct the position of the front-light image according to the matching displacement and matching angle, and obtain the front-light flaring section pattern through the backlight flaring section area;
[0248] M2: The front-light flaring section pattern is a color RGB pattern, and convert the front-light flaring section pattern into a grayscale image;
[0249] M3: Perform blob analysis on the grayscale image converted from the front-light flaring section pattern. Through blob analysis, obtain the grayscale abnormal area of the front-light flaring section pattern. If the area of the obtained grayscale abnormal area is less than 50% of the total area of the flaring section pattern, it is considered that the defect of the flaring section of this pipe is scalding; if the area of the obtained grayscale abnormal area is greater than 50% of the total area of the front-light flaring section pattern, then proceed to the next step;
[0250] M4: Perform color analysis on the front-light flaring section pattern to generate the color mean and color standard deviation of the front-light flaring section pattern;
[0251] M5: If the color standard deviation exceeds the safe color standard deviation, it is considered that the pipe detected this time is a pipe with abnormal color; if the color standard deviation is within the safe color standard deviation, then proceed to the next step;
[0252] M6: Perform color analysis on the non-flaring section pattern of the pipe to obtain the safe color mean;
[0253] M7: Determine whether the color mean of the front-light flaring section pattern is within the safe color mean. If so, it is considered that there is no color difference in the flaring section of this pipe; if not, there is a color difference in the flaring section of this pipe.
[0254] As Figure 13 shown, the steps of the detection process under backlight include:
[0255] C1: During backlight detection, it is necessary to ensure that the backlight source is turned on and the front light source is turned off. Collect the backlight image under backlight and process the backlight image to obtain a grayscale image;
[0256] C2: Obtain the flaring contour in the backlight image through the edge search method. Correct the position of the flaring contour according to the matching displacement and matching angle and obtain the backlight flaring section area. Use the line fitting method on the backlight flaring section area to generate the flaring section edge line. The flaring section edge line includes the left edge line, right edge line and upper edge line of the flaring section;
[0257] C3: Match the second flaring template on the backlight flaring section area and generate matching point information;
[0258] C4: Generate the flaring section pattern data according to the flaring section edge line and the matching point information. The obtained flaring section pattern data includes the depth, width, straightness and angle of the flaring section;
[0259] C5: According to the actual production requirements, preset the graphic data of the safety flaring section, and determine whether the graphic data of the flaring section is within the range of the graphic parameters of the safety flaring section. If so, the pipe is determined to be qualified; if not, the pipe is determined to be abnormal. In the above step S2, if only one edge straight line is fitted when the left and right edge lines of the flaring section are linearly fitted but other detection conditions are all satisfied, it proves that there is an overlapping problem with the pipe.
[0260] Based on the above problems, extract the area of the black area in the ROI region of the above pipe, and then obtain the maximum area in the extracted area of the black area. The maximum area is the overlapping area of the flaring section. Then, determine whether the overlapping area of the flaring section exceeds 50% of the first flaring template. If it exceeds, it is determined that the pipe overlaps with other pipes, and the pipe is not determined as a defective product. If it does not exceed, it is determined that the pipe has a defect in the abnormal flaring area.
[0261] When the backlight flaring section area is received, generate position data according to the backlight flaring section area.
[0262] Among them, the position data is used to indicate the position of the pipe above the background board.
[0263] If it is determined that the pipe has a defect, the defective pipes are sorted according to the position data. If it is determined that the pipe has no defect, the non-defective pipes are sorted according to the position data, so as to achieve the effect of sorting defective pipes and non-defective pipes.
[0264] Such as Figure 5 and Figure 6 As shown, an embodiment of the present invention further provides a defect judgment device for pipe flaring based on a front light image, which is implemented by using the above-mentioned defect judgment method for pipe flaring based on a front light image, and includes:
[0265] A background board, which is used as the background in the pipe image captured by the camera;
[0266] A push plate, which is used to convey the pipe above the background board;
[0267] A light source, which is used to emit light on the front of the pipe as the front light and emit light on the back of the pipe as the backlight;
[0268] A camera, which is used to capture an image on the front of the pipe;
[0269] A processor, which is used to judge whether the pipe has a defect according to the front light image and the backlight image.
[0270] Among them, determining whether there are defects in the pipe according to the front-light image and the back-light image is specifically as follows: The pipe is conveyed above the background board by the pushing plate; when the current space-time parameters of the pushing plate meet the expected space-time parameters, the image of the pipe captured by the camera under the front light is collected as the front-light image, and the image of the pipe captured by the camera under the back light is collected as the back-light image; perform distortion correction processing on the front-light image and the back-light image; calculate the graphic data of the non-flared section in the back-light image; if the graphic data of the non-flared section is not within the range of the safe non-flared section graphic parameters, it is determined that the pipe has defects; obtain the flared contour on the back-light image by the edge search method, match the flared contour with the first flared template to generate the matching displacement and the matching angle; perform position correction on the flared contour according to the matching displacement and the matching angle to obtain the back-light flared section area, perform position correction on the front-light image according to the matching displacement and the matching angle, and obtain the front-light flared section graphic in the position-corrected front-light image according to the back-light flared section area; generate the flared section graphic data according to the back-light flared section area and the front-light flared section graphic; if the flared section graphic data is not within the range of the safe flared section graphic parameters, it is determined that the pipe has defects.
[0271] In actual use, the pushing plate conveys the pipe above the background board, the light source can control the light on the front and back of the pipe, the camera can take pictures on the front of the pipe, and the processor processes the captured front-light image and back-light image, and then the processor controls output devices such as alarms, displays, and sorting devices.
[0272] In some embodiments, the camera and the front light source are arranged above the background board, and the back light source is arranged below the background board. In actual use, when the pushing plate conveys the pipe above the background board, the pipe is also below the camera and the front light source and above the back light source.
[0273] In some embodiments, the background board is light-transmissive. In actual use, the light emitted by the backlight source can pass through the background board and shine on the camera.
[0274] In some embodiments, the background board is opaque. In actual use, the opaque background board is used to prevent the camera from capturing the back light source below the background board.
[0275] In some embodiments, the background board is white. In actual use, the white background board makes the background in the back-light image captured by the camera white and the background in the front-light image captured by the camera also white.
[0276] In some embodiments, the pushing plate is also black. In actual use, the black pushing plate makes the pushing plate black in the back-light image captured by the camera and the pushing plate also black in the front-light image captured by the camera.
[0277] In some embodiments, the light source includes a front light source and a back light source. The front light source is disposed on the front of the background board, and the back light source is disposed on the back of the background board. The front light source is used to illuminate the front of the pipe as the front light, and the back light source is used to illuminate the back of the pipe as the back light. The push plate slides horizontally above the background board. When the push plate slides above the background board, the pipe can be conveyed above the background board.
[0278] In actual use, the back light source is installed below the background board to provide uniform backlight on the back of the pipe together with the background board.
[0279] In some embodiments, the processor is further configured to control the front light source switch and the back light source switch. Specifically, the front light source and the back light source are respectively electrically connected to the processor.
[0280] In some embodiments, a photoelectric switch is further included. The photoelectric switch is used to detect the position of the push plate. The triggering area of the photoelectric switch is located above the background board. When the push plate enters the triggering area of the photoelectric switch, the photoelectric switch is triggered to generate a trigger signal and send it to the processor. The photoelectric switch is electrically connected to the processor.
[0281] In some embodiments, an alarm is further included. The alarm is electrically connected to the processor.
[0282] The above embodiments are only preferred embodiments of the present invention and do not limit the protection scope of the present invention accordingly. Therefore, all equivalent changes made according to the structure, shape, and principle of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for defect judgment of pipe flaring based on positive light images, characterized in that Including: Conveying the pipe through a push plate above the background plate; Judging whether the current spatio-temporal parameters of the push plate conform to the expected spatio-temporal parameters. If not, do not collect the pipe image captured by the camera under positive light as the positive light image and the pipe image captured by the camera under backlight as the backlight image. If they conform, collect the pipe image captured by the camera under positive light as the positive light image and the pipe image captured by the camera under backlight as the backlight image; Performing position correction on the positive light image and the backlight image, and obtaining the positive light flared section graph from the position-corrected positive light image and backlight image; The steps of obtaining the positive light flared section graph include: Calculating the graph data of the non-flared section in the backlight image; Judging whether the graph data of the non-flared section is within the range of the safe non-flared section graph parameters. If not, it is determined that the pipe has defects. The specific steps include: Obtaining the edge straight line of the non-flared section in the backlight image through an edge search method; Determining the pipe diameter of the non-flared section and the number of pipes according to the edge straight line of the non-flared section; Judging that the number of pipes is 0. If it is 0, it is determined that the pipe triggers the alarm; Judging whether the pipe diameter of the non-flared section is not within the dimensional tolerance of the pipe. If not, trigger the alarm; Obtaining the flared contour on the backlight image through an edge search method, matching the flared contour with the first flared template, and generating a matching displacement and a matching angle; Performing position correction on the flared contour according to the matching displacement and the matching angle to obtain the backlight flared section area, performing position correction on the positive light image according to the matching displacement and the matching angle, and obtaining the positive light flared section graph from the position-corrected positive light image according to the backlight flared section area; The edge search method specifically includes the following steps: Dividing the backlight image into several sub-regions; Performing edge point extraction processing on each sub-region in the direction from white pixel points to black pixel points; Successively storing the edge points of the first group with different horizontal coordinate components into different edge point sets; Successively comparing the edge points extracted from the remaining all groups with the edge points extracted from the first group, and putting the edge points that meet the condition that the absolute value of the difference between the horizontal coordinate components of the corresponding edge points between the two groups is less than the set threshold into the corresponding edge point set established in the previous step. Each edge point set is the left edge information of each pipe, and the horizontal coordinate is the X-axis; Generating flared section graph data according to the positive light flared section graph; Judging whether the flared section graph data is within the range of the safe flared section graph parameters. If not, it is determined that the pipe has defects; The flared section graph data includes the ratio of the gray abnormal area in the flared section, the color mean value, and the color standard deviation; The steps of generating the flared section graph data according to the positive light flared section graph specifically include: Converting the positive light flared section graph into a grayscale image; Performing blob analysis on the grayscale image converted from the positive light flared section graph and generating the ratio of the gray abnormal area; Performing color analysis on the positive light flared section graph and generating the color mean value and the color standard deviation.
2. The defect judgment method for pipe flaring based on positive light images according to claim 1, characterized in that, In the step of judging whether the current spatio-temporal parameters of the push plate conform to the expected spatio-temporal parameters, if not, do not collect the pipe image captured by the camera under positive light as the positive light image and the pipe image captured by the camera under backlight as the backlight image, specifically including: Set a trigger area; Determine whether the current position of the push plate is within the trigger area. If it is not, do not collect the front-light image and the back-light image.
3. The defect judgment method for tube flaring based on positive light images according to claim 2, wherein When the current position of the push plate is within the trigger area, further, the following steps are also included: Collect the mis-trigger time; Determine whether the mis-trigger time collected by the processor is less than the first preset time. If it is less, do not collect the front-light image and the back-light image.
4. A method for judging defects in tube flaring based on positive light images according to claim 3, characterized in that When the mis-trigger time is not less than the first preset time, further, the following steps are also included: Collect the delay trigger time; Determine whether the collected delay trigger time is less than the second preset time. If it is less, do not collect the front-light image and the back-light image.
5. A method for judging defects in pipe flaring based on orthophoto images according to claim 2 or 3 or 4, characterized in that Determine whether the current spatio-temporal parameters of the push plate conform to the expected spatio-temporal parameters. If they do not conform, in the step of not collecting the pipe image captured by the camera under front light as the front-light image and the pipe image captured by the camera under back light as the back-light image, specifically include: Collect the trigger interval time; Determine whether the collected trigger interval time is less than the third preset time. If it is less, do not collect the front-light image and the back-light image.
6. A method for judging defects in tube flaring based on orthophoto images according to claim 2 or 3 or 4, characterized in that, In the step of determining whether the current spatio-temporal parameters of the push plate conform to the expected spatio-temporal parameters. If they do not conform, in the step of not collecting the pipe image captured by the camera under front light as the front-light image, specifically include: Calculate the front-light duration; Determine whether the calculated front-light duration is less than the safety time. If it is less, do not collect the front-light image.
7. A defect judgment device for pipe flaring based on positive light images, characterized in that, Include: A background board, which is used as the background in the pipe image captured by the camera; A push plate, which is used to convey the pipe above the background board; A light source, which is used to project light on the front of the pipe as the front light; A camera, which is used to capture images on the front of the pipe; A processor, which is used to convey the pipe to above the background board through the push plate. If the current spatio-temporal parameters of the push plate conform to the expected spatio-temporal parameters, then collect the pipe image captured by the camera under front light as the front-light image and the pipe image captured by the camera under back light as the back-light image, perform position correction on the front-light image and the back-light image, and obtain the front-light flared section graph in the position-corrected front-light image and back-light image; The steps of obtaining the front-light flared section graph include: Calculate the graph data of the non-flared section in the back-light image; Determine whether the graph data of the non-flared section is within the safe non-flared section graph parameters range. If it is not, determine that the pipe has defects. The specific steps include: Obtain the edge straight line of the non-flared section in the back-light image through the edge search method; Determine the pipe diameter of the non-flared section and the number of pipes according to the edge straight line of the non-flared section; Determine whether the number of pipes is 0. If it is 0, determine that the pipe triggers the alarm; Determine whether the pipe diameter of the non-flared section is not within the dimensional tolerance of the pipe. If it is not, trigger the alarm; Obtain the flared contour on the back-light image through the edge search method, match the flared contour with the first flared template, and generate the matching displacement and matching angle; Perform position correction on the flared contour according to the matching displacement and matching angle to obtain the back-light flared section area, perform position correction on the front-light image according to the matching displacement and matching angle, and obtain the front-light flared section graph in the position-corrected front-light image according to the back-light flared section area; The edge search method specifically includes the following steps: Divide the backlight image into several sub-regions; For each sub-region, perform edge point extraction in the direction from white pixel points to black pixel points; Successively store the edge points with different horizontal coordinate components extracted in the first group into different edge point sets; Successively compare the edge points extracted in all other groups with the edge points extracted in the first group, and put the edge points that meet the condition that the absolute value of the difference in the horizontal coordinate components of the corresponding edge points between the two groups is less than the set threshold into the corresponding edge point sets established in the previous step. Each edge point set is the left edge information of each pipe, and the horizontal coordinate is the X-axis; Generate flare section graphic data according to the forward light flare section graphic. If the flare section graphic data is not within the range of the safe flare section graphic parameters, it is determined that the pipe has defects; The flare section graphic data includes the ratio of the gray anomaly area in the flare section, the color mean value, and the color standard deviation; The step of generating flare section graphic data according to the forward light flare section graphic specifically includes: Convert the forward light flare section graphic into a grayscale image; Perform blob analysis on the grayscale image converted from the forward light flare section graphic and generate the ratio of the gray anomaly area; Perform color analysis on the forward light flare section graphic and generate the color mean value and the color standard deviation.
8. The defect judgment device for tube flaring based on positive light images according to claim 7, characterized in that, It also includes a photoelectric switch, which is used to detect the position of the push plate.
Citation Information
Patent Citations
Dynamic statistic sampling control method and device for on-line defect scanning
CN102004451A
Device and method for detecting object surface defects
CN106596574A
Ceramic tile surface defect detection visual system and detection method
CN113640310A