A thin layer detection method and system based on image processing

By dividing the thin-layer plate image into blocks and adaptive histogram equalization processing, combined with the fusion of vertical and horizontal enhancement images, the problem of low detection accuracy caused by block artifacts in the existing technology is solved, and the thin-layer plate image is improved. Detection accuracy.

CN118429196BActive Publication Date: 2024-10-01SHAANXI SCIENDAN PHARM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410896909.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-01
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

In the prior art, images processed by adaptive histogram equalization have obvious block artifacts, resulting in low accuracy of thin-layer plate detection results.

Method used

By initially dividing the thin-layer plate image into blocks, the new image block size is calculated based on the contrast and gradient mean, and adaptive histogram equalization is performed to reduce the area size of the block effect. Combined with the fusion of vertical and horizontal enhancement maps, the enhancement Image detection effect.

Benefits of technology

The accuracy of thin-layer plate detection results is improved, the influence of block effects is reduced, and the image enhancement effect is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118429196B_ABST
    Figure CN118429196B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology. Specifically, it relates to a thin layer detection method and system based on image processing. The method includes: collecting a thin layer plate image, and performing initial block division on the thin layer plate image, so as to obtain an initial image block; calculating the horizontal size and the vertical size of a new image block; constructing a rectangular block according to the vertical size and the horizontal size, and arranging the rectangular blocks until the thin layer plate image is completely covered by the rectangular blocks; removing the rectangular blocks where only part of the image exists, and translating the whole composed of the remaining rectangular blocks to the center position of the image to obtain a new image block division result, and performing histogram equalization on each new image block. The method of the present invention can make the image after adaptive histogram equalization have an image enhancement effect while reducing the size of the area of ​​the block effect to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more specifically, to a thin layer detection method and system based on image processing. Background Art

[0002] In the preparation process of Chinese herbal medicine slices, thin layer chromatography is often used to separate and analyze the components in the mixture. It is based on the different distribution coefficients of each component between the stationary phase and the mobile phase. The sample is spotted on the thin layer plate through a capillary and the sample is developed to achieve the separation and qualitative analysis of the components. When using thin layer chromatography to separate and analyze the mixture, the separation effect of the components will be poor due to the different thicknesses at different positions of the thin layer plate or defects such as cracks in the thin layer plate, resulting in the failure of the experiment. In order to ensure the experimental effect, it is necessary to detect whether the thin layer plate used has defects before the experiment. In the prior art, adaptive histogram equalization is usually used to process the thin layer plate image to obtain an enhanced image to highlight the defects of the thin layer plate, thereby obtaining the defect detection results of the thin layer plate.

[0003] Adaptive histogram equalization is an image enhancement technology that aims to improve the contrast of an image, especially in local areas of the image. However, since adaptive histogram equalization divides the image into multiple small blocks for processing during the image processing process, there will be obvious block artifacts in the image after adaptive histogram equalization processing, forming a block effect, resulting in low accuracy of the detection results of thin layer plates. For example, a Chinese patent application document with application publication number CN104952069A discloses an underwater sea cucumber image processing method based on limited contrast histogram equalization. This method first divides the image into multiple sub-areas when processing the image, and then performs histogram equalization on each sub-area. However, there will be obvious block artifacts in the image after the histogram equalization processing. Summary of the invention

[0004] In order to solve the technical problem that obvious block artifacts exist in the image after adaptive histogram equalization processing, thereby resulting in low accuracy of thin layer plate detection results, the present invention provides solutions in the following aspects.

[0005] In a first aspect, the present invention provides a thin layer detection method based on image processing, comprising: collecting a thin layer plate image, and performing initial block division on the thin layer plate image, thereby obtaining an initial image block; calculating the lateral size of a new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average longitudinal gradient of all the initial image blocks, wherein the lateral size is negatively correlated with the mean value of the contrast and the mean value of the average longitudinal gradient; calculating the new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average transverse gradient of all the initial image blocks. , wherein the longitudinal size is negatively correlated with the mean value of the contrast and the mean value of the average transverse gradient; rectangular blocks are constructed according to the longitudinal size and the transverse size, and the rectangular blocks are arranged to the right and bottom with the upper left corner of the thin layer plate image as the starting point until the thin layer plate image is completely covered by the rectangular blocks; the rectangular blocks with images only in a partial area are removed, and the whole composed of the remaining rectangular blocks is translated to the center position of the image to obtain a new image segmentation result, and each new image block is subjected to histogram equalization, so as to obtain an enhanced image of the thin layer plate image;

