Method, system, device and storage medium for image background illumination homogenization

By processing images using rectangular masks and mean filtering techniques, the problem of uneven image illumination was solved, achieving uniform image brightness and highlighting contour edges, thus improving the accuracy of visual detection.

CN116188302BActive Publication Date: 2026-04-21ANGSHI INTELLIGENT SHENZHEN CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANGSHI INTELLIGENT SHENZHEN CO LTD
Filing Date
2023-01-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, uneven image illumination leads to uneven brightness on the object surface, affecting the accuracy of visual detection. Histogram equalization methods may cause reverse changes in bright and dark areas of the image, failing to effectively unify the illumination.

Method used

A rectangular mask is used for rank filtering and mean filtering to eliminate high-frequency grayscale values. The grayscale values ​​are then scaled to a preset range after subtracting the original image from the second image. The original image is then acquired using a 3D line laser profilometer or a 3D camera.

Benefits of technology

It effectively reduces the difference in gray values ​​at different locations in the image, highlights the contour edges, greatly reduces the problem of uneven brightness, and improves the accuracy of image detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116188302B_ABST
    Figure CN116188302B_ABST
Patent Text Reader

Abstract

The application relates to a method, system, device and storage medium for image background light illumination homogenization, which comprises the following steps: step S1: inputting an original image, obtaining a rectangular mask, and performing rank filtering on the original image using the rectangular mask to obtain a first image; step S2: performing mean filtering on the first image to eliminate high-frequency gray values in the first image and obtain a second image; and step S3: subtracting the second image from the original image to obtain a final processing image, and scaling the gray value of the final processing image to a preset value. In the application, the original image is filtered using the rectangular mask, which can reduce the difference of the gray values at different positions of the original image; the second image is subtracted from the original image to obtain a third image, which is used to obtain the gray difference value of each pixel point of the second image and the original image, highlight the contour edges in the image, and greatly reduce the problem of uneven image brightness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial automation machine vision technology, and in particular to methods, systems, devices, and storage media for image background illumination uniformity. Background Technology

[0002] Currently, when photographing industrial products, uneven brightness on the surface of the object can occur due to various factors such as light source and camera. With the rapid development of industrial technology, the requirements for accuracy in visual industrial inspection are also increasing. Uneven brightness on the object's surface reduces identifiable features, directly affecting the accuracy of product defect detection. Current methods for image illumination uniformity generally use histogram equalization, but this method may cause brighter areas to become even brighter and darker areas to become even darker, thus failing to achieve the desired effect. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, system, device and storage medium for uniformizing the background illumination of an image.

[0004] The technical solution adopted by this invention to solve its technical problem is: a method for image background illumination uniformity, comprising the following steps:

[0005] Step S1: Input the original image, obtain a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image;

[0006] Step S2: Perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image and obtain the second image;

[0007] Step S3: Subtract the second image from the original image to obtain the final processed image, and scale the grayscale value of the final processed image to a preset value.

[0008] In some embodiments, in step S1, the original image is acquired by a 3D line laser profilometer or a 3D camera.

[0009] In some embodiments, step S1 further includes: traversing the pixel coordinates of each region in the original image, forming a rectangular mask of a set size with the pixel coordinates of one of the points as the center, performing rank filtering on the original image using the rectangular mask, and forming the first image by traversing the entire original image in sequence.

[0010] In some embodiments, step S2 further includes:

[0011] Step S21: Apply a rectangular filter of a preset size to the target pixel on the first image, and calculate the mean value of all gray values ​​within the rectangular filter to replace the pixel value of the current pixel.

[0012] In some embodiments, step S2 further includes:

[0013] Step S22: After traversing all pixel coordinates of the first image according to step S21, eliminate the high-frequency grayscale values ​​in the first image to obtain the second image.

[0014] In some embodiments, scaling the grayscale value of the final processed image to a preset value in step S3 includes scaling the grayscale value of the final processed image to 0-255.

[0015] In some embodiments, after performing step S3, the method further includes: enhancing, sharpening, or improving the image effect of multiple features of the final processed image.

[0016] The present invention also provides a system for image background illumination uniformity, the system comprising:

[0017] The first image acquisition module is used to input the original image, acquire a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image;

[0018] The second image acquisition module is used to perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image and obtain the second image.

