A method and system for detecting abnormalities on the wall of a metal thermos cup based on homogenization of the reflective area
By preprocessing and brightness correcting the metal thermos cup image and using the Gaussian blur method for homogenization, the problems of low efficiency and poor accuracy of traditional manual detection are solved, and efficient and accurate anomaly detection is achieved.
Patent Information
- Application Number
- CN202411073247.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2044-08-06
AI Technical Summary
Traditional manual visual inspection methods are inefficient and inaccurate when inspecting metal thermoses, and cannot meet the needs of large-scale production. They are also easily affected by uneven lighting and reflective areas, resulting in missed inspections or false inspections.
By obtaining the original image of the metal thermos cup, the average grayscale value and the longitudinal pixel mean are calculated after preprocessing, and the Gaussian blur method is used to perform brightness correction and homogenization processing to identify and locate abnormal areas.
It achieves efficient and accurate detection of abnormal areas of metal thermos bottles, improves detection accuracy and efficiency, and reduces labor costs and the risk of misjudgment.
Smart Images

Figure CN118982717B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of thermos cup detection, and in particular to a method and system for detecting abnormalities on the wall of a metal thermos cup based on homogenization of a reflective area. Background Art
[0002] Traditional manual visual inspection methods rely on individual inspections, which are slow and unable to meet the demands of modern, large-scale, high-efficiency production. This inefficient approach leads to production delays, which in turn impacts product delivery timelines and market competitiveness. Manual inspections require significant human resources, especially during peak production periods, when more inspectors must be hired to meet production demands, increasing operating costs. Furthermore, manual inspections require appropriate working conditions and benefits, driving up inspection costs.
[0003] Because manual inspection results rely on the experience, skills, and judgment of the inspector, judgment criteria vary between inspectors. During manual inspection, judgement is easily influenced by subjective factors such as personal emotions and fatigue. Prolonged, continuous work can easily lead to visual fatigue, which in turn affects inspection accuracy and efficiency. Furthermore, human factors can lead to missed or false detections, posing a potential risk to product quality control.
[0004] The high reflectivity and large curvature of thermos bottles make traditional inspection methods inadequate when dealing with complex reflective areas. Reflective areas can interfere with inspectors' ability to identify and interpret defects, reducing inspection accuracy. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a method and system for detecting abnormalities on the wall of a metal thermos cup based on homogenization of the reflective area, thereby achieving efficient and accurate detection of a large number of thermos cups.
[0006] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0007] In a first aspect, a method and system for detecting abnormalities in the wall of a metal thermos cup based on homogenization of the reflective area is provided, the method comprising:
[0008] Get the original image of the metal thermos cup;
[0009] Preprocess the original image of the metal thermos cup to obtain an optimized basic image of the thermos cup;
[0010] Based on the optimized thermos cup basic image, calculate the image's average grayscale value and vertical pixel mean;
[0011] Compare the vertical pixel mean of each column with the average grayscale value of the entire image and calculate the difference;
[0012] The original image is brightness corrected according to the difference, and the brightness corrected image is processed using the Gaussian blur method to obtain a homogenized image;
[0013] The homogenized image is analyzed to obtain the detection results of abnormal areas.
[0014] Furthermore, the original image of the metal thermos cup is preprocessed to obtain an optimized thermos cup basic image, including:
[0015] Read the original color image of the metal thermos cup and convert the color value of each pixel into a grayscale value;
[0016] Traverse each pixel in the image and assign the grayscale value to each pixel to obtain a grayscale image;
[0017] The preset sharpening convolution kernel is convolved on each pixel and neighborhood of the grayscale image to calculate the new pixel value to obtain the sharpened thermos cup image;
[0018] The sharpened thermos cup image is optimized, including brightness and contrast, to obtain an optimized thermos cup base image.
[0019] Furthermore, the grayscale value is calculated as follows:
[0020] V=0.299*R+0.587*G+0.114*B;
[0021] Among them, V represents the grayscale value; R represents the color intensity value of the red channel; G represents the color intensity value of the green channel; B represents the color intensity value of the blue channel; 0.299, 0.587, and 0.114 represent the weights of the red channel, green channel, and blue channel, respectively.
[0022] Furthermore, the new pixel value calculation formula is:
[0023]
[0024] Among them, J represents the new image obtained after the convolution operation; J(x,y) represents the pixel value of the new image at position (x,y); K represents the convolution kernel; I represents the original image; K(i,j) represents the value of the convolution kernel at position (i,j); I(x+i,y+j) represents the pixel value of the original image I at position (x+i,y+j); i and j represent the indexes inside the convolution kernel.
[0025] Furthermore, the average gray value calculation formula is:
[0026]
[0027] in, Represents the average grayscale value of the image; M represents the width of the image; N represents the height of the image; Indicates traversing each row of the image, from row 0 to row M-1; It means to traverse each pixel in each row, from column 0 to column N-1.
[0028] Furthermore, the vertical pixel mean calculation formula is:
[0029]
[0030] Among them, C j represents the vertical pixel mean; It means that each pixel in each row is traversed, from column 0 to column N-1.
[0031] Furthermore, brightness correction is performed on the original image according to the difference, and the brightness-corrected image is processed to obtain a uniformed image, including:
[0032] Adjust the brightness of the three RGB channels of the original image according to the difference to obtain a color image after brightness correction;
[0033] According to the color image after brightness correction, the image is convolved with a Gaussian kernel to obtain a convolution result;
[0034] Assign the convolution result to the new pixel at the corresponding position to obtain the blurred image;
[0035] The blurred image is histogram-adjusted to make the image brightness evenly distributed, so as to obtain a homogenized image.
[0036] In the second aspect, a metal thermos cup wall anomaly detection system based on reflective area homogenization includes:
[0037] An acquisition module is used to obtain an original image of the metal thermos cup; preprocess the original image of the metal thermos cup to obtain an optimized thermos cup basic image; and calculate the average grayscale value and vertical pixel mean of the image based on the optimized thermos cup basic image;
[0038] The processing module is used to compare the longitudinal pixel mean of each column with the average grayscale value of the entire image and calculate the difference; perform brightness correction on the original image according to the difference, and use the Gaussian blur method to process the brightness-corrected image to obtain a homogenized image; and analyze the homogenized image to obtain the detection result of the abnormal area.
[0039] According to a third aspect, a computing device includes:
[0040] one or more processors;
[0041] The storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method.
[0042] In a fourth aspect, a computer-readable storage medium stores a program, which implements the method when executed by a processor.
[0043] The above solution of the present invention includes at least the following beneficial effects:
[0044] By preprocessing the original image of the metal thermos, noise can be effectively removed and details can be enhanced, resulting in an optimized base image of the thermos. Calculating the average grayscale value and vertical pixel mean based on this optimized base image more accurately reflects the image's overall brightness and local brightness variations. By comparing the vertical pixel mean of each column with the average grayscale value of the entire image and calculating the difference, it is possible to precisely determine which areas require brightness correction. This correction method more accurately restores the true brightness distribution of the thermos, avoiding misjudgments caused by uneven lighting.
[0045] Using Gaussian blur on the brightness-corrected image further smoothes it, reducing detail loss and making it more uniform. This helps improve accuracy and stability in subsequent abnormal area detection. Analyzing the homogenized image makes it easier to identify and locate abnormal areas, such as scratches and dents. This helps promptly identify and address quality issues in thermos bottles, improving product quality and customer satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The present invention provides a flowchart of a method for detecting abnormalities in the wall of a metal thermos cup based on homogenization of the reflective area, as provided in an embodiment of the present invention.
[0047] Figure 2 Schematic diagram of a metal thermos cup wall anomaly detection system based on reflective area homogenization provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0049] like Figure 1As shown, an embodiment of the present invention provides a method for detecting abnormalities on the wall of a metal thermos cup based on homogenization of the reflective area, the method comprising the following steps:
[0050] Get the original image of the metal thermos cup;
[0051] Preprocess the original image of the metal thermos cup to obtain an optimized basic image of the thermos cup;
[0052] Based on the optimized thermos cup basic image, calculate the image's average grayscale value and vertical pixel mean;
[0053] Compare the vertical pixel mean of each column with the average grayscale value of the entire image and calculate the difference;
[0054] The original image is brightness corrected according to the difference, and the brightness corrected image is processed using the Gaussian blur method to obtain a homogenized image;
[0055] The homogenized image is analyzed to obtain the detection results of abnormal areas.
[0056] In this embodiment of the present invention, by acquiring the original image of the metal thermos, the true state of the product can be directly captured, providing original, unmodified data for subsequent processing and analysis, thereby ensuring the accuracy and reliability of the test results. Preprocessing the original image effectively removes interference factors such as noise and distortion that may be introduced during the image acquisition process. The optimized base image of the thermos is clearer and more detailed. By calculating the average grayscale value and vertical pixel mean of the optimized image, the brightness distribution of the image can be quantitatively described, providing a scientific basis for brightness correction.
[0057] Comparing the vertical pixel mean of each column with the average grayscale value of the entire image and calculating the difference can accurately identify areas of uneven brightness. Targeted brightness correction can be performed based on the difference, effectively eliminating the impact of lighting conditions on image quality. Using Gaussian blur to process the brightness-corrected image further achieves image uniformity, reducing the over-emphasis of local details, making the entire image smoother and more consistent, which facilitates accurate detection of abnormal areas.
[0058] In-depth analysis of the homogenized image can more accurately identify and locate abnormal areas on the surface of the thermos, such as scratches, stains, dents and other defects, thereby improving the accuracy and efficiency of product quality inspection.
[0059] In a preferred embodiment of the present invention, the above step 1 of obtaining the original image of the metal thermos cup may include:
[0060] Use a high-resolution industrial camera to capture images of the metal thermos. These cameras ensure crisp detail and accurate color. To ensure image quality, the capture environment requires consistent lighting conditions and background settings. Appropriate lighting highlights the thermos' features and minimizes shadows and reflections, while a simple background reduces image processing complexity.
[0061] Place the thermos cup within the designated capture area and use the camera to capture its image. During the capture process, ensure the integrity and clarity of the thermos cup, avoiding blur, distortion, or obstructions. The captured raw image is transmitted to the server via a data cable or wireless network for subsequent storage and processing.
[0062] In a preferred embodiment of the present invention, the above step 2 of preprocessing the original image of the metal thermos cup to obtain an optimized thermos cup basic image may include:
[0063] Step 21, read the original color image of the metal thermos cup and convert the color value of each pixel into a grayscale value;
[0064] Step 22, traverse each pixel in the image and assign a grayscale value to each pixel to obtain a grayscale image;
[0065] Step 23: Perform a convolution operation on each pixel and neighborhood of the grayscale image using a preset sharpening convolution kernel to calculate a new pixel value to obtain a sharpened image of the thermos cup;
[0066] Step 24 , optimizing the sharpened thermos cup image, including brightness and contrast, to obtain an optimized thermos cup basic image.
[0067] In an embodiment of the present invention, an original color image of a metal thermos cup is read. A color space conversion algorithm (e.g., RGB to grayscale) is used to convert the color value of each pixel into a grayscale value. Each pixel in the image is traversed. The calculated grayscale value is assigned to each pixel, thereby generating a grayscale image. The grayscale image simplifies subsequent processing while retaining sufficient shape and texture information for analysis.
[0068] Through the preset sharpening convolution kernel A convolution operation is performed on each pixel of the grayscale image and its neighborhood. The specific convolution operation can be expressed as: J(x,y)=(-1)*I(x-1,y-1)+(-1)*I(x-1,y)+(-1)*U(x-1,y+1)+....+9*I(x,y)+...+(-1)*I(x+1,y+1); where J(x,y() represents the pixel value of the new image at position (x,y). Through the sharpening operation, the edges and details of the image are enhanced, which facilitates subsequent anomaly detection.
[0069] The sharpened thermos cup image is further optimized, including adjusting brightness and contrast. Brightness adjustment changes the brightness of the image, while contrast adjustment enhances or reduces the difference between light and dark areas. These optimization steps aim to make the image clearer and highlight details, facilitating subsequent image analysis and processing.
[0070] Grayscale images reduce the complexity of data processing. Despite removing color information, they still retain sufficient shape and texture features for analysis and detection. Sharpening emphasizes the edges and details of the thermos, making potential defects (such as scratches and dents) more visible. By enhancing image detail and adjusting brightness and contrast, the overall visual quality of the image is improved, making it easier for both the human eye and machine vision systems to discern features within the image.
[0071] In a preferred embodiment of the present invention, the grayscale value is calculated as follows:
[0072] V=0.299*R+0.587*G+0.114*B;
[0073] Among them, V represents the grayscale value; R represents the color intensity value of the red channel; G represents the color intensity value of the green channel; B represents the color intensity value of the blue channel; 0.299, 0.587, and 0.114 represent the weights of the red channel, green channel, and blue channel, respectively.
[0074] In an embodiment of the present invention, R (red channel color intensity value) reflects the intensity of the red component in the image. In an image of a metal thermos cup, the red channel may capture certain specific details or color changes on the surface of the thermos cup. G (green channel color intensity value) represents the intensity of the green component in the image. The green channel is crucial to the overall brightness and detail presentation of the image because the human eye is most sensitive to green. B (blue channel color intensity value) represents the intensity of the blue component in the image. On a metal surface, the blue channel may help capture information about reflective or shadowed areas. 0.299, 0.587, 0.114 (weight coefficients) are set according to the sensitivity of the human eye to different colors. The green channel has the highest weight because the human eye is most sensitive to green; the red channel has the second highest weight; and the blue channel has the lowest weight.
[0075] By compressing the RGB three-channel information into a single grayscale value, the complexity of image processing and analysis is simplified. The weighting coefficients are selected based on the human eye's sensitivity to different colors. This conversion is more consistent with the human visual system's perception, thus preserving the visual information in the grayscale image. Grayscale images reduce the dimensionality and complexity of the data, thereby accelerating image processing and analysis.
[0076] Despite being converted to grayscale, the weighting coefficients are carefully chosen to preserve key details such as edges and textures. In some cases, color variations in color images may be caused by lighting conditions rather than inherent characteristics of the object. Converting to grayscale can reduce the impact of these lighting variations on the image processing results.
[0077] In a preferred embodiment of the present invention, the new pixel value calculation formula is:
[0078]
[0079] Among them, J represents the new image obtained after the convolution operation; J(x,y) represents the pixel value of the new image at position (x,y); K represents the convolution kernel; I represents the original image; K(i,j( represents the value of the convolution kernel at position (i,j); I(x+i,y+j) represents the pixel value of the original image I at position (x+i,y+j); i and j represent the indexes inside the convolution kernel.
[0080] In this embodiment of the present invention, J represents the new image obtained after the convolution operation. This is an output image whose pixel value is calculated based on the convolution kernel and a local area of the original image. J(x,y) represents the pixel value at a specific location (x,y) in the new image. This value is the result of the convolution operation and reflects the effect of the convolution kernel on the pixels at that location and its surroundings in the original image after interaction with the convolution kernel. K represents the convolution kernel, a small matrix that slides over the original image and performs the convolution operation. The value of the convolution kernel (i.e., the weight) determines the effect of the convolution operation, such as sharpening or blurring. I represents the original image, i.e., the image before the convolution operation. K(i,j) represents the value of the convolution kernel at location (i,j). These values define how the convolution kernel weights the pixels at each location in the original image. I(x+i,y+j) represents the pixel value of the original image I at location (x+i,y+j). These are the pixel values surrounding the current location of the convolution kernel, which are multiplied by the corresponding value of the convolution kernel and summed to calculate the pixel value of the new image. i and j represent the index inside the convolution kernel, which is used to traverse each element of the convolution kernel.
[0081] Convolution effectively extracts local features in images, such as edges and textures. By selecting the appropriate convolution kernel, effects such as sharpening or blurring can be achieved, improving the visual quality or highlighting specific features. Certain convolution kernel designs can be used to reduce noise and improve image quality. Convolution is an efficient local image processing technique that focuses on a specific region of an image, reducing computational effort and increasing processing speed.
[0082] The design of convolution kernels is very flexible and can be customized to meet different application requirements to achieve specific image processing effects. The convolution operation fully considers the spatial relationship between pixels, which makes it effective when processing image data with spatial structure.
[0083] In a preferred embodiment of the present invention, the above step 3, calculating the average grayscale value and the vertical pixel mean of the image based on the optimized vacuum cup basic image, may include:
[0084] In this embodiment of the present invention, the average grayscale value of the image is calculated across the entire sharpened image. The average grayscale value of the image is the sum of the grayscale values of all pixels divided by the total number of pixels. This value provides a benchmark for the overall brightness of the image and helps to understand the global brightness level of the image.
[0085] The vertical pixel mean calculation is to identify areas with uneven lighting by comparing the average grayscale value of the local area with the overall average grayscale value during the background elimination process. Since the reflective area usually shows striped changes along a certain direction (such as perpendicular to the light source direction), the vertical pixel mean calculation can better capture the illumination changes along the longitudinal (vertical) direction. After repeated experiments, the image is divided into multiple small blocks of 4*100 vertically. Because the smaller vertical height (4 pixels) can capture subtle illumination changes, it helps to perform more detailed processing on small reflective areas. The larger horizontal width (100 pixels) allows the average illumination level in a larger area to be captured, which helps to smooth and eliminate illumination unevenness in a large range. Assume that the size of the original image is M*N, where M is the number of rows of the image and N is the number of columns of the image. Divide the image into small blocks with a height of 4 pixels and a width of 100 pixels. The number of blocks that can be obtained are: the number of blocks in the row direction Number of blocks in column direction Calculate the average gray value of each small block In order to understand the local brightness changes. The average gray value of each vertical block The formula is as follows: in, is the average grayscale value of the (r, c)th block, r and c are the row and column indices of the block respectively, W = 100 is the width of each block (number of columns), and H = 4 is the height of each block (number of rows).
[0086] In a preferred embodiment of the present invention, the average gray value calculation formula is:
[0087]
[0088] in, Represents the average grayscale value of the image; M represents the width of the image; N represents the height of the image; Indicates traversing each row of the image, from row 0 to row M-1; It means to traverse each pixel in each row, from column 0 to column N-1.
[0089] In an embodiment of the present invention, The output of the formula represents the average grayscale value of the image. It provides a quantitative indicator of the overall brightness of the image, helping to understand the overall brightness and darkness of the image. The two parameters M and N define the width and height of the image, respectively, which are the dimensions of the image. They determine the pixel range to be traversed to ensure that all pixels are included in the calculation of the average grayscale value. This summation symbol indicates that we traverse each row of the image, starting from row 0 and continuing to the last row (row M-1). By traversing row by row, we can capture the brightness information of all rows in the image. Based on the row-by-row traversal, we further indicate that we traverse every pixel in each row, starting from column 0 of each row and continuing to the last column (column N-1). This allows us to accurately calculate the grayscale value of each pixel and thus determine the overall average. The function J(i, j) represents the grayscale value of the pixel at row i and column j. During the traversal process, the grayscale value of each pixel is summed up to calculate the average grayscale value.
[0090] By traversing all rows and columns of the image, the grayscale value of each pixel is taken into account, resulting in a comprehensive and accurate average grayscale value. The average grayscale value is an objective indicator that is not affected by subjective judgment. It provides a quantitative and comparable measure of brightness levels. It is applicable to grayscale images of any size by adjusting the traversal range according to the width and height of the image. Through a simple double loop and summation operation, the average grayscale value can be efficiently calculated, suitable for real-time image processing or large-scale image processing tasks. The average grayscale value can be used as an important parameter in image processing and analysis, helping to identify image brightness characteristics and perform image enhancement or correction operations.
[0091] In a preferred embodiment of the present invention, the vertical pixel mean calculation formula is:
[0092]
[0093] Among them, C j represents the vertical pixel mean; It means that each pixel in each row is traversed, from column 0 to column N-1.
[0094] In the embodiment of the present invention, C jThe output of the formula represents the vertical pixel mean. This value reflects the average grayscale value of all pixels in that row and helps to understand the vertical brightness distribution of the image. N represents the number of columns in the image, that is, the number of pixels in each row. It is used to determine the pixel range to traverse when calculating the pixel mean for each row. =((i, j) / (i, j)) / (j) / (i, j) / (j)) represents the grayscale value of the pixel at row i and column j. As each row is traversed, the grayscale values of each pixel are summed up and then divided by the total number of pixels in that row (i.e., the number of columns N) to obtain the mean pixel value for that row.
[0095] By calculating the pixel mean for each row, we can extract the local brightness characteristics of the image in the vertical direction. This is very useful for identifying and addressing image issues such as uneven lighting and reflections. Simplifying complex two-dimensional image data into a one-dimensional array of vertical pixel means helps reduce data processing and improve analysis efficiency. Based on the vertical pixel mean, operations such as brightness correction and contrast enhancement can be performed on the image to improve image quality. Compared to the global mean grayscale value, the calculation of the vertical pixel mean can be processed in parallel for each row, thereby improving computational efficiency.
[0096] In a preferred embodiment of the present invention, in step 4, the vertical pixel mean of each column is compared with the average grayscale value of the entire image to calculate the difference. The calculation formula of the difference is:
[0097]
[0098] Wherein, ΔV(j) represents the difference between the vertical pixel mean of the jth column and the average grayscale value of the entire image.
[0099] In this embodiment of the present invention, J(i,k) represents the grayscale value of the pixel at position (i,k) in the image, where i is the row index and k is the column index. J(i,j) represents the grayscale value of the pixel at the jth column and the ith row in the image. These two parameters directly reflect the grayscale information of each pixel in the image and are the basic data for calculating the difference value. The average grayscale value of the entire image is calculated. The grayscale values of all pixels in the image are accumulated through double summation. The accumulated grayscale sum is divided by the total number of pixels (M x N) to obtain the average grayscale value of the entire image, which represents the overall brightness level of the image. The vertical pixel mean of the jth column in the image is calculated by summing the grayscale values of all pixels in the jth column. Divide by the number of rows in that column, M, to obtain the average grayscale value of that column. This value reflects the brightness level of a specific column in the image. ΔV(j) represents the difference between the vertical mean pixel value of column j and the average grayscale value of the entire image. This is calculated by calculating the absolute difference between the average grayscale value of the entire image and the vertical mean pixel value of column j. This difference reflects the degree of difference between the brightness of a specific column and the overall brightness of the image.
[0100] In a preferred embodiment of the present invention, the above step 5, performing brightness correction on the original image according to the difference, and processing the brightness-corrected image to obtain a homogenized image, may include:
[0101] Step 51, adjusting the brightness of the three RGB channels of the original image according to the difference value to obtain a color image after brightness correction;
[0102] Step 52: convolve the color image after brightness correction using a Gaussian kernel to obtain a convolution result;
[0103] Step 53, assigning the convolution result to the new pixel at the corresponding position to obtain a blurred image;
[0104] Step 54 , performing histogram adjustment on the blurred image to make the image brightness distribution uniform, so as to obtain a homogenized image.
[0105] In this embodiment of the present invention, the calculated difference ΔV(j) reflects the difference between the brightness of each column in the original image and the global average brightness. For each pixel in the image, the brightness of the three RGB channels is adjusted based on the ΔV(j) value of its column. If ΔV(j) is positive, it indicates that the column is brighter than the global average brightness, so the brightness of this column should be reduced; otherwise, the brightness should be increased.
[0106] After brightness correction, in order to further smooth the image and reduce noise, the image can be convolved with a Gaussian kernel. The Gaussian kernel is a weight matrix defined as follows: Among them, G(x,y) is the value of the position in the Gaussian kernel; σ is the standard deviation of the Gaussian distribution; and e represents the base of the natural logarithm. The weight of the center position is the highest, and gradually decreases towards the surrounding areas. By convolving the Gaussian kernel with each pixel of the image and its neighborhood, a smoothed image can be obtained in which noise and details are reduced while the overall structure of the image is preserved. The result of the convolution operation is a set of new pixel values that reflect the brightness information of the original image after smoothing. These new pixel values are assigned to the new image at the corresponding position to obtain a blurred image. Specifically, the value of each pixel is replaced with the weighted average of the pixels in its neighborhood through a weighted averaging method, where the weight is determined by the Gaussian distribution, and the formula is as follows: Among them, V blurred (x,y) is the value of the blurred image at position (x,y); k is the radius of the Gaussian kernel. This blurred image reduces detail, but the overall brightness is more uniform and smooth. Histogram adjustment is performed on the blurred image to make the brightness distribution more uniform, thereby enhancing contrast and visual quality.
[0107] By adjusting the brightness of the RGB channels based on the column difference, brightness differences in the original image caused by uneven lighting or other factors can be eliminated, making the overall brightness of the image more consistent. Gaussian convolution effectively reduces noise and details in the image while preserving the main image structure, making the image appear smoother and clearer. Through histogram adjustment, the contrast of the image is enhanced because the brightness levels are redistributed to cover a wider range, thereby improving the image's visibility and detail.
[0108] In a preferred embodiment of the present invention, the above step 6 of analyzing the homogenized image to obtain the detection result of the abnormal area may include:
[0109] Load the homogenized image into the processing system. Perform preprocessing, such as denoising and contrast enhancement, to improve image quality and highlight abnormal areas. Select a threshold segmentation algorithm to divide the pixels in the image into two or more categories to distinguish between the background and foreground (abnormal areas). Apply the selected threshold segmentation method to binarize the image. Specifically, binarization is to classify pixel values by setting a threshold. Pixel values above or equal to the threshold are set to one value (255, indicating white), while those below the threshold are set to another value (0, indicating black), that is: Use morphological operations (erosion) to refine the binarized image. These operations can help remove noise, fill holes, or smooth edges, thereby improving the detection of abnormal regions. Apply contour detection algorithms to the binarized and morphologically processed image to identify the boundaries of abnormal regions. Filter contours based on size, shape, or other characteristics to remove undesirable contours, such as those that are too small or irregularly shaped.
[0110] The filtered contours are marked to highlight abnormal areas by drawing bounding boxes, filling colors, or other visualization methods. Features of the abnormal areas, such as area, shape, and location, are extracted for analysis and classification. The detected abnormal areas are verified for accuracy through manual inspection or comparison with other sensor data. The detection results are output as images, reports, or other formats.
[0111] like Figure 2As shown, an embodiment of the present invention further provides a system information processing system 20 based on power data, comprising:
[0112] The acquisition module 21 is used to obtain the original image of the metal thermos cup; pre-process the original image of the metal thermos cup to obtain an optimized thermos cup basic image; and calculate the average grayscale value and vertical pixel mean of the image based on the optimized thermos cup basic image;
[0113] The processing module 22 is used to compare the vertical pixel mean of each column with the average grayscale value of the entire image to calculate the difference; perform brightness correction on the original image according to the difference, and use the Gaussian blur method to process the brightness-corrected image to obtain a homogenized image; and analyze the homogenized image to obtain the detection result of the abnormal area.
[0114] It should be noted that this system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effects.
[0115] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the above-described method. All implementations in the above-described method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0116] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the above-described method. All implementations in the above-described method embodiment are applicable to this embodiment and can achieve the same technical effects.
[0117] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0118] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0119] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0120] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0121] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0122] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, ROM, RAM, a magnetic disk, or an optical disk.
[0123] In addition, it should be noted that, in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. Moreover, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it will be understood that all or any steps or components of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or a network of computing devices in hardware, firmware, software or a combination thereof, which can be achieved by those of ordinary skill in the art using basic programming skills after reading the description of the present invention.
[0124] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing device. The computing device can be a well-known general-purpose device. Therefore, the purpose of the present invention can also be achieved simply by providing a program product containing program code that implements the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but do not necessarily need to be performed in chronological order. Certain steps can be performed in parallel or independently of each other.
[0125] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for detecting abnormalities on the wall of a metal thermos cup based on homogenization of the reflective area, characterized in that: The method comprises: Get the original image of the metal thermos cup; Preprocess the original image of the metal thermos cup to obtain an optimized basic image of the thermos cup; Based on the optimized thermos cup basic image, calculate the average grayscale value and vertical pixel mean of the image; Compare the vertical pixel mean of each column with the average grayscale value of the entire image and calculate the difference; The original image is brightness corrected according to the difference, and the brightness corrected image is processed using the Gaussian blur method to obtain a homogenized image; The homogenized image is analyzed to obtain the detection results of abnormal areas. The original image of the metal thermos cup is preprocessed to obtain the optimized basic image of the thermos cup, including: Read the original color image of the metal thermos cup and convert the color value of each pixel into a grayscale value; Traverse each pixel in the image and assign the grayscale value to each pixel to obtain a grayscale image; The preset sharpening convolution kernel is convolved on each pixel and neighborhood of the grayscale image to calculate the new pixel value to obtain the sharpened thermos cup image; The sharpened thermos cup image is optimized in terms of brightness and contrast to obtain an optimized thermos cup base image. The grayscale value is calculated as follows: ; in, Represents grayscale value; Represents the color intensity value of the red channel; Represents the color intensity value of the green channel; Represents the color intensity value of the blue channel; 、 、 Represent the weights of the red channel, green channel, and blue channel respectively; the new pixel value calculation formula is: ; in, Represents the new image obtained after the convolution operation; Indicates that the new image is at position The pixel value on ; It represents the convolution kernel; represents the original image; Indicates that the convolution kernel is at position The value on Represents the original image In position The pixel value on ; 、 Represents the index inside the convolution kernel; The original image is brightness corrected according to the difference, and the brightness corrected image is processed to obtain a uniformed image, including: Adjust the brightness of the three RGB channels of the original image according to the difference to obtain a color image after brightness correction; According to the color image after brightness correction, the image is convolved with a Gaussian kernel to obtain a convolution result; Assign the convolution result to the new pixel at the corresponding position to obtain the blurred image; The blurred image is histogram-adjusted to make the image brightness evenly distributed, so as to obtain a homogenized image.
2. A metal thermos cup wall anomaly detection system based on reflective area homogenization, characterized in that: The system is used to perform the method according to claim 1, comprising: An acquisition module is used to obtain an original image of the metal thermos cup; preprocess the original image of the metal thermos cup to obtain an optimized thermos cup basic image; and calculate the average grayscale value and vertical pixel mean of the image based on the optimized thermos cup basic image; The processing module is used to compare the longitudinal pixel mean of each column with the average grayscale value of the entire image and calculate the difference; perform brightness correction on the original image according to the difference, and use the Gaussian blur method to process the brightness-corrected image to obtain a homogenized image; and analyze the homogenized image to obtain the detection result of the abnormal area.
3. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, causes the one or more processors to implement the method according to claim 1.
4. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which implements the method according to claim 1 when executed by a processor.
Citation Information
Patent Citations
Background image processing method and device
CN116416227A
Grape germplasm resource identification method and application thereof
CN117305426A