[0006] The calculation expression of the lateral dimension is:

[0007] ;

[0008] In the formula, is the horizontal size of the new image block, is the width of the thin layer image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average longitudinal gradient of the i-th initial image block, is the maximum longitudinal gradient of the thin layer plate image, is the floor function, is the number of initial image blocks contained in the same row of the initial block result;

[0009] The calculation expression of the longitudinal dimension is:

[0010] ;

[0011] In the formula, is the vertical size of the new image block, H is the height of the thin layer plate image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average lateral gradient of the i-th initial image block, is the maximum lateral gradient of the thin layer image, is a floor rounding function, and q is the number of initial image blocks contained in the same column of the initial block result.

[0012] The image processed by the adaptive histogram equalization method in the prior art has the defect of block effect affecting the detection of thin layer plates. The thin layer detection method based on image processing of the present invention first obtains the initial image block when performing adaptive histogram equalization on the thin layer plate image, and determines the new image block size according to the contrast and gradient of the initial image block. When determining the new image block size, the relationship between the mean value of the contrast of the initial image block and the details in the image and the relationship between the gradient of the initial image block and the texture in the image are taken into account, so that the calculated new image block size is more appropriate. Finally, the image is adaptively histogram equalized with the new image block size, so that the image after adaptive histogram equalization has the image enhancement effect while reducing the size of the block effect area to a certain extent, thereby improving the accuracy of the detection result of the thin layer plate.

[0013] When the width of the image is small, using blocks with smaller width can facilitate more fine enhancement of local contrast; when the width of the image is large, using blocks with larger width can reduce the block effect.

[0014] When the image height is small, using blocks with smaller vertical size is convenient for enhancing local contrast more finely; when the image height is large, using blocks with larger vertical size can reduce the block effect.

[0015] In one embodiment, the method further includes: dividing the thin layer plate image into longitudinal blocks and transverse blocks respectively, thereby obtaining longitudinal image blocks and transverse image blocks; the width of the longitudinal image block is equal to the transverse size, and the height of the transverse image block is equal to the longitudinal size; performing histogram equalization on each longitudinal image block, thereby obtaining a longitudinal enhancement image; performing histogram equalization on each transverse image block, thereby obtaining a transverse enhancement image; and fusing the longitudinal enhancement image, the transverse enhancement image and the enhancement image according to preset weights, thereby obtaining an enhanced fusion image.

[0016] Since adaptive histogram equalization will inevitably produce a small amount of artifacts at the adjacent boundaries between image blocks, resulting in a block effect, while the image within the image block does not have such artifacts. Therefore, by fusing the enhanced image with the horizontal enhanced image and the vertical enhanced image, the block effect in the enhanced image can be weakened, and the enhanced effect of the enhanced image can be retained, making the unevenness and cracks of the thin layer plate in the thin layer plate image more prominent, thereby improving the inspection effect of the thin layer.

[0017] In one embodiment, at the same pixel position, the weight of the enhancement map is greater than or equal to 0.5, and the weights of the horizontal enhancement map and the vertical enhancement map are calculated based on the weights of the enhancement map, and the calculation expression is:

[0018] ;

[0019] In the formula, Indicates the weight corresponding to the pixel point in the jth row and the kth column of the enhanced image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the horizontal enhancement image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the vertical enhancement image during fusion.

[0020] By making the weight of the enhancement map as small as 0.5, the enhancement map can be prevented from being over-fused.

[0021] In one embodiment, the pixels located on the central axis of the horizontal image block or on both sides of the central axis of the horizontal image block and close to the central axis are recorded as first-category pixels. For a first-category pixel, it is assumed that the position of the first-category pixel is Line Column, the weight calculation expression of the enhanced graph during fusion is:

[0022] ;

[0023] In the formula, represents the weight of the enhancement map corresponding to the first type of pixel, represents the maximum value function; represents an exponential function with base e, Represents the gradient of the first type of pixel in the horizontal enhancement image, represents the gradient of the first type of pixel in the enhanced image, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result.