[0019] The grayscale scaling module is used to subtract the second image from the original image to obtain the final processed image, and to scale the grayscale value of the final processed image to a preset value.

[0020] The present invention also provides an electronic device, including a processor and a memory storing computer-readable instructions, wherein the processor is configured to perform the method described in any of the preceding embodiments when executing the computer-readable instructions.

[0021] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the preceding claims.

[0022] The present invention has the following beneficial effects: the rectangular mask used in the present invention performs rank filtering on the original image, which can reduce the difference in gray values ​​at various positions of the original image; the second image is subtracted from the original image to obtain a third image, which is used to obtain the gray value difference of each pixel of the second image and the original image, highlighting the contour edges in the image, while greatly reducing the problem of uneven image brightness. Attached Figure Description

[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0024] Figure 1 This is a flowchart of a method for image background illumination uniformity in some embodiments of the present invention;

[0025] Figure 2a This is the original image that needs to be processed in this invention; Figure 2b The first image is formed by rank filtering of the original image using a rectangular mask; Figure 2c The second image is formed by performing mean filtering on the first image to eliminate high-frequency gray values; Figure 2d The final processed image is obtained by subtracting the original image from the second image.

[0026] Figure 3 This is a three-dimensional structural schematic diagram of the original image detection device of the present invention;

[0027] Figure 4 This is the present invention. Figure 1 A block diagram of a system for image background illumination uniformity in some embodiments. Detailed Implementation

[0028] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0029] It should be noted that the flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0030] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0031] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0032] like Figure 1 As shown, this is a method for image background illumination uniformity in some embodiments of the present invention. The method includes the following steps:

[0033] Step S1: Input the original image, obtain the rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image;

[0034] Step S2: Perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image, and obtain the second image;

[0035] Step S3: Subtract the second image from the original image to obtain the final processed image, and scale the grayscale value of the final processed image to a preset value.

[0036] See also Figures 2a to 2d ,in, Figure 2a The original image that needs to be processed; Figure 2b The first image is formed by rank filtering of the original image using a rectangular mask; Figure 2c The second image is formed by performing mean filtering on the first image to eliminate high-frequency gray values; Figure 2d The final processed image, obtained by subtracting the original image from the second image, reduces the differences in grayscale values ​​across different locations in the image, highlights the contour edges, and significantly reduces uneven brightness in the final processed image. Specifically, step S1: Input the original image, obtain a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image; wherein, the original image is obtained through a 3D line laser profilometer 10 or a 3D camera. In some embodiments, the 3D camera may include a binocular camera, a coded structured light camera, a depth camera, a time-division line scan camera, etc. Further, as... Figure 3 As shown, the original image detection device in some embodiments may include two 3D line laser profilometers 10, a multi-axis device 20, a workpiece fixture 30, an industrial control computer 40, a Mitsubishi PLC 50, and a human-machine interface 60. The 3D line laser profilometer 10 is mounted on an X-axis mount and driven by the X-axis to scan and capture the original image. The workpiece fixture 30 is fixed relative to the X-axis mount and is used to simultaneously drive the two 3D line laser profilometers 10 when capturing the original image. The industrial control computer 40 is used to connect the two 3D line laser profilometers 10 to acquire the original image in real time and perform image processing. The Mitsubishi PLC 50 is used to control the movement of all axes in the multi-axis device 20, and the human-machine interface 60 is used in some embodiments to adjust the movement position and related motion parameters of each axis. It is understood that in other embodiments, the two 3D line laser profilometers 10 can be replaced with a single line laser profilometer of a different model with a larger field of view.

[0037] Step S1, in some embodiments, further includes: traversing the pixel coordinates of every region in the original image, forming a rectangular mask of a predetermined size centered on the pixel coordinates of one of the points, performing rank filtering on the original image using the rectangular mask, and sequentially traversing the entire original image to form the first image. That is, sorting the grayscale values ​​of all pixels within the mask in ascending order, and then selecting the median of the grayscale value sequence of all pixels to replace the grayscale value of one pixel in the first image. It can be understood that, in some embodiments, a rectangular mask of a predetermined size refers to a rectangular mask of an appropriate size set according to the actual situation of the first image.

[0038] Step S2: Perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image, and obtain the second image;

[0039] Step S2 further includes:

