Light source intensity adjusting method and system for surface defect detection
By adjusting the light source intensity in the petrochemical equipment defect detection system, the problem of unstable lighting in complex light environments is solved, and more accurate and stable defect detection results are achieved.
Patent Information
- Application Number
- CN202311167817.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2043-09-11
AI Technical Summary
Existing petrochemical equipment defect detection systems are difficult to ensure stable lighting effects in complex light environments, resulting in inaccurate defect detection data.
By setting the first light source intensity and the second light source intensity, the degree of light instability is calculated, and by adjusting the light source intensity range, searching the light source intensity mean or step-by adjusting the light intensity, the optimal light source intensity is determined for surface defect detection.
It realizes rapid adaptive adjustment of the optimal lighting light source intensity in complex light environments, improves the positioning and measurement accuracy of the visual detection system, and ensures the accuracy and stability of the detection results.
Smart Images

Figure CN119603832A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface defect detection of petrochemical equipment, and in particular to a light source intensity adjustment method and system for surface defect detection in a complex light environment. Background Art
[0002] Surface defect detection is one of the necessary links to ensure equipment quality and evaluate equipment service safety. Optical inspection and measurement are the most commonly used means of surface defect detection. In recent years, in order to improve inspection quality and production efficiency and reduce labor costs, vision-based automatic inspection systems have received widespread attention and have achieved good application results in fixed inspection. However, mobile defect detection and measurement systems are still lackluster. One of the reasons is that optical inspection and measurement are greatly affected by ambient light sources. Suitable light sources can greatly reduce the difficulty of image recognition algorithm processing, improve the positioning and measurement accuracy of visual inspection systems, and thus ensure the stability and comprehensive performance of visual systems.
[0003] At present, mobile detection and measurement systems need to deal with light field environments of bright field, dark field, and alternating light field and dark field. Especially when conducting inspection and testing work in petrochemical plants, the equipment materials are diverse and the reflection of light is different. Ambient light is one of the necessary considerations. In addition, in a confined space working environment, the intensity of the dark field ambient light is uneven, and entering and exiting the confined space brings about a large change in the light field and dark field. This requires adjusting the light source intensity according to the changes in the surface characteristics of the object being inspected.
[0004] In the existing field of petrochemical equipment inspection technology, when the ambient light is weak, the intensity of the lighting is usually adjusted manually. Manual adjustment may cause the illuminated area to be too bright or too dark, resulting in inaccurate defect data, thus affecting the accurate judgment of the defect number and three-dimensional morphology.
[0005] Therefore, the prior art needs to provide a light source intensity adjustment solution and a corresponding defect detection solution suitable for petrochemical scenarios. Summary of the invention
[0006] The purpose of the present invention is to provide a solution that can solve the technical problems that the existing petrochemical equipment defect detection system is greatly affected by the lighting system and / or the lighting system is difficult to ensure a stable lighting effect when facing complex alternating light and dark ambient light.
[0007] In order to solve the above technical problems, an embodiment of the present invention provides a method for adjusting the intensity of a light source for surface defect detection, including: step one, setting a first light source intensity and a second light source intensity, and obtaining an image of the area to be measured under corresponding light source intensities, wherein the first light source intensity is less than the second light source intensity; step two, calculating the corresponding degree of illumination instability according to the image of the area to be measured under the first light source intensity and the second light source intensity, and determining the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average light intensity of the two or step-by-step adjusting the light intensity, so as to carry out surface defect detection and measurement on the area to be measured according to the optimal light source intensity.
[0008] Preferably, in the process of determining the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average of the two light intensities, the process includes: S101, determining the average of the two light source intensities according to the first light source intensity and the second light source intensity, so as to obtain the image of the area to be measured under the current average light source intensity; S102, determining the degree of illumination instability under the corresponding light source intensities according to the current first light source intensity, the current second light source intensity and the image of the area to be measured under the average light source intensity; S103, updating the first light source intensity or the second light source intensity by using a binary search method according to the current first light source intensity, the current second light source intensity and the degree of illumination instability under the average light source intensity, so as to update the average light source intensity; S104, judging whether the light source intensity adjustment is currently terminated according to the update adjustment amplitude of the average of the light source intensity for two consecutive times, and if it is terminated, taking the latest second light source intensity as the optimal light source intensity.
[0009] Preferably, in step S104, if the adjustment is not completed yet, steps S102, S103 and S104 are repeated, wherein it is determined whether the update adjustment amplitude of the two most recent consecutive mean values of the light source intensity is less than a preset threshold, and if so, the adjustment is completed, otherwise the adjustment is continued.
[0010] Preferably, in step S103, if the degree of illumination instability under the current first light source intensity does not exceed the degree of illumination instability under the current second light source intensity, and the degree of illumination instability under the current light source intensity average does not exceed the degree of illumination instability under the current second light source intensity, the current light source intensity average is assigned to the second light source intensity, and then the light source intensity average is updated; if the degree of illumination instability under the current second light source intensity does not exceed the degree of illumination instability under the current first light source intensity, and the degree of illumination instability under the current light source intensity average does not exceed the degree of illumination instability under the current first light source intensity, the current light source intensity average is assigned to the first light source intensity, and then the light source intensity average is updated.
[0011] Preferably, the preset threshold is K times the initial second light source intensity value, wherein K is 5% to 10%; or the preset threshold is K times the difference between the initial second light source intensity and the initial first light source intensity.
[0012] Preferably, in the process of determining the optimal light source intensity by stepping through the light intensity adjustment method, the process includes: dividing the range interval between the first light source intensity and the second light source intensity into M intermediate intensity values at equal intervals; calculating the light source instability degree of each intermediate intensity value based on the image of the area to be measured at each intermediate intensity value; and taking the light source intensity corresponding to the minimum value of the light source instability degree at all intermediate intensity values as the optimal light source intensity.
[0013] Preferably, the optimal light source intensity is obtained using the following expression:
[0014] S = argmin f(P m )
[0015] Among them, S represents the optimal light source intensity, m represents the sequence number of each intermediate intensity value, P m represents the image of the area to be tested at the mth intermediate intensity value, and f represents P m The degree of light source instability of the image under the light source intensity value m.
[0016] Preferably, in the process of calculating the degree of illumination instability of the image of the area to be tested under a specified light source intensity, the process includes: detecting severely underexposed and overexposed areas of the image of the area to be tested, thereby calculating the degree of illumination instability using the following expression:
[0017] f′=Xx / s′
[0018] Wherein, f′ represents the degree of lighting instability, Xx represents the area of the severely under-exposed and over-exposed regions, and s′ represents the area of the current image of the region to be measured.
[0019] Preferably, in the process of calculating the degree of illumination instability of the image of the area to be measured under the specified light source intensity, the process includes: setting up a projection device, using the projection device to project a first texture image to the area to be measured, and recording the texture area in the projected first texture image; collecting a projection image when the first texture image is projected onto the area to be measured, and performing preprocessing and texture segmentation processing on the projection image to form a second texture image; and calculating the degree of illumination instability according to the area of the first texture and the second texture image using the following expression:
[0020] f″=(s″-s″ remaining ) / s″
[0021] Among them, f″ represents the degree of lighting instability, s″remaining represents the texture area in the second texture image, and s″ represents the texture area in the first texture image.
[0022] Preferably, the texture in the first texture image is selected from one of discrete light spots, strip light and coded structured light; the preprocessing sequentially carries out grayscale processing, Gaussian blur processing, binarization processing and affine transformation processing; the texture segmentation processing is realized by a semantic segmentation model based on deep learning.
[0023] On the other hand, an embodiment of the present invention provides a defect detection method for petrochemical equipment, which performs surface defect detection and measurement on the area to be tested according to the optimal light source intensity obtained by the light source intensity adjustment method as described above.
[0024] In addition, an embodiment of the present invention further provides a light source intensity adjustment system for surface defect detection, wherein the light source intensity adjustment system is used to implement the light source intensity adjustment method as described above, wherein the light source intensity adjustment system includes: an adjustable light source, which is used to adjust its own light source intensity to a specified light source intensity under the control of a specified light source intensity parameter from a controller; an image sensor, which is used to capture an image of an area to be measured; a controller, which is used to set a first light source intensity and a second light source intensity, wherein the first light source intensity is less than the second light source intensity, and calculate the corresponding degree of illumination instability based on the image of the area to be measured under the first light source intensity and the second light source intensity, and determine the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average of the two light intensities or stepping through the light intensity, so that the detection system performs surface defect detection and measurement on the area to be measured according to the optimal light source intensity.
[0025] Compared with the prior art, one or more embodiments of the above scheme may have the following advantages or beneficial effects:
[0026] The present invention proposes a method and system for adjusting the intensity of a light source for surface defect detection. The method and system can be widely used in optical detection and measurement of surface defects of equipment in the fields of petroleum and chemical industry. The method and system for adjusting the intensity of a light source have wide applicability to equipment materials. The present invention establishes a method for feedback of the intensity of a light source to feed back the instability of the illuminated surface to the light source intensity controller as an input parameter for the intensity of the light source in the next step, so as to achieve the purpose of automatic adjustment of the ambient light, the scattered light on the surface of the object being measured, and the irradiation light source, thereby enabling rapid adaptive adjustment of the optimal illumination light source intensity suitable for the current detection environment. The specific beneficial effects produced are as follows:
[0027] 1. Use preset light source intensity for lighting, collect images for analysis, and adjust the light source intensity according to the analysis results to ensure lighting stability;
[0028] 2. Based on the ratio of the under-exposure and over-exposure areas in the image of the test area to the total area of the collected image, a binary search method and a step adjustment method are proposed to adjust whether the current light source intensity is adapted to the current ambient light intensity, which is beneficial for use in detection scenarios with a high frequency of alternating light and dark fields;
[0029] 3. In order to solve the problem of unstable clarity of captured images under complex ambient light, a texture projection method is proposed to determine the applicability of the light source intensity currently used for image acquisition. It can be used to quickly determine the degree to which the current inspected plane is affected by ambient light, thereby quickly adjusting the intensity of the lighting source to ensure the imaging quality of the plane to be measured, while also ensuring the imaging quality and imaging stability of the mobile optical inspection system.
[0030] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0032] Figure 1 Schematic diagram of the steps of a method for adjusting the intensity of a light source for surface defect detection according to an embodiment of the present application.
[0033] Figure 2 This is a schematic diagram of the principle of a second example of a process for calculating the degree of illumination instability in a method for adjusting the light source intensity for surface defect detection according to an embodiment of the present application.
[0034] Figure 3 This is a schematic diagram of the structure of a light source intensity adjustment system for surface defect detection according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.
[0036] In addition, the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. Also, although a logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a sequence different from that here.
[0037] The terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments. Unless the context clearly indicates otherwise, the singular forms "one", "one" and "item" used herein are also intended to include plural numbers. It should also be understood that the terms "include" and / or "comprise" used herein specify the existence of stated features, integers, steps, operations, units and / or components, without excluding the existence or addition of one or more other features, integers, steps, operations, units, components and / or combinations thereof.
[0038] Surface defect detection is one of the necessary links to ensure equipment quality and evaluate equipment service safety. Optical inspection and measurement are the most commonly used means of surface defect detection. In recent years, in order to improve inspection quality and production efficiency and reduce labor costs, vision-based automatic inspection systems have received widespread attention and have achieved good application results in fixed inspection. However, mobile defect detection and measurement systems are still lackluster. One of the reasons is that optical inspection and measurement are greatly affected by ambient light sources. Suitable light sources can greatly reduce the difficulty of image recognition algorithm processing, improve the positioning and measurement accuracy of visual inspection systems, and thus ensure the stability and comprehensive performance of visual systems.
[0039] At present, mobile detection and measurement systems need to deal with light field environments of bright field, dark field, and alternating light field and dark field. Especially when conducting inspection and testing work in petrochemical plants, the equipment materials are diverse and the reflection of light is different. Ambient light is one of the necessary considerations. In addition, in a confined space working environment, the intensity of the dark field ambient light is uneven, and entering and exiting the confined space brings about a large change in the light field and dark field. This requires adjusting the light source intensity according to the changes in the surface characteristics of the object being inspected.
[0040] In the existing field of petrochemical equipment inspection technology, when the ambient light is weak, the intensity of the lighting is usually adjusted manually. Manual adjustment may cause the illuminated area to be too bright or too dark, resulting in inaccurate defect data, thus affecting the accurate judgment of the defect number and three-dimensional morphology.
[0041] Therefore, the prior art needs to provide a light source intensity adjustment solution and a corresponding defect detection solution suitable for petrochemical scenarios.
[0042] In order to solve the technical problems in the above-mentioned background technology, the embodiments of the present application propose a method and system for adjusting the intensity of a light source for surface defect detection. The method and system use an image sensor to obtain the light source intensity information under the current environment, and the controller adjusts the light source intensity according to preset rules to search for the optimal light source intensity. The present invention obtains the light source intensity information by interacting with the environment and makes corresponding adjustments to the light source intensity, so that the light source is adaptive to the environment, thereby improving the accuracy, stability and comprehensive performance of the visual inspection system. At the same time, the present invention has better practicality by analyzing the collected image itself without setting up a reference object.
[0043] Embodiment 1
[0044] Figure 1 This is a schematic diagram of the steps of the light source intensity adjustment method for surface defect detection in an embodiment of the present application. Figure 1 , the specific steps and processes of the light source intensity adjustment method for surface defect detection described in an embodiment of the present invention are described.
[0045] Step S110 sets the first light source intensity L and the second light source intensity R, and obtains the image of the area to be measured under the first light source intensity and the image of the area to be measured under the second light source intensity. In the embodiment of the present invention, the first light source intensity value L is less than the second light source intensity R.
[0046] It should be noted that the image of the area to be measured described in the embodiment of the present invention is an image collected using an image sensor under specific light source intensity conditions and includes the area of the petrochemical equipment to be measured where surface defect detection and measurement tasks are currently required.
[0047] Specifically, in step S110, the controller is first used to set the light source intensity value L, and the controller adjusts the light source intensity value of the adjustable light source to the L value, so that the adjustable light source is illuminated according to the L value, and the image sensor collects the image of the current area to be tested, which is recorded as PL; then, the light source intensity value R is set, and the controller adjusts the light source intensity value of the adjustable light source to the R value, so that the adjustable light source is illuminated according to the R value, and the image sensor collects the image of the current area to be tested, which is recorded as PR.
[0048] In the embodiment of the present invention, the first light source intensity L is adapted to the minimum value of the light source intensity under the current detection environment; the second light source intensity R is adapted to the maximum value of the light source intensity under the current detection environment.
[0049] After obtaining the images of the area to be measured under the first light source intensity and the second light source intensity, the process proceeds to step S120.
[0050] Step S120 calculates the degree of illumination instability under the first light source intensity and the second light source intensity respectively according to the image of the area to be tested under the first light source intensity and the second light source intensity, and determines the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average light intensity of the two (i.e., the average of the first light source intensity and the second light source intensity) or by stepping the light intensity. In this way, the defect detection system can carry out surface defect detection and measurement work on the area to be tested under the condition of the optimal light source intensity.
[0051] In step S120, it is necessary to first calculate the illumination instability degree under the first light source intensity and the illumination instability degree under the second light source intensity respectively according to the image of the area to be measured under the first light source intensity and the image of the area to be measured under the second light source intensity.
[0052] In the first embodiment, the embodiment of the present invention can detect the serious under-exposure and over-exposure areas in the image of the tested area (the image of the tested area under the first light source intensity or the image of the tested area under the second light source intensity), and then calculate the degree of illumination instability under the corresponding light source intensity according to the detected serious under-exposure and over-exposure areas. The following expression is used to calculate the degree of illumination instability:
[0053] f′=Xx / s′
[0054] Among them, f′ represents the degree of lighting instability, Xx represents the area of the under-exposure and over-exposure serious areas in the image of the current area to be tested, and s ′ Represents the area of the current image of the area to be tested. It should be noted that, in an embodiment of the present invention, the under-exposure and over-exposure serious areas represent the sum of the under-exposure serious areas and the over-exposure serious areas in the image. In the process of calculating the areas of the under-exposure and over-exposure serious areas, the currently obtained color RGB image of the area to be tested is first converted into a grayscale image. At this time, the grayscale value range of each position in the grayscale image is between 0-255; the area of the area with a grayscale value in the range of 0-23 in the current grayscale image is calculated to obtain the area of the under-exposure serious area, and at the same time, the area of the area with a grayscale value in the range of 232-255 in the current grayscale image is counted to obtain the area of the over-exposure serious area, thereby obtaining the area of the under-exposure and over-exposure serious areas in the current image of the area to be tested.
[0055] In a second embodiment, the embodiment of the present invention can also measure the degree of illumination instability of the image of the area to be measured under different light source intensities by adding a projection device.
[0056] Specifically, in the first step, a projection device is set up, and a first texture image is projected onto the area to be measured using the projection device, and a controller records the texture area in the first texture image projected by the projection device. It should be noted that the first texture described in the embodiment of the present invention is the original texture image projected from the projection device (rather than the image when the original texture image is projected onto the area to be measured).
[0057] In the second step, the image sensor collects a projection image containing the first texture in a fully projected state when the first texture image is projected onto the area to be measured, and the controller performs preprocessing and texture segmentation processing on the projection image to form a second texture image. Figure 2 FIG. 2 is a schematic diagram showing a second example of a calculation process of the degree of illumination instability in a method for adjusting the light source intensity for surface defect detection according to an embodiment of the present application. Figure 2 As shown, when the first texture image (i.e., the image containing the preset texture) is projected onto the area to be measured, the captured projection image includes not only the first texture image, but also the complete projection (projection) state of the first texture image in the area to be measured (including the texture actually projected onto the area to be measured and the part that is not effectively projected onto the area to be measured due to factors such as inappropriate light source intensity).
[0058] In one embodiment, the texture in the first texture image is selected from one of discrete light spots, stripe light, and coded structured light.
[0059] Then, the controller pre-processes the projection image and then performs texture segmentation processing to form a second texture image.
[0060] In one embodiment, during the preprocessing of the projection image, a series of image processing tasks such as grayscale processing, Gaussian blur processing, binarization processing and affine transformation processing are carried out in sequence.
[0061] In one embodiment, during the texture segmentation process, the preprocessed projection image is semantically segmented through a semantic segmentation model based on deep learning, so that the areas in the current image that do not belong to the micro-projection texture and are not effectively projected into stripes (i.e., missing parts) are eliminated, thereby realizing the texture segmentation processing of the projection image, forming an image that only contains areas that are effectively projected into stripes, which is recorded as the second texture image.
[0062] The third step is to calculate the degree of lighting instability based on the area of the first texture and the second texture image using the following expression:
[0063] f″=(s″-s″ remaining ) / s″
[0064] Among them, f″ represents the degree of lighting instability, s″ remainingrepresents the texture area in the second texture image, and s″ represents the texture area in the first texture image.
[0065] Therefore, after obtaining the illumination instability of the image of the test area under the first light source intensity and the second light source intensity, step S120 will also determine the optimal light source intensity through preset rules based on the calculated illumination instability of the first light source intensity and the second light source intensity.
[0066] In the first embodiment, the embodiment of the present invention determines the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average value of the two light intensities.
[0067] Specifically, step S101, according to the current first light source intensity and the current second light source intensity, the average of the two light source intensities is determined, so that the image sensor collects the image of the area to be measured under the current average light source intensity and the controller obtains the image of the area to be measured under the current average light source intensity, which is recorded as PM. Then, step S102, according to the current first light source intensity, the current second light source intensity and the image of the area to be measured under the current average light source intensity, the degree of illumination instability under the corresponding light source intensity is determined respectively. Among them, the illumination instability can be calculated by selecting the first embodiment of the illumination instability degree calculation process or the second embodiment of the illumination instability degree calculation process described above.
[0068] Step S103: According to the current first light source intensity, the current second light source intensity and the degree of illumination instability at the mean light source intensity obtained in step S102, a binary search method is used to update the first light source intensity or the second light source intensity, thereby updating the mean light source intensity.
[0069] In one embodiment, if the degree of illumination instability under the current first light source intensity does not exceed the degree of illumination instability under the current second light source intensity, and the degree of illumination instability under the current light source intensity average does not exceed the degree of illumination instability under the current second light source intensity, the current light source intensity average is assigned to the second light source intensity, and then the current light source intensity average is updated.
[0070] Specifically, if f(P L )≤f(P R ), and f(P M )≤f(P R ), let R=M, and M=(L+R) / 2.
[0071] In another embodiment, if the degree of illumination instability under the current second light source intensity does not exceed the degree of illumination instability under the current first light source intensity, and the degree of illumination instability under the current light source intensity average does not exceed the degree of illumination instability under the current first light source intensity, the current light source intensity average is assigned to the first light source intensity, and then the current light source intensity average is updated.
[0072] Specifically, if f(P R )≤f(P L ), and f(P M )≤f(P L ), let L=M, and M=(L+R) / 2.
[0073] Next, in step S104, according to the update adjustment range of the two most recent consecutive light source intensity averages, it is determined whether the light source intensity adjustment is currently completed. If the light source intensity adjustment can be completed, the latest second light source intensity is used as the optimal light source intensity. If the adjustment is not currently completed, steps S102, S103 and S104 are repeated.
[0074] The process of judging whether the light source intensity adjustment needs to be terminated includes: judging whether the update adjustment amplitude of the two most recent consecutive light source intensity averages is less than a preset threshold. If so, the adjustment should be terminated; otherwise, the feedback step S102 is continued to readjust the updated light intensity average by re-executing steps S102 to S104 and judging whether the adjustment needs to be terminated (i.e., the adjustment is not terminated).
[0075] It should be noted that the embodiments of the present invention do not specifically limit the preset threshold value, and those skilled in the art can set it according to the light source intensity adjustment accuracy. In one embodiment, the preset threshold value can be K times the initial second light source intensity value (i.e., the second light source intensity value set in step S110). In another embodiment, the preset threshold value can also be K times the difference between the initial second light source intensity and the initial first light source intensity. Wherein K is 5% to 10%.
[0076] In a second embodiment, the embodiment of the present invention can also determine the optimal light source intensity by stepping through the light intensity adjustment method.
[0077] Specifically, step T101 divides the range between the first light source intensity and the second light source intensity set in step S110 into M intermediate intensity values at equal intervals according to a preset interval, thereby forming an intermediate intensity value sequence. The total number of elements in the intermediate intensity value sequence is M, and the difference between adjacent elements is a preset interval.
[0078] Step T102, collect the image of the area to be tested at each intermediate intensity (element) value, and calculate the light source instability degree of each intermediate intensity value according to the image of the area to be tested at each intermediate intensity value. The light source instability degree of each intermediate intensity value can be calculated by selecting the first embodiment of the above-mentioned illumination instability degree calculation process or the second embodiment of the illumination instability degree calculation process.
[0079] Step T103: taking the light source intensity corresponding to the minimum value of the light source instability degree under all intermediate intensity values as the final optimal light source intensity.
[0080] In one embodiment, the optimal light source intensity is obtained using the following expression:
[0081] S = argmin f(P m )
[0082] Among them, S represents the optimal light source intensity, m represents the sequence number of each intermediate intensity value, P m represents the image of the area to be tested at the mth intermediate intensity value, and f represents P m The degree of light source instability of the image under the light source intensity value m.
[0083] Therefore, the present invention searches for the optimal light source intensity suitable for the current defect detection environment through steps S110 and S120. At this time, the detection system can carry out surface defect detection and measurement on the test area under the action of the optimal light source intensity, thereby obtaining more accurate defect detection results.
[0084] Embodiment 2
[0085] Based on the above-mentioned embodiment 1, the specific process of a method for adjusting the intensity of a light source for surface defect detection is described below:
[0086] S1: preset the light source intensity value L for illumination; the image sensor collects the image of the current area to be tested, recorded as P L ; Adjust the light source intensity values to R and M respectively; The image sensor collects images of the area to be tested under the above light source intensities, which are respectively recorded as P R and P M ;
[0087] Wherein, the light source intensity L≤M≤R.
[0088] S2: Analyze the image obtained in S1 according to the preset judgment rules and adjust the light source intensity value.
[0089] Optionally, the determination rule is: after obtaining the image, detecting severely underexposed and overexposed areas in the image, and adjusting the light source intensity according to the degree of lighting instability;
[0090] The calculation method of the illumination instability degree is as follows:
[0091] f′=s′ loss / s′
[0092] Where: f′ is the degree of light instability, s′ loss is the sum of the areas of the detected image and the overexposed area, and s′ is the total area of the obtained image.
[0093] S3: Repeat the process of image acquisition, analysis and intensity adjustment until the intensity value adjustment amplitude is less than a preset threshold for two consecutive times;
[0094] The intensity adjustment process is: using a binary search method to adjust the light source intensity; wherein the binary search method is:
[0095] If f(P L )≤f(P R ), and f(P M )≤f(P R ), let R = M, and M = (L + R) / 2;
[0096] If f(P R )≤f(P L ), and f(P M )≤f(P L ), let L = M, and M = (L + R) / 2;
[0097] Among them, f is used to evaluate the degree of illumination instability under the current illumination intensity;
[0098] Preferably, the ratio K of the maximum intensity value is 5%.
[0099] S4: According to the results of S3, the final strength value is set, and surface defect detection and measurement are performed.
[0100] Embodiment 3
[0101] Based on the above-mentioned embodiment 2, the light source intensity is adjusted by a method similar to that of embodiment 2, except that in embodiment 3:
[0102] The preset light source intensity value L is the minimum intensity value of the light source; the adjusted light source intensity value R is the maximum intensity value of the light source; and the light source intensity value M is the average value of the light source intensity value L and the light source intensity value R.
[0103] During the light source intensity analysis:
[0104] like Figure 3As shown, a projection device is added to the detection system, and a specific texture is projected onto the area to be detected by the projection device, and the preset texture is regarded as the first texture;
[0105] Wherein, the special texture is strip light.
[0106] After obtaining the corresponding image, the texture projected in the area is segmented through image preprocessing and other operations, and regarded as the second texture;
[0107] Wherein, the image preprocessing includes steps such as grayscale, Gaussian blur, binarization, affine transformation, etc.;
[0108] Compare the first texture with the second texture, and adjust the light intensity according to the degree of lighting instability;
[0109] The calculation method of the illumination instability degree is as follows:
[0110] f″=(s″-s″ remaining ) / s″
[0111] Where: f″ is the degree of light instability, s″ remaining is the obtained second texture area, and s″ is the set first texture area.
[0112] The rest of the process is similar to that of the second embodiment.
[0113] Embodiment 4
[0114] Based on the above-mentioned embodiment 2, the light source intensity is adjusted by a method similar to that of embodiment 2, except that in embodiment 4:
[0115] The intensity adjustment process is: using a step adjustment method to adjust the light source intensity;
[0116] The step adjustment method is: setting M groups of intensity values at equal intervals from the minimum intensity to the maximum intensity of the light source, calculating the degree of illumination instability under each group of intensity values, and the value of the optimal intensity S is:
[0117] S = argmin f(P m )
[0118] Where: S represents the optimal light source intensity, m represents the sequence number of each intermediate intensity value, P m represents the image of the area to be tested at the mth intermediate intensity value, and f represents P m The degree of light source instability of the image under the light source intensity value m.
[0119] The rest of the process is similar to that of the second embodiment.
[0120] Embodiment 5
[0121] Based on the above-mentioned embodiment 2, the light source intensity is adjusted by a method similar to that of embodiment 2, except that in embodiment 5:
[0122] During the light source intensity analysis:
[0123] like Figure 3 As shown, a projection device is added to the detection system, and a specific texture is projected onto the area to be detected by the projection device, and the preset texture is regarded as the first texture;
[0124] Wherein, the special texture is coded structured light.
[0125] The intensity adjustment process is: using a step adjustment method to adjust the light source intensity;
[0126] The step adjustment method is: setting M groups of intensity values at equal intervals from the minimum intensity to the maximum intensity of the light source, calculating the degree of illumination instability under each group of intensity values, and the value of the optimal intensity S is:
[0127] S = argmin f(P m )
[0128] Where: S represents the optimal light source intensity, m represents the sequence number of each intermediate intensity value, P m represents the image of the area to be tested at the mth intermediate intensity value, and f represents P m The degree of light source instability of the image under the light source intensity value m.
[0129] The rest of the process is similar to that of the second embodiment.
[0130] Embodiment 6
[0131] Based on the light source intensity adjustment method described in the first to fifth embodiments, the present invention also provides a defect detection method for petrochemical equipment. The defect detection method performs surface defect detection and measurement on the area to be tested according to the optimal light source intensity obtained by the light source intensity adjustment method described in the first to fifth embodiments.
[0132] Thus, the present invention improves the quality of inspection imaging and the accuracy of defect inspection results.
[0133] Embodiment 7
[0134] Based on the light source intensity adjustment method described in the first to fifth embodiments, the present invention further provides a light source intensity adjustment system for surface defect detection. The light source intensity adjustment system is used to implement the light source intensity adjustment method described in the first to fifth embodiments.
[0135] Figure 3FIG. 1 is a schematic diagram of the structure of a light source intensity adjustment system for surface defect detection according to an embodiment of the present application. Figure 3 As shown, the light source intensity adjustment system described in the embodiment of the present invention includes: an adjustable light source 31 , an image sensor 32 and a controller 33 .
[0136] The adjustable light source 31 is used to adjust its own light source intensity to the specified light source intensity under the control of the specified light source intensity parameter from the controller. The image sensor 32 is used to collect the image of the area to be tested after obtaining the image acquisition instruction from the controller 33. The controller 33 is first used to set the first light source intensity and the second light source intensity. Among them, the first light source intensity is less than the second light source intensity. Then, the controller 33 is also used to calculate the corresponding degree of illumination instability based on the image of the area to be tested under the first light source intensity and the second light source intensity, and determine the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average light intensity of the two or stepping the light intensity to enable the detection system to carry out surface defect detection and measurement work on the area to be tested according to the optimal light source intensity.
[0137] The present invention discloses a method and system for adjusting the intensity of a light source for surface defect detection. The method and system can be widely used in optical detection and measurement of surface defects of equipment in the fields of petroleum and chemical industry. The method and system for adjusting the intensity of a light source have wide applicability to equipment materials. The present invention establishes a method for feedback of the intensity of a light source to feed back the instability of the irradiated surface to a light source intensity controller as an input parameter for the intensity of the light source in the next step, so as to achieve the purpose of automatic adjustment of the ambient light, the scattered light on the surface of the object being measured, and the irradiation light source. The beneficial effects produced are as follows:
[0138] 1. Use preset light source intensity for lighting, collect images for analysis, and adjust the light source intensity according to the analysis results to ensure lighting stability;
[0139] 2. Based on the ratio of the under-exposure and over-exposure areas in the image of the test area to the total area of the collected image, a binary search method and a step adjustment method are proposed to adjust whether the current light source intensity is adapted to the current ambient light intensity, which is beneficial for use in detection scenarios with a high frequency of alternating light and dark fields;
[0140] 3. In order to solve the problem of unstable clarity of captured images under complex ambient light, a texture projection method is proposed to determine the applicability of the light source intensity currently used for image acquisition. It can be used to quickly determine the degree to which the current inspected plane is affected by ambient light, thereby quickly adjusting the intensity of the lighting source to ensure the imaging quality of the plane to be measured, while also ensuring the imaging quality and imaging stability of the mobile optical inspection system.
[0141] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any person familiar with the technology within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0142] In the description of the present invention, unless otherwise specified, "plurality" means two or more than two; the orientations or positional relationships indicated by the terms "upper", "lower", "left", "right", "inner", "outer", "front end", "rear end", "head", "tail", etc. are based on the orientations or positional relationships shown in the drawings, and 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 orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0143] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connection" 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 an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0144] It should be understood that the embodiments disclosed in the present invention are not limited to the specific structures, processing steps or materials disclosed herein, but should be extended to equivalent substitutions of these features understood by ordinary technicians in the relevant field. It should also be understood that the terms used herein are only used for the purpose of describing specific embodiments and are not meant to be limiting.
[0145] The "one embodiment" or "embodiment" mentioned in the specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.
[0146] The embodiments of the present invention are given for the purpose of illustration and description, and are not intended to be exhaustive or to limit the invention to the disclosed forms. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments are selected and described in order to better illustrate the principles and practical applications of the present invention and to enable those of ordinary skill in the art to understand the present invention and thereby design various embodiments with various modifications suitable for specific uses.
[0147] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the patent protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A method for adjusting the intensity of a light source for surface defect detection, characterized in that: include: Step 1: setting a first light source intensity and a second light source intensity, and obtaining an image of the area to be measured under corresponding light source intensities, wherein the first light source intensity is less than the second light source intensity; Step 2: Calculate the corresponding degree of illumination instability based on the image of the area to be tested under the first light source intensity and the second light source intensity, and determine the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for the average light intensity of the two or step-by-step adjusting the light intensity, so as to carry out surface defect detection and measurement on the area to be tested according to the optimal light source intensity.
2. The method for adjusting the light source intensity according to claim 1, characterized in that: The process of determining the optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity to search for the average of the two light intensities includes: S101, determining the average of the first light source intensity and the second light source intensity according to the two light source intensities, so as to obtain an image of the area to be measured under the current average light source intensity; S102, determining the degree of illumination instability under the corresponding light source intensities according to the image of the area to be measured under the current first light source intensity, the current second light source intensity and the average light source intensity; S103, according to the current first light source intensity, the current second light source intensity and the degree of illumination instability under the average light source intensity, using a binary search method to update the first light source intensity or the second light source intensity, thereby updating the average light source intensity; S104, judging whether the light source intensity adjustment is currently completed according to the update adjustment range of the two most recent consecutive average values of the light source intensity, and if it is completed, taking the latest second light source intensity as the optimal light source intensity.
3. The method for adjusting the light source intensity according to claim 2, characterized in that: In step S104, if the adjustment is not completed, steps S102, S103 and S104 are repeated, wherein: It is determined whether the update adjustment amplitude of the two most recent consecutive average values of the light source intensity is less than a preset threshold value. If so, the adjustment is terminated; otherwise, the adjustment is continued.
4. The method for adjusting the light source intensity according to claim 2 or 3, characterized in that: In step S103, If the lighting instability degree under the current first light source intensity does not exceed the lighting instability degree under the current second light source intensity, and the lighting instability degree under the current light source intensity mean does not exceed the lighting instability degree under the current second light source intensity, assigning the current light source intensity mean to the second light source intensity, and then updating the light source intensity mean; If the degree of illumination instability under the current second light source intensity does not exceed the degree of illumination instability under the current first light source intensity, and the degree of illumination instability under the current light source intensity average does not exceed the degree of illumination instability under the current first light source intensity, then the current light source intensity average is assigned to the first light source intensity, and then the light source intensity average is updated.
5. The method for adjusting the light source intensity according to claim 3, characterized in that: The preset threshold is K times the initial second light source intensity value, wherein K is 5% to 10%; or The preset threshold is K times the difference between the initial second light source intensity and the initial first light source intensity.
6. The method for adjusting the light source intensity according to any one of claims 1 to 5, characterized in that: The process of determining the optimal light source intensity by stepping through the light intensity adjustment includes: Divide the range between the first light source intensity and the second light source intensity into M intermediate intensity values at equal intervals; According to the image of the area to be tested at each intermediate intensity value, the instability degree of the light source at each intermediate intensity value is calculated; The light source intensity corresponding to the minimum value of the light source instability degree under all intermediate intensity values is taken as the optimal light source intensity.
7. The method for adjusting the light source intensity according to claim 6, characterized in that: The optimal light source intensity is obtained using the following expression: S=argmin f(P m ) Among them, S represents the optimal light source intensity, m represents the sequence number of each intermediate intensity value, P m represents the image of the area to be tested at the mth intermediate intensity value, and f represents P m The degree of light source instability of the image under the light source intensity value m.
8. The method for adjusting the light source intensity according to any one of claims 1 to 7, characterized in that: The process of calculating the degree of illumination instability of the image of the area to be measured under the specified light source intensity includes: Detect the severely under-exposed and over-exposed areas of the image of the test area, and calculate the degree of illumination instability using the following expression: f′=Xx / s′ Wherein, f′ represents the degree of lighting instability, Xx represents the area of the severely under-exposed and over-exposed regions, and s′ represents the area of the current image of the region to be measured.
9. The method for adjusting the light source intensity according to any one of claims 1 to 7, characterized in that: The process of calculating the degree of illumination instability of the image of the area to be measured under the specified light source intensity includes: Building a projection device, projecting a first texture image onto the area to be measured using the projection device, and recording the texture area in the projected first texture image; Acquire a projection image when the first texture image is projected onto the area to be measured, and perform preprocessing and texture segmentation processing on the projection image to form a second texture image; According to the area of the first texture and the second texture image, the degree of illumination instability is calculated using the following expression: f″=(s″-s″ remaining ) / s″ Among them, f″ represents the degree of lighting instability, s″ remaining represents the texture area in the second texture image, and s″ represents the texture area in the first texture image.
10. The method for adjusting the light source intensity according to claim 9, characterized in that: The texture in the first texture image is selected from one of discrete light spots, strip light, and coded structured light; The preprocessing sequentially carries out grayscale processing, Gaussian blur processing, binarization processing and affine transformation processing; The texture segmentation process is implemented through a semantic segmentation model based on deep learning.
11. A defect detection method for petrochemical equipment, characterized in that: The defect detection method performs surface defect detection and measurement work on the area to be tested according to the optimal light source intensity obtained by the light source intensity adjustment method according to any one of claims 1 to 10.
12. A light source intensity adjustment system for surface defect detection, characterized in that: The light source intensity adjustment system is used to implement the light source intensity adjustment method according to any one of claims 1 to 10, wherein the light source intensity adjustment system comprises: An adjustable light source, which is used to adjust its own light source intensity to a specified light source intensity under the control of a specified light source intensity parameter from a controller; An image sensor, which is used to collect images of the area to be tested; A controller is used to set a first light source intensity and a second light source intensity, wherein the first light source intensity is less than the second light source intensity, and to calculate a corresponding degree of illumination instability based on images of a test area under the first light source intensity and the second light source intensity, and to determine an optimal light source intensity by continuously narrowing the range between the first light source intensity and the second light source intensity and searching for an average of the two light intensities or by stepping through the light intensity, so that the detection system performs surface defect detection and measurement on the test area according to the optimal light source intensity.
Citation Information
Patent Citations
Visual inspection device and illumination condition setting method of visual inspection device
CN110186926A
Illumination brightness adjustment-based automobile painting surface defect image quality optimization method
CN110672621A
Device and method for light intensity correction, illumination, microscope imaging and silicon wafer defect detection
CN116430570A
Method for locating surface defects
EP2463175A2
Method and apparatus for optically controlling the quality of objects having a circular edge
US20060072105A1
Cited By
High-voltage thyristor image generation method and system for quality detection
CN119806454A
Aluminum alloy CNC product defect detection method and system based on structured light scanning
CN120927673A
Light source adaptive dimming system, light source adaptive dimming method and related device
CN122421143A
Light source adaptive dimming system, light source adaptive dimming method and related device
CN122421143B