[0024] The area on the central axis of the horizontal image block or on both sides of the central axis of the horizontal image block and close to the central axis is an area with a relatively serious horizontal blocking effect. When performing image fusion, a horizontal enhancement map without horizontal blocking effect should be referred to. For the lateral enhancement diagram Line The gradient of the pixel points in the column is the same as the enhancement map Line The difference in gradients of pixel points in a column. When the value is larger, it means that the block effect of the enhancement image here is more serious, so the weight of the enhancement image is made smaller during image fusion, thereby weakening the block effect part of the enhancement image through larger horizontal enhancement image weight and vertical enhancement image weight. When the value is smaller, it means that the block effect of the enhancement image in this area is lighter, so the weight of the enhancement image is greater during image fusion, thereby retaining the image enhancement effect.

[0025] In one embodiment, for the first type of pixel points, the weight of the enhancement map is modified before fusion. Assuming that the position of a first type of pixel point is Line The weight calculation expression of the modified enhancement graph is:

[0026] ;

[0027] In the formula, represents the weight of the modified enhancement map corresponding to the first type of pixel, Represents the gradient of the pixel below the first type of pixel in the enhanced image, Represents the gradient of the pixel above the first type of pixel in the enhanced image.

[0028] In order to avoid the situation where the image edge corresponding to the thin layer defect is exactly at the position corresponding to the first type of pixel point and this part is mistaken for the block effect, so that this part of the edge is weakened, the gradient size of the pixel points on the upper and lower sides of the first type of pixel point is used The weight of the enhancement map corresponding to the first type of pixel is modified. When the value is larger, it indicates that the edge here is more likely to be the edge of the thin layer image itself rather than the edge caused by the block effect, and the weight value of the enhanced image corresponding to the first type of pixel after correction is smaller, so that the edge is retained during image fusion; on the contrary, when The smaller it is, the more likely the edge here is an artifact caused by the block effect. The larger the weight of the enhanced image corresponding to the first type of pixel after correction, the greater the weight of the enhanced image when performing image fusion, thereby reducing the block effect.

[0029] In one embodiment, the pixels located on the central axis of the longitudinal image block or on both sides of the central axis of the longitudinal image block and close to the central axis are recorded as second-category pixels. For the second-category pixels located at the mth row and nth column, the weight calculation expression of the enhancement map during fusion is:

[0030] ;

[0031] In the formula, represents the weight of the enhancement map corresponding to the second type of pixel, represents the maximum value function, represents an exponential function with base e, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result. Represents the gradient of the second type of pixel in the vertical enhancement image, Represents the gradient of the second type of pixel in the enhanced image.

[0032] The area on the central axis of the vertical image block or on both sides of the central axis of the vertical image block and close to the central axis is an area with a relatively serious vertical block effect. When performing image fusion, a vertical enhancement image without vertical block effect should be referred to. It is the difference between the gradient of the pixel point in the mth row and nth column of the vertical enhancement image and the gradient of the pixel point in the mth row and nth column of the enhancement image. When the value is larger, it means that the block effect of the enhancement image at this place is more serious, so the weight of the enhancement image is made smaller when image fusion is performed, so as to weaken the block effect part of the enhancement image through larger horizontal enhancement image weight and vertical enhancement image weight. When the value is smaller, it means that the block effect of the enhancement image in this area is lighter, so the weight of the enhancement image is made larger when image fusion is performed, so as to retain the image enhancement effect.

[0033] In one embodiment, for the second type of pixel points, the weight of the enhancement map is corrected before fusion. For the second type of pixel points at the mth row and nth column, the weight calculation expression of the corrected enhancement map is:

[0034] ;

[0035] In the formula, represents the weight of the modified enhancement map corresponding to the second type of pixel, Represents the gradient of the pixel below the second type of pixel in the enhanced image, Represents the gradient of the pixel above the second type of pixel in the enhanced image.

[0036] In a second aspect, the present invention provides a thin layer detection system based on image processing, comprising a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the thin layer detection method based on image processing of the present invention is implemented.

[0037] The beneficial effect of the present invention is that the thin layer detection method based on image processing of the present invention can make the image after adaptive histogram equalization have image enhancement effect while reducing the size of the block effect area to a certain extent, thereby improving the accuracy of the thin layer plate detection result. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0039] Figure 1 The present invention schematically shows the thin layer detection method based on image processing according to an embodiment of the present invention. Figure 1 ;

[0040] Figure 2 is a schematic diagram of a thin layer plate image schematically illustrating an embodiment of the present invention;

[0041] Figure 3 is a schematic diagram schematically showing the distribution of initial image blocks acquired according to an embodiment of the present invention;

[0042] Figure 4 is a schematic diagram schematically showing the distribution of rectangular blocks according to an embodiment of the present invention;

