Laser welding head lens detection device and detection method
By designing a laser welding lens detection device, using the combination of collimated detection light and reflector, combined with real-time image acquisition and differential area matching, the problem of low detection efficiency of welding slag and oil pollution during welding is solved, and the butt welding lens is realized Real-time detection and defect identification improve welding efficiency.
Patent Information
- Application Number
- CN202411204924.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-06
AI Technical Summary
During laser welding, the unstable molten pool leads to splashing of welding slag and oil pollution contaminating the welding head lenses, affecting the welding quality. The existing detection methods are inefficient and require frequent manual inspection.
Design a laser welding head lens detection device, including a first housing, a second housing, a light emitting device and an industrial camera, realize real-time detection of laser welding head lenses by combining collimated detection light and reflector, and adopts modular The design is easy to disassemble, combining real-time image acquisition and differential area matching to judge the defect area and realize the identification of large defects.
Real-time detection of laser welding lenses is achieved, welding work efficiency is improved, interference to the welding process is reduced, defect identification is good, and defects with large areas can be discovered in a timely manner.
Smart Images

Figure CN119086600A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of laser welding detection, and in particular to a laser welding head lens detection device and a detection method. Background Art
[0002] Laser welding uses a high-energy-density laser beam as a heat source to heat the material locally to a molten or near-molten state, thereby achieving welding of metal or non-metal materials. The instability of the molten pool during laser welding can easily lead to frequent splashing of welding slag and oil stains on the welding head lens, resulting in obstruction of the laser beam and uneven heating of local parts of the workpiece, which in turn leads to poor welding. Currently, personnel frequently remove the welding head lens and check whether there are impurities such as welding slag and oil stains on the welding head lens, which affects the work efficiency of the laser welding process and is relatively inconvenient. Summary of the invention
[0003] The object of the present invention is to provide a laser welding head lens detection device and detection method. The laser welding head lens detection device can perform real-time detection of the laser welding head without affecting or hindering the normal use and operation of the laser welding head. The detection method realizes defect detection at the equipment position and has better detection and identification effect for defects with larger areas.
[0004] A first aspect of the present invention provides a laser welding head lens detection device, the laser welding head lens detection device comprising a first housing, a second housing, a light emitting element and an industrial camera;
[0005] A first shell, one end of which is provided with a detection port, the detection port is communicated with the interior of the first shell, the detection port is used to fix the laser welding head, a second reflector is provided in the first shell, and a mirror surface of the second reflector is provided at an acute angle to an end surface where the detection port is located;
[0006] A second shell, the second shell is connected to the first shell, a third semi-transparent semi-reflective mirror is arranged in the second shell, and the third semi-transparent semi-reflective mirror is arranged parallel to the second reflective mirror;
[0007] A light emitting member, which is mounted on a side of the second housing away from the first housing, and emits collimated detection light, wherein an optical axis direction of the collimated detection light is arranged at an acute angle to a mirror surface of the third semi-transparent and semi-reflective mirror;
[0008] An industrial camera is connected to the second shell, and the optical axis of the collimated detection light and the center axis of the field of view of the industrial camera are perpendicular to each other.
[0009] In a possible embodiment of the present invention, the detection device also includes a focusing mirror, which is arranged in the first shell, the focusing mirror is located between the detection port and the second reflector, and the main optical axis of the focusing mirror and the end face where the detection port is located are perpendicular to each other.
[0010] In a possible embodiment of the present invention, the detection device further includes a fourth protective mirror, which is disposed between the first shell and the second shell, and is disposed opposite to the light-emitting component.
[0011] In a possible embodiment of the present invention, the first shell has a first opening, the second shell has a second opening corresponding to the first opening, the fourth protective mirror can close the first opening and the second opening, the fourth protective mirror is perpendicular to the optical axis direction of the collimated detection light, and the collimated detection light and the light entering the industrial camera can pass through the fourth protective mirror.
[0012] In a possible embodiment of the present invention, the optical axis direction of the collimated detection light and the mirror angle of the third semi-transparent semi-reflective mirror is θ3, and the optical axis direction of the collimated detection light and the mirror angle of the second reflector is θ4, satisfying: 42°≤θ3=θ4≤48°.
[0013] A second aspect of the present invention provides a defect detection method, the detection method comprising:
[0014] Performing real-time image acquisition on the first protective lens, and obtaining contour information of the first protective lens according to the real-time image, wherein the first protective lens is a lens in a laser welding head installed on the detection end surface;
[0015] Perform contour matching between the contour information and the contour edge of a preset image;
[0016] Determine that the contour information matches the contour edge, and extract the difference area between the real-time image and the preset image;
[0017] Determine whether the area of the difference region is smaller than a set threshold;
[0018] If the answer is no, it is determined that the test fails; if the answer is yes, it is determined that the test passes.
[0019] In a possible embodiment of the present invention, the step of extracting a difference area between a real-time image and a preset image includes:
[0020] Compare the real-time image with the preset image to obtain a differential image;
[0021] Obtaining a preset first pixel threshold;
[0022] Calculating the area of a first region in the differential image where the grayscale value is lower than a first pixel threshold;
[0023] Determining whether the area of the first region exceeds a first set value;
[0024] If it is no, the differential test passes, if it is yes, the test fails.
[0025] In a possible embodiment of the present invention, in the step of extracting the difference area between the real-time image and the preset image, the step further includes:
[0026] Performing local binarization processing on the real-time image to form multiple sub-image areas, and obtaining an adaptive pixel threshold in each sub-image area;
[0027] Calculate the area of the second region in each sub-image region where the grayscale value is lower than the adaptive pixel threshold;
[0028] Determining whether there is a second region whose area exceeds a second set value;
[0029] If it is no, the local binary detection passes, if it is yes, the detection fails.
[0030] In a possible embodiment of the present invention, in the step of extracting the difference area between the real-time image and the preset image, the step further includes:
[0031] Set a fixed threshold to perform fixed binary processing on the real-time image;
[0032] Calculating the area of a third region in the real-time image whose grayscale value is lower than a fixed threshold;
[0033] determining whether the area of the third region exceeds a third set value;
[0034] If it is no, the test passes, if it is yes, the test fails.
[0035] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention provides a laser welding head lens detection device and a detection method, the laser welding head lens detection device can perform real-time detection of the first protective lens of the laser welding head, the detection port of the first shell is used to fix the laser welding head, the collimated detection light can provide a light source for the position of the first protective lens, the collimated detection light emitted by the light emitting component is transmitted to the second reflector through the third semi-transparent semi-reflective mirror, and then reflected from the second reflector to the first protective lens, the collimated detection light is incident on the first protective lens to form a light entering the industrial camera, the light entering the industrial camera is reflected by the second reflector, and then enters the industrial camera through the third semi-transparent semi-reflective mirror, so that the position of the first protective lens of the laser welding head can be photographed and monitored by the industrial camera, the detection device adopts a modular design to facilitate disassembly and replacement, and will not affect and hinder the normal use and operation of the laser welding head, thereby improving the working efficiency of laser welding, the defect detection method performs contour matching on the contour information of the real-time image, so as to extract the difference area, and determine whether the equipment has defects by comparing the area of the difference area with the set threshold, so as to realize the defect detection of the equipment position, and has a better detection and recognition effect for defects with larger areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 It is a schematic diagram of the side structure of the detection device provided in some embodiments of the present invention;
[0038] Figure 2 It is a schematic diagram of a top view of the structure of a detection device provided in some embodiments of the present invention;
[0039] Figure 3 A schematic diagram of a defect detection method provided in some embodiments of the present invention;
[0040] Figure 4 Schematic diagram of the sub-steps of the defect detection method provided in some embodiments of the present invention Figure 1 , wherein the sub-steps of step 300 are shown;
[0041] Figure 5 Schematic diagram of the sub-steps of the defect detection method provided in some embodiments of the present invention Figure 2 , wherein the sub-steps of step 300 are shown;
[0042] Figure 6 Schematic diagram of the sub-steps of the defect detection method provided in some embodiments of the present invention Figure 3 , where sub-steps of step 300 are shown.
[0043] Description of main component symbols;
[0044] 100-detection device; 110-first shell; 111-laser welding head; 112-first protective lens; 113-second reflector; 114-focusing lens; 115-first opening; 116-detection port; 120-second shell; 121-third semi-transparent and semi-reflective mirror; 122-second opening; 130-light-emitting element; 140-industrial camera; 150-fourth protective lens. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0048] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific position, be constructed and operated in a specific position, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0049] In addition, the terms "horizontal", "vertical", "overhanging" and the like do not mean that the components are required to be absolutely horizontal or overhanging, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0050] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0052] Example 1
[0053] refer to Figure 1 As shown, an embodiment of the present application provides a laser welding head lens detection device 100 , which includes a first shell 110 , a second shell 120 , a light emitting element 130 and an industrial camera 140 .
[0054] Specifically, combined Figure 1 and Figure 2 As shown, a detection port 116 is provided at one end of the first shell 110, and the detection port 116 is communicated with the interior of the first shell 110. The detection port 116 is used to fix the laser welding head 111. A first protective lens 112 is provided in the laser welding head 111. The first protective lens 112 protects both the laser welding head 111 and the detection device. The detection device 100 adopts a modular design to facilitate the disassembly and replacement of the laser welding head 111 through the detection port 116. A second reflector 113 is provided in the first shell 110, and the mirror surface of the second reflector 113 is arranged at an acute angle with the end face where the detection port 116 is located. Exemplarily, the angle between the second reflector 113 and the end face where the detection port 116 is located is θ1, which satisfies 42°≤θ1≤48°.
[0055] In this embodiment, the second shell 120 is connected to the first shell 110, and a third semi-transparent half-reflecting mirror 121 is arranged in the second shell 120, and the third semi-transparent half-reflecting mirror 121 is arranged parallel to the second reflector 113; the light emitting element 130 is installed on the side of the second shell 120 away from the first shell 110, and the light emitting element 130 emits collimated detection light, and the optical axis direction of the collimated detection light is arranged at an acute angle with the mirror surface of the third semi-transparent half-reflecting mirror 121. Exemplarily, the angle between the optical axis direction of the collimated detection light and the mirror surface of the third semi-transparent half-reflecting mirror 121 is θ2, which satisfies 42°≤θ2≤48°. The industrial camera 140 is connected to the second shell 120, and the optical axis of the collimated detection light is perpendicular to the central axis direction of the field of view of the industrial camera 140. The light entering the industrial camera 140 is formed after the first protective lens 112 reflects the collimated detection light through the second reflector 113 and the third semi-transparent half-reflecting mirror 121. The laser welding head lens detection device 100 can perform real-time detection on the laser welding head 111 , and the collimated detection light can provide a light source for the position of the first protective lens 112 .
[0056] like Figure 1 As shown, Figure 1 The solid arrow in the figure represents the collimated detection light. The collimated detection light emitted by the light-emitting element 130 is transmitted to the second reflector 113 through the third semi-transparent and semi-reflective mirror 121, and then reflected from the second reflector 113 to the first protective lens 112. The collimated detection light is incident on the first protective lens 112 and is reflected to form light that enters the industrial camera 140. Figure 1 The dotted line in the figure represents the light entering the industrial camera 140. The light entering the industrial camera 140 is formed by the first protective lens 112 reflecting the collimated detection light through the second reflector 113 and the third semi-transparent semi-reflective mirror 121. The light entering the industrial camera 140 is reflected by the second reflector 113 and then by the third semi-transparent semi-reflective mirror 121 before entering the industrial camera 140, so that the position of the first protective lens 112 of the laser welding head 111 can be photographed and monitored by the industrial camera 140.
[0057] In one embodiment, optionally, Figure 1 As shown, the detection device 100 also includes a focusing mirror 114, which is arranged in the first shell 110. The focusing mirror 114 is located between the detection port 116 and the second reflector 113, and the main optical axis of the focusing mirror 114 and the end face where the detection port 116 is located are perpendicular to each other. The focusing mirror 114 can make the light path more focused, reduce the energy loss caused by the divergence of the light path, and improve the efficiency of light energy utilization.
[0058] In one embodiment, optionally, reference Figure 1 and Figure 2As shown, the detection device 100 further includes a fourth protective mirror 150, which is disposed between the first housing 110 and the second housing 120, and is disposed opposite to the light emitting element 130. Accordingly, the fourth protective mirror 150 allows light to pass through, but plays a protective role against spattering slag and impurities generated during laser welding, preventing impurities such as slag from entering the second housing 120 through the fourth protective mirror 150.
[0059] Optionally, the first shell 110 is provided with a first opening 115, and the second shell 120 is provided with a second opening 122 corresponding to the first opening 115. The fourth protective mirror 150 can close the first opening 115 and the second opening 122, and the mirror surface of the fourth protective mirror 150 is perpendicular to the optical axis direction of the collimated detection light. The collimated detection light and the light entering the industrial camera 140 can pass through the fourth protective mirror 150, that is, the purpose of closing the first opening 115 and the second opening 122 is achieved through the fourth protective mirror 150. The fourth protective mirror 150 connects the first shell 110 and the second shell 120, and the fourth protective mirror 150 does not affect the injection of the collimated detection light and the light entering the industrial camera 140.
[0060] In one embodiment, optionally, the optical axis direction of the collimated detection light and the mirror angle of the third semi-transparent semi-reflecting mirror 121 are θ3, and the optical axis direction of the collimated detection light and the mirror angle of the second reflector 113 are θ4, which satisfies: 42°≤θ3=θ4≤48°, that is, the incident angle of the collimated detection light on the third semi-transparent semi-reflecting mirror 121 and the incident angle of the collimated detection light on the second reflector 113 are equal, θ3 and θ4 are any value between 42° and 48°, and θ3 and θ4 can be 42°, 43°, 46°, 47°, 48°. It can be understood that the collimated detection light can be incident on the first protective lens 112 after being transmitted through the third semi-transparent semi-reflecting mirror 121 and reflected by the second reflector 113, so as to display the metal molten splashes adhered to the first protective lens 112, and further, θ3=θ4=45°, so that the reflected light can be accurately incident on the industrial camera 140.
[0061] In summary, the laser welding head lens detection device 100 can perform real-time detection of the first protective lens 112 of the laser welding head 111. The detection port 116 of the first shell 110 is used to fix the laser welding head 111. The collimated detection light can provide a light source for the position of the first protective lens 112. The collimated detection light emitted by the light emitting component 130 is transmitted to the second reflector 113 through the third semi-transparent and semi-reflective mirror 121, and then reflected from the second reflector 113 to the first protective lens 112. The collimated detection light is incident on the first protective lens 112 to form light that enters the industrial camera 140. The light that enters the industrial camera 140 is reflected by the second reflector 113, and then enters the industrial camera 140 through the third semi-transparent and semi-reflective mirror 121, so that the position of the first protective lens 112 of the laser welding head 111 can be photographed and monitored through the industrial camera 140. The detection device 100 adopts a modular design to facilitate disassembly and replacement, and will not affect and hinder the normal use and operation of the laser welding head 111, thereby improving the work efficiency of laser welding.
[0062] Example 2
[0063] refer to Figure 3 As shown, an embodiment of the present application provides a defect detection method, which includes:
[0064] S100: collecting a real-time image of the first protective lens 112, and obtaining contour information of the first protective lens 112 according to the real-time image;
[0065] S200: performing contour matching between the contour information and the contour edge of a preset image;
[0066] S300: Determine that the contour information matches the contour edge, and extract a difference area between the real-time image and the preset image;
[0067] S400: Determine whether the area of the difference region is smaller than a set threshold;
[0068] S500: If no, it is determined that the test fails;
[0069] S600: If yes, it is determined that the detection has passed.
[0070] Specifically, a first protective lens 112 is provided in the laser welding head 111, and the first protective lens 112 in the laser welding head 111 is captured in real time by an industrial camera 140, and the contour information of the first protective lens 112 is obtained according to the real-time image, and the contour is matched by the contour information of the first protective lens 112 and the contour edge of the preset image. When the contour information of the real-time image matches the contour edge of the preset image, it can be ensured that the installation position of the first protective lens is accurate at this time, and other defects can be detected. When the contour information of the real-time image does not match the contour edge of the preset image, it may be due to the tilt problem of the installation position of the first protective lens, and it can be directly determined as a failure of the test without the need for subsequent testing. Among them, the preset image is an image of the first protective lens that is pre-selected and has fewer defects or is defect-free.
[0071] Under the premise of ensuring the contour matching of the real-time image, the difference area between the real-time image and the preset image is extracted to detect whether the first protective lens has defects. Among them, the difference area refers to the difference image obtained by comparing the real-time image and the preset image. When the area of the difference area is greater than or equal to the set threshold, it is determined that there are many defects, that is, the detection fails, and the equipment can be stopped. The metal splatter such as welding slag on the first protective lens 112 is detected based on the difference area. Of course, if the area of the difference area is less than the set threshold, it can be determined that there are few defects and the detection can be judged to be passed.
[0072] It can be understood that the difference area expresses the difference and distinction between the real-time image and the preset image, and the set threshold expresses the range of the set area of the difference area. By judging the size of the area of the difference area, it is judged whether the first protective lens 112 is qualified, thereby realizing defect detection of the first protective lens 112, and having better detection and identification effect for defects with larger areas (such as larger areas of oil and dirt).
[0073] In one embodiment, optionally, Figure 4 As shown, in the step of extracting the difference area between the real-time image and the preset image, it includes:
[0074] S310a: Compare the real-time image with the preset image to obtain a differential image;
[0075] S320a: Obtain a preset first pixel threshold;
[0076] S330a: Calculate the area of a first region in the differential image whose grayscale value is lower than the first pixel threshold;
[0077] S340a: Determine whether the area of the first region exceeds a first set value;
[0078] S350a: If no, the differential detection passes;
[0079] S360a: If yes, the detection fails.
[0080] In this embodiment, the real-time image and the preset image are compared to obtain a differential image, which is an image obtained by comparing the pixel values of the real-time image and the pixel values of the preset image. The preset first pixel threshold is to make the individual pixels in the differential image more distinct, so as to facilitate the calculation of the area size of the difference region. The area of the first region in the differential image whose grayscale value is lower than the first pixel threshold is calculated. Accordingly, the differential image can form a grayscale image after processing the pixel values of the real-time image, that is, the pixel values of the differential image are obtained by subtracting the pixel values of the real-time image from the pixel values of the preset image, weakening the similar parts of the images between the two, and strengthening the different parts of the images between the two. The difference region is determined based on the differential image extraction, and the difference region can detect defects such as oil stains and dirt in the equipment.
[0081] In addition, the first pixel threshold is obtained, and the area of the first region in the differential image whose grayscale value is lower than the first pixel threshold is calculated, that is, the area of the first region in the differential image whose grayscale value is lower than the first pixel threshold is calculated, and it is determined whether the area of the first region exceeds the first set value. If the area of the first region is less than or equal to the first set value, the detection passes and the device can continue to operate; if the area of the first region is greater than the first set value, the detection fails, and the position of the first region is the position where the equipment has defects such as oil stains and dirt.
[0082] Exemplarily, f1(x,y) is the pixel value of the preset image, f2(x,y) is the pixel value of the real-time image, and D(x,y) is the differential image, satisfying: D(x,y)=f1(x,y)-f2(x,y).
[0083] In one embodiment, optionally, reference Figure 5 As shown, in the step of extracting the difference area between the real-time image and the preset image, it also includes:
[0084] S310b: Perform local binarization processing on the real-time image to form multiple sub-image areas, and obtain an adaptive pixel threshold in each sub-image area;
[0085] S320b: Calculate the area of a second region in each sub-image region where the grayscale value is lower than the adaptive pixel threshold;
[0086] S330b: Determine whether there is a second region whose area exceeds a second set value;
[0087] S340b: If no, the local binarization detection passes;
[0088] S350b: If yes, the detection fails.
[0089] It can be understood that binarization is an image processing technology that sets the grayscale value of pixels in an image to two discrete values (usually black and white), which can also be called black and white processing, thereby converting the image into a binary image composed of these two colors, which helps to highlight the key features of the image, remove noise, and simplify further image analysis or processing steps. Binarization converts the pixels in an image into two values of either black or white to highlight features or simplify image analysis. Among them, in the local binarization process, the real-time image is divided into multiple sub-areas, and each sub-area is independently binarized.
[0090] In this embodiment, the real-time image is locally binarized to form multiple sub-image areas, and the adaptive pixel threshold in each sub-image area is obtained. A threshold is dynamically calculated in each sub-image area, which is the adaptive pixel threshold in each sub-image area. The area of the second area in each sub-image area whose grayscale value is lower than the adaptive pixel threshold is calculated, and it is determined whether there is any second area whose area exceeds the second set value. If there is no second area whose area exceeds the second set value, the detection is passed, that is, the area of any second area is less than or equal to the second set value. The detection is passed so that the device can continue to operate, and the area of the second area is not enough to form a detection defect. If there is a second area whose area exceeds the second set value, that is, the area of the second area is greater than the second set value, at this time, there is a large detection defect in the sub-image area, and it is determined that the detection fails. The area of the second area is sufficient to form a device defect, and the device needs to be stopped for inspection. For defects with low contrast (dirty dust type defects), local binarization can be used to better detect and identify them.
[0091] It can be understood that determining the area of the second region and the grayscale value of each sub-image region based on the adaptive pixel threshold is more effective when extracting features under different lighting conditions or complex backgrounds. The important features in the image can be better preserved and highlighted under different lighting conditions, and the background noise can be suppressed. The binarization process is adaptive binarization. Adaptive binarization does not apply a fixed threshold in the real-time image. The real-time image is divided into multiple sub-images. Adaptive binarization can calculate the corresponding adaptive pixel threshold according to the different areas of the sub-image, that is, a small area will be considered around each pixel of the real-time image, and the average grayscale value or median grayscale value of the area will be calculated as the adaptive pixel threshold.
[0092] In addition, Blob (Binary Large Object) analysis usually refers to connected pixel areas with similar attributes in an image, which is used to describe a set of continuous white (or black) pixel points in a binary image. They are consistent in shape, size or color and can be distinguished from the surrounding environment or background. Each sub-image area is regarded as a Blob block, and the Blob block is analyzed to achieve the purpose of counting, measuring area, and positioning.
[0093] In the present application, each Blob block can be calculated to obtain its features, such as area, perimeter, centroid, direction angle, circularity, etc., and the corresponding black pixels in any sub-image can be marked, the marked black pixels are connected pixel by pixel and the marked features are extracted, and the Blobs are screened or classified according to the extracted features, the marked features are characterized to extract features of black pixels, and the sub-image area of black pixels is connected pixel by pixel. The difference area is extracted based on the sub-image with the marked features, that is, the difference area is determined based on the range area of the marked features. It can be understood that at each pixel position, the adaptive pixel threshold of the local binarization of the sub-image area is determined according to the brightness distribution of its neighborhood (local area), rather than using a global unified threshold, so that more local features can be retained and the impact of noise can be reduced.
[0094] Optionally,
[0095] Among them, if src(x,y) is the input grayscale value, thresh is the adaptive pixel threshold, maxVal is the maximum grayscale value, and dst(x,y) is the output grayscale value. That is, each sub-image can be binarized according to the adaptive pixel threshold, and the grayscale value of the sub-image can be output to achieve local binarization.
[0096] In one embodiment, optionally, reference Figure 6 As shown, in the step of extracting the difference area between the real-time image and the preset image, it also includes:
[0097] S310c: Setting a fixed threshold to perform fixed binarization processing on the real-time image;
[0098] S320c: Calculate the area of a third region in the real-time image whose grayscale value is lower than a fixed threshold;
[0099] S330c: Determine whether the area of the third region exceeds a third set value;
[0100] S340c: If no, the test passes;
[0101] S350c: If yes, the detection fails.
[0102] Specifically, a fixed threshold is set, and a fixed binarization process is performed on the real-time image according to the fixed threshold, wherein the real-time image area less than the fixed threshold is a black pixel image, and the real-time image area greater than or equal to the real-time threshold is a white pixel image, and the binarization process is a fixed value binarization. Accordingly, the fixed value binarization applies a fixed value threshold in the real-time image to achieve the effect of enhancing the image contrast of the defect position, so that the processing result of the real-time image meets the standard of the fixed threshold. The area of the third area in the real-time image whose gray value is lower than the fixed threshold is calculated, and it is determined whether the area of the third area exceeds the third set value. If the area of the third area does not exceed the third set value, that is, the area of the third area is less than or equal to the third set value, the detection method passes, so that the device can continue to run. If the area of the third area exceeds the third set value, that is, the area of the third area is greater than the third set value, the detection fails, and the device needs to be stopped for equipment inspection. The third area is the location where the device defect exists, thereby detecting defects of a type with a high contrast but a small area on the device (such as metal molten spatters such as welding slag), and achieving a better defect detection and recognition effect.
[0103] In summary, the detection method performs contour matching on the real-time image so as to match the image of the equipment position according to the preset image, detects the position of the defect on the equipment by determining the difference area, and realizes defect detection at the equipment position. It has better detection and recognition effect for defects with larger areas, and determines the position of defects such as oil and dirt in the equipment by calculating the differential image. The position of the equipment defect is better detected and recognized for defects with low contrast (dirt and dust type defects) through local binarization. Fixed threshold is used for binarization processing to detect defects with high contrast but small area on the equipment (such as metal spatters such as welding slag), so as to achieve better defect detection and recognition effect.
[0104] Example 3
[0105] An embodiment of the present invention further provides a controller, which is used to execute computer instructions to implement the defect detection method provided in Embodiment 2.
[0106] The controller can be an integrated circuit chip with signal processing capability. The above-mentioned controller can be a general processor, including a central processing unit (CPU), a single-chip microcomputer, a microcontroller (MCU), a complex programmable logic device (CPLD), a field programmable gate array (FPGA), an application-specific integrated circuit (ASNC), an embedded ARM and other chips. The controller can implement or execute the disclosed methods, steps and logic diagrams in the embodiments of the present invention.
[0107] In a feasible implementation, a memory is also provided to store program instructions executable by the controller. For example, the defect detection method provided in the embodiment of the present application includes at least one that can be stored in the memory in the form of software or firmware. The memory can be an independent external memory, including but not limited to random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), and electrically erasable read-only memory (EEPROM). The memory can also be integrated with the controller, for example, the memory can be integrated with the controller in the same chip.
[0108] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0109] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0110] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0111] In all examples shown and described herein, any specific values should be interpreted as merely exemplary and not as limiting, and thus other examples of the exemplary embodiments may have different values.
[0112] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A laser welding head lens detection device, characterized in that: include: a first shell, wherein a detection port is provided at one end of the first shell, the detection port is communicated with the interior of the first shell, and the detection port is used to fix the laser welding head; a second reflector is provided in the first shell, and a mirror surface of the second reflector is arranged at an acute angle with an end face where the detection port is located; a second housing, the second housing being in communication with the first housing, a third semi-transparent half-reflecting mirror being disposed in the second housing, the third semi-transparent half-reflecting mirror being disposed parallel to the second reflective mirror; a light-emitting element, the light-emitting element being mounted on a side of the second housing away from the first housing, the light-emitting element emitting collimated detection light, wherein an optical axis of the collimated detection light forms an acute angle with the mirror surface of the third semi-transparent and semi-reflective mirror; An industrial camera is connected to the second housing, and the optical axis of the collimated detection light and the central axis of the field of view of the industrial camera are perpendicular to each other.
2. The laser welding head lens detection device according to claim 1, characterized in that: It also includes a focusing mirror, which is arranged in the first shell and located between the detection port and the second reflector. The main optical axis of the focusing mirror and the end face where the detection port is located are perpendicular to each other.
3. The laser welding head lens detection device according to claim 1, characterized in that: It also includes a fourth protective mirror, which is arranged between the first shell and the second shell, and is arranged opposite to the light-emitting component.
4. The laser welding head lens detection device according to claim 3, characterized in that: The first shell has a first opening, the second shell has a second opening corresponding to the first opening, the fourth protective mirror can close the first opening and the second opening, the fourth protective mirror is perpendicular to the optical axis direction of the collimated detection light, and the collimated detection light and the light entering the industrial camera can both pass through the fourth protective mirror.
5. The laser welding head lens detection device according to claim 1, characterized in that: The included angle between the optical axis of the collimated detection light and the mirror surface of the third semi-transparent and semi-reflective mirror is θ3, and the included angle between the optical axis of the collimated detection light and the mirror surface of the second reflector is θ4, satisfying: 42°≤θ3=θ4≤48°.
6. A defect detection method, characterized in that: include: Performing real-time image capture on a first protective lens, and obtaining contour information of the first protective lens based on the real-time image, wherein the first protective lens is a lens in a laser welding head mounted on the detection end face; Performing contour matching between the contour information and the contour edge of a preset image; Determining that the contour information matches the contour edge, and extracting a difference area between the real-time image and the preset image; Determining whether the area of the difference region is smaller than a set threshold; If the answer is no, it is determined that the test has failed; if the answer is yes, it is determined that the test has passed.
7. The detection method according to claim 6, characterized in that The step of extracting a difference area between the real-time image and the preset image includes: Comparing the real-time image with the preset image to obtain a differential image; Obtaining a preset first pixel threshold; Calculating the area of a first region in the differential image having a grayscale value lower than the first pixel threshold; determining whether the area of the first region exceeds a first set value; If the answer is no, the differential test passes; if the answer is yes, the test fails.
8. The detection method according to claim 7, characterized in that The step of extracting the difference area between the real-time image and the preset image also includes: Performing local binarization processing on the real-time image to form multiple sub-image areas, and obtaining an adaptive pixel threshold in each sub-image area; Calculate the area of a second region in each sub-image region where the grayscale value is lower than the adaptive pixel threshold; Determining whether the area of the second region exceeds a second set value; If it is no, the local binarization test passes; if it is yes, the test fails.
9. The detection method according to claim 8, characterized in that The step of extracting the difference area between the real-time image and the preset image further includes: Setting a fixed threshold to perform fixed binarization processing on the real-time image; Calculating the area of a third region in the real-time image whose grayscale value is lower than the fixed threshold; determining whether the area of the third region exceeds a third set value; If the answer is no, the test passes; if the answer is yes, the test fails.