[0040] Step S21: Apply a rectangular filter of a preset size to the target pixel in the first image, and calculate the mean of all gray values ​​within the rectangular filter, replacing the pixel value of the current pixel. Understandably, in some embodiments, the preset size rectangular filter refers to a rectangular filter of a suitable preset size based on the actual situation of the first image.

[0041] Step S22: After traversing all pixel coordinates of the first image according to step S21, eliminate the high-frequency grayscale values ​​in the first image to obtain the second image.

[0042] Step S3: Subtract the original image from the second image to obtain the final processed image, and scale the grayscale value of the final processed image to a preset value. Scale the grayscale value of the final processed image to the preset value in step S3 includes scaling the grayscale value of the final processed image to 0-255. Scale the grayscale value of the final processed image to between 0 and 255, which facilitates observation and identification of image defects. Here, grayscale value refers to the brightness display of each pixel, generally ranging from 0 to 255, including 0 and 255, where 0 represents the darkest point and 255 represents the brightest point.

[0043] The process, following step S3, further includes enhancing, sharpening, or improving multiple features of the final processed image to improve image quality, reduce noise, increase the contrast between the target image and the background, and emphasize or suppress certain details in the image. In some embodiments, the multiple features of the final processed image may include edges, contours, and contrast.

[0044] See also Figure 4 The present invention also provides a system for image background illumination uniformity, the system comprising:

[0045] The first image acquisition module is used to input the original image, obtain a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image;

[0046] The second image acquisition module is used to perform mean filtering on the first image to eliminate high-frequency gray values ​​in the first image and obtain the second image.

[0047] The grayscale scaling module is used to subtract the second image from the original image to obtain the final processed image, and to scale the grayscale value of the final processed image to a preset value.

[0048] Specifically, the first image acquisition module is used to input the original image, obtain a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image;

[0049] The original image is acquired using a 3D line laser profilometer 10 or a 3D camera. In some embodiments, the 3D camera may include a binocular camera, a coded structured light camera, a depth camera, a time-division line scan camera, etc. Further, such as... Figure 3 As shown, the original image detection device in some embodiments may include two 3D line laser profilometers 10, a multi-axis device 20, a workpiece fixture 30, an industrial control computer 40, a Mitsubishi PLC 50, and a human-machine interface 60. The 3D line laser profilometer 10 is mounted on an X-axis mount and driven by the X-axis to scan and capture the original image. The workpiece fixture 30 is fixed relative to the X-axis mount and is used to simultaneously drive the two 3D line laser profilometers 10 when capturing the original image. The industrial control computer 40 is used to connect the two 3D line laser profilometers 10 to acquire the original image in real time and perform image processing. The Mitsubishi PLC 50 is used to control the movement of all axes in the multi-axis device 20, and the human-machine interface 60 is used in some embodiments to adjust the movement position and related motion parameters of each axis. Understandably, in other embodiments, the two 3D line laser profilometers 10 can be replaced with a single line laser profilometer of a different model with a larger field of view.

[0050] In some embodiments, the first image acquisition module further includes: traversing the pixel coordinates of every region in the original image, forming a rectangular mask of a predetermined size centered on the pixel coordinates of one of the points, performing rank filtering on the original image using the rectangular mask, and forming the first image by traversing the entire original image sequentially. That is, sorting the grayscale values ​​of all pixels within the mask in ascending order, and then selecting the median of the grayscale value sequence of all pixels to replace the grayscale value of one pixel in the first image. It can be understood that in some embodiments, the predetermined size of the rectangular mask refers to a rectangular mask of an appropriate size set according to the actual situation of the first image.

[0051] The second image acquisition module is used to perform mean filtering on the first image to eliminate high-frequency gray values ​​in the first image and obtain the second image.

[0052] The second image acquisition module also includes:

[0053] Mean filtering module: Applies a rectangular filter of a preset size to the target pixel in the first image, and calculates the mean of all gray values ​​within the rectangular filter, replacing the pixel value of the current pixel. Understandably, in some embodiments, the preset size rectangular filter refers to providing a rectangular filter of a suitable preset size based on the actual situation of the first image.

[0054] Traversal module: After traversing all pixel coordinates of the first image according to the mean filtering module, the high-frequency gray values ​​in the first image are eliminated to obtain the second image.