[0043] Figure 5 is a schematic diagram schematically showing the distribution of new image blocks obtained according to an embodiment of the present invention;

[0044] Figure 6 The present invention schematically shows the thin layer detection method based on image processing according to an embodiment of the present invention. Figure 2 ;

[0045] Figure 7 is a schematic diagram of a first row of new image blocks schematically illustrating a new image segmentation result according to an embodiment of the present invention;

[0046] Figure 8 is a schematic diagram of a first column of new image blocks schematically illustrating a new image segmentation result according to an embodiment of the present invention;

[0047] Fig. 9 is a schematic diagram schematically showing the distribution of various longitudinal image blocks in an embodiment of the present invention;

[0048] Fig.10 is a schematic diagram schematically showing the distribution of various horizontal image blocks in an embodiment of the present invention;

[0049] Fig.11 It is a schematic diagram schematically showing the structure of a thin layer detection system based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0051] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0052] Example of thin layer detection method based on image processing:

[0053] like Figure 1 As shown, the thin layer detection method based on image processing of the present invention comprises:

[0054] S101, collecting a thin layer plate image, and performing initial block division on the thin layer plate image, so as to obtain initial image blocks.

[0055] In this embodiment, the collected thin layer plate image is as follows: Figure 2 shown.

[0056] In this embodiment, the thin layer plate image is divided into 64 image blocks, and in other embodiments, it can also be divided into other appropriate numbers of image blocks.

[0057] The distribution of the initial image blocks obtained is as follows Figure 3 shown.

[0058] S102, calculating the horizontal size and the vertical size, specifically: calculating the horizontal size of the new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average vertical gradient of all the initial image blocks, wherein the horizontal size is negatively correlated with the mean value of the contrast and the mean value of the average vertical gradient; calculating the vertical size of the new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average horizontal gradient of all the initial image blocks, wherein the vertical size is negatively correlated with the mean value of the contrast and the mean value of the average horizontal gradient;

[0059] Before calculating the transverse size and the longitudinal size, it is necessary to obtain the maximum longitudinal gradient and the maximum transverse gradient of the thin layer plate image, as well as the contrast, the average transverse gradient and the average longitudinal gradient of each initial image block.

[0060] The larger the mean value of the contrast of the initial image block is, the richer the details in the image are, and the smaller the block size should be, so as to better enhance the local contrast; conversely, the smaller the mean value of the contrast of the initial image block is, the fewer the details in the image are, and the larger the block size should be, so as to better reduce the blocking effect.

[0061] The larger the mean of the average longitudinal gradients of all the initial image blocks, the larger the longitudinal gradient of the entire image, and the more complex the transverse texture of the image, the smaller the transverse size of the blocks should be to better enhance the local contrast and achieve the purpose of image enhancement; conversely, the smaller the value, the smaller the longitudinal gradient of the entire image, and the simpler the transverse texture of the image, the larger the transverse size of the blocks should be to better reduce the blocking effect.

[0062] Since larger blocks contain more pixels, the statistically obtained histogram is smoother and can better represent the local features of the entire image. In this way, after histogram equalization, the distribution of pixel values ​​is more continuous, and the histogram will not show obvious discrete features and produce block effects due to too few pixels in the block; however, if the block is too large, the local details in the image will disappear and the noise will be over-enhanced. Therefore, by calculating the most appropriate size of the new image block, the quality of the enhanced image obtained after histogram equalization is higher.

[0063] S103, using rectangular blocks to cover the thin layer plate image, specifically: constructing rectangular blocks according to the longitudinal size and the transverse size, taking the upper left corner of the thin layer plate image as the starting point, and arranging the rectangular blocks to the right and bottom until the thin layer plate image is completely covered by the rectangular blocks.

[0064] After arranging the rectangular blocks, the distribution of the rectangular blocks is as follows: Figure 4 shown.

[0065] S104, performing adaptive histogram equalization on the thin layer plate image, specifically: removing rectangular blocks that only exist in a partial area of ​​the image, translating the entirety of the remaining rectangular blocks to the center of the image to obtain a new image segmentation result, and performing histogram equalization on each new image block, thereby obtaining an enhanced image of the thin layer plate image.

[0066] Since samples are not usually spotted at the edge of the TLC plate when performing TLC, the situation at the edge of the TLC plate can be ignored.

[0067] The distribution of the new image blocks is as follows Figure 5 shown.

[0068] After obtaining the enhanced image of the thin layer plate image, the defects of the thin layer plate can be detected according to the enhanced image.

