Periodic image hole filling method and system
By employing multi-scale gradient coupling and a nonlinear dynamic decay mechanism, the problem of jagged edges in periodic image hole filling is solved, achieving high-precision adaptive hole filling and improving automation and adaptability.
Patent Information
- Application Number
- CN202511555222.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-10-29
AI Technical Summary
Existing technologies tend to produce jagged edges in the transition areas when filling periodic image holes, affecting filling accuracy, and have low automation and poor adaptability.
By employing multi-scale gradient coupling and a nonlinear dynamic decay mechanism, and through smoothing of grayscale statistical curves and adjustment of weight parameters, filling data is obtained to achieve adaptive hole filling.
It improves the accuracy and automation of periodic image hole filling, avoids jagged edges, adapts to complex backgrounds, and enhances the smoothness and accuracy of filling.
Smart Images

Figure CN121033035A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of digital image processing, and particularly relates to a periodic image hole filling method and system. BACKGROUND
[0002] Image hole filling is a key technology of digital image processing, and is mainly used for repairing blank areas in binary or grayscale images caused by data loss, noise interference or acquisition restrictions. The image hole filling technology is widely used in medical image repair, industrial detection, remote sensing image processing and other fields, and the core goal is to maintain the continuity of image structure and the integrity of semantic.
[0003] At present, the methods of image hole filling mainly include morphological processing, connected domain analysis, flood fill algorithm and texture synthesis, but the above methods all have defects and deficiencies, for example, in the prior art, the morphological processing method is used for image hole filling, the closed operation is used for filling closed holes, the kernel size is relied on and the universality is poor, the parameters need to be manually adjusted, and it is difficult to balance the filling accuracy and the calculation efficiency; the connected domain analysis method is only suitable for regular holes, and the processing effect is poor for irregular holes (such as texture fracture and multi-scale holes) by interpolation or adjacent pixel filling after marking the holes; the flood fill algorithm is a method of filling holes based on region growing, and the degree of automation is low; the above three methods have a common shortcoming that they are not suitable for filling images with periodic texture. The intelligent filling based on texture synthesis, such as the contour drawing method of OpenCV (open source image processing library), has limited adaptability to complex background, especially in the edge transition area, which is easy to produce sawtooth or fuzzy effect, affecting the filling accuracy.
[0004] Therefore, the prior art needs to be further developed. SUMMARY
[0005] The present application aims to overcome the above technical deficiencies, and provides a periodic image hole filling method and system to solve the technical problem that sawteeth are generated in the edge transition area after the periodic image hole filling in the related art, affecting the filling accuracy.
[0006] To achieve the above technical purpose, the present application adopts the following technical scheme: a periodic image hole filling method is provided, comprising: pre-processing a periodic image based on a preset image processing model to obtain a hole region, a grayscale reference region and a grayscale statistical curve of the periodic image; smoothing the grayscale statistical curve to obtain a period segmentation node; obtaining filling data based on the hole region and the period segmentation node; and filling holes of the periodic image according to the filling data.
[0007] Furthermore, the method for preprocessing the periodic image includes: correcting the periodic image to obtain a standard periodic image; and performing horizontal and vertical projection on the gray values of the standard periodic image to obtain a gray-scale statistical curve, wherein the gray-scale statistical curve includes a gray-scale statistical curve in the horizontal direction and a gray-scale statistical curve in the vertical direction.
[0008] Furthermore, the method for obtaining the periodic segmentation node includes: performing dual-channel gradient detection based on the gray-scale statistical curve to obtain the gradient points of the gray-scale statistical curve; and smoothing the gray-scale statistical curve according to a weight parameter to obtain the periodic segmentation node, wherein the weight parameter is a dynamic weight parameter.
[0009] Furthermore, the dual-channel gradient detection method includes: ; The formulas above are for calculating gradients. The first formula is the commonly used gradient calculation formula, i.e., the short-time gradient. The second formula is an improved formula, i.e., the long-time gradient. The third formula is a two-channel gradient coupling calculation formula that combines the two. The design idea is to add information about the neighboring segments before and after the calculation point to maintain the gradient trend. i This is the current gray-level gradient calculation point on the statistical curve. j This is the distance from the current grayscale gradient calculation point. grad s (i) These are short-time gradient detection values. (i+j) The point is added to the current calculation point. j point, (i-j) The point is the subtraction from the current calculation point. j point, y i+j For curve points (i+j) grayscale value, y i-j For curve points (i-j) grayscale value, △x for 2*j The value of, i.e. (i+j) Click (i-j) Distance between points W The width of the standard periodic image, grad l (i) These are long-term gradient detection values. W k The normalized weight vector for the kernel. k It is some integer value between -4 and 4. (i+k) The point is added to the current calculation point. k The point of value, grad s (i+k)For the short-time gradient detection value of the point (i+k) , grad fusion For the coupled gradient detection value of the point α , is the coupling weight of the short-time gradient detection, (1-α) is the coupling weight of the long-time gradient detection.
[0010] Further, the method for obtaining the filling data comprises: obtaining a gray distribution rule; obtaining a gray reference array based on the gray reference region and the gray distribution rule; and obtaining the filling data based on the period segmentation node and the gray reference array.
[0011] Further, the gray distribution rule comprises uniform distribution of gray values and gradual distribution of gray values.
[0012] Further, the method for obtaining the filling data comprises: when the gray distribution rule is the uniform distribution of gray values, a formula for calculating the gray distribution rule is: ; The above formula is a mean value formula, the numerator uses a summation formula to calculate a gray accumulation value, and then the gray accumulation value is divided by the number of elements to obtain the mean value, wherein, p is a sequence number of an image pixel point, g h (p) is a filling value in a horizontal direction, g v (p) is a filling value in a vertical direction, N is the number of elements contained in the horizontal direction in the gray reference region, M is the number of elements contained in the vertical direction in the gray reference region, f is a specific value in 0 , N or M , g href (f) is a gray value of the point f in the horizontal direction reference gray array, g verf (f) is a gray value of the point f in the vertical direction reference gray array, f is the coordinate of the point in the hole region.
[0013] Further, the method for obtaining the filling data comprises: when the gray distribution rule is the gradual distribution of gray values, a formula for calculating the gray distribution rule is: g h (t)=gh0 ·e -μ(t-t0) ; g v (t)=g v0 ·e -μ(t-t0) ; g fill (t)=θ·g h (t)+ (1-θ)·g v (t); The above formula is the derivation formula of the filling gray value, which is fitted by the gray value of the luminance attenuation pixel, and then fused by the horizontal direction and vertical direction weight to obtain the final pixel coordinate point gray filling value, wherein, g h (t) is the filling value in the horizontal direction, g h0 The distance between the horizontal direction prediction point and the first gray point is equal to the gray value at 0 μ is the attenuation coefficient, t is the current filling point coordinate of the image, t 0 is the coordinate of the first gray point, g v (t) is the filling value in the vertical direction, g v0 is the vertical direction d equal to 0 the gray value at g fill (t) is the derived gray filling value at t θ is the g h (t) fusion weight of (1-θ) g v (t) fusion weight of
[0014] Also provided is a periodic image hole filling system, comprising: a preprocessing unit configured to preprocess a periodic image based on a preset image processing model to obtain a hole region, a gray reference region and a gray statistical curve of the periodic image; an optimization unit configured to perform smoothing processing on the gray statistical curve to obtain a period segmentation node; a calculation unit configured to obtain filling data based on the hole region and the period segmentation node; and a filling unit configured to fill holes of the periodic image according to the filling data.
[0015] Also provided is a computer readable storage medium having computer readable instructions stored thereon, the computer readable instructions being executed by a processor to implement each step of the periodic image hole filling method or the periodic image hole filling system.
[0016] Advantages: 1. The periodic image hole filling method of the present application calculates the change period of the periodic image through multi-scale gradient coupling and nonlinear dynamic attenuation mechanism, provides adaptive segmentation endpoint calculation results, avoids the influence of image noise on the period segmentation result, summarizes the gray change rule of the image in the period, combines the gray distribution rule of the context reference region on the hole region, infers the filling gray of the hole region, realizes the high-precision filling demand of the hole region with adaptive periodic distribution, and solves the technical problem that the periodic image hole filling in the prior art produces sawtooth in the edge transition area, affecting the filling precision.
[0017] 2. The periodic image hole filling method of the present application automatically calculates the change period of the periodic image based on the projection statistical method, skillfully avoids the low universality problem of manual adjustment of kernel size and preset seed point in morphological processing, and makes the filling gray more smooth through the pixel insertion method based on statistical mean, avoiding the problem of sawtooth in the transition edge. BRIEF DESCRIPTION OF DRAWINGS
[0018] Fig. 1 is a periodic image hole filling method flowchart adopted by the embodiment of the present application; Fig. 2 is a structural schematic diagram of the periodic image hole filling system adopted by the embodiment of the present application; Fig. 3 is a periodic image hole filling method flowchart adopted by the fifth embodiment of the present application; Fig. 4 is a flowchart of the method for inferring the period segmentation node adopted by the fifth embodiment of the present application; Fig. 5 is a structural diagram of the periodic image hole filling system adopted by the sixth embodiment of the present application; Fig. 6 is a schematic diagram of the filling data acquisition method adopted by the embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to enable persons skilled in the art to better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0020] According to the embodiment of the present application, a periodic image hole filling method is provided, please refer to Figs. 1 to 6 , comprising: S100, pre-processing the periodic image based on a preset image processing model to obtain a hole region, a gray reference region and a period segmentation node of the periodic image; The preset image processing model includes a hole region positioning unit, a gray reference region acquisition unit and a period segmentation node acquisition unit.
[0021] Specifically, the method for positioning the hole region by the hole region positioning unit includes threshold segmentation, blob analysis processing. First, the suspected hole region is obtained by gray threshold segmentation, and then the suspected region is filtered by using the blob analysis of gray mean, size and shape, and further the hole region is obtained.
[0022] In specific practice, the method for acquiring the gray reference region by the gray reference region acquisition unit includes: collecting the context gray reference region (i.e. the upper and lower regions of the hole) of the hole region. Taking the horizontal direction as an example, the hole region is taken as the middle part, and a region larger than 5 periods is collected on both sides as the context gray reference region. However, in special cases, it is necessary to judge whether the collected region exceeds the image boundary. If the period of the region collected on one side is less than 1 period, the collection on that side is abandoned.
[0023] It should be noted that the period segmentation node of the hole region and the period segmentation node of the gray reference region are calculated by using the gray statistical curve of the periodic image respectively, and the period segmentation node of the hole region and the period segmentation node of the gray reference region are a set.
[0024] It should be noted that the periodic image is an image with periodic distribution of light and shade in horizontal and vertical directions, so in a single direction, the gray value distribution is similar to a sine curve, the only difference is that the periodic image mentioned in the present application does not have a standard periodicity, and the period length is different in distribution, so the periodic segmentation node method mentioned in the present application is required, and a fixed period segmentation value cannot be used.
[0025] In the periodic image hole filling method of the present embodiment, the method for obtaining the periodic segmentation node by the periodic segmentation node acquisition unit comprises: S110 corrects the periodic image to obtain a standard periodic image; Embodiment one: In the panel detection industry, products are pre-aligned with carriers to ensure that the products are horizontal images in the camera field of view as much as possible, but due to alignment errors, the image source may be slightly rotated, so that the obtained periodic image is not a standard horizontal image, and therefore the edge of the product in the periodic image needs to be extracted first, a straight line is fitted, the direction of the periodic image is corrected, a standard periodic image is obtained, and the statistical error in the subsequent process is reduced.
[0026] S120 performs horizontal projection and vertical projection on the gray value of the standard periodic image to obtain a gray statistical curve, wherein the gray statistical curve includes a horizontal gray statistical curve and a vertical gray statistical curve; In specific practice, the gray value of the product ROI (region of interest, i.e. target area to be processed) image needs to be projected horizontally and vertically, wherein the horizontal projection is to establish a pixel distribution axis of the X direction of the coordinate system with the width of the ROI image, and to take the Y axis of the coordinate system as the statistical axis of the pixel gray value, i.e. taking b point on the X axis as an example, superimposing all pixel gray values of column b of the ROI image as Y value of b point, and then forming a gray statistical curve y H on the horizontal direction. V .
[0027] Specifically, the formula of the gray statistical curve is as follows: ; wherein Y b is the Y axis statistical value of b point on the X axis, (b, a) is the pixel coordinate of the image, h is the height of the ROI image, gray(b, a) is the gray value of the (b, a) coordinate point on the ROI image, y H is the statistical curve on the horizontal direction, and y V is the statistical curve on the vertical direction, which is a curve of the sine function sin(cx+φ) with a certain periodicity. φ(x)These represent amplitude values of varying degrees caused by factors such as noise or grayscale fluctuations.
[0028] S200 smooths the grayscale statistical curve to obtain periodic segmentation nodes; In the periodic image hole filling method of this embodiment, the method for obtaining periodic segmentation nodes includes: S210 performs dual-channel gradient detection based on grayscale statistical curves to obtain the gradient points of the grayscale statistical curves; Specifically, the dual-channel gradient detection method includes: ; The formulas above are for calculating gradients. The first formula is the commonly used gradient calculation formula, i.e., the short-time gradient; the second formula is an improved formula, i.e., the long-time gradient; and the third formula is a dual-channel gradient coupling calculation formula, designed to incorporate information about the neighboring segments before and after the calculation point to maintain the gradient trend. i This is the current gray-level gradient calculation point on the statistical curve. j This is the distance from the current grayscale gradient calculation point. grad s (i) These are short-time gradient detection values. (i+j) The point is the number of points added after the current calculation point. j point, (i-j) The point is the subtraction from the current calculation point. j point, y i+j For curve points (i+j) grayscale value, y i-j For curve points (i-j) grayscale value, △x for 2*j The value of, i.e. (i+j) Click (i-j) Distance between points W The width of the standard periodic image, grad l (i) These are long-term gradient detection values. W k The normalized weight vector for the kernel. k It is some integer value between -4 and 4. (i+k) The point is added to the current calculation point. k The point of value, grad s (i+k) For point (i+k) The short-time gradient detection value, grad fusion The gradient detection value after coupling. α These are the coupling weights for short-time gradient detection.(1-α) is a coupling weight of long-time gradient detection.
[0029] It should be noted that in the periodic image hole filling method of the embodiment, a multi-scale gradient coupling mechanism is introduced, wherein the multi-scale gradient coupling refers to using a double-channel gradient detection curve gradient point, and a single gradient detection method usually needs to set a suitable filter parameter to avoid incomplete removal of image noise or excessive filtering, resulting in loss of too much original real data. The double-channel gradient detection includes short-time gradient detection and long-time gradient detection. The short-time gradient detection is a discrete data derivation, that is, the difference between the values before and after the current point is divided by the distance value between the two points before and after the current point, which is used to capture instantaneous changes, filter image noise, and avoid losing too much original real data. However, it is sensitive to image high-frequency noise and easy to produce pseudo fluctuation signals. The long-time gradient detection is a kind of windowed calculation of weighted convolution, such as establishing a Gaussian kernel, which performs long-time gradient detection on the short-time gradient detection by using the Gaussian kernel, and normalizes the Gaussian kernel to weight each short-time gradient detection. This method is sensitive to image high-frequency noise and can remove the influence of image high-frequency noise while retaining the trend characteristics of the data. Finally, the short-time gradient detection and the long-time gradient detection are coupled to realize the complementarity of double-scale gradient detection, which can filter high-frequency interference and maintain edge sharpness, balances sensitivity and stability, and shows stronger generalization ability in complex image noise environment.
[0030] S220 smoothes the gray scale statistical curve according to a weight parameter to obtain the periodic segmentation node, wherein the weight parameter is a dynamic weight parameter.
[0031] Specifically, the nonlinear dynamic attenuation mechanism is to dynamically adjust the weight of the current smoothing according to the gradient information, that is, in the low gradient area, the weight is dynamically adjusted to a larger weight to maintain a larger smoothing force, thereby filtering the influence of image noise; in the high gradient area, the weight is dynamically adjusted to a smaller weight, the smoothing force is small, and the curve trend change characteristics are retained, and the smoothing weight value of each point can be dynamically solved.
[0032] It should be noted that the principle of the nonlinear dynamic attenuation mechanism is specifically as follows: ; The design idea is to use β The parameter value changes according to the change of the gradient value of different points, and the value in the formula is set by experience, so that W i The weight value is dynamically adjusted with the change of the gradient value. Among them, i and the meaning of i in S210 in Embodiment One is the same, which is a coordinate point on the statistical curve, W i i Smooth weight value of the point, β Control weight drop rate, the greater the value, the more sensitive to gradient change, |grad fusion | Indicates the first i Gradient absolute value of the point, used to quantify the strength of statistical value change, τ Is a preset gradient threshold value (empirical value is usually 1.5-2 times the standard deviation of the gradient), μ g Is the average value of the gradient detection value, N Is the number of gradient detection values, σ g Is the standard deviation of the gradient detection value.
[0033] Finally, the statistical curve is smoothed in real time according to the dynamic weight parameter, the sawtooth mutation in the curve is eliminated, the pseudo-undulation point caused by pixel gray jump or image noise when the curve is derived is solved, and the problem of error in cycle endpoint segmentation is solved.
[0034] Specifically, the formula for curve smoothing is: ; Wherein, i And the meaning of S210 in example one i The same, is a certain coordinate point on the statistical curve, f Is an integer value between -2 and 2, y s (i) Is the statistical curve i The value after point smoothing, C f Is the weight coefficient.
[0035] S300 obtains filling data based on the hole region and the cycle segmentation node; In the periodic image hole filling method of the embodiment, the method for obtaining filling data includes: S310 obtains the gray distribution rule; S320 obtains a gray reference array based on the gray reference region and the gray distribution rule in the gray reference region; wherein, the gray distribution rule includes uniform distribution of gray value and gradual distribution of gray value.
[0036] It should be noted that the method for obtaining the gray distribution rule includes: taking the cycle segmentation node of the gray reference region and the cycle segmentation node of the hole region as the starting and ending endpoints of the gray distribution rule.
[0037] Specifically, if the average gray value of the context gray reference area of the collected hole region is similar, it is considered that the overall distribution of the gray value of the image filling region (i.e. the hole region) and the reference region is relatively uniform; if the average gray value of the context gray reference area of the collected hole region is not similar, it is considered that the overall distribution of the gray value of the image filling region and the reference region exists a gradual change.
[0038] Embodiment two: The method for obtaining the gray reference array in this embodiment includes: Taking the period segmentation node of the gray reference region as the starting point, the gray value of the reference point corresponding to the to-be-filled point in the hole region in the context gray reference region is obtained respectively to form the gray reference array, and then the gray value to be filled in the period point in the hole is inferred, and the filling coordinates of the hole are looped until the filling is completed.
[0039] S330 obtains the filling data based on the period segmentation node and the gray reference array.
[0040] Embodiment three: In the periodic image hole filling method of this embodiment, the gray value is uniformly distributed, and the method for obtaining the filling data includes: ; The above formula is a mean value formula, the numerator is calculated by using a summation formula to calculate the gray value, and then divided by the number of elements to obtain the mean value. Wherein, p is the sequence number of the image pixel point, g h (p) is the filling value in the horizontal direction, g v (p) is the filling value in the vertical direction, N is the number of elements contained in the horizontal direction in the gray reference region, M is the number of elements contained in the vertical direction in the gray reference region, f is from 0, N or M a specific value in the middle, g href (f) is the gray value of the point in the horizontal direction reference gray array, f g verf (f) is the gray value of the point in the vertical direction reference gray array, f f the point is the coordinate of the hole region.
[0041] Embodiment four: In the periodic image hole filling method of the embodiment, the gray scale distribution rule is a gradual distribution of gray scale values, wherein the method for obtaining the filling data comprises: g h (t)=g h0 ·e -μ(t-t0) ; g v (t)=g v0 ·e -μ(t-t0) ; g fill (t)=θ·g h (t)+ (1-θ)·g v (t); The above formula is a derivation formula for filling the gray scale value, which is fitted from the gray scale value of the luminance decay pixel, and then fused by the horizontal direction and vertical direction weight to obtain the final pixel coordinate point gray scale filling value. Wherein, g h (t) is the filling value in the horizontal direction, g h0 is the gray scale value at the position where the distance between the horizontal direction prediction point and the first gray scale point is equal to 0, μ is the decay coefficient, t is the current filling point coordinate of the image, t 0 is the coordinate of the first gray scale point, g v (t) is the filling value in the vertical direction, g v0 is the gray scale value at the position where the vertical direction d is equal to 0, g fill (t) is the derived gray scale filling value at t , θ is the derived gray scale filling value at g h (t) is the fusion weight of (1-θ) , g v (t) is the fusion weight of
[0042] Embodiment five: Referring to Fig. 3 , the embodiment provides a periodic image hole filling method, comprising the following steps: ①Receive image input start.
[0043] ②Image horizontal direction correction and ROI image interception.
[0044] ③Collect context gray reference area of hole position on ROI image.
[0045] ④Set default prediction direction as horizontal direction.
[0046] ⑤Calculate prediction period segmentation node, see Fig. 4 The method for predicting the period segmentation node comprises: I. Set the projection direction as the horizontal direction.
[0047] II. Gray projection, generate gray projection curve.
[0048] III. Detect the curve gradient point using the method of double-channel multi-scale gradient detection coupling.
[0049] IV. Calculate the smoothing weight of the curve point based on the gradient point using the nonlinear adaptive method, which can dynamically adjust the weight coefficient of each point.
[0050] V. Smooth the projection statistical curve based on the smoothing weight, and eliminate the curve sawtooth and gray noise.
[0051] VI. Derive the smoothed curve, calculate the zero point, and the point with low to high gray statistical value as the period segmentation point in the horizontal direction.
[0052] VII. Judge the current projection direction, if the projection direction is the horizontal direction, return to step I, set the projection direction as the vertical direction, repeat the above steps to obtain the period segmentation point in the vertical direction, otherwise end.
[0053] ⑥Induce the gray distribution law of the context reference area, judge whether the current distribution law is gray uniform or gray gradual.
[0054] ⑦If the distribution law is gray gradual, use the gray value filled based on the fitting prediction of the gradient, if the distribution law is gray uniform, use the gray value filled based on the statistical mean prediction.
[0055] ⑧Judge the current prediction direction, if it is the horizontal direction, return to step ④, set the prediction direction as the vertical direction, otherwise end.
[0056] ⑨Weighted fusion of the prediction gray values in two directions to obtain the final filled gray value.
[0057] ⑩Judge whether all the pixels in the hole are filled, if yes, end the filling, otherwise return to step ④.
[0058] SeeFig. 2 The embodiment provides a periodic image hole filling system, and the periodic image hole filling system comprises the following: a preprocessing unit, which is used for preprocessing a periodic image based on a preset image processing model to obtain a hole region of the periodic image and an initial periodic segmentation node; an optimization unit, which is used for performing smoothing processing on the initial periodic segmentation node to obtain an optimized periodic segmentation node; a calculation unit, which is used for obtaining filling data based on the hole region and the optimized periodic segmentation node; a filling unit, which is used for filling holes of the periodic image based on the filling data.
[0059] Embodiment six: Referring to Fig. 5 The embodiment provides a periodic image hole filling system, and the periodic image hole filling system comprises the following: an image hole region extraction module, a context gray reference region acquisition module, an automatic periodic segmentation point acquisition module, a filling gray value prediction module and a cyclic hole pixel gray filling module.
[0060] In this way, when an image is received, the image hole region is first extracted, the hole position to be filled in the current image is located, the hole region actually filled needs to be expanded by a small number of pixels out of the hole contour, then the context gray reference region of the hole region is acquired, the normal pixel region around the hole to be filled is intercepted, the context is the up, down, left and right of the hole, and the reference region is generally about 5 complete periods, and the periodic segmentation point is calculated by using the automatic periodic segmentation point acquisition module, as shown in Fig. 6 Taking a row of pixels in a reference region image as an example, the periodic segmentation point divides the image into 5 periods in the diagram, and the pixel points pointed by the red arrows are the first serial number of pixels in each period, thereby forming a gray value reference set of the first to-be-filled pixel point in the period in the filling region, then the first to-be-filled gray value in the period in the hole is calculated by using the filling gray value prediction module, and the above steps are cyclically used until all the pixels in the hole are filled, so that the complete filled image can be obtained.
[0061] The embodiment provides a computer readable storage medium, and the computer readable storage medium stores computer readable instructions. When the computer readable instructions are executed by a processor, the steps of the periodic image hole filling method or the periodic image hole filling system according to any one of the above are implemented.
[0062] The embodiments of the present application can take the form of computer program products implemented on one or more storage media (including, but not limited to, magnetic storage media, CD-ROMs, optical storage media, etc.) including program code that can be executed by one or more computers. The computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information can be stored by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to: new memory such as phase change memory / Resistive Random Access Memory / Magnetic Memory / Ferroelectric Memory (PRAM / RRAM / MRAM / FeRAM), etc., static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0063] It should be noted that the terms "first", "second" and the like in the description and claims of the present application and above-described accompanying drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to include those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0064] Optionally, specific examples in the embodiments can refer to the examples described in the above-described embodiments, and the embodiments will not be described here.
[0065] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0066] In the above-described embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0067] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be considered as the protection scope of the present application.
Claims
1. A method for filling holes in a periodic image, characterized in that, include: The periodic image is preprocessed based on a preset image processing model to obtain the hole region, gray-level reference region and gray-level statistical curve of the periodic image. The grayscale statistical curve is smoothed to obtain periodic segmentation nodes; Based on the hole region and the periodic segmentation node, the filling data is obtained; The holes in the periodic image are filled according to the filling data.
2. The periodic image hole filling method according to claim 1, characterized in that, The method for preprocessing periodic images includes: The periodic image is corrected to obtain a standard periodic image; The grayscale values of the standard periodic image are projected horizontally and vertically to obtain grayscale statistical curves, wherein the grayscale statistical curves include grayscale statistical curves in the horizontal direction and grayscale statistical curves in the vertical direction.
3. The periodic image hole filling method according to claim 2, characterized in that, The method for obtaining periodic segmentation nodes includes: Dual-channel gradient detection is performed based on the gray-scale statistical curve to obtain the gradient points of the gray-scale statistical curve; The gray-scale statistical curve is smoothed according to the weight parameters to obtain the periodic segmentation nodes, wherein the weight parameters are dynamic weight parameters.
4. The periodic image hole filling method according to claim 3, characterized in that, The dual-channel gradient detection method includes: ; in, i This is the current gray-level gradient calculation point on the statistical curve. j This is the distance from the current grayscale gradient calculation point. grad s (i) These are short-time gradient detection values. (i+j) The point is the number of points added after the current calculation point. j point, (ij) The point is the subtraction from the current calculation point. j point, y i+j For curve points (i+j) grayscale value, y i-j For curve points (ij) grayscale value, △x for 2*j The value of, i.e. (i+j) Click (ij) Distance between points W The width of the standard periodic image, grad l (i) is Long-term gradient detection values, W k The normalized weight vector for the kernel. k for -4 arrive 4 Some integer value between, (i+k) The point is added to the current calculation point. k The point of value, grad s (i+ k) For point (i+k) The short-time gradient detection value, grad fusion The gradient detection value after coupling. α These are the coupling weights for short-time gradient detection. (1-α) It is the coupling weight for long-term gradient detection.
5. The periodic image hole filling method according to claim 1, characterized in that, The method for obtaining the fill data includes: Obtain the pattern of grayscale distribution; A gray-level reference array is obtained based on the gray-level reference region and the gray-level distribution pattern; The filling data is obtained based on the periodic segmentation nodes and the grayscale reference array.
6. The periodic image hole filling method according to claim 5, characterized in that, The grayscale distribution patterns include uniform grayscale value distribution and gradual grayscale value distribution.
7. The periodic image hole filling method according to claim 6, characterized in that, The method for obtaining the filling data includes: When the grayscale distribution pattern is a uniform distribution of grayscale values, the formula for calculating the grayscale distribution pattern is: ; The above formula is for calculating the mean. The numerator first uses a summation formula to calculate the cumulative grayscale value, then divides it by the number of elements to obtain the mean. p The pixel number of the image. g h (p) This is the fill value in the horizontal direction. g v (p) This is the fill value in the vertical direction. N This represents the number of elements contained in the horizontal direction within the grayscale reference area. M This represents the number of elements contained in the vertical direction within the grayscale reference area. f To start from 0, N or M A specific value in g href (f) For the horizontal reference grayscale array f The grayscale value of a dot. g verf (f) For vertical reference grayscale array f The grayscale value of a dot. f The point represents the coordinates of the hole area.
8. The periodic image hole filling method according to claim 6, characterized in that, The method for obtaining the filling data includes: When the grayscale distribution pattern is a gradual distribution of grayscale values, the formula for calculating the grayscale distribution pattern is: g h (t)= g h0 ·e -μ(t-t0) ; g v (t)= g v0 ·e -μ(t-t0) ; g fill (t)=θ·g h (t)+ ·g v (t); The above formula is the derivation formula for filling grayscale values. It is obtained by fitting the grayscale values of pixels with reduced brightness, and then fusing them using horizontal and vertical weights to obtain the final grayscale filling value of the pixel coordinates. g h (t) This is the fill value in the horizontal direction. g h0 The distance between the horizontally predicted point and the first grayscale point is equal to 0 grayscale value at that location μ The attenuation coefficient is... t The coordinates of the current fill point in the image. t 0 The coordinates of the first grayscale point. g v (t) This is the fill value in the vertical direction. g v0 Vertical direction d The gray value at position 0 is equal to the gray value at position 0. g fill (t) for t The derived grayscale fill value at that location. θ for g h (t) The fusion weight, (1-θ) for g v (t) The fusion weight.
9. A periodic image hole-filling system, characterized in that, The periodic image hole-filling system includes: The preprocessing unit preprocesses the periodic image based on a preset image processing model to obtain the hole region, grayscale reference region, and grayscale statistical curve of the periodic image. An optimization unit is used to smooth the grayscale statistical curve to obtain periodic segmentation nodes; The calculation unit is used to obtain filling data based on the hole region and the periodic segmentation node; A filling unit is used to fill the holes in the periodic image according to the filling data.
10. A computer-readable storage medium storing computer-readable instructions thereon, characterized in that, When the computer-readable instructions are executed by a processor, they implement the steps of the periodic image hole-filling method as described in any one of claims 1-8 or the periodic image hole-filling system as described in claim 9.
Citation Information
Patent Citations
Real-time visual detection and identification method for high speed rail surface defect
CN102854191A
Sea antenna detection method based on gray dynamic characteristics of adjacent video frames
CN109064479A
Quick optic disk positioning method based on area positioning and swarm intelligent search algorithm
CN112927242A
Self-adaptive threshold segmentation method and device for lung CT density increase shadow
CN114764809A
Grinding wheel abrasive particle image segmentation method based on machine vision
CN119151979A