An online image pre-processing method and device for surface defects of an aluminum plate
By using interpolation, timed interruption, and adaptive weight processing based on the MSRCR algorithm, the problems of background interference and boundary blurring in the preprocessing of aluminum plate surface defect images were solved, achieving clarity of the foreground boundary and quality improvement of the image.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2026-03-24
AI Technical Summary
Existing image preprocessing methods have several drawbacks when processing images of surface defects on aluminum plates. These include discrepancies between the image of the surface defect and the actual defect, the image background easily interfering with the defect, and the image foreground boundaries being blurred and unclear.
A stable aluminum plate running speed signal is obtained by interpolation and timer interrupt methods. A second image is generated by boundary removal using the differential method. A third image is synthesized by combining RGB synthesis technology. Image feature enhancement is performed using the MSRCR algorithm. The target image is generated by adaptive weight processing.
It effectively removes the interference of the image background on defects, makes the foreground boundary of the image clear, improves the image quality and clarity, and provides a reliable basis for subsequent detection.
Smart Images

Figure CN116630279B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a preprocessing method and apparatus for online detection of surface defects on cross-section aluminum plates. Background Technology
[0002] With the continuous development and popularization of digital image acquisition technology, the amount of image data has exploded. How to efficiently process this massive amount of image data has become an important research direction in the field of computer vision. At the same time, since the image quality, brightness, contrast and other characteristics of images acquired by different devices and in different scenes vary, it is necessary to preprocess the images to eliminate these differences and improve the image quality, so as to better support subsequent image analysis, recognition, classification and other tasks.
[0003] In industrial production, the surface of metal sheet and strip products may be affected by damage to processing equipment or harsh industrial environments, leading to product quality issues. Some surface defects not only affect subsequent production processes but also negatively impact the quality of the final product, often exhibiting large-area or periodic characteristics. Machine vision-based surface defect detection technology can significantly improve production efficiency. By using automated methods, this technology eliminates the variables of manual operation, reduces errors caused by human factors, and enables faster acquisition of product defect information, thereby improving production efficiency and product quality. The application of machine vision technology can improve product quality and production efficiency and contribute to accelerating the development and upgrading of intelligent automated manufacturing.
[0004] Aluminum is an important structural and functional material. In the cross-cutting process of finished products, current industrial manufacturing relies on traditional manual visual inspection and historical experience for process setting, resulting in significant economic and time costs, and failing to detect many unseen defects. Therefore, there is an urgent need to change research methods to improve quality and efficiency. In China's steel industry, new-generation information technology and manufacturing are rapidly integrating to enhance industrial level and competitiveness. Promoting intelligent manufacturing in the steel industry can improve production efficiency, reduce resource waste, improve product quality, and contribute to the upgrading and development of the entire manufacturing industry. Currently, image preprocessing has become an important branch of computer vision; however, preprocessing methods for other scene images are not applicable to processing images of aluminum plate surface defects. The processed images show differences between the surface defects and the actual defects, and the background easily interferes with the defects, resulting in blurred and unclear foreground boundaries. Therefore, there is an urgent need for those skilled in the art to provide a preprocessing solution suitable for aluminum plate surface defect images. Summary of the Invention
[0005] This invention provides an online detection image preprocessing method and apparatus for aluminum plate surface defects, which solves the problems that existing image preprocessing methods produce images of aluminum plate surface defects that differ from the actual defects, and that the image background easily interferes with the defects, and the image foreground boundaries are blurred and unclear.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] This invention provides an online image preprocessing method for detecting surface defects on aluminum plates, wherein the method includes:
[0008] A stable aluminum plate running speed signal is obtained based on interpolation and timer interrupt methods.
[0009] A first image is generated based on the running speed signal;
[0010] The first image is processed by removing the boundary using the difference method to obtain the second image, wherein the second image contains only the image of the aluminum plate;
[0011] The bright field image and dark field image of the second image are combined using RGB synthesis technology to generate a third image, wherein the third image contains two viewpoint information.
[0012] The adaptive weights of the MSRCR algorithm are calculated based on the information entropy of the third image, and the MSRCR algorithm with the adaptive weights is used to perform image feature enhancement processing on the third image to obtain the target image. The MSRCR algorithm is a multi-scale retinal enhancement algorithm with color restoration.
[0013] Optionally, the steps for obtaining a stable aluminum plate running speed signal based on interpolation and timer interrupt methods include:
[0014] The electrical signal from the controller read by the encoder is filtered by a trigger, wherein the electrical signal from the controller is the speed signal generated when the aluminum plate is running.
[0015] The host computer connected to the trigger reads the byte stream returned by the trigger and decodes the buffer area to convert the read hexadecimal data into decimal data.
[0016] The frequency value of the running speed that occurs more frequently than the preset frequency in actual production is selected by interpolation, and the running function of the aluminum plate is calculated based on the frequency value.
[0017] When a sudden change occurs in frequency, a timer interrupt method is used to smoothly transition the output frequency value to the preset value, thereby obtaining a stable aluminum plate running speed signal.
[0018] Optionally, the step of performing boundary removal processing on the first image based on the difference method to obtain the second image includes:
[0019] The first image is converted into a grayscale image, and the average grayscale value of each column array is calculated along the 0th axis of the two-dimensional array of the grayscale image.
[0020] Based on the difference method and the average gray value of each axis, noise outside the aluminum plate boundary in the first image is filtered out, and the noise-filtered image is converted into a pure black image.
[0021] Optionally, the step of combining the bright-field image and dark-field image of the second image based on RGB compositing technology to generate the third image includes:
[0022] The bright field image of the second image is used as the G and B channels, and the dark field image of the second image is used as the R channel. The RGB channels are combined to generate the third image.
[0023] Optionally, the step of calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and performing image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image includes:
[0024] Based on the total number of pixels contained in the third image and the probability of the corresponding binary feature group, the proportion of the corresponding binary feature group in the third image is determined;
[0025] Based on the proportion of the aforementioned binary feature set, the two-dimensional entropy of the discrete image is calculated;
[0026] The adaptive weights of the MSRCR algorithm are calculated based on the aforementioned two-dimensional entropy.
[0027] The MSRCR algorithm based on the adaptive weights is used to perform image feature enhancement processing on the third image to obtain the target image.
[0028] Optionally, the step of performing image feature enhancement processing on the third image based on the adaptive weights MSRCR algorithm to obtain the target image includes:
[0029] The third image is blurred to obtain a blurred image;
[0030] Calculate the illumination component of the blurred image;
[0031] Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component;
[0032] Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel;
[0033] Based on the mean and standard deviation of the data in each channel, as well as the adaptive weights of the MSRCR algorithm, the maximum and minimum values of the data in each channel are calculated.
[0034] The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the carried object based on the maximum and minimum values of the data in each channel.
[0035] This application embodiment also provides an image preprocessing device for online detection of surface defects in aluminum plates, wherein the method includes:
[0036] The acquisition module is used to acquire a stable aluminum plate running speed signal based on interpolation and timer interrupt methods.
[0037] A first generation module is used to generate a first image based on the running speed signal;
[0038] A boundary processing module is used to perform boundary removal processing on the first image based on the difference method to obtain a second image, wherein the second image contains only the image of the aluminum plate;
[0039] The compositing module is used to combine the bright field image and dark field image of the second image based on RGB compositing technology to generate a third image, wherein the third image contains two viewpoint information;
[0040] The processing module is used to calculate the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and to perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image.
[0041] Optionally, the acquisition module includes:
[0042] The filtering submodule is used to filter the electrical signal of the controller read by the encoder through a trigger, wherein the electrical signal of the controller is the speed signal generated when the aluminum plate is running.
[0043] The decoding submodule is used to read the byte stream returned by the trigger through the host computer connected to the trigger, and to decode the buffer area to convert the read hexadecimal data into decimal data.
[0044] The selection submodule is used to select the frequency value of the running speed that occurs more frequently than the preset frequency in actual production by interpolation, and to calculate the aluminum plate running function based on the frequency value;
[0045] The transition submodule is used to smoothly transition the output frequency value to a preset value by using a timer interrupt method when the frequency changes abruptly, thereby obtaining a stable aluminum plate running speed signal.
[0046] Optionally, the boundary processing module includes:
[0047] The first submodule is used to convert the first image into a grayscale image and calculate the average grayscale value of each column array along the 0th axis of the two-dimensional array of the grayscale image.
[0048] The second submodule is used to filter out noise outside the aluminum plate boundary in the first image based on the difference method and the average gray value of each axis, and to convert the noise-filtered image into a pure black image.
[0049] Optionally, the synthesis module is specifically used for:
[0050] The bright field image of the second image is used as the G and B channels, and the dark field image of the second image is used as the R channel. The RGB channels are combined to generate the third image.
[0051] Optionally, the processing module includes:
[0052] The third submodule is used to determine the proportion of the feature binary group corresponding to the third image based on the total number of pixels contained in the third image and the probability of the feature binary group corresponding to the third image;
[0053] The fourth submodule is used to calculate the two-dimensional entropy of the discrete image based on the proportion of the feature binary group;
[0054] The fifth submodule is used to calculate the adaptive weights of the MSRCR algorithm based on the two-dimensional entropy;
[0055] The sixth submodule is used to perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image.
[0056] Optionally, the sixth submodule is specifically used for:
[0057] The third image is blurred to obtain a blurred image;
[0058] Calculate the illumination component of the blurred image;
[0059] Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component;
[0060] Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel;
[0061] Based on the mean and standard deviation of the data in each channel, as well as the adaptive weights of the MSRCR algorithm, the maximum and minimum values of the data in each channel are calculated.
[0062] The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the carried object based on the maximum and minimum values of the data in each channel.
[0063] The online image preprocessing scheme for aluminum plate surface defect detection provided in this application includes: acquiring a stable aluminum plate running speed signal based on interpolation and timed interrupt methods; generating a first image based on the running speed signal; performing boundary removal processing on the first image based on the difference method to obtain a second image containing only the aluminum plate image; synthesizing the bright field image and dark field image of the second image based on RGB synthesis technology to generate a third image, which contains two viewpoint information; calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and performing image feature enhancement processing on the third image based on the MSRCR algorithm with adaptive weights to obtain the target image. The image processed by this image preprocessing scheme can remove interference from the image background that affects defects, making the foreground boundary of the image clear. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a schematic flowchart of the steps of an online detection image preprocessing method for aluminum plate surface defects provided in an embodiment of the present invention;
[0066] Figure 2 This is a structural block diagram of an image preprocessing device for online detection of surface defects in aluminum plates provided in an embodiment of the present invention. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0068] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms “first,” “second,” and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an,” “a,” or “the,” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising,” “including,” or “including,” and similar terms mean that the element or object preceding the word encompasses the element or object listed following the word and its equivalents, without excluding other elements or objects. The terms “connected,” “linked,” or “connected,” and similar terms are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.
[0069] It should be noted that the terms "up", "down", "left", "right", "front", and "back" used in this invention are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0070] Current research on image preprocessing in the field of image processing includes, but is not limited to, the following aspects:
[0071] (1) Image enhancement: By performing enhancement operations on the image, such as noise reduction, increasing contrast, sharpening, etc., the quality and clarity of the image can be improved, thereby better supporting subsequent image analysis tasks.
[0072] (2) Image standardization: Standardize images acquired from different scenarios and devices, such as color space conversion, grayscale conversion, and size adjustment, to eliminate differences and better support subsequent image recognition and classification tasks.
[0073] (3) Image segmentation: The original image is divided into several sub-regions in order to better extract image features and perform local analysis, such as object detection and image semantic segmentation.
[0074] (4) Image denoising: By using filtering, noise reduction algorithms and other methods, noise in the image is eliminated to improve image quality and clarity.
[0075] In summary, image preprocessing is a crucial aspect of computer vision, encompassing various research areas and possessing broad application prospects. This application provides a scheme for preprocessing aluminum surface images based on an improved MSRCR algorithm.
[0076] like Figure 1 As shown in the figure, this invention provides a flowchart of a method for online detection image preprocessing of defects on aluminum plate surfaces. The method includes the following steps:
[0077] Step 101: Obtain a stable aluminum plate running speed signal based on interpolation and timer interrupt methods.
[0078] An alternative method for obtaining a stable aluminum plate running speed signal based on interpolation and timer interrupts is as follows:
[0079] First, the electrical signal from the controller read by the encoder is filtered by a trigger. The electrical signal from the controller is the speed signal generated when the aluminum plate is running.
[0080] Secondly, the host computer connected to the trigger reads the byte stream returned by the trigger and decodes the buffer area to convert the read hexadecimal data into decimal data.
[0081] Next, the frequency value of the running speed that occurs more frequently than the preset frequency in actual production is selected by interpolation, and the running function of the aluminum plate is calculated based on the frequency value.
[0082] Finally, when a sudden change occurs in the frequency, a timer interrupt method is used to smoothly transition the output frequency value to the preset value, thereby obtaining a stable aluminum plate running speed signal.
[0083] Step 102: Generate the first image based on the running speed signal.
[0084] Step 103: Perform boundary removal processing on the first image based on the difference method to obtain the second image.
[0085] The second image contains only the image of the aluminum plate.
[0086] A feasible way to obtain a second image by performing boundary removal processing on the first image based on the difference method is as follows:
[0087] First, the first image is converted into a grayscale image, and the average grayscale value of each column array is calculated along the 0th axis of the two-dimensional array of the grayscale image;
[0088] Secondly, based on the difference method and the average gray value of each axis, the noise outside the aluminum plate boundary in the first image is filtered out, and the noise-filtered image is converted into a pure black image.
[0089] Step 104: Based on RGB synthesis technology, the bright field image and dark field image of the second image are synthesized to generate the third image.
[0090] The third image contains information from two perspectives.
[0091] The bright and dark images of the second image are combined using RGB compositing technology to generate the third image. The bright image of the second image is used as the G and B channels, and the dark image of the second image is used as the R channel. The RGB channels are then combined to generate the third image.
[0092] In practical implementation, the bright and dark field images are processed and combined using RGB channels. The bright field image and the dark field image are used as three channels in the RGB three-channel color image for image synthesis. The bright field image is used as the G and B channels, and the dark field image is used as the R channel.
[0093] Step 105: Calculate the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image.
[0094] The method for obtaining the target image by calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image and performing image feature enhancement processing on the third image based on the adaptive weights of the MSRCR algorithm includes the following steps:
[0095] Based on the total number of pixels contained in the third image and the probability of the corresponding binary feature group in the third image, the proportion of the corresponding binary feature group in the third image is determined.
[0096] The two-dimensional entropy of a discrete image is calculated based on the proportion of the feature binary set.
[0097] Adaptive weights for the MSRCR algorithm are calculated based on two-dimensional entropy.
[0098] The MSRCR algorithm based on adaptive weights is used to perform image feature enhancement processing on the third image to obtain the target image.
[0099] In practical implementation, it is more preferable to use the MSRCR algorithm based on adaptive weights to perform image feature enhancement processing on the third image, and the target image can be obtained in the following way:
[0100] The third image is blurred to obtain a blurred image;
[0101] Calculate the illumination component of the blurred image;
[0102] Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component;
[0103] Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel;
[0104] Based on the mean, standard deviation, and adaptive weights of the MSRCR algorithm for each channel, the maximum and minimum values of the data for each channel are calculated.
[0105] The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the object based on the maximum and minimum values of the data in each channel.
[0106] In this optional embodiment, the MSRCR algorithm is used as a basis. Based on this, the relevant weights in the MSRCR algorithm are adaptively calculated by combining image information entropy, thereby achieving a good feature enhancement effect.
[0107] The online image preprocessing method for detecting surface defects on aluminum plates provided in this application includes: acquiring a stable aluminum plate running speed signal based on interpolation and timed interrupt methods; generating a first image based on the running speed signal; performing boundary removal processing on the first image based on the difference method to obtain a second image containing only the aluminum plate image; synthesizing the bright field image and dark field image of the second image based on RGB synthesis technology to generate a third image, which contains two viewpoint information; calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and performing image feature enhancement processing on the third image based on the MSRCR algorithm with adaptive weights to obtain the target image. The image processed by this image preprocessing scheme can remove interference from the image background that affects defects, making the foreground boundary of the image clear.
[0108] The following describes the online image preprocessing method for detecting surface defects on aluminum plates according to a specific embodiment.
[0109] In actual production, on-site operators frequently accelerate, decelerate, start, and stop the board. These operations, after being read by the encoder and transmitted to the controller, will cause the following two problems: (1) When the encoder signal changes abruptly, the change in the controller's electrical signal will be relatively slower. If the changes occur frequently in a short period of time, this difference in change will accumulate, leading to subsequent controller signal chaos. (2) During the process of acceleration and deceleration signal changes abruptly, due to the lag in the controller signal, the captured image may be stretched or compressed, which does not match the actual image shape.
[0110] To address the signal distortion issue, an external trigger was used for initial filtering. Compared to the previous method, a new mode was added where the internal signal frequency follows the external signal frequency changes: a "correction-following" mode. In this mode, the internal signal frequency changes in two ways: "automatic adjustment" and "feedback frequency to the host computer for further frequency parameter adjustment." The filtered signal is relatively stable and will not be significantly affected by frequency changes caused by the board's acceleration or deceleration.
[0111] To address image distortion issues, a trigger was connected to a host computer. The host computer sent commands, and the internal signal frequency was adjusted in real-time based on set parameters and the real-time external signal frequency. This was a secondary development of the trigger. First, the byte stream returned by the trigger was read by sending HEX code, and the buffer area was decoded to convert the read hexadecimal data into decimal. Then, using interpolation, a frequency value representing a frequently occurring operating speed in actual production was selected to calculate a specific function, f(x). Subsequently, when the frequency changed slightly, the program judged the change. If the absolute value was less than a threshold, the frequency sent after processing was the same as the previous one; if the absolute value was greater than the threshold, the new processing result was used. Furthermore, when the frequency changed abruptly, a time (timer interrupt) accumulation method was used to smoothly transition the output to another value. For example, a timer interrupt data of 100ms was set, with a data value of 2000. Starting from 0, the data value transitioned from 0 to 2000 through 100 interrupts (10 seconds). When the first 100ms arrives, the output data value is 20, the second interrupt data value is 40, and so on until the 100th interrupt arrives, when the data value is 2000.
[0112] After processing, electromagnetic interference from various on-site conditions and signal disturbances caused by the acceleration and deceleration of the aluminum plate were eliminated, ensuring that an image consistent with the actual object was obtained, providing a basic guarantee for subsequent data annotation and defect detection in actual production.
[0113] The resulting image is then subjected to an edge-cropping algorithm:
[0114] 1. Convert the input image to grayscale and calculate the average grayscale of each column along the 0th axis of the two-dimensional array.
[0115] 2. Divide each axis by a factor and select the larger subset of values.
[0116] 3. Calculate the difference between the average pixels within a 128-pixel range to the left and right of this value, and take the maximum value.
[0117] 4. Calculate the average gray value to the left and right of the maximum boundary, and set the part with the smaller gray value to black.
[0118] Since both the bright-field and dark-field images are single-channel grayscale images, they can be used as two channels of an RGB three-channel color image for image compositing, with the third channel set to pure black. In this application, the bright-field image is used as the G and B channels, and the dark-field image as the R channel. Due to the larger grayscale values of the bright-field image, the merged image appears as a cyan color with a blue-green overlay, while the larger grayscale values of the dark-field image result in a reddish hue in the composite image.
[0119] After obtaining the composite image, proceed as follows:
[0120] S(x,y)=R(x,y)*L(x,y)
[0121] In the formula: S(x,y) represents the received image signal; L(x,y) represents the illumination component; R(x,y) represents the reflection component of the carrying object.
[0122] L(x,y) can be obtained by applying Gaussian blur to the image data S(x,y).
[0123] Therefore, the steps can be summarized as follows:
[0124] 1. Input: Original image data S(x,y)
[0125] 2. Handling:
[0126] 1) Calculate the blurred image L(x,y);
[0127] 2) Calculate the value of Log[R(x,y)] according to the formula;
[0128] Log[R(x,y)]=Log[I(x,y)]-Log[L(x,y)]
[0129] 3) Quantize Log[R(x,y)] within the range of 0 to 255.
[0130] R(x,y)=(Value-Min) / (Max-Min)*(255-0)
[0131] 4) Calculate the mean (Mean) and standard deviation (Var) of the R / G / B channels in Log[R(x,y)].
[0132] 5) Calculate the Min and Max values of each channel using the following formula.
[0133] Min = Mean - W K *Var
[0134] Max = Mean + W K *Var
[0135] For each value Value of Log[R(x, y)], perform a linear mapping as follows:
[0136] R(x,y)= (Value - Min) / (Max - Min)* (255-0)
[0137] In this method, parameter W kTypically, manual settings are required, and optimal results are obtained through continuous adjustments. This is not only heavily influenced by subjective factors but also very time-consuming. Therefore, this paper uses an adaptive weight calculation method to replace the original subjective setting method, automatically determining the weights W by calculating the image information entropy. k .
[0138] The following uses image information entropy for feature statistics, which reflects the average amount of information in the image. Generally, the mean gray level of the image's neighborhood is selected as the spatial feature of the gray level distribution, forming a feature binary group together with the pixel gray levels. This approach better describes the image's attributes, making image processing and recognition more accurate and efficient.
[0139] P ij =N(i,j) / M
[0140] In the formula P ij Let N(i,j) represent the proportion of the binary feature set (i,j), N(i,j) represent the probability of the binary feature set (i,j), and M represent the total number of pixels in the image. Therefore, the two-dimensional entropy of a discrete image is defined as:
[0141]
[0142] Therefore, the formula for calculating the image weights at each scale is as follows:
[0143]
[0144] In the experiment, the adaptive weighted MSRCR algorithm was used to process the defect image, and compared with the traditional MSR and MSRCR algorithms. The MSR algorithm resulted in color distortion, blurring of many defects, and poor separation from the background, along with poor contrast. While MSRCR improved the contrast between the target and background, the target edges remained blurry, leading to inaccurate segmentation. The adaptive MSRCR significantly reduced background interference, sharpened target edges, and effectively improved image quality, laying a solid foundation for the images fed into the algorithm.
[0145] Furthermore, it should be noted that the present invention can be provided as a surface inspection device, apparatus, or computer program product. Therefore, embodiments of the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0146] like Figure 2 Furthermore, this application embodiment also provides an online image preprocessing device for detecting surface defects on aluminum plates, which includes the following functional modules:
[0147] The acquisition module 201 is used to acquire a stable aluminum plate running speed signal based on interpolation and timer interrupt methods.
[0148] The first generation module 202 is used to generate a first image based on the running speed signal;
[0149] The boundary processing module 203 is used to perform boundary removal processing on the first image based on the difference method to obtain a second image, wherein the second image contains only the image of the aluminum plate;
[0150] The compositing module 204 is used to combine the bright field image and dark field image of the second image based on RGB compositing technology to generate a third image, wherein the third image contains two viewpoint information;
[0151] The processing module 205 is used to calculate the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and to perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image.
[0152] Optionally, the acquisition module includes:
[0153] The filtering submodule is used to filter the electrical signal of the controller read by the encoder through a trigger, wherein the electrical signal of the controller is the speed signal generated when the aluminum plate is running.
[0154] The decoding submodule is used to read the byte stream returned by the trigger through the host computer connected to the trigger, and to decode the buffer area to convert the read hexadecimal data into decimal data.
[0155] The selection submodule is used to select the frequency value of the running speed that occurs more frequently than the preset frequency in actual production by interpolation, and to calculate the aluminum plate running function based on the frequency value;
[0156] The transition submodule is used to smoothly transition the output frequency value to a preset value by using a timer interrupt method when the frequency changes abruptly, thereby obtaining a stable aluminum plate running speed signal.
[0157] Optionally, the boundary processing module includes:
[0158] The first submodule is used to convert the first image into a grayscale image and calculate the average grayscale value of each column array along the 0th axis of the two-dimensional array of the grayscale image.
[0159] The second submodule is used to filter out noise outside the aluminum plate boundary in the first image based on the difference method and the average gray value of each axis, and to convert the noise-filtered image into a pure black image.
[0160] Optionally, the synthesis module is specifically used for:
[0161] The bright field image of the second image is used as the G and B channels, and the dark field image of the second image is used as the R channel. The RGB channels are combined to generate the third image.
[0162] Optionally, the processing module includes:
[0163] The third submodule is used to determine the proportion of the feature binary group corresponding to the third image based on the total number of pixels contained in the third image and the probability of the feature binary group corresponding to the third image;
[0164] The fourth submodule is used to calculate the two-dimensional entropy of the discrete image based on the proportion of the feature binary group;
[0165] The fifth submodule is used to calculate the adaptive weights of the MSRCR algorithm based on the two-dimensional entropy;
[0166] The sixth submodule is used to perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image.
[0167] Optionally, the sixth submodule is specifically used for:
[0168] The third image is blurred to obtain a blurred image;
[0169] Calculate the illumination component of the blurred image;
[0170] Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component;
[0171] Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel;
[0172] Based on the mean and standard deviation of the data in each channel, as well as the adaptive weights of the MSRCR algorithm, the maximum and minimum values of the data in each channel are calculated.
[0173] The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the carried object based on the maximum and minimum values of the data in each channel.
[0174] The online image preprocessing device for detecting surface defects on aluminum plates provided in this application includes: acquiring a stable aluminum plate running speed signal based on interpolation and timed interrupt methods; generating a first image based on the running speed signal; performing boundary removal processing on the first image based on the difference method to obtain a second image containing only the aluminum plate image; synthesizing the bright field image and dark field image of the second image based on RGB synthesis technology to generate a third image, which contains two viewpoint information; calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and performing image feature enhancement processing on the third image based on the MSRCR algorithm with adaptive weights to obtain the target image. The image processed by this image preprocessing device can remove interference from the image background that affects defects, making the foreground boundary of the image clear.
[0175] The following points need to be explained:
[0176] (1) The accompanying drawings of the embodiments of the present invention only involve the structures involved in the embodiments of the present invention. Other structures can refer to the general design.
[0177] (2) For clarity, the thickness of layers or regions is enlarged or reduced in the drawings used to describe embodiments of the present invention; that is, these drawings are not drawn to actual scale. It is understood that when an element such as a layer, film, region, or substrate is referred to as being “above” or “below” another element, the element may be “directly” located “above” or “below” the other element, or there may be intermediate elements.
[0178] (3) Where there is no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other to obtain new embodiments.
[0179] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for online image preprocessing for detecting surface defects on aluminum plates, characterized in that, include: A stable aluminum plate running speed signal is obtained based on interpolation and timer interrupt methods. A first image is generated based on the running speed signal; The first image is processed by removing the boundary using the difference method to obtain the second image, wherein the second image contains only the image of the aluminum plate; The bright field image and dark field image of the second image are combined using RGB synthesis technology to generate a third image, wherein the third image contains two viewpoint information. The adaptive weights of the MSRCR algorithm are calculated based on the information entropy of the third image, and the image feature enhancement processing of the third image is performed based on the MSRCR algorithm with the adaptive weights to obtain the target image. The steps of calculating the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and performing image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image include: Based on the total number of pixels contained in the third image and the probability of the corresponding binary feature group, the proportion of the corresponding binary feature group in the third image is determined; Based on the proportion of the aforementioned binary feature set, the two-dimensional entropy of the discrete image is calculated; The adaptive weights of the MSRCR algorithm are calculated based on the aforementioned two-dimensional entropy. The MSRCR algorithm based on the adaptive weights is used to perform image feature enhancement processing on the third image to obtain the target image; The step of performing image feature enhancement processing on the third image based on the adaptive weights MSRCR algorithm to obtain the target image includes: The third image is blurred to obtain a blurred image; Calculate the illumination component of the blurred image; Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component; Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel; Based on the mean and standard deviation of the data in each channel, as well as the adaptive weights of the MSRCR algorithm, the maximum and minimum values of the data in each channel are calculated. The minimum value (Min) and maximum value (Max) of each channel's data are calculated using the following formulas: ; ; Where Mean represents the mean of the data from each channel, and Var represents the standard deviation. Represents the image weights at each scale; The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the carried object based on the maximum and minimum values of the data in each channel.
2. The method according to claim 1, characterized in that, The steps for obtaining a stable aluminum plate running speed signal based on interpolation and timer interrupt methods include: The electrical signal from the controller read by the encoder is filtered by a trigger, wherein the electrical signal from the controller is the speed signal generated when the aluminum plate is running. The host computer connected to the trigger reads the byte stream returned by the trigger and decodes the buffer area to convert the read hexadecimal data into decimal data. The frequency value of the running speed that occurs more frequently than the preset frequency in actual production is selected by interpolation, and the running function of the aluminum plate is calculated based on the frequency value. When a sudden change occurs in frequency, a timer interrupt method is used to smoothly transition the output frequency value to the preset value, thereby obtaining a stable aluminum plate running speed signal.
3. The method according to claim 1, characterized in that, The steps for synthesizing the bright and dark areas of the second image using RGB compositing technology to generate the third image include: The bright field image of the second image is used as the G and B channels, and the dark field image of the second image is used as the R channel. The RGB channels are combined to generate the third image.
4. An image preprocessing device for online detection of surface defects in aluminum plates, characterized in that, include: The acquisition module is used to acquire a stable aluminum plate running speed signal based on interpolation and timer interrupt methods. A first generation module is used to generate a first image based on the running speed signal; A boundary processing module is used to perform boundary removal processing on the first image based on the difference method to obtain a second image, wherein the second image contains only the image of the aluminum plate; The compositing module is used to combine the bright field image and dark field image of the second image based on RGB compositing technology to generate a third image, wherein the third image contains two viewpoint information; The processing module is used to calculate the adaptive weights of the MSRCR algorithm based on the information entropy of the third image, and to perform image feature enhancement processing on the third image based on the MSRCR algorithm with the adaptive weights to obtain the target image; Specifically, the adaptive weights of the MSRCR algorithm are calculated based on the information entropy of the third image, and the image feature enhancement processing of the third image is performed based on the MSRCR algorithm with the adaptive weights to obtain the target image, including: Based on the total number of pixels contained in the third image and the probability of the corresponding binary feature group, the proportion of the corresponding binary feature group in the third image is determined; Based on the proportion of the aforementioned binary feature set, the two-dimensional entropy of the discrete image is calculated; The adaptive weights of the MSRCR algorithm are calculated based on the aforementioned two-dimensional entropy. The MSRCR algorithm based on the adaptive weights is used to perform image feature enhancement processing on the third image to obtain the target image; The MSRCR algorithm based on the adaptive weights performs image feature enhancement processing on the third image to obtain the target image, including: The third image is blurred to obtain a blurred image; Calculate the illumination component of the blurred image; Calculate the logarithm of the reflection component of the object carrying the blurred image based on the illumination component; Calculate the mean and root mean square error of the logarithm of the reflection component of the carried object for each channel; Based on the mean and standard deviation of the data in each channel, as well as the adaptive weights of the MSRCR algorithm, the maximum and minimum values of the data in each channel are calculated. The minimum value (Min) and maximum value (Max) of each channel's data are calculated using the following formulas: ; ; Where Mean represents the mean of the data from each channel, and Var represents the standard deviation. Represents the image weights at each scale; The target image is obtained by linearly mapping each value in the logarithm of the reflection component of the carried object based on the maximum and minimum values of the data in each channel.
5. The apparatus according to claim 4, characterized in that, The acquisition module includes: The filtering submodule is used to filter the electrical signal of the controller read by the encoder through a trigger, wherein the electrical signal of the controller is the speed signal generated when the aluminum plate is running. The decoding submodule is used to read the byte stream returned by the trigger through the host computer connected to the trigger, and to decode the buffer area to convert the read hexadecimal data into decimal data. The selection submodule is used to select the frequency value of the running speed that occurs more frequently than the preset frequency in actual production by interpolation, and to calculate the aluminum plate running function based on the frequency value; The transition submodule is used to smoothly transition the output frequency value to a preset value by using a timer interrupt method when the frequency changes abruptly, thereby obtaining a stable aluminum plate running speed signal.
6. The apparatus according to claim 4, characterized in that, The synthesis module is specifically used for: The bright field image of the second image is used as the G and B channels, and the dark field image of the second image is used as the R channel. The RGB channels are combined to generate the third image.
Citation Information
Patent Citations
Novel online colored aluminum surface defect detection system
CN110376210A
Adaptive low-illumination image enhancement method and system based on MSRCR
CN113256533A