[0069] The image processed by the adaptive histogram equalization method in the prior art has the defect of block effect affecting the detection of thin layer plate. The thin layer detection method based on image processing of the present invention first obtains the initial image block when performing adaptive histogram equalization on the thin layer plate image, and determines the new image block size according to the contrast and gradient of the initial image block. When determining the new image block size, the relationship between the mean value of the contrast of the initial image block and the details in the image and the relationship between the gradient of the initial image block and the texture in the image are taken into account, so that the calculated new image block size is more appropriate. Finally, the image is adaptively histogram equalized with the new image block size, so that the image after adaptive histogram equalization has the image enhancement effect while reducing the size of the block effect area to a certain extent.

[0070] It can be seen from the above embodiments that the lateral size is negatively correlated with the mean value of the contrast and the mean value of the average longitudinal gradient, and the longitudinal size is negatively correlated with the mean value of the contrast and the mean value of the average lateral gradient. In one embodiment, the calculation expression of the lateral size is:

[0071] (1)

[0072] In the formula, is the horizontal size of the new image block, is the width of the thin layer image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average longitudinal gradient of the i-th initial image block, is the maximum longitudinal gradient of the thin layer plate image, is the floor function, is the number of initial image blocks contained in the same row of the initial block result.

[0073] The calculation expression of the longitudinal dimension is:

[0074] (2)

[0075] In the formula, is the vertical size of the new image block, H is the height of the thin layer plate image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average lateral gradient of the i-th initial image block, is the maximum lateral gradient of the thin layer image, is a floor rounding function, and q is the number of initial image blocks contained in the same column of the initial block result.

[0076] is the mean value of the contrast. For the convenience of calculation, the mean value is divided by 255 to normalize the mean value of the contrast. is the average of the average longitudinal gradients of all initial image blocks, divided by the maximum longitudinal gradient of the thin layer plate image , thereby normalizing it. is the average of the average transverse gradients of all initial image blocks, divided by the maximum transverse gradient of the thin layer plate image , thereby normalizing it.

[0077] When the height and width of the image are smaller, smaller blocks should be used to enhance the local contrast more finely. When the height and width of the image are larger, larger blocks should be used to reduce the blocking effect.

[0078] like Figure 6 As shown, in one embodiment, it also includes:

[0079] S501, constructing longitudinal image blocks and transverse image blocks, specifically: dividing the thin layer plate image into longitudinal blocks and transverse blocks respectively, so as to obtain longitudinal image blocks and transverse image blocks; the width of the longitudinal image block is equal to the transverse size, and the height of the transverse image block is equal to the longitudinal size.

[0080] The straight line where the longitudinal dividing line between every two adjacent new image blocks in the first row of new image blocks of the new image segmentation result is located is taken as the central axis, the transverse size is taken as the width, and the sum of the heights of all new image blocks in each column is taken as the height to form each longitudinal image block; the straight line where the transverse dividing line between every two adjacent new image blocks in the first column of new image blocks of the new image segmentation result is taken as the central axis, the longitudinal size is taken as the height, and the sum of the widths of all new image blocks in the same row is taken as the width to form each transverse image block.

[0081] The first row of new image blocks of the new image segmentation result is as follows: Figure 7 As shown, the first column of new image blocks of the new image segmentation result is as follows Figure 8 shown.

[0082] The distribution of each vertical image block is as follows: Fig. 9 The distribution of each horizontal image block is shown as Fig.10 shown.

[0083] S502, obtaining a longitudinal enhancement map and a transverse enhancement map, specifically: performing histogram equalization on each longitudinal image block to obtain a longitudinal enhancement map; performing histogram equalization on each transverse image block to obtain a transverse enhancement map.

[0084] S503: Fusing the longitudinal enhancement map, the transverse enhancement map, and the enhancement map according to preset weights to obtain an enhanced fused map.

[0085] During fusion, for pixels at different positions, the weight of the longitudinal enhancement map can take the same value or different values, the weight of the transverse enhancement map can take the same value or different values, and the weight of the enhancement map can take the same value or different values.

[0086] Since adaptive histogram equalization will inevitably produce a small amount of artifacts at the adjacent boundaries between image blocks, resulting in a block effect, while the image within the image block does not have such artifacts. Therefore, by fusing the enhanced image with the horizontal enhanced image and the vertical enhanced image, the block effect in the enhanced image can be weakened, and the enhanced effect of the enhanced image can be retained, making the unevenness and cracks of the thin layer plate in the thin layer plate image more prominent, thereby improving the inspection effect of the thin layer.

