Three-dimensional detection device and detection method for high-frequency resistance welding seam appearance based on line structure light scanning
Technical Field
The invention relates to three-dimensional detection, in particular to three-dimensional detection of high-frequency resistance welding seam appearance based on line structure light scanning.
Background
At present, a welding inspection ruler is mainly adopted to detect the welding seam of the steel bar. The welding inspection ruler is a measuring instrument for inspecting the width, height, welding gap, groove angle, undercut depth and the like of a welding part by using the principles of line and vernier measurement and the like. The inspection ruler is influenced by various factors in the using process, different errors can exist in the detected result, manual detection is time-consuming and labor-consuming, efficiency is not high, and three-dimensional shape information of the surface of the welding seam cannot be acquired in real time for quality detection.
The structured light method is one of machine vision measurement methods, and comprises a point structured light method, a line structured light method and a surface structured light method, and the topography measurement of the surface of an object can be completed by using the structured light method. However, no report of measuring the shape of the weld joint by using a structured light method is seen at present, and the main problem is how to quickly and accurately acquire point cloud data about the shape of the weld joint, and one of the reasons for the problem is that the laser light strip image is affected by reflected light, and the central position of the laser line on the weld joint cannot be accurately determined.
Disclosure of Invention
The invention aims to overcome the defects and provides a three-dimensional detection device and a detection method for the appearance of a high-frequency resistance welding seam based on line structure light scanning; the method is simple to operate, high in detection efficiency and reliable in detection quality.
In order to achieve the purpose, the invention adopts the following technical scheme:
a three-dimensional detection device for high-frequency resistance welding seam appearance based on line structure light scanning comprises a line structure light sensor and a computer; the line structure light sensor comprises a laser for scanning a welded object and an industrial camera for collecting laser light strip images of the welded object, wherein a line structure light plane of the laser is intersected with a welding seam (when laser is projected onto the welding seam) on the surface of the welded object; the industrial camera is connected with the computer; the computer comprises a software system, wherein the software system comprises a video data acquisition module, a point cloud data processing module, an I/O and control module and a system calibration module;
the system calibration module is used for calibrating internal parameters and external parameters of the industrial camera; the external parameters are the pose relation between the light plane of the linear structure and the industrial camera;
the video data acquisition module is used for transmitting the laser light strip images of the welded object acquired by the industrial camera to the point cloud data processing module; the laser light strip image of the welded object is a laser line image which is projected on the surface of the welded object and is distorted and collected by an industrial camera;
the point cloud data processing module is used for acquiring three-dimensional point cloud data of a welding seam according to laser light bar images of welded objects and the relation between pixel coordinates of the light bar images obtained through calibration and actual world coordinates, and measuring the width and height of the welding seam;
the I/O and control module is used for monitoring the input of the industrial camera, informing the video data acquisition module to start or stop acquiring the video image, outputting a signal according to the point cloud data acquired by the point cloud data processing module and the welding seam measurement result and displaying the signal by a computer.
Preferably, the point cloud data processing module comprises a sub-module A, a sub-module B, a sub-module C and a sub-module D; the sub-module A is a light strip center sub-pixel coordinate extraction module and is used for performing sub-pixel precision extraction on the laser light strip center coordinate; the sub-module B is a welding line and object segmentation module and is used for segmenting the center of the laser light bar according to the welded object and the welding line and reserving the center coordinate of the laser light bar at the welding line; the sub-module C is an image coordinate and world coordinate mapping module and is used for converting the divided laser light bar central coordinates at the welding seam into world coordinates to obtain welding seam surface point cloud data; and the sub-module D is a parameter acquisition and display module and is used for calculating the width and height information of the welding seam and generating a welding seam three-dimensional model in real time according to the point cloud data on the surface of the welding seam.
Preferably, in the line-structured light sensor, the laser is selected from a red laser with a wavelength range of 630nm to 660nm, and the red laser has low divergence, good collimation and high transmittance, so that a red laser with a wavelength of about 650nm is selected; the included angle range between the industrial camera and the vertical direction is 31-43 degrees, so that the image collected by the industrial camera contains laser light bars, wherein 37 degrees is selected, the light bars can be positioned in the center of the image, and the information of the complete light bar image can be conveniently extracted.
Preferably, the three-dimensional detection device further comprises a linear displacement transmission system and a fixed panel positioned above the linear displacement transmission system, and the laser and the industrial camera are arranged on the fixed panel; the linear displacement transmission system comprises a stepping motor, a stepping motor controller, a linear movement mechanical device driven by the stepping motor and a base for bearing the welded object; the base is fixed on the mechanical device; the stepping motor is connected with a stepping motor controller, and the stepping motor controller is connected with the computer.
Preferably, the I/O and control module stops the linear displacement transmission system from driving the base to perform the linear movement while notifying the video data acquisition module to stop acquiring the video image.
A three-dimensional detection method for the appearance of a high-frequency resistance welding seam based on line structure light scanning comprises the following steps:
1) scanning the welded object by adopting line structured light generated by a laser, and acquiring a laser light strip image of the welded object by an industrial camera; the line-structured light plane of the laser is intersected with a welding seam (when the laser is projected on the welding seam) on the surface of the welded object;
2) and processing the laser light stripe image of the welded object to obtain welding seam three-dimensional point cloud data and welding seam width and height morphology characteristics.
Preferably, the step 2) specifically comprises the following steps: inputting the laser light strip image of the welded object collected in real time into a computer, and converting the central coordinate of the laser light strip on the surface of the welding seam into a world coordinate by the computer according to the laser light strip image of the welded object and the relation between the pixel coordinate of the light strip image and the actual world coordinate to obtain the three-dimensional coordinate value of each point on the laser light strip on the surface of the welding seam; the width (horizontal distance between two ends of the cross section of the welding seam) and the height (vertical distance between the current highest point of the welding seam and the highest point of the surface of the welded object) of the welding seam are measured by the coordinate values.
Preferably, the method for extracting the central coordinates of the laser light bar on the surface of the weld seam comprises the following steps: firstly, performing dynamic threshold segmentation on a laser light bar image of a welded object to obtain an image region of interest; applying a gray threshold gravity center method to the region of interest to obtain the initial center of the structured light stripes; after obtaining the initial center of the structured light stripe, a Sobel operator is used for obtaining a gradient vector of a stripe pixel point, then a neighborhood (the number of vertical pixels of a direction block is 5-11 and is determined by the width of the light stripe, the number of horizontal pixels is 2-5 and is determined by the horizontal resolution of a light stripe image, such as 7 multiplied by 2) of each pixel point is selected as the direction speed of the point, the horizontal gradient and the vertical gradient of the direction block are obtained, the direction angle of the direction block, namely the direction field of the direction block, is obtained through calculation of the horizontal gradient and the vertical gradient, and the sub-pixel precision center of the laser light stripe is obtained along the direction field direction; and finally, removing the center point of the sub-pixel projected on the surface of the welded object on the laser light strip image of the welded object, and reserving the center point of the sub-pixel projected on the surface of the welding seam.
Preferably, the relationship between the coordinates of the pixels of the image of the light bars and the coordinates of the real world is obtained by calibrating a line-structured light sensor consisting of a laser and an industrial camera.
Preferably, the step 1) specifically comprises the following steps: and placing the welded object on a base of the linear displacement transmission system, continuously acquiring laser light strip images of the welded object by using an industrial camera along with the movement of the welded object, and sequentially inputting the laser light strip images into a computer for processing until the laser finishes scanning the welding seam on the whole welded object.
The invention has the beneficial effects that:
the invention can adopt a non-contact measurement mode to obtain the shape characteristics of the width, the height and the like of the welding line, can be used for judging the quality of the welding line and realizing the automatic detection of the quality of the welding line, has the advantages of high precision, safety, reliability, real-time detection and the like, and improves the efficiency of the detection of the quality of the welding line.
Furthermore, the method solves the problem of influence of light reflection of the welded object on the identification of the laser light bar image by extracting the sub-pixel coordinates in the center of the light bar, and improves the measurement precision.
Drawings
FIG. 1 is a schematic structural diagram of a three-dimensional detection device for the appearance of a high-frequency resistance welding seam;
in fig. 1: 1. laser 2, industrial camera 3, welded object 4, step motor controller 5, computer 6, base 7, mechanical device.
FIG. 2 is a flow chart of laser light bar sub-pixel center extraction.
Detailed Description
The invention is further illustrated by the following figures and examples. The examples are given solely for the purpose of illustration and are not intended to be limiting.
Examples
Referring to fig. 1, the three-dimensional detection device for the weld morphology of the high-frequency resistance welding based on line structure light scanning comprises a 650mm red light laser, an industrial camera with the model of WAT-902H2, a stepping motor controller, a computer and a base, wherein the red light laser 1 and the industrial camera 2 are fixed in the same panel to form a line structure light sensor, the industrial camera 2 inclines downwards and forms an included angle of 37 degrees with the vertical direction, the base 6 is fixed on a mechanical device 7 with a stepping motor (with the model of ASM66AC), the mechanical device 7 can enable the base 6 to move linearly under the driving of the stepping motor, an object to be welded 3 is fixed on the base 6, the industrial camera 2 and the stepping motor controller 4 are respectively connected with the computer 5, and the stepping motor is connected with the stepping motor controller 4.
The device is a non-contact scanning device and is used for acquiring three-dimensional information of the welding seam. An oil-gas pipeline with a welding line is placed on a base 6, a panel of a stepping motor controller comprises a power switch, a forward indicator light and a backward indicator light, the power switch of the stepping motor controller is turned on, a red laser is connected with a power supply of a red laser, the red laser is projected downwards to an object 3 to be welded in a mode of being perpendicular to the welding line (the line structure light plane of the laser is perpendicularly intersected with the welding line on the object to be welded), an instruction is sent out through a computer, the stepping motor controller 4 receives user instruction control, reads a signal and sends the signal to a stepping motor to enable the stepping motor to act, the base 6 is driven to linearly move (if the forward instruction is sent, the stepping motor controller receives the instruction, the forward indicator light starts to flash, the stepping motor is controlled to rotate clockwise, the base 6 is driven to linearly move on a mechanical device, and if the backward instruction is sent, the, the back indicator light begins to flash, the stepping motor is controlled to rotate in the anticlockwise direction, the base 6 is driven to perform reverse linear displacement action on the mechanical device), and the industrial camera 2 is informed to begin to collect videos. The device comprises an automatic termination function, wherein an image of a current welded object is shot by an industrial camera, the image of the welded object is processed by a computer, if a laser light bar in the current image is not projected on the surface of a welding seam any more, the scanning is judged to be finished, a stop instruction is sent by the computer to stop a stepping motor, and the shooting of the industrial camera is stopped. In addition, the device also comprises a manual termination function, when the automatic termination function is invalid, the system can be manually terminated, the motor stops operating, and the industrial camera stops shooting.
The industrial camera 2 shoots a laser line image which is projected on the surface of the welded object and generates distortion, namely a laser light strip image of the welded object, the image is transmitted to the computer 5 through a data line, the computer 5 processes the collected light strip image, three-dimensional coordinate values of a welding seam are obtained, a three-dimensional model of the welding seam is reconstructed, and the three-dimensional coordinate values are displayed through a computer display, and the method specifically comprises the following steps:
(1) light bar center sub-pixel coordinate extraction
As shown in fig. 2, firstly, performing dynamic threshold segmentation on a light stripe image to obtain an image region of interest (ROI), preliminarily calculating the center of the stripe by using a gray threshold gravity center method, obtaining the preliminary center of the structured light stripe, then obtaining gradient vectors of stripe pixel points by using Sobel operators, then selecting a 7 × 2 neighborhood of each pixel point as the direction speed of the point, calculating the horizontal gradient and the vertical gradient of a direction block, calculating the direction angle of the direction block, namely the direction field of the direction block, and calculating the sub-pixel precision center of the laser stripe along the direction of the direction field.
(2) Separation of welded seam and welded article
Because the welded object is an oil-gas pipeline, the cross section of the oil-gas pipeline is circular, the cross section of the oil-gas pipeline projected by laser is arc-shaped, 200 pixel points (depending on the size of the welded object) at the left end and the right end (namely outward along the width direction of a welding seam) of the sub-pixel precision center of the laser stripe extracted in the step (1) are selected for curve fitting (fitting of different orders can be selected according to the cross section shape of the welded object), and a curve equation of the cross section shape of the oil-gas pipeline is obtained. Removing the pixel points (namely the sub-pixel central points projected on the surface of the welded object) belonging to the 3 x 3 neighborhood of each pixel point on the curve equation from the light strip image of the welded object, and reserving the pixel points which are not in the neighborhood, wherein the reserved points are the sub-pixel central points projected on the surface of the welding line, thereby realizing the segmentation of the welding line and the welded object in the image.
(3) Calibration of line structured light sensor
The calibration of the line structured light sensor comprises the calibration of internal parameters and external parameters, the internal parameters of the industrial camera are calibrated by a checkerboard and Zhang Zhengyou calibration method, the external parameters are the position and posture relation of a structured light plane and the industrial camera, and the external parameters are calibrated by a sawtooth target method. And finally, the calibration result is the relationship between the pixel coordinate in the light bar image and the actual world coordinate.
(4) Image coordinate to world coordinate mapping
The industrial camera continuously shoots the laser light strip image of the welded object after the action along with the continuous action of the stepping motor, the laser can complete the scanning of the whole welding seam, the coordinates of the central point of the laser light strip projected on the welding seam at each moment are obtained, and all the coordinates of the central point can be converted into the coordinates of the actual world through the calibration result, namely the relationship between the pixel coordinates in the light strip image and the coordinates of the actual world, so that the point cloud data of the welding seam is obtained; and then establishing a world coordinate system through opengl, drawing the point cloud data into a three-dimensional model, and displaying the three-dimensional model on a display.
According to the three-dimensional coordinate data of the welding seam, the computer can obtain the characteristic information of the welding seam, such as real-time width, height and the like, the width and height numerical values are visually displayed on the display, and the welding quality of the welding seam is judged by comparing the characteristic information with the existing standard.
The invention has the following advantages:
1. and non-contact optical three-dimensional scanning is adopted, so that the reliability of the system is improved.
2. Compared with the manual detection technology, the detection efficiency is improved.
3. The measurement precision is high and can reach 0.1 mm.
4. The continuous scanning of the surface of the welding seam can be realized.
5. The weld joint image can be shot in real time by the industrial camera for processing, and real-time detection is facilitated.