A polarized light image processing method and system for high-reflective object detection
By acquiring and fusing grayscale values from different polarization directions, a three-channel color image is generated, which solves the problem of poor environmental adaptability of polarized light detection methods in the detection of highly reflective objects, and achieves efficient and clear image acquisition and detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-13
- Publication Date
- 2026-03-31
AI Technical Summary
Existing polarized light detection methods have poor environmental adaptability in detecting highly reflective objects, are complex to use, require adjustments for different angles, and are difficult to adapt to consistent changes in the external environment and the object being detected.
By acquiring a polarized light image of the object to be detected, and using gray values with polarization directions of 0°, 45°, 90° and 135°, the polarization intensity components C0, C1 and C2 are calculated. A polarization degree image is generated and mapped to a three-channel color image. Image fusion and polarization direction analysis are then performed to remove non-polarized parts and obtain a clear image of the object.
It effectively suppresses reflections on object surfaces, improves image clarity, enhances environmental adaptability, reduces detection difficulty, and increases detection efficiency. It eliminates the need for different angle adjustments, thereby improving detection efficiency and accuracy.
Smart Images

Figure CN114897787B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and specifically to a polarized light image processing method and system for detecting highly reflective objects. Background Technology
[0002] In many practical industrial applications, low-contrast and highly reflective imaging environments often pose significant challenges to machine vision inspection. For example, in industrial inspection processes, many objects have highly reflective surfaces, making it difficult to obtain clear images. Figure 1 The electronic components shown in the image have many reflective areas, making surface inspection difficult. Polarizers or polarization sensors can help solve this problem. While ordinary color and monochrome sensors detect light intensity and wavelength, polarization sensors detect and filter polarized light resulting from reflection, refraction, and scattering. Different materials in a product can reflect light and alter its properties. Compared to traditional color or monochrome sensors, polarization sensors can help uncover hidden material properties and provide a clearer, more discernible image. Application engineers can fully utilize the characteristics of polarization sensors to filter reflected light or glare and color-code the polarization angle of light to enhance image contrast.
[0003] Polarized light has been used in machine vision inspection for a long time, for example, to detect stress points, targets, and reduce glare from transparent objects. A typical polarized light system requires one or more additional polarizers placed between the target, the light source, and the camera. Images obtained using polarized light can be used to detect material stress, enhance contrast, suppress reflections, and analyze surface defects.
[0004] Because polarized light is directional, most current light sources only have one polarization direction. This means that the captured image can only suppress reflections from one direction, and has little effect on suppressing reflections from other directions. Furthermore, polarized light systems consist of two parts: a polarizer and an analyzer. Different scenes require suppression of reflections from different directions, so these two parts need to be adjusted for specific scenarios. This places high demands on the user, and when the consistency of the external environment or the object being detected is poor, it is difficult to meet actual detection needs. In summary, the main drawbacks of current methods for object detection using polarized light are:
[0005] (1) Poor adaptability to the environment: unable to adapt to changes in the environment such as external workpieces and external lighting;
[0006] (2) It is complicated to use and requires adjustment for different angles. Summary of the Invention
[0007] In order to solve the problems of existing methods for detecting highly reflective objects using polarized light, this invention provides a polarized light image processing method and system for detecting highly reflective objects.
[0008] According to a first aspect, one embodiment provides a polarized light image processing method for detecting highly reflective objects, comprising:
[0009] Acquire one or more polarized light images of the object to be detected, wherein the one or more polarized light images include gray values I(0°), I(45°), I(90°), and I(135°) when the polarization directions are 0°, 45°, 90°, and 135° respectively;
[0010] Calculate the polarized light intensity components C0, C1, and C2 using the following formulas:
[0011] C0 = I(0°) + I(90°),
[0012] C1 = I(0°) - I(90°),
[0013] C2 = I(45°) - I(135°);
[0014] The polarization degree image P is calculated based on the polarization intensity components C0, C1, and C2, and then mapped to a three-channel color image.
[0015] In one embodiment, the polarization degree image P is calculated based on the polarization intensity components C0, C1, and C2, specifically by calculating the polarization degree image P according to the following formula:
[0016]
[0017] In one embodiment, the polarized light image processing method further includes: calculating the polarization angle θ according to the following formula:
[0018]
[0019] Generate a polarization direction image based on the polarization angle θ;
[0020] The polarization direction image is mapped into a three-channel color image.
[0021] In one embodiment, the image is mapped to a three-channel color image in the following manner:
[0022] The gray values of the mapped image are discretized according to a preset step size, and the values p of the absolute histogram corresponding to each discretized gray value are obtained. i The absolute histogram value p i This represents the proportion of pixels with grayscale value i to the total number of pixels in the image;
[0023] Calculate the cumulative histogram for each gray value in ascending order of gray values. Stop when the value of the cumulative histogram is greater than the preset percentage threshold, and take the gray value corresponding to the last cumulative histogram as the minimum value.
[0024] Calculate the cumulative histogram for each gray value in descending order of gray value. Stop when the value of the cumulative histogram is greater than the preset percentage threshold, and take the gray value corresponding to the last cumulative histogram as the maximum value.
[0025] The grayscale values from the minimum to the maximum value are converted to the range of [0, 255]. The corresponding RGB values are obtained based on the converted grayscale values, and the image is mapped to a three-channel color image.
[0026] The specific steps for obtaining the corresponding RGB value based on the converted grayscale value are as follows:
[0027] The converted grayscale value is used as the value of the H channel in the HSV color model. The value of the H channel is converted to the range of [0, 2π]. The values of the S channel and V channel are both set to 1. Then, the RGB value is calculated according to the following conversion equation:
[0028]
[0029] Where M1 = S × cosH, M2 = S × sinH,
[0030] The calculated RGB values are multiplied by 255 to obtain the final RGB values of the three-channel color image;
[0031] Alternatively, obtaining the corresponding RGB value based on the converted grayscale value specifically involves searching for the corresponding RGB value in a preset color image lookup table based on the converted grayscale value.
[0032] In one embodiment, the polarized light image processing method further includes: performing anisotropic image fusion according to the following formula to obtain a fused image:
[0033] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0034] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0035]
[0036]
[0037]
[0038]
[0039]
[0040] Where c is a preset constant, and the function g is one of the following three:
[0041]
[0042]
[0043]
[0044] Where C is a preset constant.
[0045] In one embodiment, the polarized light image processing method further includes: performing isotropic image fusion according to the following formula to obtain a fused image:
[0046] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0047] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0048] w1 = e -I′(0°,x,y) / S,w2=e -I′(45°,x,y) / S,w3=e -I′(90°,x,y) / S,w4=e -I′(135°,x,y) / S,
[0049] S = e -I′(0°,x,y) +e -I′(45,x,y) +e -I′(90°,x,y) +e -I′(135°,x,y) ,
[0050] Where I′(0°,x,y), I′(45°,x,y), I′(90°,x,y), and I′(135°,x,y) represent the values corresponding to point (x,y) after converting the gray values I(0°), I(45°), I(90°), and I(135°) to the range [0,1].
[0051] In one embodiment, the polarized light image processing method further includes: calculating the diffuse light image I according to the following formula. s The diffuse light image I s Used to characterize the non-polarized portion of light:
[0052]
[0053] The image I representing the polarization of light is calculated using the following formula. t :
[0054]
[0055] In one embodiment, the polarized light image processing method further includes: calculating the light intensity in any direction α according to the following formula:
[0056]
[0057] Where α represents the angle with the positive X-axis direction of the image.
[0058] According to a second aspect, one embodiment provides a polarized light image processing system for detecting highly reflective objects, including a light source, a polarizer, a camera, a processor, and a display;
[0059] The polarizer is placed between the object to be detected and the camera to filter the reflected light from the object to be detected, producing polarized light with polarization directions of 0°, 45°, 90° and / or 135°.
[0060] The camera is used to capture one or more polarized light images of the object to be detected. The one or more polarized light images include gray values I(0°), I(45°), I(90°), and I(135°) with polarization directions of 0°, 45°, 90°, and 135°, respectively.
[0061] The processor is connected to the camera, and the processor includes an image acquisition module, a polarization intensity component calculation module, a polarization degree image calculation module, and a color image mapping module; the image acquisition module is used to acquire the one or more polarized light images; the polarization intensity component calculation module is connected to the image acquisition module and is used to calculate the polarization intensity components C0, C1, and C2 according to the following formula:
[0062] C0 = I(0°) + I(90°),
[0063] C1 = I(0°) - I(90°),
[0064] C2 = I(45°) - I(135°),
[0065] The polarization degree image calculation module is connected to the polarization light intensity component calculation module and is used to calculate the polarization degree image P based on the polarization light intensity components C0, C1 and C2. The color image mapping module is connected to the polarization degree image calculation module and is used to map the polarization degree image P into a three-channel color image.
[0066] The display is connected to the processor and is used to acquire and display the polarization image P.
[0067] According to a third aspect, one embodiment provides a computer-readable storage medium storing a program that can be executed by a processor to implement the polarized light image processing method described in the first aspect.
[0068] The polarized light image processing method and system for detecting highly reflective objects according to the above embodiments obtain polarized light images of the object to be detected by using polarized light with polarization directions of 0°, 45°, 90° and 135°, respectively, and obtain grayscale values in each polarization direction. These values are then used for image fusion to obtain a polarization degree image. This effectively suppresses reflections on the object surface and can obtain high-definition images of highly reflective, low-contrast objects, reducing the difficulty of subsequent processing. At the same time, because the effect obtained by covering polarized light in four directions is achieved, it greatly enhances the adaptability to the environment, adapting to changes in the environment such as external workpieces and external lighting, and eliminating the need for adjustments to different angles, thus improving detection efficiency. After obtaining the polarization degree image, it is mapped into a three-channel color image, allowing the human eye to directly judge and identify it. Attached Figure Description
[0069] Figure 1 An image of a highly reflective object obtained using unpolarized light;
[0070] Figure 2 An image of a highly reflective object obtained using polarized light;
[0071] Figure 3 This is a schematic diagram of the structure of a polarized light image processing system for detecting highly reflective objects according to one embodiment;
[0072] Figure 4 This is a schematic diagram illustrating the effect of a polarizer;
[0073] Figure 5This is a schematic diagram of a polarized light image in one embodiment;
[0074] Figure 6 This is a schematic diagram of the processor structure in one embodiment;
[0075] Figure 7 This is a grayscale histogram of a polarization degree image in one embodiment;
[0076] Figure 8 This is a rendering of the polarization degree image in one embodiment;
[0077] Figure 9 This is a schematic diagram of the processor in another embodiment;
[0078] Figure 10 This is a flowchart of a polarized light image processing method for detecting highly reflective objects in one embodiment;
[0079] Figure 11 A flowchart for mapping an image to a three-channel color image;
[0080] Figure 12 This is a flowchart of a polarized light image processing method for detecting highly reflective objects in another embodiment. Detailed Implementation
[0081] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of this application. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to this application are not shown or described in the specification. This is to avoid obscuring the core parts of this application with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0082] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.
[0083] The serial numbers assigned to components in this document, such as "first" and "second," are used only to distinguish the described objects and have no sequential or technical meaning. The terms "connection" and "linkage" used in this application, unless otherwise specified, include both direct and indirect connections (linkages).
[0084] In industrial inspection processes, it is often necessary to detect defects on the surface of objects. However, many object surfaces have highly reflective properties, making it difficult to obtain clear images. This invention utilizes the polarization properties of light to provide a polarized light image processing system and method. By fusing polarized light images obtained from polarized light in different directions, the strong reflections from object surfaces are removed, reducing image overexposure and improving the efficiency of object detection and recognition. The effects of this invention can be seen in [reference needed]. Figure 1 and Figure 2 , Figure 1 The image was captured using a non-polarized light source. Figure 2 The image obtained by using a polarized light source and processing with the technical solution in one embodiment of the present invention shows that the image clarity has been greatly improved, and the characters on the object are clearly visible. For character recognition, this greatly reduces the difficulty of recognition and improves the accuracy of recognition.
[0085] The polarized light image processing system for detecting highly reflective objects of the present invention will be described below. Please refer to [link / reference needed]. Figure 3 In one embodiment, the system includes a light source 1, a polarizer 2, a camera 3, a processor 4, and a display 5, which are described below.
[0086] Light source 1 provides illumination light. This light strikes the object being inspected, causing reflection / diffuse light, which then enters camera 3 for imaging. Polarizer 2 is placed between the object and camera 3 to filter the reflected / diffuse light, allowing only polarized light with a specific polarization direction to pass through. The effect of the polarizer is as follows: Figure 4 As shown, light may include multiple polarized lights with different polarization directions. After passing through a polarizer, only polarized light with a polarization direction perpendicular to the grid arrangement direction in the polarizer can pass through. This characteristic can be used to filter out polarized light with a specific direction and obtain an image of polarized light with a specific direction.
[0087] Camera 3 is used to sense polarized light passing through polarizer 2 and capture one or more polarized light images of the object to be detected. This invention primarily utilizes polarized light with polarization directions of 0°, 45°, 90°, and 135° for imaging. Polarizers of 0°, 45°, 90°, or 135° can be placed between the object to be detected and camera 3 respectively to obtain polarized light images in these four directions. Alternatively, polarizers with polarization directions in all four directions can be used to obtain grayscale values from polarized light imaging in a single polarized light image. Please refer to [reference needed]. Figure 5The image can then be divided into computational units, each consisting of four pixels, representing the imaging results of polarized light at 0°, 45°, 90°, and 135°. The grayscale values obtained from imaging under polarized light at 0°, 45°, 90°, and 135° are denoted as I(0°), I(45°), I(90°), and I(135°), respectively. These represent the intensity of polarized light in each direction. Using this information for image fusion, multiple images with different physical meanings can be obtained, for example:
[0088] (1) Image of total light intensity;
[0089] (2) The intensity difference image of polarized light in the 0° direction and the 90° direction can be used to determine whether the 0° direction is dominant, the 90° direction is dominant, or the two are equal.
[0090] (3) The intensity difference image of polarized light in the 45° direction and the 135° direction can be used to determine whether the 45° direction is dominant, the 135° direction is dominant, or the two are equal.
[0091] (4) Direction vector diagram of light.
[0092] The key to this invention lies in performing image fusion based on the polarized light imaging results in four directions to obtain a clear image of the object to be detected, which facilitates further processing.
[0093] Processor 4 is connected to camera 3 and is used to process polarized light images captured by camera 3. Please refer to [reference needed]. Figure 6 In one embodiment, the processor 4 includes an image acquisition module 41, a polarization intensity component calculation module 42, a polarization degree image calculation module 43, and a color image mapping module 44, which are described below.
[0094] The image acquisition module 41 is used to acquire one or more polarized light images captured by the camera 3. As can be seen from the above, the one or more polarized light images include gray values I(0°), I(45°), I(90°), and I(135°) with polarization directions of 0°, 45°, 90°, and 135° respectively.
[0095] The polarization intensity component calculation module 42 is connected to the image acquisition module 41 and is used to calculate new polarization intensity components based on I(0°), I(45°), I(90°), and I(135°). In this invention, the following polarization intensity components C0, C1, and C2 are mainly constructed for subsequent image processing:
[0096] C0 = I(0) + I(90°),
[0097] C1 = I(0°) - I(90°),
[0098] C2 = I(45°) - I(135°).
[0099] The polarization degree image calculation module 43 is connected to the polarization light intensity component calculation module 42, and is used to calculate the polarization degree image P based on the polarization light intensity components C0, C1, and C2. In one embodiment, the polarization degree image calculation module 43 calculates the polarization degree image P according to the following formula:
[0100]
[0101] The obtained degree of polarization is a value within the range [0,1], which is difficult for the human eye to judge and recognize. In order to improve the human eye's judgment and recognition ability, a mapping relationship from numerical value to vector can be established: The polarization image P is mapped to a three-channel color image. The color image mapping module 44 is used to implement this function.
[0102] The color image mapping module 44 and the polarization degree image calculation module 43 are used to map the polarization degree image P into a three-channel color image. In one embodiment, the color image mapping module 44 first discretizes the gray values of the image to be mapped by a preset step size. For example, for a polarization degree image, if the discretization is performed by a step size of 0.2, the discretized gray values are 0, 0.2, 0.4, 0.6, 0.8, and 1. Then, histogram statistics are performed to obtain the absolute histogram value p corresponding to each discretized gray value. i The absolute histogram value p i This represents the proportion of pixels with grayscale value i to the total number of pixels in the image. Assuming that for the polarization image mentioned above, the absolute histogram values corresponding to grayscale values 0, 0.2, 0.4, 0.6, 0.8, and 1 are 0.1, 0.1, 0.3, 0.2, 0.25, and 0.05 respectively, then the histogram is as follows: Figure 7 As shown. After obtaining the histogram, calculate the cumulative histogram for each grayscale value in ascending order. Stop when the value of the cumulative histogram exceeds a preset percentage threshold, and take the grayscale value corresponding to the last cumulative histogram as the minimum value; then calculate the cumulative histogram for each grayscale value in descending order. Stop when the value of the cumulative histogram exceeds a preset percentage threshold, and take the grayscale value corresponding to the last cumulative histogram as the maximum value. Figure 7In this example, assuming a percentage threshold of 5%, the cumulative histogram of grayscale values is calculated from grayscale value 0 to the right. When the cumulative histogram of grayscale value 0 is calculated, its value is 0.1, which is greater than 5%, so grayscale value 0 is taken as the minimum value. Similarly, the cumulative histogram of grayscale values is calculated from grayscale value 1 to the left. When the cumulative histogram of grayscale value 0.8 is calculated, its value is 0.3, which is greater than 5%, so grayscale value 0.8 is taken as the maximum value. This process removes extremely large and small values, thus eliminating the influence of noise.
[0103] After obtaining the maximum and minimum values, the color image mapping module 44 transforms the grayscale values from the range of minimum to maximum (e.g., [0,1] as mentioned above) to the range of [0,255] through linear transformation, obtains the corresponding RGB values based on the transformed grayscale values, and maps the image into a three-channel color image.
[0104] This invention provides two methods to obtain the corresponding RGB values based on the converted grayscale values. In one method, the converted grayscale value is first used as the value of the H channel in the HSV color model. The value of the H channel is converted to the range of [0, 2π]. The values of the S channel and V channel are both set to 1. Then, the RGB value is calculated according to the following conversion equation:
[0105]
[0106] Where M1 = S × cosH, M2 = S × sinH, The calculated RGB values are multiplied by 255 to obtain the final RGB values of the three-channel color image.
[0107] In another approach, the corresponding RGB value can be obtained by looking up a table. A color image lookup table corresponding to grayscale values and RGB values can be pre-set, and the corresponding RGB value is looked up in the pre-set color image lookup table based on the converted grayscale value. In some embodiments, the color image lookup table can be implemented using a linear piecewise function, where the grayscale value is equivalent to the input variable of the function, and the RGB value is equivalent to the output variable of the function.
[0108] The display 5 is connected to the processor 4 and is used to acquire and display the polarization image P for staff to view and analyze.
[0109] The polarization image obtained in this invention can be used to analyze the internal stress of an object and to detect defects in the object being tested, especially for transparent objects such as mobile phone glass and phone cases. It can clearly display surface defects, with significantly better results than traditional methods. For example, traditional methods for detecting surface defects on mobile phone cases use a black-and-white brightness-based detection approach, judging the presence of scratches by the difference in brightness imaging on the image. This detection method is highly dependent on the angle of the light source, often requiring multiple lighting angles and multiple shots to detect an object, resulting in low on-site detection efficiency and unsatisfactory results. However, the polarization image processing system of this invention uses image fusion to detect surface defects, reducing system complexity, improving detection efficiency, and clearly displaying scratches on the surface of the mobile phone case. Please refer to [reference needed]. Figure 8 , Figure 8 The image on the left is a picture of a phone case taken using traditional methods, while the image on the right is a polarization image obtained by image fusion using the polarization image processing system of this invention. It can be seen that the polarization image shows a very high sensitivity to defects on the surface of the phone case, making scratches on the phone case immediately apparent.
[0110] Polarization direction is also an important property of polarized light, and it plays a crucial role in the analysis of internal stress and defect detection of objects. Please refer to [reference needed]. Figure 9 In one embodiment, the processor 4 further includes a polarization direction calculation module 45, which is connected to the polarization light intensity component calculation module 42 and the color image mapping module 44. The polarization direction can be represented by a polarization angle θ, and the polarization direction calculation module 45 calculates the polarization angle θ according to the following formula:
[0111]
[0112] A polarization direction image is generated based on the polarization angle θ at each point (x,y). The polarization direction image is then sent to the color image mapping module 44 to be mapped into a three-channel color image, which is finally displayed on the display 5.
[0113] Please refer to Figure 9 In one embodiment, the processor 4 further includes an anisotropic fusion module 46, which is used to anisotropically fuse the obtained polarized light image to obtain a fused image. The anisotropic image fusion is mainly performed according to the following formula:
[0114] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0115] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0116]
[0117]
[0118] Where c is a preset constant. The gradient value at point (x, y) can be calculated using forward differencing, backward differencing, and intermediate differencing. For forward differencing:
[0119]
[0120]
[0121] For backward difference:
[0122]
[0123]
[0124] For the intermediate difference:
[0125]
[0126]
[0127] gradient value
[0128] This invention uses forward difference calculation to obtain the following results for different polarization directions:
[0129]
[0130]
[0131]
[0132] The function g can be represented by one of the following three methods:
[0133] (1) Parabolic:
[0134]
[0135] (2) Perona-Malik:
[0136]
[0137] (3)Weickert:
[0138]
[0139] Where C is a preset constant.
[0140] Please refer to Figure 9 In one embodiment, the processor 4 further includes an isotropic fusion module 47, which is used to perform isotropic fusion on the obtained polarized light image to obtain a fused image. Before performing isotropic fusion, the gray values I(0), I(45), I(90), and I(135) need to be converted to the range [0,1]. Isotropic image fusion is mainly performed according to the following formula:
[0141] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0142] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0143] w1 = e -I′(0°,x,y) / S,w2=e -I′(45°,x,y) / S,w3=e -I′(90°,x,y) / S,w4=e -I′(135°,x,y) / S,
[0144] S = e -I′(0°,x,y) +e -I′(45,x,y) +e- I′(90°,x,y) +e -I′(135°,x,y) ,
[0145] Where I′(0°,x,y), I′(45°,x,y), I′(90°,x,y), and I′(135°,x,y) represent the values corresponding to point (x,y) after converting the gray values I(0°), I(45°), I(90°), and I(135°) to the range [0,1].
[0146] The fused image obtained by anisotropic and isotropic image fusion in this invention can effectively eliminate reflections on the surface of the object to be detected, resulting in a clear image of the object.
[0147] An image is formed by a sensor detecting light intensity and converting it into an electrical signal. Light contains polarized and unpolarized components, and the unpolarized component is a major cause of reflections. Therefore, it is necessary to remove the unpolarized portion from the image. Please refer to [reference needed]. Figure 9 In one embodiment of the present invention, the processor 4 further includes a polarization decomposition module 48, which is connected to the polarized light intensity component calculation module 42 and is used to decompose the polarized and unpolarized parts of light using polarized light in different directions. Diffuse light represents the unpolarized part of light, so the diffuse light image I can be calculated first. s Diffuse light image I s It can be calculated using the following formula:
[0148]
[0149] Since C0 represents the total intensity of light, subtracting the diffuse portion from the total intensity yields an image I characterizing the polarization portion of the light. t :
[0150]
[0151] Image I of the polarization portion of light t Reflective elements on the object's surface are removed; for example, reflections from rippling water can be eliminated, resulting in a clearer image of the object. Image I t It can also be displayed on monitor 5.
[0152] Please refer to Figure 9 In one embodiment, the processor 4 further includes a directional light calculation module 49, which is connected to the polarized light intensity component calculation module 42. The directional light calculation module 49 is used to calculate the light intensity in any direction α using the intensities of polarized light at 0°, 45°, 90°, and 135°. Here, α represents the angle with the positive X-axis direction of the image, which can be set by the user. The directional light calculation module 49 obtains the direction α and calculates the light intensity in direction α according to the following formula:
[0153]
[0154] By acquiring the light intensity in various directions, users can be guided to select the appropriate polarization angle. Furthermore, comparing the light intensity in different directions can be used to analyze the surface texture of objects, detect the consistency of stripe directions, and identify defective products.
[0155] Based on the aforementioned polarized light image processing system for detecting highly reflective objects, this invention also provides a polarized light image processing method for detecting highly reflective objects. This method can run in processor 4. Please refer to [reference needed]. Figure 10 In one embodiment, the method includes steps 110 to 140, which are described in detail below.
[0156] Step 110: Acquire one or more polarized light images of the object to be detected. These one or more polarized light images include grayscale values I(0°), I(45°), I(90°), and I(135°) at polarization directions of 0°, 45°, 90°, and 135°, respectively. The process of capturing polarized light images can be referred to above and will not be repeated here.
[0157] Step 120: Construct polarized light intensity components C0, C1, and C2. New polarized light intensity components can be constructed based on I(0°), I(45°), I(90°), and I(135°) for subsequent image processing. In this invention, the following polarized light intensity components C0, C1, and C2 are mainly constructed for subsequent image processing:
[0158] C0 = I(0°) + I(90°),
[0159] C1 = I(0°) - I(90°),
[0160] C2 = I(45°) - I(135°).
[0161] Step 130: Calculate the polarization degree image P based on the polarization intensity components C0, C1, and C2. In one embodiment, the polarization degree image P can be calculated according to the following formula:
[0162]
[0163] Step 140: Map the polarization degree image P to a three-channel color image. The polarization degree obtained in step 130 is a value within the range [0,1], which is difficult for the human eye to judge and recognize. To improve the human eye's judgment and recognition ability, a mapping relationship from value to vector can be established: Map the polarization degree image P to a three-channel color image. Please refer to [reference needed]. Figure 11 In one embodiment, the process of mapping the polarization image P to a three-channel color image includes steps 141 to 144, which are described in detail below.
[0164] Step 141: Discretize the gray values of the mapped image according to a preset step size. For example, for a polarization image, if the discretization is performed with a step size of 0.2, the discretized gray values will be 0, 0.2, 0.4, 0.6, 0.8 and 1.
[0165] Step 142: Perform histogram statistics to obtain the absolute histogram values p corresponding to each discretized gray value. i The absolute histogram value p iThis represents the proportion of pixels with grayscale value i to the total number of pixels in the image. Assuming that for the polarization image mentioned above, the absolute histogram values corresponding to grayscale values 0, 0.2, 0.4, 0.6, 0.8, and 1 are 0.1, 0.1, 0.3, 0.2, 0.25, and 0.05 respectively, then the histogram is as follows: Figure 7 As shown.
[0166] Step 143: Calculate the cumulative histogram corresponding to each gray value in ascending order of gray values. Stop when the value of the cumulative histogram is greater than the preset percentage threshold, and take the gray value corresponding to the last cumulative histogram as the minimum value; Calculate the cumulative histogram corresponding to each gray value in descending order of gray values. Stop when the value of the cumulative histogram is greater than the preset percentage threshold, and take the gray value corresponding to the last cumulative histogram as the maximum value.
[0167] like Figure 7 In this example, assuming a percentage threshold of 5%, the cumulative histogram of grayscale values is calculated from grayscale value 0 to the right. When the cumulative histogram of grayscale value 0 is calculated, its value is 0.1, which is greater than 5%, so grayscale value 0 is taken as the minimum value. Similarly, the cumulative histogram of grayscale values is calculated from grayscale value 1 to the left. When the cumulative histogram of grayscale value 0.8 is calculated, its value is 0.3, which is greater than 5%, so grayscale value 0.8 is taken as the maximum value. This process removes extremely large and small values, thus eliminating the influence of noise.
[0168] Step 144: Through linear transformation, the grayscale values from the minimum to the maximum value range (e.g., [0.2,1] above) are converted to the range of [0,255]. Based on the converted grayscale values, the corresponding RGB values are obtained, and the image is mapped to a three-channel color image.
[0169] This invention provides two methods to obtain the corresponding RGB values based on the converted grayscale values. In one method, the converted grayscale value is first used as the value of the H channel in the HSV color model. The value of the H channel is converted to the range of [0, 2π]. The values of the S channel and V channel are both set to 1. Then, the RGB value is calculated according to the following conversion equation:
[0170]
[0171] Where M1 = S × cosH, M2 = S × sinH, The calculated RGB values are multiplied by 255 to obtain the final RGB values of the three-channel color image.
[0172] In another approach, the corresponding RGB value can be obtained by looking up a table. A color image lookup table corresponding to grayscale values and RGB values can be pre-set, and the corresponding RGB value is looked up in the pre-set color image lookup table based on the converted grayscale value. In some embodiments, the color image lookup table can be implemented using a linear piecewise function, where the grayscale value is equivalent to the input variable of the function, and the RGB value is equivalent to the output variable of the function.
[0173] Polarization direction is also an important property of polarized light, and it plays a crucial role in the analysis of internal stress and defect detection of objects. Please refer to [reference needed]. Figure 12 In one embodiment, steps 210 to 230 may be included after step 120 for producing polarization direction images, which will be described below.
[0174] Step 210: Calculate the polarization angle θ using the following formula:
[0175]
[0176] Step 220: Generate a polarization direction image based on the polarization angle θ. The polarization direction can be represented by the polarization angle θ, therefore a polarization direction image can be generated based on the polarization angle θ at each point (x,y).
[0177] Step 230: Map the polarization direction image to a three-channel color image. This can be done using the same method as in step 140.
[0178] The polarized light image processing method in one embodiment of the present invention can further perform anisotropic or isotropic fusion of the obtained polarized light image to obtain a fused image. Anisotropic image fusion is mainly performed according to the following formula:
[0179] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0180] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0181]
[0182]
[0183] Where c is a preset constant. The gradient value at point (x, y) can be calculated using forward differencing, backward differencing, and intermediate differencing. For forward differencing:
[0184]
[0185]
[0186] For backward difference:
[0187]
[0188]
[0189] For the intermediate difference:
[0190]
[0191]
[0192] gradient value
[0193] This invention uses forward difference calculation to obtain the following results for different polarization directions:
[0194]
[0195]
[0196]
[0197] The function g can be represented by one of the following three methods:
[0198] (1) Parabolic:
[0199]
[0200] (2) Perona-Malik:
[0201]
[0202] (3)Weickert:
[0203]
[0204] Where C is a preset constant.
[0205] Before performing isotropic fusion, the grayscale values I(0°), I(45°), I(90°), and I(135°) need to be converted to the range [0,1]. Isotropic image fusion is mainly performed according to the following formula:
[0206] u(x,y)=w1I(0°,x,y)+w2I(45°,x,y)+w3I(90°,x,y)+w4I(135°,x,y),
[0207] Where u(x,y) represents the gray value at point (x,y) in the fused image, and I(0°,x,y), I(45°,x,y), I(90°,x,y), and I(135°,x,y) represent the gray values corresponding to point (x,y) when the polarization direction is 0°, 45°, 90°, and 135°, respectively.
[0208] w1 = e -I′(0°,x,y) / S,w2=e -I′(45°,x,y) / S,w3=e -I′(90°,x,y) / S,w4=e- I′(135°,x,y) / S,
[0209] S = e -I′(0°,x,y) +e -I′(45,x,y) +e -I′(90°,x,y) +e -I′(135°,x,y) ,
[0210] Where I′(0°,x,y), I′(45°,x,y), I′(90°,x,y), and I′(135°,x,y) represent the values corresponding to point (x,y) after converting the gray values I(0°), I(45°), I(90°), and I(135°) to the range [0,1].
[0211] An image is formed by a sensor sensing light intensity and converting it into an electrical signal. Light contains polarized and unpolarized components, and the unpolarized component is a major cause of reflection; therefore, it needs to be removed from the image. One embodiment of the present invention provides a polarized light image processing method that can decompose the polarized and unpolarized components of light using polarized light from different directions. Specifically, it first calculates the diffuse light image I. s Diffuse light image I s It can be calculated using the following formula:
[0212]
[0213] Since diffuse light represents the unpolarized portion of light, and C0 represents the total intensity of light, subtracting the diffuse portion from the total intensity yields an image I representing the polarized portion of light. t :
[0214]
[0215] Image I of the polarization portion of light tReflective elements on the object's surface are removed; for example, reflections caused by undulating water can be eliminated, making the image of the object clearer.
[0216] The intensity of polarized light at 0°, 45°, 90°, and 135° can be used to calculate the light intensity in any direction α. Based on this, the polarized light image processing method in one embodiment of the present invention can also calculate the light intensity in any direction α, where α represents the angle with the positive X-axis of the image, which can be set by the user. The light intensity in direction α can be calculated according to the following formula:
[0217]
[0218] By acquiring the light intensity in various directions, users can be guided to select the appropriate polarization angle. Furthermore, comparing the light intensity in different directions can be used to analyze the surface texture of objects, detect the consistency of stripe directions, and identify defective products.
[0219] The polarized light image processing method and system for detecting highly reflective objects according to the above embodiments, by using polarized light with polarization directions of 0°, 45°, 90°, and 135° to obtain polarized light images of the object to be detected, obtaining grayscale values in each polarization direction, and using them for image fusion to obtain a polarization degree image, can effectively suppress reflections on the object surface, obtain high-definition images of highly reflective, low-contrast objects, reduce the difficulty of subsequent processing, and can be used to analyze the internal stress of the object, etc. Furthermore, because the effect obtained by covering polarized light in four directions is included, it greatly enhances adaptability to the environment, adapting to changes in the environment such as external workpieces and external lighting, and eliminating the need for adjustments to different angles, thus improving detection efficiency. After obtaining the polarization degree image, it is mapped to a three-channel color image, allowing the human eye to directly judge and identify it. In some embodiments, the obtained polarized light images can also be fused isotropically or anisotropically to obtain a fused image, which can effectively eliminate reflections on the surface of the object to be detected and obtain a clear image of the object. In some embodiments, the polarized and unpolarized portions of light can be decomposed to obtain an image representing the polarized portion of light, which can also remove reflective parts from the object's surface. In some embodiments, the light intensity in any direction can be calculated, which can guide the user to select an appropriate polarization angle. It can also be used to analyze the surface texture of the object and detect the consistency of stripe directions by comparing the light intensity in different directions.
[0220] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.
[0221] The above examples illustrate the present invention only to aid in understanding it and are not intended to limit the scope of the invention. Those skilled in the art can make various simple deductions, modifications, or substitutions based on the principles of this invention.
Claims
1. A polarized light image processing method for high-reflective object detection, characterized by, The method comprises: acquiring one or more polarized light images of the object to be detected, the one or more polarized light images comprising gray scale values I(0°), I(45°), I(90°), and I(135°) at polarized directions of 0°, 45°, 90°, and 135°, respectively; calculating polarized light intensity components C0, C1, and C2 according to the following formula: , , ; calculating a polarized degree image P from the polarized light intensity components C0, C1, and C2, and mapping the polarized degree image P into a three-channel color image; performing anisotropic or isotropic image fusion according to the following formula to obtain a fused image: , wherein u(x, y) represents a gray value at point (x, y) in the fused image, I(0°, x, y), I(45°, x, y), I(90°, x, y) and I(135°, x, y) represent gray values corresponding to point (x, y) at polarization directions of 0°, 45°, 90° and 135° respectively; for anisotropic image fusion, w1, w2, w3 and w4 are determined according to the anisotropic weighting function, gradient values at point (x, y) at polarization directions of 0°, 45°, 90° and 135° and a preset constant c; for isotropic image fusion, w1, w2, w3 and w4 are determined according to 、 、 、 wherein 、 、 、 respectively represent values corresponding to point (x, y) after converting the gray values I(0°), I(45°), I(90°) and I(135°) to the range of [0, 1].
2. The polarized light image processing method of claim 1, wherein, The calculation of the polarized degree image P from the polarized light intensity components C0, C1, and C2 is specifically performed according to the following formula: 。 3. The polarized light image processing method of claim 1, wherein, The method further comprises: calculating a polarized angle θ according to the following formula: ; generating a polarized direction image from the polarized angle θ; mapping the polarized direction image into a three-channel color image.
4. The polarized light image processing method according to any one of claims 1 to 3, characterized by, The mapping of the image into a three-channel color image is performed in the following manner: Discretize the gray value of the mapped image by a preset step length, and obtain a value p of an absolute histogram corresponding to each gray value after discretization i , the value p of the absolute histogram i represents the proportion of the number of pixels with a gray value of i to the total number of pixels in the image; in order of gray scale values from small to large, calculating a cumulative histogram corresponding to each gray scale value, and stopping when the value of the cumulative histogram is greater than a preset percentage threshold, and taking the gray scale value corresponding to the last cumulative histogram as a minimum value; in order of gray scale values from large to small, calculating a cumulative histogram corresponding to each gray scale value, and stopping when the value of the cumulative histogram is greater than a preset percentage threshold, and taking the gray scale value corresponding to the last cumulative histogram as a maximum value; converting the gray scale values in the range from the minimum value to the maximum value to the range of [0, 255], obtaining corresponding RGB values according to the converted gray scale values, and mapping the image into a three-channel color image; The obtaining of the corresponding RGB values according to the converted gray scale values is specifically performed in the following manner: taking the converted gray scale value as a value of an H channel in an HSV color model, converting the value of the H channel to the range of [0, 2π], setting values of S and V channels to 1, and then calculating the RGB values according to the following conversion equation: , wherein ; scaling the calculated RGB values by 255 times, respectively, to obtain the RGB values of the final three-channel color image; Or the obtaining of the corresponding RGB values according to the converted gray scale values is specifically performed in the following manner: searching for the corresponding RGB values in a preset color map according to the converted gray scale values.
5. The polarized light image processing method of claim 1, wherein, For anisotropic image fusion, , , , wherein the function g is one of the following three: , , , wherein C is a preset constant.
6. The polarized light image processing method of claim 1, wherein, For isotropic image fusion, , 。 7. The polarized light image processing method of claim 1, wherein, The method further comprises: The diffuse light image I is calculated according to the following formula s , the diffuse light image I s for characterizing the non-polarized part of the light: , The image I representing the polarized part of the light is calculated according to the following formula t : 。 8. The polarized light image processing method of claim 1, wherein, The method further comprises: calculating light intensity in any direction α according to the following formula: , wherein α represents an included angle with the positive direction of an X axis of the image.
9. A polarized light image processing system for high-reflective object detection, characterized by, The system comprises a light source, a polarizer, a camera, a processor, and a display; The polarizer is placed between the object to be detected and the camera, and is used to filter reflected light of the object to be detected to generate polarized light with polarized directions of 0°, 45°, 90°, and / or 135°; The camera is used to capture one or more polarized light images of the object to be detected, the one or more polarized light images comprising gray scale values I(0°), I(45°), I(90°), and I(135°) at polarized directions of 0°, 45°, 90°, and 135°, respectively; The processor is connected with the camera, and the processor comprises an image acquisition module, a polarized light intensity component calculation module, a polarization degree image calculation module, a color image mapping module, an anisotropic fusion module and an isotropic fusion module; the image acquisition module is used for acquiring the one or more polarized light images; the polarized light intensity component calculation module is connected with the image acquisition module and is used for calculating polarized light intensity components C0, C1 and C2 according to the following formula: , , , The polarization degree image calculation module is connected with the polarized light intensity component calculation module and is used for calculating a polarization degree image P according to the polarized light intensity components C0, C1 and C2; the color image mapping module is connected with the polarization degree image calculation module and is used for mapping the polarization degree image P into a three-channel color image; The anisotropic fusion module and the isotropic fusion module are respectively used for carrying out anisotropic and isotropic image fusion according to the following formula to obtain a fusion image: , wherein u(x, y) represents a gray value at point (x, y) in the fused image, I(0°, x, y), I(45°, x, y), I(90°, x, y) and I(135°, x, y) represent gray values corresponding to point (x, y) at polarization directions of 0°, 45°, 90° and 135° respectively; for anisotropic image fusion, w1, w2, w3 and w4 are determined according to an anisotropic weighting function, gradient values at point (x, y) at polarization directions of 0°, 45°, 90° and 135° and a preset constant c; for isotropic image fusion, w1, w2, w3 and w4 are determined according to 、 、 、 wherein 、 、 、 respectively represent values corresponding to point (x, y) after converting the gray values I(0°), I(45°), I(90°) and I(135°) to the range of [0, 1]. The display is connected with the processor and is used for acquiring and displaying the polarization degree image P.
10. A computer-readable storage medium, characterized in that, The medium has a program stored thereon, and the program can be executed by the processor to implement the polarized light image processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
A real-time polarization fog-penetrating imaging image enhancement processing method
CN109886883A