[0087] In order to reduce the block effect of the enhanced image and avoid the horizontal enhanced image and the vertical enhanced image from bringing a new block effect to the enhanced image (that is, the enhanced image is over-fused), in one embodiment, at the same pixel position, the weight of the enhanced image is greater than or equal to 0.5, and the weights of the horizontal enhanced image and the vertical enhanced image are calculated based on the weights of the enhanced image, and the calculation expression is:

[0088] (3)

[0089] In the formula, Indicates the weight corresponding to the pixel point in the jth row and the kth column of the enhanced image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the horizontal enhancement image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the vertical enhancement image during fusion.

[0090] By making the weight of the enhancement map as small as 0.5, the enhancement map can be prevented from being over-fused.

[0091] In one embodiment, the pixels located on the central axis of the horizontal image block or on both sides of the central axis of the horizontal image block and close to the central axis are recorded as first-category pixels. For a first-category pixel, it is assumed that the position of the first-category pixel is Line Column, the weight calculation expression of the enhanced graph during fusion is:

[0092] (4)

[0093] The area on the central axis of the horizontal image block or on both sides of the central axis of the horizontal image block and close to the central axis is an area with a relatively serious horizontal blocking effect. When performing image fusion, a horizontal enhancement map without horizontal blocking effect should be referred to. For the lateral enhancement diagram Line The gradient of the pixel points in the column is the same as the enhancement map Line The difference in gradients of pixel points in a column. When the value is larger, it means that the block effect of the enhancement image here is more serious, so the weight of the enhancement image is made smaller during image fusion, thereby weakening the block effect part of the enhancement image through larger horizontal enhancement image weight and vertical enhancement image weight. When the value is smaller, it means that the block effect of the enhancement image in this area is lighter, so the weight of the enhancement image is greater during image fusion, thereby retaining the image enhancement effect.

[0094] In one embodiment, the method further includes: for the first type of pixel points, modifying the weight of the enhancement map before fusion, assuming that the position of a first type of pixel point is Line The weight calculation expression of the modified enhancement graph is:

[0095] (5)

[0096] In formula (4) to formula (5), represents the weight of the enhancement map corresponding to the first type of pixel, represents the weight of the modified enhancement map corresponding to the first type of pixel, represents an exponential function with base e, Represents the gradient of the first type of pixel in the horizontal enhancement image, represents the gradient of the first type of pixel in the enhanced image, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result. Represents the gradient of the pixel below the first type of pixel in the enhanced image, represents the gradient of the pixel above the first type of pixel in the enhanced image, Represents the maximum value function.

[0097] In order to avoid the situation where the image edge corresponding to the thin layer defect is exactly at the position corresponding to the first type of pixel point and this part is mistaken for the block effect, so that this part of the edge is weakened, the gradient size of the pixel points on the upper and lower sides of the first type of pixel point is used The weight of the enhancement map corresponding to the first type of pixel is modified. When the value is larger, it indicates that the edge here is more likely to be the edge of the thin layer image itself rather than the edge caused by the block effect, and the weight value of the enhanced image corresponding to the first type of pixel after correction is smaller, so that the edge is retained during image fusion; on the contrary, when The smaller it is, the more likely the edge here is an artifact caused by the block effect. The larger the weight of the enhanced image corresponding to the first type of pixel after correction, the greater the weight of the enhanced image when performing image fusion, thereby reducing the block effect.

[0098] In one embodiment, the pixels located on the central axis of the longitudinal image block or on both sides of the central axis of the longitudinal image block and close to the central axis are recorded as second-category pixels. For the second-category pixels located at the mth row and nth column, the weight calculation expression of the enhancement map during fusion is:

[0099] (6)

[0100] The area on the central axis of the vertical image block or on both sides of the central axis of the vertical image block and close to the central axis is an area with a relatively serious vertical block effect. When performing image fusion, a vertical enhancement image without vertical block effect should be referred to. It is the difference between the gradient of the pixel point in the mth row and nth column of the vertical enhancement image and the gradient of the pixel point in the mth row and nth column of the enhancement image. When the value is larger, it means that the block effect of the enhancement image at this place is more serious, so the weight of the enhancement image is made smaller when image fusion is performed, so as to weaken the block effect part of the enhancement image through larger horizontal enhancement image weight and vertical enhancement image weight. When the value is smaller, it means that the block effect of the enhancement image in this area is lighter, so the weight of the enhancement image is made larger when image fusion is performed, so as to retain the image enhancement effect.