[0055] The grayscale scaling module subtracts the original image from the second image to obtain the final processed image, and then scales the grayscale values ​​of the final processed image to a preset value. Scaling the grayscale values ​​of the final processed image to the preset value includes scaling the grayscale values ​​of the final processed image to 0-255. Scaling the grayscale values ​​of the final processed image to between 0 and 255 facilitates the observation and detection of image defects. Here, grayscale value refers to the brightness display of each pixel, generally ranging from 0 to 255, including 0 and 255, where 0 represents the darkest point and 255 represents the brightest point.

[0056] The grayscale scaling module further includes enhancing, sharpening, or improving multiple features of the final processed image to improve image quality, reduce noise, increase the contrast between the target image and the background, and emphasize or suppress certain details in the image. In some embodiments, these multiple features of the final processed image may include edges, contours, and contrast.

[0057] The present invention also provides an electronic device, including a processor and a memory storing computer-readable instructions, wherein the processor is configured to perform any of the methods described above when executing the computer-readable instructions.

[0058] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0059] The present invention has the following beneficial effects: The present invention uses a rectangular mask to perform rank filtering on the original image, which can reduce the difference in gray values ​​at various positions in the original image; the second image is subtracted from the original image to obtain the third image, which is used to obtain the gray value difference of each pixel between the second image and the original image, highlighting the contour edges in the image, while greatly reducing the problem of uneven image brightness.

[0060] It is understood that the above embodiments only illustrate preferred embodiments of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can freely combine the above technical features without departing from the concept of the present invention, and can also make several modifications and improvements, all of which fall within the protection scope of the present invention. Therefore, all equivalent transformations and modifications made with respect to the scope of the claims of the present invention should fall within the scope of the claims of the present invention.

Claims

1. A method of image background illumination homogenization, characterized in that, Includes the following steps: Step S1: Input the original image obtained by a 3D line laser profilometer or 3D camera, obtain a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image; Step S2: Perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image and obtain the second image; Step S3: Subtract the second image from the original image to obtain the final processed image, and scale the grayscale value of the final processed image to a preset value; Step S2 includes: Step S21: Apply a rectangular filter of a preset size to the target pixel in the first image, and calculate the mean value of all gray values ​​within the rectangular filter to replace the pixel value of the current pixel. Step S22: After traversing all pixel coordinates of the first image according to step S21, eliminate the high-frequency grayscale values ​​in the first image to obtain the second image.

2. The method of image background illumination uniformization according to claim 1, characterized in that, Step S1 further includes: traversing the pixel coordinates of each region in the original image, forming a rectangular mask of a set size with the pixel coordinates of one of the points as the center, performing rank filtering on the original image using the rectangular mask, and forming the first image by traversing the entire original image in sequence.

3. The method of image background illumination uniformization according to claim 1, characterized in that, The step S3 of scaling the grayscale value of the final processed image to a preset value includes scaling the grayscale value of the final processed image to 0-255.

4. The method of image background illumination uniformization according to claim 1, characterized in that, After performing step S3, the method further includes: enhancing, sharpening, or improving the image effect of multiple features of the final processed image.

5. A system for image background illumination homogenization, characterized by, The system includes: The first image acquisition module is used to input the original image acquired by a 3D line laser profilometer or a 3D camera, acquire a rectangular mask, and use the rectangular mask to perform rank filtering on the original image to obtain the first image; The second image acquisition module is used to perform mean filtering on the first image to eliminate high-frequency grayscale values ​​in the first image and obtain the second image. The grayscale scaling module is used to subtract the second image from the original image to obtain the final processed image, and to scale the grayscale value of the final processed image to a preset value. The second image acquisition module includes: The mean filtering module is used to provide a rectangular filter of a preset size for the target pixel in the first image, and to calculate the mean of all gray values ​​within the rectangular filter to replace the pixel value of the current pixel. The traversal module is used to eliminate high-frequency grayscale values ​​in the first image after traversing all pixel coordinates of the first image according to the mean filtering module, and obtain the second image.

6. An electronic device, comprising: It includes a processor and a memory storing computer-readable instructions, the processor being configured to perform the method as described in any one of claims 1-4 when executing the computer-readable instructions.

7. A computer readable storage medium having stored thereon a computer program, characterized in that When the program is executed by the processor, it implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and computer readable storage medium

    CN111415317A