Intelligent item distribution system based on QR code and digital verification
Through block analysis and adaptive clipLimit value adjustment, the noise and detail recognition problems in traditional image enhancement methods are solved, and the scanning and reading effect of the QR code by the intelligent item distribution system is improved, ensuring the stable distribution of the semen collection cup.
Patent Information
- Application Number
- CN202410425564.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-10
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-04-10
AI Technical Summary
When traditional histogram equalization enhances images, if the same clipLimit value is used uniformly for grayscale images, it may cause noise in some areas to be over-enhanced, and some areas are under-enhanced and cannot recognize image details, resulting in the intelligent item distribution system to two-dimensional The code scanning and reading effect is not good.
Grayscale images are collected through the image acquisition module, the edge analysis module divides into blocks and obtains the factors affected by reflection of the sub-blocks. The internal analysis module combines the pixel point grayscale values to obtain the degree of enhancement of the reflected sub-blocks. The image enhancement module adaptively generates a histogram The equalized clipLimit value enhances the reflective photon block.
Accurately identify and enhance sub-blocks affected by reflection, improve the contrast of grayscale images, improve the scanning and reading of QR codes by the smart item distribution system, and ensure the stable distribution of the semen collection cup.
Smart Images

Figure CN118261177B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image enhancement technology, and in particular to an intelligent item distribution system based on QR code and digital verification. Background Art
[0002] At present, in the field of medical examination and collection, the distribution of semen collection cups has been realized through the intelligent item distribution system. The main purpose of the system is to improve the efficiency and accuracy of distributing semen collection cups, simplify the operation process and improve the user experience. The input end of the intelligent item distribution system is realized by scanning and inputting a QR code. However, when collecting the QR code image corresponding to the semen collection cup, it is always affected by light, resulting in the presence of reflective areas in the grayscale image, which reduces the image quality of the grayscale image, and affects the scanning and reading of the QR code by the intelligent item distribution system, as well as the subsequent QR code verification and the distribution process of the semen collection cup; therefore, it is necessary to enhance the grayscale image, but when the traditional histogram equalization is used to enhance the image, if the same clipLimit value is used to enhance the grayscale image, it may cause some areas to be over-enhanced and noisy, and some areas to be under-enhanced and unable to identify image details; that is, the traditional use of histogram equalization to enhance the image is not effective. Summary of the invention
[0003] The present invention provides an intelligent article distribution system based on two-dimensional code and digital verification to solve the existing problem that the traditional method of enhancing images by using histogram equalization has poor effect.
[0004] The intelligent item distribution system based on QR code and digital verification of the present invention adopts the following technical solutions:
[0005] Includes the following modules:
[0006] An image acquisition module, used for acquiring grayscale images;
[0007] The edge analysis module is used to divide the grayscale image into blocks according to the connected domain in the grayscale image to obtain a plurality of sub-blocks; obtain a first factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block; obtain a second factor of the sub-block affected by reflection according to the gradient value of the edge pixels in the sub-block; obtain the degree of the sub-block affected by reflection according to the first factor of the sub-block affected by reflection and the second factor of the sub-block affected by reflection; obtain a reflective sub-block according to the degree of the sub-block affected by reflection;
[0008] An internal analysis module is used to obtain the degree to which the anti-photon block needs to be enhanced according to the grayscale value of the pixel in the anti-photon block and the degree to which the anti-photon block is affected by the reflection;
[0009] The image enhancement module is used to generate a clipLimit value for histogram equalization of the anti-photon block according to the degree to which the anti-photon block needs to be enhanced; and enhance the anti-photon block according to the clipLimit value for histogram equalization of the anti-photon block to obtain an enhanced result of the anti-photon block.
[0010] Preferably, the grayscale image is divided into blocks according to the connected domains in the grayscale image to obtain a plurality of sub-blocks, including the specific method of:
[0011] The grayscale image is subjected to Otsu threshold segmentation to obtain the segmentation result of the grayscale image, and all connected domains in the segmentation result of the grayscale image are obtained. The square connected domain with the smallest area among all the connected domains in the segmentation result of the grayscale image is recorded as the reference connected domain; then the grayscale image is equally divided into a number of sub-blocks with the same size as the reference connected domain to obtain a number of sub-blocks.
[0012] Preferably, the obtaining of the first factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block includes the following specific methods:
[0013] Use the Sobel operator to perform edge detection on all sub-blocks, obtain the edge pixels in all sub-blocks, and record the gradient values of all edge pixels in the sub-blocks; for any sub-block, classify the edge pixels adjacent to the eight neighborhoods in the sub-block as the same edge line, and obtain all edge lines in the sub-block; take the lower left corner of the grayscale image as the coordinate origin, take the horizontal right direction as the horizontal axis direction, the vertical upward direction as the vertical axis direction, and take the side length of the sub-block as the unit length, construct a coordinate system and place the sub-block into the coordinate system;
[0014] For any sub-block, first obtain all edge lines in the sub-block, and obtain the first factor of the sub-block affected by reflection according to the positions of all edge pixels on all edge lines in the sub-block in the coordinate system. The specific calculation formula is:
[0015]
[0016] Where S1 represents the first factor of the sub-block affected by reflection; m represents the number of edge lines in the sub-block; n i represents the number of edge pixels on the i-th edge line in the sub-block; k i,j+1 represents the slope of the j+1th edge pixel on the i-th edge line in the sub-block in the coordinate system; k i,j It represents the slope of the jth edge pixel on the i-th edge line in the sub-block in the coordinate system; exp{} represents an exponential function with a natural constant as the base; MOD[] represents a function to take the decimal part; arctan() represents an inverse tangent function; || represents an absolute value operation.
[0017] Preferably, the second factor of the sub-block affected by reflection is obtained according to the gradient value of the edge pixel points in the sub-block, and the specific method includes:
[0018] For any sub-block, the gradient values of all edge pixels on all edge lines in the sub-block are used to obtain the second factor of the sub-block affected by reflection. The specific calculation formula is:
[0019]
[0020] Where S2 represents the second factor of the sub-block affected by reflection; g i,j+1 represents the gradient value of the j+1th edge pixel on the i-th edge line in the sub-block; g i,j Represents the gradient value of the jth edge pixel on the i-th edge line in the sub-block; It represents the mean of the absolute values of the gradient differences between all adjacent edge pixels on the i-th edge line in the sub-block; norm{} represents the normalization function.
[0021] Preferably, the obtaining the degree to which the sub-block is affected by reflection according to the first factor of the sub-block being affected by reflection and the second factor of the sub-block being affected by reflection comprises the following specific methods:
[0022] The product of the first factor of the sub-block being affected by the reflection and the second factor of the sub-block being affected by the reflection is taken as the degree of the sub-block being affected by the reflection.
[0023] Preferably, the obtaining of the reflective sub-block according to the degree to which the sub-block is affected by the reflection comprises the following specific methods:
[0024] An influence degree threshold α is preset. For the qth sub-block, if the degree to which the qth sub-block is affected by reflection is greater than α, the qth sub-block is recorded as a reflection sub-block.
[0025] Preferably, the method of obtaining the degree to which the anti-photon block needs to be enhanced according to the grayscale value of the pixel in the anti-photon block and the degree to which the anti-photon block is affected by the reflection includes the following specific methods:
[0026] For the p-th anti-photon block, the pixels within the eight-neighborhood of each pixel in the p-th anti-photon block are used as the local pixels of each pixel in the p-th anti-photon block. According to the grayscale difference between each pixel in the p-th anti-photon block and the local pixel of each pixel in the p-th anti-photon block, combined with the degree to which the p-th anti-photon block is affected by reflection, the degree to which the p-th anti-photon block needs to be enhanced is obtained.
[0027] Preferably, the step of obtaining the degree to which the p-th photoreflective sub-block needs to be enhanced includes a specific calculation formula as follows:
[0028]
[0029] In the formula, R p Indicates the degree to which the p-th anti-photon block needs to be enhanced; S p Indicates the degree to which the p-th photoreflector block is affected by the reflection; y z represents the number of pixels in the pth anti-photon block; t p,z represents the number of local pixels of the zth pixel in the pth anti-photon block; G p,z represents the gray value of the zth pixel in the pth anti-photon block; G p,z,v represents the grayscale value of the vth local pixel of the zth pixel in the pth anti-photon block; norm() represents the normalization function; || represents the absolute value operation.
[0030] Preferably, the method for generating a clipLimit value for performing histogram equalization on the anti-photon block according to the degree to which the anti-photon block needs to be enhanced includes the following specific methods:
[0031] An initial clipLimit value is preset; for the p-th anti-photon block, the sum of the degree to which the p-th anti-photon block needs to be enhanced plus 1 is recorded as the first value, and the product of the first value and the initial clipLimit is used as the clipLimit value for histogram equalization of the p-th anti-photon block.
[0032] Preferably, the enhancing the anti-photon block according to the clipLimit value of the histogram equalization of the anti-photon block to obtain the enhanced result of the anti-photon block includes the following specific methods:
[0033] For the p-th anti-photon block, first obtain the clipLimit value for histogram equalization of the p-th anti-photon block, and then enhance the p-th anti-photon block using the histogram equalization to obtain the enhanced result of the p-th anti-photon block.
[0034] The beneficial effects of the technical solution of the present invention are as follows: the present invention uses an image acquisition module to acquire grayscale images;
[0035] The edge analysis module is used to divide the grayscale image into blocks according to the connected domain in the grayscale image to obtain a number of sub-blocks; obtain the first factor and the second factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block and the gradient value of the edge pixels; obtain the degree of the sub-block affected by reflection according to the first factor of the sub-block affected by reflection and the second factor of the sub-block affected by reflection; obtain the reflective sub-block according to the degree of the sub-block affected by reflection, and accurately identify the reflective sub-block;
[0036] Then, through the internal analysis module, the degree of enhancement required for each reflective sub-block can be obtained according to the grayscale value of the pixel in the reflective sub-block and the degree to which the reflective sub-block is affected by the reflection. Finally, the image enhancement module is used to enhance the grayscale image according to the degree to which the reflective sub-block needs to be enhanced; thereby improving the contrast results of different sub-blocks in the grayscale image, and thus enabling the intelligent item distribution system to better scan and read the QR code and the subsequent QR code verification, thereby ensuring the stable distribution of semen collection cups. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a structural block diagram of the intelligent item distribution system based on QR code and digital verification of the present invention;
[0039] Figure 2 The present invention is a flow chart for enhancing a grayscale image. DETAILED DESCRIPTION
[0040] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation method, structure, features and effects of the intelligent item distribution system based on QR code and digital verification proposed by the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0042] The specific scheme of the intelligent item distribution system based on QR code and digital verification provided by the present invention is described in detail below with reference to the accompanying drawings.
[0043] See also Figure 1 , which shows a structural block diagram of an intelligent item distribution system based on QR code and digital verification provided by an embodiment of the present invention, the system includes the following modules:
[0044] The image acquisition module 101 is used to acquire grayscale images.
[0045] It should be noted that this embodiment is a smart item distribution system based on QR code and digital verification, and its specific application scenario is to improve the efficiency and accuracy of distributing semen collection cups through the smart item distribution system. The input end of the smart item distribution system is realized by QR code scanning input, so it is necessary to first collect the QR code image corresponding to the semen collection cup, and at the same time, in order to better analyze the QR code image, it is also necessary to grayscale the QR code image.
[0046] Specifically, a camera is used to capture a two-dimensional code image corresponding to the semen collection cup; at the same time, the two-dimensional code image corresponding to the semen collection cup is gray-scaled to obtain a two-dimensional code image corresponding to the semen collection cup after gray-scale processing, which is recorded as a grayscale image.
[0047] At this point, a grayscale image is obtained.
[0048] The edge analysis module 102 is used to divide the grayscale image into blocks according to the connected domains in the grayscale image to obtain a plurality of sub-blocks; obtain a first factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block; obtain a second factor of the sub-block affected by reflection according to the gradient value of the edge pixels in the sub-block; obtain a degree of influence of reflection on the sub-block according to the first factor of the sub-block affected by reflection and the second factor of the sub-block affected by reflection; and obtain a reflective sub-block according to the degree of influence of reflection on the sub-block.
[0049] It should be noted that, since the QR code image corresponding to the semen collection cup is always affected by light when collecting it, there will be reflective areas in the grayscale image, which will reduce the image quality of the grayscale image and cause a negative impact on the scanning and reading of the QR code and the subsequent verification of the QR code and the distribution process of the semen collection cup by the smart item distribution system; therefore, it is necessary to enhance the grayscale image, but when the image is enhanced by traditional histogram equalization, if the same clipLimit value is used to enhance the grayscale image, it may cause some areas to be over-enhanced and noisy, and some areas to be under-enhanced and unable to identify image details. Therefore, this embodiment proposes an image enhancement method, which enhances the grayscale image so that the smart item distribution system can better scan and read the QR code and the subsequent verification of the QR code to ensure the stable distribution of semen collection cups.
[0050] It should be further explained that in order to improve the quality of grayscale images, this embodiment divides the grayscale image into blocks, and analyzes the specific conditions of the pixels in the blocks to adaptively adjust the clipLimit value of each block, so as to avoid over-enhancement or under-enhancement, thereby achieving the purpose of improving the quality of the QR code image.
[0051] Specifically, the grayscale image is subjected to Otsu threshold segmentation to obtain the segmentation result of the grayscale image, and all connected domains in the segmentation result of the grayscale image are obtained, and the square connected domain with the smallest area among all the connected domains in the segmentation result of the grayscale image is recorded as the reference connected domain; then the grayscale image is equally divided into a number of sub-blocks with the same size as the reference connected domain, to obtain a number of sub-blocks;
[0052] The sobel operator is used to perform edge detection on all sub-blocks to obtain edge pixels in all sub-blocks, and the gradient values of all edge pixels in the sub-blocks are recorded at the same time; for any sub-block, the edge pixels adjacent to the eight neighborhoods in the sub-block are classified as the same edge line to obtain all edge lines in the sub-block, that is, if one edge pixel is the eight-neighborhood pixel of another edge pixel, the two edge pixels are classified as the same edge line, and are continuously classified into the edge line according to the eight-neighborhood relationship, and finally a number of edge lines are obtained; the lower left corner of the grayscale image is taken as the coordinate origin, the horizontal right direction is the horizontal axis direction, the vertical upward direction is the vertical axis direction, and the side length of the sub-block is taken as the unit length, a coordinate system is constructed, and the sub-block is placed in the coordinate system; since the specific process of edge detection using the sobel operator is a well-known prior art, it will not be repeated in this embodiment.
[0053] It should be noted that since the grayscale image in this embodiment is a QR code image corresponding to the semen collection cup that has been grayscaled, the edge pixel points of the sub-blocks that are not affected by reflection in the grayscale image are only the pixel points between the black and white sub-blocks in the QR code, but the edge pixel points of the sub-blocks that are affected by reflection in the grayscale image also include the edge pixel points caused by the reflection.
[0054] It should be further explained that when the edge pixel points in the sub-block are the pixel points between the black and white sub-blocks in the QR code, the edge line formed by the edge pixel points has a stable trend, and the trend of the edge line changes only at the corners of the sub-block, and the angle of change of the edge line trend is equal to 90°, and the difference in gradient values between adjacent edge pixel points in the edge line is small; the edge line caused by reflection does not have this feature; therefore, this can be used as a basis to obtain the degree to which each sub-block is affected by reflection.
[0055] Specifically, for any sub-block, first obtain all edge lines in the sub-block, and obtain the degree of the sub-block affected by reflection according to the positions of all edge pixels on all edge lines in the sub-block in the coordinate system and the gradient values of all edge pixels on all edge lines in the sub-block. The specific calculation formula is:
[0056]
[0057]
[0058] S=S1×S2
[0059] Where S1 represents the first factor of the sub-block affected by reflection; S2 represents the second factor of the sub-block affected by reflection; S represents the degree to which the sub-block is affected by reflection; m represents the number of edge lines in the sub-block; n i represents the number of edge pixels on the i-th edge line in the sub-block; k i,j+1 represents the slope of the j+1th edge pixel on the i-th edge line in the sub-block in the coordinate system; k i,j represents the slope of the jth edge pixel on the i-th edge line in the sub-block in the coordinate system; g i,j+1 represents the gradient value of the j+1th edge pixel on the i-th edge line in the sub-block; g i,j Represents the gradient value of the jth edge pixel on the i-th edge line in the sub-block; represents the mean of the absolute values of the gradient differences between all adjacent edge pixels on the ith edge line in the sub-block; exp{} represents an exponential function with a natural constant as the base; MOD[] represents a function that takes the fractional part; arctan() represents an inverse tangent function; norm{} represents a normalization function, and the normalization object is the || represents absolute value operation; the slope calculation of the pixel point in the coordinate system is the tangent slope, which is a well-known technology and will not be repeated in this embodiment; this embodiment adopts the exp{-x} model to present the inverse proportional relationship and normalization processing, x is the input of the model, and the implementer can set the inverse proportional function and normalization function according to the actual situation.
[0060] At this point, the extent to which the sub-block is affected by the reflection is obtained.
[0061] It should be noted that S1 is the degree to which the sub-block is affected by reflection, which is obtained by the distribution trend of adjacent edge pixel points in the edge line of the sub-block in the coordinate system; S2 is the degree to which the sub-block is affected by reflection, which is obtained by the difference in gradient values between adjacent edge pixel points in the edge line; the larger the values of S1 and S2, the more likely the sub-block is to be affected by reflection, so this can be used as a basis for obtaining the character block affected by reflection.
[0062] Specifically, an influence degree threshold α is preset, and the specific value of α can be set by oneself in combination with the specific actual situation. The embodiment of this city does not make a rigid requirement, and α=0.4 is described in this embodiment; for the qth sub-block, when the degree to which the qth sub-block is affected by the reflection is less than or equal to α, the qth sub-block is recorded as a normal sub-block; if the degree to which the qth sub-block is affected by the reflection is greater than α, the qth sub-block is recorded as a reflective sub-block.
[0063] At this point, the anti-photon block is obtained.
[0064] The internal analysis module 103 is used to obtain the degree to which the photoreflective sub-block needs to be enhanced based on the grayscale value of the pixel in the photoreflective sub-block and the degree to which the photoreflective sub-block is affected by the reflection.
[0065] It should be noted that, since the present embodiment is a method of enhancing the grayscale image of the QR code to realize better scanning and reading of the QR code and subsequent QR code verification by the smart item distribution system; and the reflective area in the grayscale image is generated by the external natural environment, there is a difference in the light intensity at different positions in the reflective area in the grayscale image. Therefore, enhancing all the reflective sub-blocks with the same clipLimit value will not obtain a good enhancement result. In order to obtain a better reflective sub-block enhancement result, each reflective sub-block needs to be analyzed.
[0066] It should be further explained that since the reflective area in the grayscale image is generated by the external natural environment, the more chaotic the grayscale value in the reflective sub-block is, the higher the intensity of the impact of light on the reflective sub-block will be, and therefore the more it is necessary to enhance the reflective sub-block.
[0067] Specifically, for the p-th anti-photon block, the pixels within the eight neighborhoods of each pixel in the p-th anti-photon block are used as local pixels of each pixel in the p-th anti-photon block. According to the grayscale difference between each pixel in the p-th anti-photon block and the local pixel of each pixel in the p-th anti-photon block, combined with the degree to which the p-th anti-photon block is affected by reflection, the degree to which the p-th anti-photon block needs to be enhanced is obtained. The specific calculation formula is:
[0068]
[0069] In the formula, R p Indicates the degree to which the p-th anti-photon block needs to be enhanced; S p Indicates the degree to which the p-th photoreflector block is affected by the reflection; y z represents the number of pixels in the pth anti-photon block; t p,z represents the number of local pixels of the zth pixel in the pth anti-photon block; G p,z represents the gray value of the zth pixel in the pth anti-photon block; G p,z,v represents the gray value of the vth local pixel of the zth pixel in the pth anti-photon block; norm() represents the normalization function, and the normalization object is the gray value of all anti-photon blocks. || represents absolute value operation.
[0070] It should be noted that It represents the difference in grayscale value between each pixel in the pth anti-photon block and other pixels in the eight neighborhoods of the pixel, so The larger the value of is, the more chaotic the grayscale values of the pixels in the p-th anti-photon block are, that is, the more the p-th anti-photon block should be enhanced; S p The larger the value of is, the more likely the sub-block is to be affected by reflections. p The larger the value of , the more the p-th anti-photon block should be enhanced.
[0071] At this point, the degree to which the anti-photon block needs to be enhanced is obtained.
[0072] The image enhancement module 104 is used to generate a clipLimit value for histogram equalization of the anti-photon block according to the degree to which the anti-photon block needs to be enhanced; enhance the anti-photon block according to the clipLimit value for histogram equalization of the anti-photon block to obtain the enhancement result of the anti-photon block; and enhance all anti-photon blocks to complete the enhancement of the grayscale image.
[0073] It should be noted that after obtaining the degree to which the reflective sub-block needs to be enhanced through the internal analysis module 103, the clipLimit value for histogram equalization of the reflective sub-block can be generated according to the degree to which the reflective sub-block needs to be enhanced. The clipLimit value is a parameter in the histogram equalization algorithm to achieve enhancement of each reflective sub-block, thereby improving the image quality and enabling the smart item distribution system to better scan and read the QR code and perform subsequent QR code verification, thereby ensuring the stable distribution of semen collection cups.
[0074] Specifically, an initial clipLimit value is preset. The specific value of the initial clipLimit value can be set according to the actual situation. This embodiment does not make a rigid requirement. In this embodiment, the initial clipLimit value is described as 2. For the p-th anti-photon block, according to the degree to which the p-th anti-photon block needs to be enhanced, a clipLimit value for histogram equalization of the p-th anti-photon block is generated. The specific calculation formula is:
[0075] C p =clipLimit×(1+R p )
[0076] In the formula, C p is equal to the clipLimit value of the histogram equalization of the p-th anti-photon block; clipLimit represents the preset initial clipLimit value; R p Indicates the degree to which the p-th anti-photon block needs to be enhanced.
[0077] Get the clipLimit value for histogram equalization of all anti-photon blocks; for the p-th anti-photon block, set the clipLimit value in the histogram equalization of the p-th anti-photon block to C p, performing histogram equalization on the p-th anti-photon block to obtain an enhanced result of the p-th anti-photon block; since the specific process of histogram equalization is a well-known prior art, it will not be described in detail in this embodiment;
[0078] Similarly, all anti-photon blocks are enhanced to obtain the enhanced results of all anti-photon blocks, thus completing the enhancement of the grayscale image.
[0079] It should be noted that, in this embodiment, by enhancing the grayscale image, the intelligent item distribution system can better scan and read the QR code and perform subsequent QR code verification, thereby ensuring the stable distribution of semen collection cups.
[0080] The flowchart of this embodiment for enhancing the grayscale image is as follows: Figure 2 shown.
[0081] At this point, this embodiment is completed.
[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. Intelligent item distribution system based on QR code and digital verification, characterized by: The system includes the following modules: An image acquisition module, used for acquiring grayscale images; The edge analysis module is used to divide the grayscale image into blocks according to the connected domain in the grayscale image to obtain a plurality of sub-blocks; obtain a first factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block; obtain a second factor of the sub-block affected by reflection according to the gradient value of the edge pixels in the sub-block; obtain the degree of the sub-block affected by reflection according to the first factor of the sub-block affected by reflection and the second factor of the sub-block affected by reflection; obtain a reflective sub-block according to the degree of the sub-block affected by reflection; An internal analysis module is used to obtain the degree to which the anti-photon block needs to be enhanced according to the grayscale value of the pixel in the anti-photon block and the degree to which the anti-photon block is affected by the reflection; The image enhancement module is used to generate a clipLimit value for performing histogram equalization on the anti-photon block according to the degree to which the anti-photon block needs to be enhanced; and enhance the anti-photon block according to the clipLimit value for performing histogram equalization on the anti-photon block to obtain an enhancement result of the anti-photon block; The method of obtaining the first factor of the sub-block affected by reflection according to the distribution trend of the edge pixels in the sub-block includes the following specific methods: Use the Sobel operator to perform edge detection on all sub-blocks, obtain the edge pixels in all sub-blocks, and record the gradient values of all edge pixels in the sub-blocks; for any sub-block, classify the edge pixels adjacent to the eight neighborhoods in the sub-block as the same edge line, and obtain all edge lines in the sub-block; take the lower left corner of the grayscale image as the coordinate origin, take the horizontal right direction as the horizontal axis direction, the vertical upward direction as the vertical axis direction, and take the side length of the sub-block as the unit length, construct a coordinate system and place the sub-block into the coordinate system; For any sub-block, first obtain all edge lines in the sub-block, and obtain the first factor of the sub-block affected by reflection according to the positions of all edge pixels on all edge lines in the sub-block in the coordinate system. The specific calculation formula is: Where S1 represents the first factor of the sub-block affected by reflection; m represents the number of edge lines in the sub-block; n i represents the number of edge pixels on the i-th edge line in the sub-block; k i,j+1 represents the slope of the +1th edge pixel on the ith edge line in the sub-block in the coordinate system; k i,j represents the slope of the ith edge pixel on the ith edge line in the sub-block in the coordinate system; exp{} represents an exponential function with a natural constant as the base; MOD[] represents a function to take the decimal part; arctan() represents an inverse tangent function; || represents an absolute value operation; The method of obtaining the second factor of the sub-block affected by reflection according to the gradient value of the edge pixel point in the sub-block includes the following specific methods: For any sub-block, the gradient values of all edge pixels on all edge lines in the sub-block are used to obtain the second factor of the sub-block affected by reflection. The specific calculation formula is: Where S2 represents the second factor of the sub-block affected by reflection; g i,j+1 represents the gradient value of the j+1th edge pixel on the i-th edge line in the sub-block; g i,j Represents the gradient value of the edge pixel on the i-th edge line in the sub-block; represents the mean of the absolute values of the gradient value differences between all adjacent edge pixels on the ith edge line in the sub-block; norm{} represents a normalization function; the specific method for obtaining the degree to which the anti-photon sub-block needs to be enhanced according to the grayscale value of the pixel in the anti-photon sub-block and the degree to which the anti-photon sub-block is affected by reflection is as follows: For the p-th anti-photon block, the pixels within the eight neighborhoods of each pixel in the p-th anti-photon block are used as the local pixels of each pixel in the p-th anti-photon block, and the degree to which the p-th anti-photon block needs to be enhanced is obtained according to the grayscale difference between each pixel in the p-th anti-photon block and the local pixel of each pixel in the p-th anti-photon block, combined with the degree to which the p-th anti-photon block is affected by reflection; The method of obtaining the degree to which the anti-photon block needs to be enhanced according to the grayscale value of the pixel in the anti-photon block and the degree to which the anti-photon block is affected by the reflection includes the following specific methods: In the formula, R p Indicates the degree to which the p-th anti-photon block needs to be enhanced; S p Indicates the degree to which the p-th photoreflector block is affected by the reflection; y z represents the number of pixels in the pth anti-photon block; t p,z represents the number of local pixels of the zth pixel in the pth anti-photon block; G p,z represents the gray value of the zth pixel in the pth anti-photon block; G p,z,v represents the gray value of the vth local pixel of the zth pixel in the pth anti-photon block; norm() represents the normalization function; || represents the absolute value operation; The method for generating a clipLimit value for performing histogram equalization on the anti-photon block according to the degree to which the anti-photon block needs to be enhanced includes the following specific methods: Preset an initial clipLimit value; for the p-th anti-photon block, add 1 to the degree to which the p-th anti-photon block needs to be enhanced as the first value, and use the product of the first value and the initial clipLimit as the clipLimit value for histogram equalization of the p-th anti-photon block; The calculation formula for the clipLimit value of histogram equalization is: C p =clipLimit×(1+R p ) In the formula, C p is equal to the clipLimit value of the histogram equalization of the p-th anti-photon block; clipLimit represents the preset initial clipLimit value; R p Indicates the degree to which the p-th anti-photon block needs to be enhanced.
2. The intelligent item distribution system based on QR code and digital verification according to claim 1 is characterized in that: The grayscale image is divided into blocks according to the connected domains in the grayscale image to obtain a plurality of sub-blocks, and the specific method includes: Performing Otsu threshold segmentation on the grayscale image to obtain the segmentation result of the grayscale image, obtaining all connected domains in the segmentation result of the grayscale image, and recording the square connected domain with the smallest area among all the connected domains in the segmentation result of the grayscale image as the reference connected domain; Then the grayscale image is equally divided into a number of sub-blocks having the same size as the reference connected domain, thereby obtaining a number of sub-blocks.
3. The intelligent item distribution system based on QR code and digital verification according to claim 1 is characterized in that: The method of obtaining the degree to which the sub-block is affected by reflection according to the first factor of the sub-block being affected by reflection and the second factor of the sub-block being affected by reflection includes the following specific methods: The product of the first factor of the sub-block being affected by the reflection and the second factor of the sub-block being affected by the reflection is taken as the degree of the sub-block being affected by the reflection.
4. The intelligent item distribution system based on QR code and digital verification according to claim 1 is characterized in that: The specific method of obtaining the reflective sub-block according to the degree to which the sub-block is affected by the reflection includes: An influence degree threshold α is preset. For the qth sub-block, if the degree to which the qth sub-block is affected by reflection is greater than α, the qth sub-block is recorded as a reflection sub-block.
5. The intelligent item distribution system based on QR code and digital verification according to claim 1 is characterized in that: The method of enhancing the anti-photon block according to the clipLimit value of the histogram equalization of the anti-photon block to obtain the enhanced result of the anti-photon block includes the following specific methods: For the p-th anti-photon block, first obtain the clipLimit value for histogram equalization of the p-th anti-photon block, and then enhance the p-th anti-photon block using the histogram equalization to obtain the enhanced result of the p-th anti-photon block.
Citation Information
Patent Citations
Intelligent defect detection method for aero-engine parts based on machine vision
CN117522870A