[0101] In one embodiment, the method further includes: for the second type of pixel points, modifying the weight of the enhancement map before fusion, and for the second type of pixel points at the mth row and nth column, the modified weight calculation expression of the enhancement map is:

[0102] (7)

[0103] In formula (6) to formula (7), represents the weight of the modified enhancement map corresponding to the second type of pixel, represents the weight of the enhancement map corresponding to the second type of pixel, represents an exponential function with base e, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result. Represents the gradient of the second type of pixel in the vertical enhancement image, Represents the gradient of the second type of pixel in the enhanced image, represents the maximum value function, Represents the gradient of the pixel below the second type of pixel in the enhanced image, Represents the gradient of the pixel above the second type of pixel in the enhanced image.

[0104] In order to avoid the situation where the image edge corresponding to the thin layer defect is exactly at the position corresponding to the second type of pixel point and this part is mistaken for the block effect, so that this part of the edge is weakened, the gradient size of the pixel points on the upper and lower sides of the second type of pixel point is used. The weight of the enhancement map corresponding to the second type of pixel is modified. When the value is larger, it indicates that the edge here is more likely to be the edge of the thin layer image itself rather than the edge caused by the block effect. After correction, the weight value of the enhanced image corresponding to the second type of pixel point is smaller, so that the edge is retained during image fusion. On the contrary, when The smaller it is, the more likely the edge here is an artifact caused by the block effect. After correction, the weight value of the enhanced image corresponding to the second type of pixel point is larger, thereby reducing the block effect after image fusion.

[0105] In one embodiment, the pixels in the thin layer plate image that do not belong to the first type of pixels or the second type of pixels are recorded as third type of pixels. For a certain third type of pixel, when fusion is performed, the weight calculation expression of the enhancement map is:

[0106] (8)

[0107] In the formula, represents the weight of the enhancement map corresponding to the third type of pixel, represents an exponential function with base e, Represents the gradient of the third type of pixel in the enhanced image, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result.

[0108] It can be seen from the above embodiments that when calculating the weight of the enhancement map, the weight of the horizontal enhancement map, and the weight of the vertical enhancement map, it is necessary to calculate the gradients of the pixel points in the enhancement map, the horizontal enhancement map, and the vertical enhancement map. In one embodiment, the Sobel operator or other suitable methods can be used when calculating the gradients of the pixel points in the enhancement map, the horizontal enhancement map, and the vertical enhancement map.

[0109] In one embodiment, for a pixel point at the sth row and hth column, if the following expression is satisfied, the pixel point is determined to be a first-category pixel point.

[0110] (9)

[0111] In the formula, represents the height of the thin layer plate image, represents the longitudinal dimension, To find the remainder symbol.

[0112] If the following expression is satisfied, the pixel is determined to be a second-class pixel.

[0113] (10)

[0114] Where w represents the width of the thin layer image, represents the lateral dimension, To find the remainder symbol.

[0115] Example of thin layer detection system based on image processing:

[0116] The present invention also provides a thin layer detection system based on image processing. Fig.11 As shown, the thin layer detection system based on image processing includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the thin layer detection method based on image processing according to the first aspect of the present invention is implemented.

[0117] The thin layer detection system based on image processing also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, whose configuration and functions are known in the art and thus will not be described in detail here.

[0118] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.

[0119] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0120] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A thin layer detection method based on image processing, It is characterized in that include: Acquiring a thin layer plate image, and performing initial block division on the thin layer plate image, thereby obtaining an initial image block; Calculating the horizontal size of the new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average longitudinal gradient of all the initial image blocks, wherein the horizontal size is negatively correlated with the mean value of the contrast and the mean value of the average longitudinal gradient; Calculating the vertical size of the new image block according to the mean value of the contrast of all the initial image blocks and the mean value of the average transverse gradient of all the initial image blocks, wherein the vertical size is negatively correlated with the mean value of the contrast and the mean value of the average transverse gradient; Constructing rectangular blocks according to the longitudinal size and the transverse size, taking the upper left corner of the thin layer plate image as a starting point, and arranging the rectangular blocks to the right and bottom until the thin layer plate image is completely covered by the rectangular blocks; Rectangular blocks with only partial areas of the image are removed, and the entirety of the remaining rectangular blocks is translated to the center of the image to obtain a new image segmentation result, and each new image block is subjected to histogram equalization to obtain an enhanced image of the thin layer plate image; The calculation expression of the lateral dimension is: ; In the formula, is the horizontal size of the new image block, is the width of the thin layer image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average longitudinal gradient of the i-th initial image block, is the maximum longitudinal gradient of the thin layer image, is the floor function, is the number of initial image blocks contained in the same row of the initial block result; The calculation expression of the longitudinal dimension is: ; In the formula, is the vertical size of the new image block, H is the height of the thin layer plate image, is the number of initial image blocks, is the local contrast of the i-th initial image block, is the average lateral gradient of the i-th initial image block, is the maximum lateral gradient of the thin layer image, is a floor rounding function, and q is the number of initial image blocks contained in the same column of the initial block result.

