A protection plate image preprocessing method
By using a multi-level fusion edge enhancement algorithm and a deformation degree surface correction algorithm, the problem of insufficient image preprocessing in traditional protective pressure plate detection is solved. This enables efficient image preprocessing under different shooting angles and lighting conditions, improving detection accuracy and batch processing efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- STATE GRID CORPORATION OF CHINA
- Filing Date
- 2022-09-22
- Publication Date
- 2026-05-05
AI Technical Summary
Traditional automatic detection technology for protective pressure plates neglects image preprocessing, resulting in poor generalization ability of images from different shooting angles and lighting environments, failing to eliminate individual differences, and affecting the accuracy of batch processing operations.
Image preprocessing is performed using a multi-level fusion edge enhancement algorithm, a shadow removal algorithm based on dual color space and illumination compensation, and an image correction algorithm based on deformable surfaces. This includes edge enhancement, shadow removal, and distortion correction.
It improves the detection accuracy and batch processing efficiency of protective pressure plate images, eliminates individual differences caused by shooting environment and angle, and enhances the operability and accuracy of subsequent operations.
Smart Images

Figure CN115511823B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to image preprocessing technology, specifically to a method for preprocessing images of a protective pressure plate. Background Technology
[0002] Traditional automatic detection technology for protective pressure plates often neglects the prior image preprocessing operations, directly using target detection or segmentation networks to extract the ROI region of the protective pressure plate. This method has poor generalization ability for images taken from various shooting angles and lighting environments in real-world applications, and cannot eliminate individual differences in the pressure plates caused by image distortion in the same image. It is not conducive to batch processing operations and has low accuracy. Summary of the Invention
[0003] The purpose of this invention is to provide a protective pressure plate image preprocessing algorithm that combines a multi-level fusion edge enhancement algorithm and an image correction algorithm based on the degree of deformation surface. This algorithm enables the preprocessing of images captured of the protective pressure plate, eliminates individual differences in the pressure plate caused by the shooting environment and angle, and helps to improve the accuracy and efficiency of subsequent batch processing operations such as automatic detection of the protective pressure plate status.
[0004] The technical solution of the present invention:
[0005] A protective pressure plate image preprocessing method is proposed, which combines a multi-level fusion edge enhancement algorithm, a shadow removal algorithm based on dual color space and illumination compensation, and an image correction algorithm based on the degree of deformation surface. The image preprocessing operation is performed before subsequent batch processing.
[0006] The multi-level fusion edge enhancement algorithm starts from different color level spaces of the image, uses different edge enhancement methods to enhance the edges of each layer separately, and then fuses them to improve the contrast between the pressure plate ROI area and the background, which is beneficial for subsequent detection and segmentation operations. The shadow removal algorithm based on dual color space and illumination compensation uses HSV and RGB dual color spaces to realize automatic shadow detection, and uses illumination compensation methods to restore the original features of the image to the greatest extent, thus completing the shadow removal.
[0007] An image correction algorithm based on a deformation degree surface is proposed, which reflects the deformation degree of the pressure plate due to different shooting angles. The algorithm adaptively corrects the distortion by correcting each pressure plate ROI image to the same plane and angle, thereby improving the operability and accuracy of subsequent batch processing.
[0008] The preferred multi-level fusion edge enhancement algorithm is as follows: Select an image, convert it into an HSV mode image and a grayscale image respectively, and then perform edge enhancement processing on both levels; In HSV mode, histogram equalization is performed on the luminance component to enhance image contrast, and then Gaussian-Laplacian transform is performed on the equalized luminance image to sharpen the edges, and the processed luminance component is then superimposed with the original saturation and hue components to obtain the first enhanced image in HSV mode; At the grayscale level, Canny operator edge extraction is performed, and then superimposed on the grayscale image and contrast stretching transformation is performed on the grayscale image for gray switches. The two are superimposed together to obtain the second image. After the two images are restored to RGB mode respectively, image fusion is performed to finally obtain the output edge-enhanced image.
[0009] Preferably, the preprocessing of the image correction algorithm based on the degree of deformation surface includes the following steps:
[0010] Based on edge enhancement and shadow removal, the Faster-RCNN object detection network is used to extract all the ROIs of the pressure plate in the image. Individual image processing operations are performed on each ROI region image. Combining the Canny edge detection algorithm and the connected component detection algorithm, the largest connected component in each ROI image is extracted, and it is filled or partially removed according to the nearest edges around it to achieve the segmentation of the protective pressure plate.
[0011] Preferably, to address the shadow problem generated when the protective pressure plate image is captured under normal lighting conditions, this step proposes a shadow removal method based on dual color space and illumination compensation, which is applied before the image correction algorithm to improve the correction accuracy.
[0012] The shadow removal method based on dual color space and illumination compensation consists of two parts: shadow detection and shadow region restoration. The specific steps are as follows:
[0013] A. Shadow detection based on RGB and HSV dual color spaces
[0014] First, the protective pressure plate image is converted to the HSV color space to obtain the hue, saturation, and brightness values of each pixel. Then, a shadow-like coefficient LS is proposed to comprehensively evaluate the saturation and brightness values of the corresponding pixels. The LS calculation formula is as follows:
[0015] LS=e V +e -S
[0016] Where V and S represent the brightness and saturation in the HSV color space of the image, respectively; the shadow-like coefficient LS is positively correlated with the brightness of the pixel and negatively correlated with the saturation. That is, the lower the brightness and the higher the saturation of the region, the higher the shadow-like coefficient, and the greater the probability of it being considered a shadow region. This is consistent with the shadow characteristics observed by the human eye.
[0017] The LS values of all pixels in the protective pressure plate image are calculated, and its kernel density curve is calculated using statistical methods. The LS value corresponding to the first trough position after the maximum peak in the kernel density curve is taken as the threshold. The pre-selected region R1 of the shaded area is separated from other parts by this threshold.
[0018] The image is converted to the RGB color space. Since the shadow area is darker, its contrast with other parts in the R channel is higher than that of the other two channels. The grayscale image of the R channel is extracted, and the image is divided into two parts according to the grayscale value using the Otsu's method. The part with the smaller grayscale value is the shadow pre-selected region R2 extracted from the RGB color space. The intersection R of R1 and R2 is taken as the final detected shadow area.
[0019] B. Shadow Removal Algorithm Based on Illumination Compensation
[0020] Since shadows produced by lighting in real shooting scenarios have a gradual change, illumination compensation is used to adaptively fill the shadow areas in order to restore the features of the original image to the greatest extent.
[0021] The RGB values of a color image satisfy the formula:
[0022] I x =L x R x
[0023] Where I x L represents the RGB value of pixel x. x The illumination representing pixel x, R x Let x be the surface reflectance of pixel x; apart from shadows caused by occlusion, the illumination of pixels in the image comes from direct illumination L from the light source. d and ambient reflected light L r Therefore, the following formula can be obtained:
[0024] L x =aL d +L r
[0025] I x =(aL d +L r )R x
[0026] Where 'a' is the reduction factor of direct light in the corresponding region of the image, with 'a' being 0 for the shadow region and 1 for the full image region; rewriting the above formula, we get:
[0027]
[0028] Among them, I s The pixels representing the shaded area have an a value of 0, I o This refers to the area excluding the shaded region. For a specific pixel x within the shaded region, its RGB value after shadow filling is... Compared with the RGB values before filling The relationship between them satisfies:
[0029]
[0030] According to the above formula, the pixel value of each pixel in the shadow area S can be restored according to the corresponding lighting compensation relationship, thereby achieving the removal of shadows;
[0031] After removing shadows using illumination compensation, the edges of the shadow areas often exhibit unnatural transitions due to the impact of detection accuracy. To improve the accuracy of shadow removal and restore the original image information to the greatest extent possible, this project performs a smoothing operation on the edges of the shadow areas after shadow removal and adaptively assigns corresponding weights based on the distance from the edge. The weighting formula is as follows:
[0032]
[0033] Where d is the distance of the current pixel from the actual edge, d max and d min These are the maximum and minimum distances from the actual edge in the edge region, respectively.
[0034] Preferably, the area of the protective pressure plate segmented in each ROI image is calculated sequentially, and the pressure plate area variation curve is plotted in rows and columns. The curves are arranged according to their row and column positions to form a surface of pressure plate deformation. The shape of the pressure plate deformation surface reflects the distortion of each part of the image, and its maximum value point O max Represents the location closest to the camera being photographed, from O max Starting from the point, calculate the difference between each pressure plate area point and its eight neighboring points in sequence, and stop when the first minimum difference point is obtained; the calculated minimum point corresponds to the pressure plate ROI with the least degree of distortion, and this ROI is taken as the correction template.
[0035] Preferably, the edge region is the region obtained by expanding the edge part using a 5*5 kernel;
[0036] Each part of the image shows the area where the pressure plate is located;
[0037] The length and width of the pressure plate in the calculated correction template are used as the standard to individually correct each ROI image.
[0038] Preferably, the correction rule is as follows: based on the previous segmentation results, locate the four corner points of the protective pressure plate, keeping the upper left corner point fixed, the inclination of the line connecting the upper left corner point to the upper right and lower left corner points unchanged, and the distance between the corner points becomes the corresponding template length and width. Preferably, the four sets of corner point positions before and after correction can be obtained from the correction rule, and then the perspective transformation matrix can be calculated; the specific calculation process is as follows:
[0039]
[0040] Where M is the perspective transformation matrix, mij are the coefficients of the perspective transformation matrix; (x, y) is any point in the image before correction (source and target points); [X, Y, Z] is the point moved to three-dimensional space by the perspective transformation; (x ′ ,y ′ ) represents the points that are transformed from perspective to three-dimensional space and then transformed back to two-dimensional image, i.e., the points in the corresponding corrected image; let m33 = 1, then by substituting the four sets of corner point positions, the values of each coefficient in M can be obtained, and thus the corrected image can be calculated based on the image before correction.
[0041] Preferably, the probabilistic Hough line detection algorithm is used to detect lines in the original image, and the longest line is selected. Using the longest line as a reference, its tilt is calculated to represent the overall tilt of the image. Based on the tilt of the image, each ROI image is rotated to achieve tilt correction of the image.
[0042] Preferably, the longest straight line is the seam line between the protective pressure plate cabinets.
[0043] Multi-level fusion edge enhancement algorithm refers to an algorithm that starts from different color level spaces of an image, uses different edge enhancement methods to enhance the edges of each image separately, and then fuses them together.
[0044] The deformation degree surface refers to the three-dimensional surface proposed in this patent, which is composed of the area and position information of each pressure plate and can reflect the degree of influence of image distortion on the area where each pressure plate is located. The standard template for subsequent image correction can be determined based on this surface.
[0045] The protection pressure plate, also called the protection connector, is the bridge and link between the protection device and the external wiring in the substation. It is related to whether the protection function and the action output can play a normal role.
[0046] The beneficial effects of this invention are:
[0047] Based on the protective pressure plate image acquired by the image acquisition device, this invention proposes a protective pressure plate image preprocessing algorithm that combines a multi-level fusion edge enhancement algorithm and an image correction algorithm based on the deformation degree surface. This algorithm enables image preprocessing operations before batch processing, such as automatic detection of the protective pressure plate status.
[0048] To address the low batch processing accuracy issues of traditional methods for protective pressure plates with varying shooting angles and environments, a protective pressure plate image preprocessing algorithm is proposed. This algorithm consists of two parts: a multi-level fusion edge enhancement algorithm and an image correction algorithm based on a deformation degree surface. This preprocessing operation, performed before subsequent batch processing, improves the accuracy and operability of batch processing. The multi-level fusion edge enhancement algorithm and the deformation degree surface-based image correction algorithm introduce a pressure plate deformation degree surface that reflects image distortion caused by different shooting angles and adaptively corrects the distortion. By correcting the ROI images of each pressure plate to the same plane and angle, the operability and accuracy of subsequent batch processing are improved. Furthermore, this algorithm can be extended to other image distortion situations caused by varying shooting angles, providing a new approach to image correction.
[0049] The layered fusion edge enhancement algorithm and the image correction algorithm based on the deformation degree surface jointly realize the preprocessing operation of the protective pressure plate image, eliminating the influence of image distortion caused by shooting on the individual differences of the pressure plate, laying the foundation for subsequent batch processing operations. Attached Figure Description
[0050] Figure 1 Flowchart of the present invention;
[0051] Figure 2 Flowchart of multi-layered fusion edge enhancement algorithm;
[0052] Figure 3 Schematic diagram of the seam line of the protective pressure plate cabinet. Detailed Implementation
[0053] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this application or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0054] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0055] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.
[0056] In the description of this application, it should be understood that the orientation or positional relationship indicated by directional terms such as "front, back, up, down, left, right", "horizontal, vertical, horizontal" and "top, bottom" is usually based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing this application and simplifying the description. Unless otherwise stated, these directional terms do not indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the scope of protection of this application; the directional terms "inner" and "outer" refer to the inner and outer contours relative to the outline of each component itself.
[0057] For ease of description, spatial relative terms such as "above," "on top of," "on the upper surface of," "above," etc., are used herein to describe the spatial positional relationship of a device or feature as shown in the figures to other devices or features. It should be understood that spatial relative terms are intended to encompass different orientations in use or operation beyond the orientation of the device as described in the figures. For example, if the device in the figures were inverted, a device described as "above" or "on top of" other devices or structures would subsequently be positioned as "below" or "under" other devices or structures. Thus, the exemplary term "above" can include both "above" and "below." The device may also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatial relative descriptions used herein will be interpreted accordingly.
[0058] Furthermore, it should be noted that the use of terms such as "first" and "second" to define components is merely for the purpose of distinguishing the corresponding components. Unless otherwise stated, the above terms have no special meaning and therefore cannot be construed as limiting the scope of protection of this application.
[0059] Example 1
[0060] like Figure 1 As shown, to address the problem of low batch processing accuracy of traditional methods for protective pressure plates with varying shooting angles and environments, a protective pressure plate image preprocessing algorithm is proposed. This algorithm consists of two parts: a multi-level fusion edge enhancement algorithm, a shadow removal algorithm based on dual color space and illumination compensation, and an image correction algorithm based on deformable surfaces. This algorithm enables image preprocessing operations before subsequent batch processing, thereby improving the accuracy and operability of batch processing. Among them, the multi-level fusion edge enhancement algorithm starts from different color level spaces of the image, uses different edge enhancement methods to enhance the edges separately and then fuses them, which improves the contrast between the pressure plate ROI area and the background, which is beneficial for subsequent detection and segmentation operations; the shadow removal algorithm based on dual color space and illumination compensation uses HSV and RGB dual color spaces to realize automatic shadow detection, and uses illumination compensation methods to restore the original features of the image to the greatest extent, thus completing the shadow removal; the image correction algorithm based on deformation degree surface proposes a pressure plate deformation degree surface that can reflect the distortion caused by different shooting angles, and can adaptively correct the distortion. By correcting each pressure plate ROI image to the same plane and angle, the operability and accuracy of subsequent batch processing are improved. In addition, this algorithm can be extended to other image distortion cases caused by different shooting angles, providing a new approach to image correction.
[0061] (1) Multi-level fusion edge enhancement algorithm
[0062] like Figure 2 As shown, an image is selected and converted into both an HSV mode image and a grayscale image. Edge enhancement processing is then performed at both levels. In HSV mode, histogram equalization is applied to the luminance component to enhance image contrast. Next, Gaussian-Laplacian transform is applied to the equalized luminance image for sharpening, enhancing edges. The processed luminance component is then superimposed with the original saturation and hue components to obtain the first enhanced image in HSV mode. At the grayscale level, Canny edge extraction is performed, and the resulting images are superimposed on the grayscale image. Contrast stretching transformation is also applied to the grayscale image for grayscale switching. These two images are then superimposed to obtain the second image. After restoring both images to RGB mode, image fusion is performed to obtain the final output image with enhanced edges.
[0063] (2) To address the shadow problem generated when the protective pressure plate image is captured under normal lighting conditions, this embodiment proposes a shadow removal method based on dual color space and illumination compensation, applied before the image correction algorithm to improve correction accuracy. The shadow removal method consists of two parts: shadow detection and shadow region recovery. The specific steps are as follows:
[0064] 1. Shadow detection based on RGB and HSV dual color spaces
[0065] Because the HSV format better aligns with the human eye's intuitive perception of object color, its three-dimensional parameters—hue (H), saturation (S), and lightness (V)—better reflect the human eye's perception of low shadow brightness and high saturation. This embodiment first converts the protective pressure plate image to the HSV color space to obtain the hue, saturation, and lightness values of each pixel. A shadow-like coefficient (LS) is then proposed to comprehensively evaluate the saturation and lightness values corresponding to each pixel. The LS calculation formula is as follows:
[0066] Ls = e V +e -S
[0067] Where V and S represent the lightness and saturation in the HSV color space of the image, respectively. The shadow-like coefficient LS is positively correlated with the lightness of the corresponding pixel and negatively correlated with the saturation. That is, the lower the lightness and the higher the saturation of the region, the higher the shadow-like coefficient, and the greater the probability that it is considered a shadow region. This is consistent with the shadow characteristics observed by the human eye.
[0068] The LS values of all pixels in the protective pressure plate image are calculated, and its kernel density curve is calculated using statistical methods. The LS value corresponding to the first trough position after the maximum peak in the kernel density curve is taken as the threshold. The pre-selected region R1 of the shaded area is separated from other parts by this threshold.
[0069] The image is converted to the RGB color space. Because the shadow areas are darker, their contrast with other areas is higher in the R channel compared to the other two channels. The grayscale image of the R channel is extracted, and the image is divided into two parts according to grayscale value using the Otsu's method (OSTU). The part with the smaller grayscale value is the pre-selected shadow region R2 extracted from the RGB color space. The intersection R of R1 and R2 is taken as the final detected shadow region.
[0070] 2. Shadow Removal Algorithm Based on Illumination Compensation
[0071] Since shadows produced by lighting in real shooting scenarios have gradual changes, this embodiment uses illumination compensation to adaptively fill the shadow areas in order to restore the features of the original image to the greatest extent.
[0072] Existing research has shown that the RGB values of a color image satisfy the formula:
[0073] I x =L x R x
[0074] Where I x L represents the RGB value of pixel x. x The illumination representing pixel x, R x Let be the surface reflectance of pixel x. Aside from shadows caused by occlusion, the illumination of pixels in the image comes from direct illumination L from the light source. d and ambient reflected light L r Therefore, the following formula can be obtained:
[0075] L x =aL d +L r
[0076] I x =(aL d +L r )R x
[0077] Where 'a' is the reduction factor of direct light in the corresponding region of the image, with 'a' being 0 for the shadow region and 1 for the full image region. Rewriting the above equation, we get:
[0078]
[0079] Among them, I s The pixels representing the shaded area have an a value of 0, I o This refers to the area excluding the shaded region. For a specific pixel x within the shaded region, its RGB value after shadow filling is... Compared with the RGB values before filling The relationship between them satisfies:
[0080]
[0081] According to the above formula, the pixel value of each pixel in the shadow area S can be restored according to the corresponding lighting compensation relationship, thereby achieving the removal of shadows.
[0082] After removing shadows using illumination compensation, the edges of the shadow areas often exhibit unnatural transitions due to the impact of detection accuracy. To improve the accuracy of shadow removal and restore the original image information to the greatest extent possible, this embodiment performs a smoothing operation on the edge regions of the shadow areas (the regions obtained by dilating the edge parts using a 5*5 kernel) after shadow removal, and adaptively assigns corresponding weights according to the distance from the edge. The weight formula is as follows:
[0083]
[0084] Where d is the distance of the current pixel from the actual edge, d max and d min These are the maximum and minimum distances from the actual edge in the edge region, respectively.
[0085] (3) Image correction algorithm based on deformable surfaces
[0086] Building upon edge enhancement and shadow removal, the Faster-RCNN object detection network is used to extract all regions of interest (ROIs) of the pressure plates in the image. Individual image processing operations are then performed on each ROI. Combining the Canny edge detection algorithm and connected component detection algorithm, the largest connected component in each ROI image is extracted, and it is filled or partially removed based on its nearest surrounding edges to achieve segmentation of the protective pressure plates.
[0087] The area of the protective pressure plate segmented from each ROI image is calculated sequentially. Curves depicting the area variation of the pressure plate are plotted row by row and column by column. These curves are arranged according to their row and column positions to form a surface representing the degree of pressure plate deformation. The shape of this surface reflects the distortion of different parts of the image (the area containing the pressure plate), with its maximum value at point O. max Represents the location closest to the camera being photographed, from O max Starting from the first point and working outwards, calculate the difference between each pressure plate area point and its eight neighboring points, stopping at the first minimum difference point. The calculated minimum point corresponds to the pressure plate ROI with the least distortion, and this ROI is taken as the correction template.
[0088] The calculated length and width of the pressure plate in the correction template are used as the standard to individually correct each ROI image. The correction rules are as follows: Based on the previous segmentation results, locate the four corner points of the protective pressure plate, keeping the upper left corner point fixed, the inclination of the line connecting the upper left corner point to the upper right and lower left corner points unchanged, and the distance between the corner points becomes the corresponding template length / width. For example, if the pressure plate in the correction template is 5 pixels long and 3 pixels wide, and the original positions of the four corner points of the current protective pressure plate ROI image before correction are (0, 4), (6, 4), (6, 0), (0, 0), then during the correction process, the angle of the line connecting each point remains unchanged (in this setting, horizontal and vertical directions), and the distance changes with the length and width of the correction template, that is, the corrected corner point positions are (0, 3), (5, 3), (5, 0), (0, 0). From the above rules, the four sets of corner point positions before and after correction can be obtained, and then the perspective transformation matrix can be calculated. The specific calculation process is as follows:
[0089]
[0090] Where M is the perspective transformation matrix, and (x,y) is any point in the image before correction. ′ ,y ′ Let m33 be the point in the corresponding corrected image. Then, by substituting the four sets of corner point positions, we can obtain the values of each coefficient in M, and thus calculate the corrected image based on the image before correction.
[0091] The probabilistic Hough line detection algorithm is used to detect lines in the original image, and the longest line is selected (such as the seam line between the protective pressure plate cabinets). Figure 3 (As shown in the circled part of the rectangle), the tilt of the line is calculated to represent the overall tilt of the image. Based on the tilt of the image, each ROI image is rotated to achieve tilt correction of the image.
[0092] The aforementioned multi-level fusion edge enhancement algorithm and the image correction algorithm based on the deformation degree surface jointly realize the preprocessing operation of the protective pressure plate image, eliminating the influence of image distortion caused by shooting on the individual differences of the pressure plate, and laying the foundation for subsequent batch processing operations.
Claims
1. A method for preprocessing images of a protective pressure plate, characterized in that, This protective pressure plate image preprocessing algorithm combines three parts: a multi-level fusion edge enhancement algorithm, a shadow removal algorithm based on dual color space and illumination compensation, and an image correction algorithm based on deformation degree surface. This algorithm performs image preprocessing before subsequent batch processing. The multi-level fusion edge enhancement algorithm starts from different color levels of the image, uses different edge enhancement methods to enhance the edges separately, and then fuses them, improving the contrast between the pressure plate ROI area and the background, which is beneficial for subsequent detection and segmentation operations. The shadow removal algorithm based on dual color space and illumination compensation uses HSV and RGB dual color spaces to automatically detect shadows and uses illumination compensation to restore the original features of the image to the greatest extent, thus completing shadow removal. The image correction algorithm based on deformation degree surface proposes a pressure plate deformation degree surface that reflects the image distortion caused by different shooting angles and adaptively corrects the distortion. By correcting each pressure plate ROI image to the same plane and angle, it improves the operability and accuracy of subsequent batch processing. The multi-level fusion edge enhancement algorithm is as follows: Select an image, convert it into an HSV mode image and a grayscale image respectively, and then perform edge enhancement processing on both levels; In HSV mode, histogram equalization is performed on the luminance component to enhance image contrast, and then Gaussian-Laplacian transform is performed on the equalized luminance image to sharpen the edges, and the processed luminance component is then superimposed with the original saturation and hue components to obtain the first enhanced image in HSV mode; At the grayscale level, Canny operator edge extraction is performed, and then superimposed on the grayscale image and contrast stretch transformation is performed on the grayscale switch in the grayscale image. The two are superimposed together to obtain the second image. After the two images are restored to RGB mode respectively, image fusion is performed to obtain the final output edge-enhanced image.
2. The method for preprocessing images of a protective pressure plate according to claim 1, characterized in that, The image correction algorithm based on the degree of deformation of curved surfaces includes the following preprocessing steps: Based on edge enhancement and shadow removal, the Faster-RCNN object detection network is used to extract all the ROIs of the pressure plate in the image. Individual image processing operations are performed on each ROI region image. Combining the Canny edge detection algorithm and the connected component detection algorithm, the largest connected component in each ROI image is extracted, and it is filled or partially removed according to the nearest edges around it to achieve the segmentation of the protective pressure plate.
3. The method for preprocessing images of a protective pressure plate according to claim 2, characterized in that, The shadow removal method based on dual color space and illumination compensation consists of two parts: shadow detection and shadow region restoration. The specific steps are as follows: A. Shadow detection based on RGB and HSV dual color spaces First, the protective pressure plate image is converted to the HSV color space to obtain the hue, saturation, and brightness values of each pixel. Then, a shadow-like coefficient LS is proposed to comprehensively evaluate the saturation and brightness values of the corresponding pixels. The LS calculation formula is as follows: Where V and S represent the brightness and saturation in the HSV color space of the image, respectively; the shadow-like coefficient LS is positively correlated with the brightness of the pixel and negatively correlated with the saturation. That is, the lower the brightness and the higher the saturation of the region, the higher the shadow-like coefficient, and the greater the probability of it being considered a shadow region. This is consistent with the shadow characteristics observed by the human eye. The LS values of all pixels in the protective pressure plate image are calculated, and its kernel density curve is calculated using statistical methods. The LS value corresponding to the first trough after the maximum peak in the kernel density curve is taken as the threshold. The pre-selected shaded area is then defined using this threshold. Separated from other parts; The image is converted to the RGB color space. Because the shadow areas are darker, their contrast with other areas is higher in the R channel compared to the other two channels. The grayscale image of the R channel is extracted, and the image is divided into two parts according to grayscale value using the Otsu's method. The part with the lower grayscale value is the pre-selected shadow area extracted from the RGB color space. ;Pick and intersection As the final detected shadow area; B. Shadow Removal Algorithm Based on Illumination Compensation Since shadows produced by lighting in real shooting scenarios have a gradual change, illumination compensation is used to adaptively fill the shadow areas in order to restore the features of the original image to the greatest extent. The RGB values of a color image satisfy the formula: in For pixels RGB values, Representing pixels Light, For pixels The surface reflectivity; apart from shadows caused by occlusion, the illumination of pixels in the image comes from direct illumination from the light source. and ambient reflected light Therefore, the following formula can be obtained: in The reduction factor for direct light in the corresponding region of the image is the shadow region. The value is 0, while the corresponding total shadow region The value is 1; rewriting the above formula, we get: in, The pixels representing the shaded area, their corresponding The value is 0. The rest of the area excluding the shaded area; for a specific pixel within the shaded area. Its RGB values after shadow filling Compared with the RGB values before filling The relationship between them satisfies: According to the above formula, the pixel value of each pixel in the shadow area S can be restored according to the corresponding lighting compensation relationship, thereby achieving the removal of shadows; After removing shadows using illumination compensation, the edges of the shadow areas often exhibit unnatural transitions due to the impact of detection accuracy. To improve the accuracy of shadow removal and restore the original image information to the greatest extent possible, this project performs a smoothing operation on the edges of the shadow areas after shadow removal and adaptively assigns corresponding weights based on the distance from the edge. The weighting formula is as follows: in, The distance of the current pixel from the actual edge. and These are the maximum and minimum distances from the actual edge in the edge region, respectively.
4. The method for preprocessing images of a protective pressure plate according to claim 3, characterized in that, The area of the protective pressure plate segmented from each ROI image is calculated sequentially. Pressure plate area variation curves are plotted in rows and columns, and these curves are arranged according to their row and column positions to form a surface representing the degree of pressure plate deformation. The shape of this surface reflects the distortion of different parts of the image, with its maximum value... Represents the location closest to the camera being photographed, from Starting from the point, calculate the difference between each pressure plate area point and its eight neighboring points in sequence, and stop when the first minimum difference point is obtained; the calculated minimum point corresponds to the pressure plate ROI with the least degree of distortion, and this ROI is taken as the correction template.
5. The method for preprocessing images of a protective pressure plate according to claim 4, characterized in that, The edge region is the area obtained by expanding the edge part using a 5*5 kernel; Each part of the image shows the area where the pressure plate is located; The length and width of the pressure plate in the calculated correction template are used as the standard to individually correct each ROI image.
6. The method for preprocessing images of a protective pressure plate according to claim 5, characterized in that, The correction rule is as follows: based on the previous segmentation results, locate the four corner points of the protective pressure plate, keep the upper left corner point unchanged, keep the inclination of the line connecting the upper left corner point and the upper right and lower left corner points unchanged, and change the distance between the corner points to the corresponding template length and width.
7. The method for preprocessing images of a protective pressure plate according to claim 6, characterized in that, The four sets of corner point positions before and after correction can be obtained from the correction rules, and then the perspective transformation matrix can be calculated; the specific calculation process is as follows: Where M is the perspective transformation matrix. These are the coefficients of the perspective transformation matrix; [X,Y,Z] represents any point in the image before correction; [X,Y,Z] represents the point moved to 3D space by perspective transformation; ) represents the points that are transformed from perspective to three-dimensional space and then transformed back to two-dimensional image, i.e., the points in the corresponding corrected image; let m33=1, then by substituting the four sets of corner point positions, the values of each coefficient in M can be obtained, and thus the corrected image can be calculated based on the image before correction.
8. The method for preprocessing images of a protective pressure plate according to claim 7, characterized in that, The probabilistic Hough line detection algorithm is used to detect lines in the original image. The longest line is selected and its tilt is calculated to represent the overall tilt of the image. Based on the tilt of the image, each ROI image is rotated to achieve tilt correction.
9. The method for preprocessing images of a protective pressure plate according to claim 8, characterized in that, The longest straight line is the seam line between the protective pressure plate cabinets.
Citation Information
Patent Citations
Correction method for warped document image
CN108921804A
Pressing plate state identification method based on improved K-means algorithm
CN113344047A