2. The thin layer detection method based on image processing as claimed in claim 1, It is characterized in that Also includes: Dividing the thin layer plate image into longitudinal blocks and transverse blocks respectively, thereby obtaining longitudinal image blocks and transverse image blocks; the width of the longitudinal image block is equal to the transverse size, and the height of the transverse image block is equal to the longitudinal size; Performing histogram equalization on each longitudinal image block to obtain a longitudinal enhancement map; performing histogram equalization on each transverse image block to obtain a transverse enhancement map; The longitudinal enhancement map, the transverse enhancement map and the enhancement map are fused according to preset weights to obtain an enhanced fusion map.

3. The thin layer detection method based on image processing as claimed in claim 2, It is characterized in that At the same pixel position, the weight of the enhancement map is greater than or equal to 0.5, and the weights of the horizontal enhancement map and the vertical enhancement map are calculated based on the weights of the enhancement map. The calculation expression is: ; In the formula, Indicates the weight corresponding to the pixel point in the jth row and the kth column of the enhanced image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the horizontal enhancement image during fusion. Indicates the weight corresponding to the pixel point in the jth row and the kth column of the vertical enhancement image during fusion.

4. The thin layer detection method based on image processing as claimed in claim 3, It is characterized in that The pixels located on the central axis of the horizontal image block or on both sides of the central axis of the horizontal image block and close to the central axis are recorded as first-category pixels. For a first-category pixel, assume that the position of the first-category pixel is Line Column, the weight calculation expression of the enhanced graph during fusion is: ; In the formula, represents the weight of the enhancement map corresponding to the first type of pixel, represents the maximum value function; represents an exponential function with base e, Represents the gradient of the first type of pixel in the horizontal enhancement image, represents the gradient of the first type of pixel in the enhanced image, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result.

5. The thin layer detection method based on image processing as claimed in claim 4, It is characterized in that For the first type of pixel points, the weight of the enhancement map is modified before fusion. Assuming that the position of a first type of pixel point is Line The weight calculation expression of the modified enhancement graph is: In the formula, represents the weight of the modified enhancement map corresponding to the first type of pixel, Represents the gradient of the pixel below the first type of pixel in the enhanced image Represents the gradient of the pixel above the first type of pixel in the enhanced image.

6. The thin layer detection method based on image processing as claimed in claim 3, It is characterized in that The pixels located on the central axis of the longitudinal image block or on both sides of the central axis of the longitudinal image block and close to the central axis are recorded as second-category pixels. For the second-category pixels located at the mth row and nth column, the weight calculation expression of the enhancement map during fusion is: ; In the formula, represents the weight of the enhancement map corresponding to the second type of pixel, represents the maximum value function, represents an exponential function with base e, Indicates the maximum gradient in the new image block where the pixel is located in the new image segmentation result. Represents the gradient of the second type of pixel in the vertical enhancement image, Represents the gradient of the second type of pixel in the enhanced image.

7. The thin layer detection method based on image processing as claimed in claim 6, It is characterized in that For the second type of pixel points, the weight of the enhancement map is corrected before fusion. For the second type of pixel point at the mth row and nth column, the weight calculation expression of the modified enhancement map is: In the formula, represents the weight of the modified enhancement map corresponding to the second type of pixel, Represents the gradient of the pixel below the second type of pixel in the enhanced image, Represents the gradient of the pixel above the second type of pixel in the enhanced image.

8. A thin layer detection system based on image processing, comprising a memory and a processor, wherein the memory stores computer program instructions, It is characterized in that When the computer program instructions are executed by the processor, the thin layer detection method based on image processing described in any one of claims 1 to 7 is implemented.