Image generation method and system
Through multi-stage processing path refinement image boundary recovery and structure fusion, the problem of inaccurate recovery of occlusion area is solved, and image quality and details are improved, especially in complex image processing.
Patent Information
- Application Number
- CN202510562573.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, when processing complex images, especially in the restoration of occlusion areas, there is inaccurate boundary extraction and single texture and structure processing, resulting in blurred or incomplete image recovery and insufficient realism and detail performance.
By obtaining the boundary pixel positions in the occlusion area, identifying the grayscale gradient direction, calculating the angle of the direction vector, establishing a reverse extension path, extracting the grayscale value change sequence, filtering the jump amplitude, dividing texture sub-blocks, analyzing the texture direction angle and phase changes, generating a distribution map of the variation region, and optimizing image structure fusion.
Accurately restore the boundaries of the occlusion area, improve image quality and detail presentation, enhance the realism and detail perception of the image, especially in occlusion and complex image processing scenarios.
Smart Images

Figure CN120495106A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics processing, and in particular to an image generation method and system. Background Art
[0002] The field of computer graphics processing encompasses image generation, image editing, 3D modeling, and animation, focusing on the creation, modification, and optimization of images and graphics through algorithms and computational methods. The application of computer graphics processing techniques is broad, ranging from basic image processing to complex graphics rendering and the construction of virtual reality environments. Core areas include image analysis, image reconstruction, visual enhancement, and the design of interactive graphical interfaces, all aimed at improving the quality and interactivity of graphical displays.
[0003] The image generation method refers to a technical means of automatically creating images based on given data or parameters using computer technology. The patent subject matter focuses on generating or improving images through specific algorithmic processes, such as learning and application based on convolutional neural network models. Technical matters range from acquiring original images, identifying and extracting entity contours, to image synthesis and optimization. The specific method includes using convolutional neural networks to identify and process entity contours in images, and generating a high-quality fused image based on the contours and the original image, so that the entity can be visualized even when it is obscured.
[0004] Existing technologies have certain limitations when processing complex images, especially in the recovery of occluded areas. Existing technologies often rely on rough boundary extraction or simple edge detection methods, and the processing effect of occluded areas in the image is poor. Due to the failure to effectively consider the detailed correlation between grayscale gradients and direction vectors, the image restoration process lacks accuracy, and the reconstruction of occluded areas appears blurry or incomplete. Existing technologies have a relatively simple processing of texture and structure, and are unable to perform in-depth analysis and optimization at the detail level, resulting in distortion or misalignment of the overall texture of the image. In scenes where people or objects are partially occluded, traditional methods find it difficult to achieve perfect filling of occluded areas, and the realism and detail performance of the image are significantly affected. Summary of the Invention
[0005] In order to solve the problem that the existing technology has poor processing effect of occluded areas in images, fails to effectively consider the detailed correlation between grayscale gradients and direction vectors, resulting in a lack of accuracy in the image restoration process and the reconstruction of occluded areas appears blurred or incomplete. The existing technology has a relatively simple processing of texture and structure, and is unable to perform in-depth analysis and optimization at the detail level, resulting in distortion or dislocation of the overall texture of the image. In scenes where people or objects are partially occluded, traditional methods are difficult to achieve perfect filling of the occluded areas, and the realism and detail performance of the image are significantly affected. The embodiment of the present invention provides an image generation method and system. The technical solution is as follows:
[0006] In one aspect, a method for generating an image is provided, the method comprising:
[0007] S1: Obtain the position of identifiable boundary pixels in the occluded area, identify the edge grayscale gradient direction of the pixel point, calculate the main direction vector of each pixel point in the pixel point set, extract the angle value between the direction vector pairs, establish a reverse extension path, and obtain the reverse extension path of the occluded area boundary;
[0008] S2: Based on the reverse extension path of the occluded area boundary, extract the grayscale value change sequence of the pixel points in the reverse extension trajectory path by path, screen the continuous segments of the grayscale jump amplitude, and combine the angle value of the direction vector of each point with the starting point of the original vector to determine whether the angle reaches the boundary drift limit, thereby obtaining the occluded area boundary recovery node set;
[0009] S3: Using the occlusion area boundary recovery node set, the image contour area is divided into multiple texture sub-blocks, the texture direction angle and phase change amplitude of each sub-block are analyzed, the main direction angle difference and phase mutation amplitude between adjacent sub-blocks are determined, and the path points where the phase change is concentrated are marked to obtain the texture cracking boundary trajectory;
[0010] S4: using the texture cracking boundary trajectory, extracting the brightness gradient value, edge mutation frequency and texture direction vector difference of the pixels in the path coverage area, and dividing the level of the variation area to obtain the variation area distribution map.
[0011] As a further solution of the present invention, the reverse extension path of the occlusion area boundary includes a set of boundary pixel points, grayscale gradient direction, a set of grayscale gradient exceeding pixel points, a main direction vector, a direction vector angle value, and a reverse extension path; the occlusion area boundary recovery node set includes a grayscale value change sequence, a grayscale deviation value, a continuous segment of grayscale jump amplitude, a direction vector angle, a boundary drift limit, a jump amplitude offset and a direction angle position point within the reverse extension trajectory; the texture cracking boundary trajectory includes texture sub-blocks, texture direction angles, phase change amplitudes, main direction angle differences between adjacent sub-blocks, phase mutation amplitudes, and path points.
[0012] As a further solution of the present invention, the step of obtaining the reverse extension path of the occlusion area boundary is specifically as follows:
[0013] S101: Obtain the positions of identifiable boundary pixels within the occlusion area, identify the grayscale gradient direction values of the pixels within the boundary range of the area, and refer to the comparison relationship between the grayscale gradient direction values and the gradient change rates of adjacent pixels to screen out a set of pixels whose grayscale gradient change rates exceed the boundary identification reference value to generate a set of boundary variant pixels;
[0014] S102: Based on the grayscale gradient direction values of the pixels in the boundary variation pixel set, a continuous pixel sequence is called, and by performing a cosine value comparison on the direction vectors of two adjacent pixels, the main direction vector corresponding to each pixel direction vector is extracted, a direction structure in two-dimensional coordinates is established, and a main vector angle sequence is obtained;
[0015] S103: Based on the main vector angle sequence, continuously changing direction segments in the angle value sequence are screened, and corresponding positions of the direction reversal are identified through sequential comparison. The direction position information and the spatial coordinate position of the boundary strong variation pixel set are called to construct a connection segment to obtain the reverse extension path of the occluded area boundary.
[0016] As a further solution of the present invention, the step of obtaining the occlusion region boundary recovery node set is specifically as follows:
[0017] S201: Extending the path in reverse based on the boundary of the occluded area, extracting the grayscale values of consecutive pixels in the path path by path, arranging them in order to construct a grayscale value change sequence for each path, calling the sequence position index of the pixel points in the path, calculating the grayscale value difference between two adjacent points, and obtaining a continuous grayscale deviation sequence;
[0018] The formula for calculating the grayscale value difference between two adjacent points is:
[0019]
[0020] Among them, ΔG i Represents the grayscale difference between adjacent pixels in the i-th path, G i Represents the gray value of the i-th pixel, G i+1 Represents the grayscale value of the i+1th pixel, G j represents the gray value of the jth pixel, n represents the total number of pixels in the path, G k Represents the grayscale value of the k-th pixel, represents the average grayscale value within the path, i represents the path point index, and j represents the index of the cumulative deviation;
[0021] S202: Based on the difference between each deviation value in the continuous grayscale deviation sequence and the two deviation values before and after it, screen continuous pixel segments whose deviation value change rate is greater than the grayscale jump amplitude threshold, call the path coordinate index at the corresponding sequence position, extract the start and end coordinate points in the path, and generate a jump continuous segment coordinate set;
[0022] S203: Calling the coordinates of each pixel point in the jump continuous segment coordinate set and the coordinates of the starting point position of the corresponding path, identifying the direction vector through the spatial coordinate difference, combining the original direction vector value in the reverse extension path of the occlusion area boundary, calculating the angle value between the two point by point, and obtaining a direction angle value sequence;
[0023] S204: According to the direction angle value sequence, for each pixel point in the jump continuous segment coordinate set, determine whether the corresponding angle value in the direction angle value sequence is greater than the boundary drift limit threshold, and at the same time match whether the corresponding grayscale deviation value in the continuous grayscale deviation sequence is greater than the jump amplitude threshold, select the position points that meet the dual conditions as interruption nodes, and obtain the occlusion area boundary recovery node set.
[0024] As a further solution of the present invention, the step of obtaining the texture cracking boundary trajectory is specifically as follows:
[0025] S301: Recovering the coordinate position of the node set based on the boundary of the occluded area, dividing the image contour area into a plurality of independent sub-areas with the lines between the nodes as boundaries, extracting the grayscale value sequence of the pixel points in the sub-area, and identifying the main direction angle and phase change interval of the grayscale gradient in the sub-block by referring to the relationship between the two-dimensional coordinate position and the grayscale distribution, and generating a texture direction phase parameter set;
[0026] S302: Based on the main direction angle and phase change interval of the texture sub-block in the texture direction phase parameter set, two spatially adjacent sub-blocks are called, and a joint judgment is performed based on the main direction angle difference and the difference between the corresponding phase change intervals. Sub-block combinations whose main direction angle difference exceeds the angle difference threshold and whose phase change interval difference exceeds the mutation amplitude threshold are selected to obtain a main direction difference sub-block pair set;
[0027] S303: Based on the pixel coordinates on the sub-block boundary path in the main direction difference sub-block pair set, mark the pixel positions in the corresponding path whose phase change frequency exceeds the path mean frequency, call the continuous arrangement positions of the similar pixel points in the spatial coordinates, construct a pixel trajectory sequence, and obtain the texture cracking boundary trajectory.
[0028] As a further solution of the present invention, the step of obtaining the variation region distribution map is specifically as follows:
[0029] S401: Based on the texture cracking boundary trajectory, referring to the grayscale value distribution of pixels in the path coverage area, a grayscale difference sequence between each pixel and its adjacent pixels is obtained, and a corresponding gradient direction sequence is established according to the pixel coordinate position. After normalizing the pixel grayscale difference and direction sequence, the brightness change amplitude between pixels in adjacent directions is identified to generate an image brightness gradient value;
[0030] S402: Calling the image brightness gradient value, combining it with the continuous distribution sequence of the grayscale change rate of each group of pixels in the path coverage area, detecting the number of grayscale jumps for each pair of adjacent pixels, and counting the number of jumps generated per unit pixel spacing to obtain the edge mutation frequency;
[0031] S403: According to the edge mutation frequency, the texture direction vectors of the pixels in the path coverage area are extracted, and the direction vector difference sequence between the pixels is calculated. The difference sequence, the brightness gradient value and the mutation frequency value are combined according to the pixel number, and the difference distribution intensity of the three joint values between the pixels is compared. The difference degree between the pixels is divided into intervals to generate a variation area distribution map.
[0032] As a further solution of the present invention, the formula for identifying the brightness variation amplitude of the pixel in adjacent directions is:
[0033]
[0034] in, Represents the brightness gradient value of the image at position (a, b), I a,b Represents the grayscale value of the pixel at position (a, b), I a+1,b Represents the grayscale value of the pixel at position (a+1,b), I a,b+1 Represents the grayscale value of the pixel at position (a, b+1), Δx represents the change in the horizontal coordinate, Δy represents the change in the vertical coordinate, and θ represents the calculation direction of the point. Indicates the total distance the image position changes.
[0035] As a further solution of the present invention, the method further includes step S5:
[0036] S5: calculating the transition intensity change value sequence of the pixel point set in the variation region through the variation region distribution map, analyzing the direction of the structure extension path in the variation region, adjusting the pixel position based on the structure extension path, and obtaining the image structure fusion path;
[0037] The image structure fusion path includes a pixel point set in a variation region, a transition intensity change value sequence, a structure extension path, and pixel position adjustment conditions.
[0038] As a further solution of the present invention, the steps of obtaining the image structure fusion path are specifically as follows:
[0039] S501: extracting a pixel point set based on the pixel area marked as a variation level in the variation region distribution map, sequentially extracting transition intensity values between adjacent pixel points, constructing a continuous transition intensity change sequence of the variation region pixel point set, and obtaining a variation transition intensity sequence;
[0040] S502: Detecting the continuous distribution direction of the mutated pixel point set in the image based on the correspondence between the multiple change values in the mutated transition intensity sequence and the pixel space coordinates, and obtaining the structure extension path direction sequence by tracking the continuous points with the same intensity change direction;
[0041] S503: Based on the spatial arrangement structure of each direction in the direction sequence of the structural extension path, the position index value of the pixel point in the original image is adjusted, and the continuous coordinate positions in the direction sequence are offset calibrated to perform coherent splicing of the pixels to obtain the image structure fusion path.
[0042] On the other hand, the image generation system is used to perform the above-mentioned image generation method, and the system includes:
[0043] The boundary extraction module obtains the boundary pixel position and corresponding grayscale value of the occlusion area, calculates the grayscale gradient value of each pixel in the horizontal and vertical directions, determines whether the angle between the gradient direction and the boundary tangent direction exceeds the boundary recognition angle reference value, and obtains the reverse extension path of the occlusion area boundary;
[0044] The trajectory analysis module extends the path in reverse according to the boundary of the occlusion area, extracts the grayscale values of consecutive pixels on the path, calculates the grayscale difference between adjacent pixels, selects the path segments whose jump amplitude exceeds the grayscale jump amplitude reference value, and generates a node set for restoring the boundary of the occlusion area;
[0045] The node recognition module recovers the node set according to the boundary of the occluded area, divides the occluded area into multiple texture sub-blocks, extracts the main direction value and grayscale phase value of the pixel direction vector in each sub-block, calculates the direction angle difference and phase mutation amplitude between adjacent sub-blocks, filters the path points that exceed the double threshold, and generates the texture cracking boundary trajectory;
[0046] The cracking path module calls the texture cracking boundary trajectory, extracts the brightness gradient value, edge mutation frequency value and direction vector difference of the pixels within the path range, evaluates the mapping relationship between pixel pairs, classifies the pixel pairs into cracking level intervals according to the direction vector difference and offset degree in the matrix, and generates a variation area distribution map;
[0047] The structural fusion module screens pixel position points whose cracking levels are within the mutation level interval according to the variation region distribution map, obtains the pixel arrangement relationship and extracts the direction extension vector, connects the direction vectors that meet the consistency to form a continuous path, adjusts the spatial position of the path pixels, and generates an image structure fusion path.
[0048] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0049] Through a multi-stage processing path, the image's boundary restoration and structural fusion are refined, improving image quality and detail. Leveraging the grayscale gradient information of boundary pixels, the algorithm identifies changes within the boundary segment to accurately extract visualization paths within occluded regions. For the visualization path, the calculation of grayscale values and direction vectors, along with the screening of transition amplitudes, helps identify boundary restoration nodes within the image, effectively enhancing the visualization of occluded portions of the image. This process accurately calibrates the locations of breaks within the image, laying the foundation for subsequent texture fragmentation and structural fusion. By analyzing texture direction and phase changes, the image's texture regions are successfully demarcated, and the trajectory of texture fragmentation boundaries is precisely tracked. Leveraging fragmentation boundary data, the texture structure within the image is optimized, and the distribution map of the variation regions further enhances overall image quality. This allows for efficient reconstruction and fusion of image details, improving both image restoration quality and detail perception, particularly in occlusion and complex image processing scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a schematic diagram of the workflow of the present invention;
[0051] Figure 2 It is a system flow chart of the present invention. DETAILED DESCRIPTION
[0052] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0053] In the embodiments of the present invention, words such as "exemplarily" and "set" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as an "exemplary" in the present invention should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner. Furthermore, in the embodiments of the present invention, "and / or" can mean both or either of the two.
[0054] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0055] See also Figure 1, an embodiment of the present invention provides an image generation method, the processing flow of the method may include the following steps:
[0056] S1: Obtain the position of identifiable boundary pixels within the occluded area, identify the edge grayscale gradient direction of the pixel points, filter out the set of pixels whose grayscale gradient values exceed the boundary identification reference value within the continuous boundary segment, calculate the main direction vector of each pixel in the pixel set, extract the angle between the direction vector pairs, establish a reverse extension path, and obtain the reverse extension path of the occluded area boundary;
[0057] S2: Based on the reverse extension path of the occluded area boundary, the grayscale value change sequence of the pixel points in the reverse extension trajectory is extracted path by path, the grayscale continuous deviation value between each two adjacent pixels is calculated, and the continuous segments of the grayscale jump amplitude are screened. The angle value of the direction vector of each point and the starting point of the original vector is combined to determine whether the angle reaches the boundary drift limit. The position point that satisfies the jump amplitude offset and the direction angle is selected as the interruption node to obtain the occluded area boundary recovery node set;
[0058] S3: Use the occluded area boundary recovery node set to divide the image contour area into multiple texture sub-blocks, analyze the texture direction angle and phase change amplitude of each sub-block, determine the main direction angle difference and phase mutation amplitude between adjacent sub-blocks, mark the path points where the phase change is concentrated, and obtain the texture cracking boundary trajectory;
[0059] S4: Using the texture cracking boundary trajectory, the brightness gradient value, edge mutation frequency, and texture direction vector difference of the pixels in the path coverage area are extracted. Based on these three data, a transition intensity mapping matrix between pixels is constructed, and the level of the variation area is divided to obtain the variation area distribution map;
[0060] S5: Calculate the transition intensity change value sequence of the pixel point set in the variation area through the variation area distribution map, analyze the direction of the structure extension path in the variation area, adjust the pixel position based on the structure extension path, and obtain the image structure fusion path;
[0061] The reverse extension path of the occluded area boundary includes a set of boundary pixel points, grayscale gradient direction, a set of grayscale gradient exceeding pixel points, a main direction vector, a direction vector angle value, and a reverse extension path. The occluded area boundary recovery node set includes a grayscale value change sequence, a grayscale deviation value, a continuous segment of grayscale jump amplitude, a direction vector angle, a boundary drift limit, a jump amplitude offset and a direction angle position point within the reverse extension trajectory. The texture cracking boundary trajectory includes texture sub-blocks, texture direction angles, phase change amplitudes, main direction angle differences of adjacent sub-blocks, phase mutation amplitudes, and path points. The variation area distribution map includes brightness gradient values, edge mutation frequencies, texture direction vector differences, transition intensity mapping matrices, and variation area levels.
[0062] The specific steps for obtaining the reverse extension path of the occlusion area boundary are:
[0063] S101: Obtain the positions of identifiable boundary pixels within the occlusion area, identify the grayscale gradient direction values of the pixels within the boundary range of the area, and refer to the comparison relationship between the grayscale gradient direction values and the gradient change rates of adjacent pixels to screen out a set of pixels whose grayscale gradient change rates exceed the boundary identification reference value to generate a set of boundary variant pixels;
[0064] Get the current image, based on the trained convolutional neural network model, get the current entity contour corresponding to the current image, and get the position of the identifiable boundary pixels in the occluded area. First, grayscale the original image and convert it into a single-channel image for gradient extraction. In the occluded area, call the image gradient calculation tool to measure the grayscale change of each pixel. Common methods include using the image processing module to perform horizontal and vertical gradient decomposition on the image. In this process, by scanning the pixels in the area row by row and column by column, the grayscale difference between it and the upper and lower, left and right adjacent pixels is obtained, and the directional gradient information of each pixel is generated. This information is recorded in a structured array and kept corresponding to the original image position. On this basis, Execute the recognition of the grayscale gradient direction value of the pixel point, store the result in the form of angle in the pixel label after recognition, and bind it to the pixel coordinates to complete the direction vector annotation, calculate the grayscale change rate of each pixel in its 4-neighborhood or 8-neighborhood, analyze the grayscale difference in each direction, compare the pixel point with a larger change rate with the current pixel direction, calculate the direction difference of the adjacent points, and then judge whether the pixel is an area with a large boundary change. In actual operation, the boundary recognition benchmark value needs to refer to the average grayscale gradient difference of different areas in the image. By statistically analyzing the pixel gradient changes in the area, a medium to high empirical threshold can be set for screening, and a set of pixel points with a change rate exceeding the benchmark value is retained to form a boundary variation pixel set.
[0065] S102: Based on the grayscale gradient direction values of the pixels in the boundary variation pixel set, a continuous pixel sequence is called, and by performing a cosine value comparison on the direction vectors of two adjacent pixels, the main direction vector corresponding to each pixel direction vector is extracted, a direction structure in two-dimensional coordinates is established, and a main vector angle sequence is obtained;
[0066] It is necessary to extract the corresponding main direction according to the grayscale gradient direction value of each pixel in the set, and establish a sequential connection relationship between the pixels. The specific method is to traverse the pixels in the set in coordinate order, extract their direction information for each pair of adjacent pixels, and determine whether they can be regarded as a continuous sequence with the same direction by calculating the size of the direction difference. If the direction difference is within an acceptable range, they are merged into the same direction segment and the connection path is recorded. At the same time, the direction structure cache is called to uniformly mark the direction of the pixels in the segment as the main direction to generate a direction segment structure. Then, the direction segment is continuously expanded in this way to form a complete direction grouping. Through this direction comparison process, the pixels with chaotic direction distribution can be merged into an orderly direction chain. In this example, if the directions of several points in the boundary variation pixel set are close to 30°, 32°, 31°, 29°, etc., they are regarded as the same main direction segment, and a direction structure is constructed with the central direction 30° as the main direction. The pixels containing the direction segment are assigned this direction label, and the direction segments are then arranged in the original coordinate order to obtain the main vector angle sequence.
[0067] S103: Based on the main vector angle sequence, the continuously changing direction segments in the angle value sequence are screened, and the corresponding positions of the direction reversal are identified by sequential comparison. The direction position information and the spatial coordinate positions of the boundary strong variation pixel set are used to construct a connecting segment to obtain the reverse extension path of the occluded area boundary;
[0068] The sequence needs to be analyzed for continuous change trends. By judging the continuity of the direction angle, the direction reversal area caused by occlusion in the image can be effectively distinguished. In the specific operation process, the angle sequence is sequentially extracted for direction change values. For angle segments with continuous changes and monotonous directions, they are continuously marked and classified and saved. In the recognition process, if a large jump in the angle is found, and the continuous upward trend suddenly changes to a downward trend, the point pairs before and after the jump are marked as potential direction reversal points. The recognition of direction change does not rely on the specific gradient value, but is based on the reverse situation of the angle trend. The situation is judged. In actual scenarios, if an angle sequence presents 30°, 45°, and 60° and then jumps to -60°, -45°, and -30°, it means that the direction has reversed 180°. The middle turning point is recorded as the boundary turning point, and then the coordinate information of the turning point is called to match the position with the end point in the previous direction structure. A direction extension line segment is formed by interpolation or connection. The connected line segment can identify the extension path from the boundary turning point of the occluded area to the extension segment. By merging and completing such reverse extension paths, the reverse extension path of the boundary of the occluded area is obtained.
[0069] The specific steps for obtaining the occlusion area boundary recovery node set are:
[0070] S201: Extending the path in reverse based on the boundary of the occluded area, extracting the grayscale values of consecutive pixels in the path path by path, arranging them in order to construct a grayscale value change sequence for each path, calling the sequence position index of the pixel points in the path, calculating the grayscale value difference between two adjacent points, and obtaining a continuous grayscale deviation sequence;
[0071] The formula for calculating the grayscale value difference between two adjacent points is:
[0072]
[0073] Among them, ΔG i Represents the grayscale difference between adjacent pixels in the i-th path, G i Represents the gray value of the i-th pixel, G i+1 Represents the grayscale value of the i+1th pixel, G j represents the gray value of the jth pixel, n represents the total number of pixels in the path, G k Represents the grayscale value of the k-th pixel, represents the average grayscale value within the path, i represents the path point index, and j represents the index of the cumulative deviation;
[0074] Parameter meaning and formula calculation derivation process:
[0075] Parameter G i+1 and G i : represents the grayscale value of the i+1th pixel and the i-th pixel, respectively. The grayscale value is obtained by sampling each pixel in the image. In practical applications, the grayscale value can be obtained through the grayscale analysis function of the image acquisition system. It is the numerical value of the image brightness. The grayscale values of the i-th pixel and the i+1-th pixel in the image are set to 100 and 105 respectively;
[0076] Parameter n: represents the total number of pixels in the path. If there are 5 pixels in the path, n=5.
[0077] Parameter G k : represents the grayscale value of the kth pixel in the path. Taking the grayscale value in the path as an example, there are 5 pixels in the path, and the grayscale values are: G1 = 100, G2 = 102, G3 = 99, G4 = 105, G5 = 101;
[0078] parameter The average grayscale value of all pixels in the path is obtained by summing the grayscale values of all pixels in the path and dividing it by the total number of pixels.
[0079]
[0080] Parameter i: represents the index of the path point currently being calculated. When calculating the grayscale difference, each pixel will be compared with the previous pixel. Therefore, each pixel needs to be operated on in turn during the calculation process. Set the current calculation to the second pixel, i=2;
[0081] Parameter j: used to calculate the cumulative sum of the grayscale deviations of the first i pixels in the path, and calculate the grayscale deviation between each pixel and the current pixel. For the second pixel, the grayscale deviation of the previous pixel is accumulated. When j = 1, the difference between the first and second points is calculated.
[0082] Formula calculation derivation process:
[0083] Calculate the grayscale difference between the second and third pixels:
[0084] |G3-G2|=|99-102|=3;
[0085] Calculate the standard deviation of the grayscale values of all pixels in the path. The standard deviation formula is:
[0086]
[0087]
[0088] Compute the squared difference of each term:
[0089] (100-101.4) 2 =(-1.4) 2 =1.96;
[0090] (102-101.4) 2 =0.6 2 =0.36;
[0091] (99-101.4) 2 =(-2.4) 2 =5.76;
[0092] (105-101.4) 2 =3.6 2 =12.96;
[0093] (101-101.4) 2 =(-0.4) 2 =0.16;
[0094] Add the results and divide by the total:
[0095]
[0096] Calculate the cumulative deviation:
[0097]
[0098] Substituting the calculation results of each part into the original formula, we get:
[0099] ΔG2=|99-102|·2.06+(-1)=3·2.06-1=6.18-1=5.18;
[0100] The result shows that the grayscale difference between the second and third pixels in the path is 5.18, reflecting the grayscale changes of adjacent pixels.
[0101] S202: Based on the difference between each deviation value in the continuous grayscale deviation sequence and the two deviation values before and after it, a continuous pixel segment is selected whose deviation value change rate is greater than the grayscale jump amplitude threshold. The path coordinate index at the corresponding sequence position is called to extract the start and end coordinate points in the path to generate a jump continuous segment coordinate set.
[0102] It is necessary to analyze its change rate. By comparing the increase and decrease relationship between each deviation value and the two previous and next deviation values, the area segments with grayscale mutation are identified. During the operation, the continuous deviation sequence is traversed. For any deviation value, the change difference between it and the previous and next items is extracted. If the difference in a segment is continuous and the change rate is significantly higher than the set grayscale jump amplitude threshold, it is marked as a grayscale abnormal segment. The path sequence index position corresponding to the segment is extracted, and its starting point and end point on the path are recorded to generate a jump continuous segment coordinate set. The grayscale deviation of a segment is set to [3, 5, 12, 45, 43, 40], where the jump amplitude threshold is set to 15. Based on actual image processing experience, this value can be set in the range of 20 to 30 in most medium-resolution images. If it is set to 25, it is found that many values in the segment are much larger than the threshold. In this case, the path position segment containing the value can be classified as a jump segment. Its starting path coordinates, such as points 15 to 20, are extracted as the basis for subsequent spatial direction difference analysis to generate a jump continuous segment coordinate set.
[0103] S203: Calling the coordinates of each pixel point in the jump continuous segment coordinate set and the coordinates of the starting point position of the corresponding path, identifying the direction vector through the spatial coordinate difference, combining the original direction vector value in the reverse extension path of the occlusion area boundary, and calculating the angle value between the two point by point to obtain a direction angle value sequence;
[0104] The spatial coordinate relationship between the current point and the starting point of the path is combined to calculate the direction vector of the current point relative to the starting point of the path. The difference between this direction vector and the original direction vector in the path is compared to obtain the direction angle between the two. In the operation, the horizontal and vertical coordinate differences of each pixel are read to generate a pointing vector. After the direction vector is normalized, a one-to-one angle calculation is performed with the main direction recorded in the original direction of the path to form a direction angle value sequence. In a practical scenario, the starting point of the occlusion path is set to (10, 20) and a certain point in the jump segment is set to (20, 25). The relative vector is (10, 5). If the original direction vector of the path is recorded as close to the horizontal direction, it is set to (1, 0). The actual direction deviation trend can be deduced based on the direction of the coordinate difference to determine whether the direction of the point deviates from the path direction. This process is particularly critical in the path deflection segment and can be used for subsequent recovery point screening. Through this sequence, the angle offset of each point in the jump segment is modeled, and a dataset that can be used for direction offset analysis is constructed. This provides directional data support for the next interruption node judgment and obtains a direction angle value sequence.
[0105] S204: Based on the direction angle value sequence, for each pixel point in the jump continuous segment coordinate set, determine whether the corresponding angle value in the direction angle value sequence is greater than the boundary drift limit threshold, and simultaneously match whether the corresponding grayscale deviation value in the continuous grayscale deviation sequence is greater than the jump amplitude threshold. Position points that meet both conditions are selected as interruption nodes to obtain the occlusion area boundary recovery node set;
[0106] Each pixel point in the jump continuous segment coordinate set is judged, and the angle value of the point is detected in turn to see if it exceeds the preset boundary drift limit threshold, and the corresponding grayscale deviation value is matched to see if it exceeds the grayscale jump amplitude threshold. Only when both conditions are met can it be marked as an interruption node and added to the occlusion area boundary recovery node set. During execution, the setting of the boundary drift limit threshold needs to consider the actual tolerance angle difference of the image. Generally, it can be set to the range of 20° to 45° based on the overall directional structure stability of the image. The angle threshold is set to 30° and the grayscale jump threshold is set to 25. For a certain point, if the direction offset reaches 32° and the grayscale deviation is 28, the point meets the dual screening conditions and can be used as an important interruption node for path recovery. All coordinate positions in the jump segment are traversed point by point. After all data points that meet the dual conditions are screened out, their spatial coordinates are uniformly recorded to form a boundary repair information set with stable structure and accurate positioning, which is used in the completion calculation and reconstruction process of the occlusion path to obtain the occlusion area boundary recovery node set.
[0107] The specific steps for obtaining texture cracking boundary trajectory are:
[0108] S301: Recovering the coordinate positions of the node set based on the boundary of the occluded area, dividing the image contour area into multiple independent sub-areas with the lines between the nodes as boundaries, extracting the grayscale value sequence of the pixel points in the sub-area, and referring to the relationship between the two-dimensional coordinate position and the grayscale distribution, identifying the main direction angle and phase change interval of the grayscale gradient in the sub-block, and generating a texture direction phase parameter set;
[0109] The image contour area is divided, and the line between each two nodes is used as the boundary edge. The entire image occlusion area is cut into several independent sub-areas with closed boundaries according to the boundary. During the execution process, all points in the recovery node set need to be traversed and combined into several non-intersecting boundary paths according to their spatial coordinate order in the image, and the regional border is closed and constructed accordingly to form a sub-region structural framework. After the structural division is completed, enter the sub-region, extract the grayscale values of all pixels in it region by region, and record their corresponding two-dimensional coordinate positions in the image. Combined with the distribution state of the pixels in the image plane, through analysis The direction of change of the grayscale value of each pixel is used to identify the main direction angle of the grayscale gradient in the sub-region, and further calculate the phase range of its gradient change. During execution, the grayscale gradient direction can be obtained by comparing the grayscale value increase and decrease trends between adjacent pixels, and the phase change range can be identified by the change amplitude of the gradient direction in different spatial segments. It is set that most pixels in a certain area have a 45-degree gradient growth, and the angle in the edge area changes from 70 to 90 degrees. It can be considered that the main direction angle of the sub-block is 45 degrees, and the phase change range is [45°, 90°]. After binding this information with the sub-region index, a texture direction phase parameter set is generated.
[0110] S302: Based on the main direction angle and phase change interval of the texture sub-block in the texture direction phase parameter set, two spatially adjacent sub-blocks are called, and a joint judgment is performed based on the main direction angle difference and the difference between the corresponding phase change intervals. Sub-block combinations whose main direction angle difference exceeds the angle difference threshold and whose phase change interval difference exceeds the mutation amplitude threshold are selected to obtain a main direction difference sub-block pair set;
[0111] It is necessary to compare two adjacent sub-blocks in space one by one to determine whether there is a sudden change in the texture direction between them. The specific operation is to extract the main direction angle and phase change interval of the two adjacent sub-blocks, and by jointly comparing the two indicators, screen out the sub-block pairs whose main direction angle difference is greater than the set angle difference threshold and whose phase interval difference is greater than the sudden change amplitude threshold. In actual image processing, the main direction angle threshold is set between 15° and 25°, and the phase interval sudden change amplitude threshold is set between 20° and 30°. The specific value can be determined according to the image type. The type and complexity can be flexibly set. For example, in a certain image, the main direction of sub-block A is 30°, the phase interval is [20°, 40°], and the main direction of adjacent sub-block B is 80°, the phase interval is [75°, 95°]. If the main direction difference is 50° and the phase interval difference is 35°, both of which are greater than the set threshold, the pair of sub-blocks will be listed as part of the main direction difference sub-block pair set. After traversing all adjacent sub-block pairs, they are used to analyze the boundary areas in the image where the texture structure is discontinuous or changes dramatically, and the main direction difference sub-block pair set is obtained.
[0112] S303: Based on the pixel coordinates on the sub-block boundary path in the main direction difference sub-block pair set, mark the pixel positions in the corresponding path whose phase change frequency exceeds the path mean frequency, call the continuous arrangement positions of the similar pixel points in the spatial coordinates, construct a pixel trajectory sequence, and obtain the texture cracking boundary trajectory;
[0113] It is necessary to further mark the phase change frequency of the pixels on its boundary path, extract the phase change value point by point for each sub-block boundary path, and on this basis calculate the overall phase change mean frequency on the path. The pixel positions with a phase change frequency higher than the overall mean frequency of the path are marked separately as potential texture breakpoints. At the same time, in order to extract a coherent texture cracking trajectory from the breakpoints, it is also necessary to call the arrangement relationship of similar pixels in the image space to determine whether they form a relatively dense pixel sequence with consistent direction. If the conditions are met, the sequence is organized into a continuous pixel trajectory. During the execution process, it is assumed that there are a total of 50 pixels on a sub-block boundary path, and the average phase change frequency is 0.35. If the local phase frequencies of some pixels are measured to be 0.5, 0.6, 0.58, etc., and the points form a continuously distributed area on the image coordinates, such as (25, 40), (26, 40), (27, 41), (28, 42), it can be determined that the point set forms an obvious texture cracking trend, and the texture cracking boundary trajectory is obtained.
[0114] The specific steps for obtaining the variation region distribution map are as follows:
[0115] S401: Based on the texture cracking boundary trajectory, referring to the grayscale value distribution of pixels in the path coverage area, a grayscale difference sequence between each pixel and its adjacent pixels is obtained, and a corresponding gradient direction sequence is established according to the pixel coordinate position. After normalizing the pixel grayscale difference and direction sequence, the brightness change amplitude between pixels in adjacent directions is identified to generate an image brightness gradient value;
[0116] The formula for identifying the brightness change amplitude of pixels in adjacent directions is:
[0117]
[0118] in, Represents the brightness gradient value of the image at position (a, b), I a,b Represents the grayscale value of the pixel at position (a, b), I a+1,b Represents the grayscale value of the pixel at position (a+1,b), I a,b+1 Represents the grayscale value of the pixel at position (a, b+1), Δx represents the change in the horizontal coordinate, Δy represents the change in the vertical coordinate, and θ represents the calculation direction of the point. Indicates the total distance of image position change;
[0119] Parameter meaning and formula calculation derivation process:
[0120] In image processing, brightness gradient is used to describe the degree of change in pixel grayscale values in an image, reflecting the edge and texture information of the image. The above formula calculates the brightness gradient value of the image at position (a, b). The following is a detailed description of each parameter in the formula and is derived through calculation using actual data.
[0121] I a,b : Represents the grayscale value of the pixel at position (a, b) in the image. After the original image is acquired by the image acquisition device, the color image is converted into a grayscale image using grayscale processing to obtain the grayscale value of each pixel. The grayscale value is between 0 and 255, where 0 represents black and 255 represents white.
[0122] I a+1,b : Represents the grayscale value of the pixel at position (a+1,b) in the image, that is, the grayscale value of the adjacent pixels in the vertical direction;
[0123] I a,b+1 : Represents the grayscale value of the pixel at position (a, b+1) in the image, that is, the grayscale value of the adjacent pixels in the horizontal direction;
[0124] Δx: represents the change in pixel position in the horizontal direction. In standard image processing, the pixel spacing is set to 1, that is, Δx = 1;
[0125] Δy: represents the change in pixel position in the vertical direction. Similarly, the pixel spacing is set to 1, that is, Δy = 1;
[0126] θ: Indicates the direction of calculating the brightness gradient. Since the formula calculates the difference between the horizontal and vertical directions, the value of θ is 0 (horizontal) or 90 (vertical);
[0127] Calculation process example:
[0128] Set the grayscale value of the pixel at position (a,b) = (5,5) in the image to be 120, the grayscale value of the adjacent pixel in the vertical direction (position (6,5)) to be 125, and the grayscale value of the adjacent pixel in the horizontal direction (position (5,6)) to be 130;
[0129] Calculate the grayscale difference:
[0130] Vertical difference: |I 5,5 -I 6,5 |=|120-125|=5;
[0131] Horizontal difference: |I 5,5 -I 5,6 |=|120-130|=10;
[0132] Calculate the denominator:
[0133]
[0134] Calculate the gradient value:
[0135]
[0136] The results show that the brightness gradient value at position (5, 5) is about 10.61. A high gradient value indicates that the grayscale values of pixels around this position vary greatly, corresponding to the edge or texture area in the image.
[0137] S402: Calling the image brightness gradient value, combined with the continuous distribution sequence of the grayscale change rate of each group of pixels in the path coverage area, detects the number of grayscale jumps for each pair of adjacent pixels, and counts the number of jumps generated per unit pixel spacing to obtain the edge mutation frequency;
[0138] It is necessary to further detect the grayscale jump characteristics between adjacent pixels in the path coverage area. In the operation, the grayscale value sequence is extracted according to the pixel arrangement order. By calculating the grayscale change rate between each group of adjacent pixels, a continuous distribution sequence of grayscale change rate is formed. The number of grayscale jumps between each pair of pixels is detected. The specific judgment standard can be set to when the grayscale difference between adjacent pixels exceeds the set jump threshold (set to 15), it is considered a jump. The pixel pairs of the entire path are traversed, and the number of jumps occurring in each unit pixel spacing is accumulated and counted to form edge mutation frequency data. In the actual image, if the path length is 100 pixels and the unit pixel spacing is set to 1 pixel, the presence of a jump event between each two adjacent points is counted. If a total of 40 jumps are detected, the average edge mutation frequency is 0.4. In actual analysis, the frequency distribution can be further refined using a local area window to characterize the edge change intensity of a certain area on the path, providing frequency basic data support for subsequent direction difference judgment and variation area extraction, and obtaining edge mutation frequency.
[0139] S403: Extracting texture direction vectors of pixels within the path coverage area based on the edge mutation frequency, calculating a sequence of inter-pixel direction vector differences, combining the difference sequence, brightness gradient value, and mutation frequency value according to the pixel number, comparing the difference distribution intensity of the three combined values between pixels, and dividing the degree of difference between pixels into intervals to generate a variation region distribution map;
[0140] The texture direction vector corresponding to each pixel in the path coverage area is extracted. The direction vectors between pixels are compared in pairs to form a direction vector difference sequence. This difference sequence is then combined with the brightness gradient value and edge mutation frequency value obtained in the previous step according to the pixel number, forming a three-dimensional joint data structure. Each group of pixels contains three joint indicators. This structure is used to analyze the joint differences between pixels and compare their comprehensive differences in direction, brightness, and jump frequency. Based on the distribution characteristics of the pixels in the joint numerical space, they are divided into different difference intensity intervals to form a variation intensity level standard. The division standard can be completed based on cluster analysis or fixed interval division method. The joint difference value less than 0.2 is defined as low difference area, between 0.2 and 0.5 is defined as medium difference area, and greater than 0.5 is classified as high variation area. The difference level in the pixel space is annotated back to its corresponding 2D image coordinates, which intuitively reflects the degree of texture structure and brightness feature mutation in the path area, provides a clear regional reference for subsequent image restoration direction judgment, and generates a variation area distribution map.
[0141] The specific steps for obtaining the image structure fusion path are:
[0142] S501: extracting a pixel point set based on the pixel area marked as the variation level in the variation region distribution map, sequentially extracting transition intensity values between adjacent pixel points, constructing a continuous transition intensity change sequence of the pixel point set in the variation region, and obtaining a variation transition intensity sequence;
[0143] Based on the pixel areas marked with different variation levels in the variation area distribution map, it is necessary to extract all pixel point sets marked with medium and high variation levels. During the execution process, the variation level labels are read from the distribution map, and the corresponding pixel coordinates are summarized into a pixel point set through coordinate screening. In this set, the grayscale information or texture feature parameters of adjacent pixel points are read pair by pair according to the original arrangement order of the pixels in the image. The grayscale difference, texture direction difference or brightness difference between each pair of pixel points is quantified and its transition intensity is expressed in numerical form. The transition intensity values are recorded in sequence to construct a continuously changing The pixel transition intensity sequence forms a variation transition intensity sequence. For example, if the grayscale values of the pixel points in a certain area are 130, 132, 150, 151, and 155, the transition intensities between adjacent pixels are 2, 18, 1, and 4. The values are combined with the spatial arrangement order to form a sequence [2, 18, 1, 4], and the spatial position of each point is bound as the measurement basis of the regional variation trend. The integrity and continuity of the sequence can reveal the spatial coherence and change rhythm of the variation phenomenon in the local area, provide reference data for subsequent structural direction analysis, and obtain the variation transition intensity sequence.
[0144] S502: Detecting the continuous distribution direction of the mutated pixel point set in the image based on the correspondence between multiple change values in the mutated transition intensity sequence and pixel space coordinates, and obtaining the structure extension path direction sequence by tracking consecutive points with consistent intensity change directions;
[0145] It is necessary to combine the spatial coordinates of the pixel corresponding to each change value and analyze the continuous distribution direction of the pixel point set in the image. Specifically, all the variant pixel points and their transition intensity values are traversed, and the intensity change direction between any pair of adjacent points is compared with their spatial distribution direction. The directional trend of their change direction in the image coordinates is recorded. If the intensity change trend of multiple consecutive points is consistent and the spatial position extension direction is also consistent, then the points are considered to form an extension path with a clear structural direction. On this basis, the spatial extension of the path in the image is further tracked. If the transition intensity of multiple consecutive pixels gradually increases from the upper left to the lower right of the image, and the spatial positions are arranged in sequence along the diagonal direction, the extension trend of this segment can be recorded as from the upper left to the lower right and organized in the form of path segments. Structurally, each segment of continuous points with the same direction can be stored in segments. Each segment contains parameters such as direction mark, start and end point coordinates, and the number of points included. This direction sequence reflects the dominant trend of texture or brightness structure change in the image variation area and is the basic information for subsequent pixel position reconstruction, generating a structural extension path direction sequence.
[0146] S503: Based on the spatial arrangement structure of each direction in the direction sequence of the structural extension path, the position index value of the pixel point in the original image is adjusted, and the continuous coordinate positions in the direction sequence are offset-calibrated to perform coherent splicing of the pixels to obtain the image structure fusion path;
[0147] It is necessary to use the spatial arrangement structure of each segment in the sequence to adjust the pixel point position index in the original image. During the operation, first determine whether there is an offset, dislocation or break in the pixel point arrangement in the segment according to the directional trend and path coordinates represented by each segment in the direction sequence. If so, it is necessary to perform offset calibration on the pixel position index. The calibration method is to find the minimum offset of the grayscale value, directional feature or other texture information mutation in the continuous path, and rearrange the subsequent pixels along the direction according to the corresponding offset value to restore the continuity of each pixel in the direction. In actual operation, set a path direction from left to right, and the image is The coordinates of the pixel points are (10, 20), (11, 21), and (12, 22), but their grayscale information shows nonlinear jumps, indicating that point (11, 21) is misplaced. At this time, the coordinates of the point are adjusted to (11, 20) based on the mean trend and transition intensity of the previous and next points, forming a more natural arrangement. After performing this adjustment operation, the continuous segments are spliced together. This path is the directional structure sequence with consistency and coherence in the image after the structural continuity is restored. It can be used in the actual execution process of image content restoration and texture filling, so that the entity can be visualized even when it is occluded, and an image structure fusion path is generated.
[0148] See also Figure 2 ,Image generation system, the system includes:
[0149] The boundary extraction module obtains the boundary pixel position and corresponding grayscale value of the occlusion area, calculates the grayscale gradient value of each pixel in the horizontal and vertical directions, determines whether the angle between the gradient direction and the boundary tangent direction exceeds the boundary recognition angle reference value, and obtains the reverse extension path of the occlusion area boundary;
[0150] The trajectory analysis module extends the path in reverse according to the boundary of the occluded area, extracts the grayscale values of consecutive pixels on the path, calculates the grayscale difference between adjacent pixels, filters out the path segments whose jump amplitude exceeds the grayscale jump amplitude reference value, and generates a set of nodes for restoring the boundary of the occluded area;
[0151] The node recognition module recovers the node set based on the occlusion area boundary, divides the occlusion area into multiple texture sub-blocks, extracts the main direction value and grayscale phase value of the pixel direction vector in each sub-block, calculates the direction angle difference and phase mutation amplitude between adjacent sub-blocks, filters the path points that exceed the double threshold, and generates the texture cracking boundary trajectory;
[0152] The cracking path module calls the texture cracking boundary trajectory, extracts the brightness gradient value, edge mutation frequency value and direction vector difference of the pixels within the path range, evaluates the mapping relationship between pixel pairs, and classifies the pixel pairs into cracking level intervals based on the direction vector difference and offset degree in the matrix, generating a variation area distribution map.
[0153] The structural fusion module screens pixel positions whose cracking levels are within the mutation level range according to the distribution map of the variation region, obtains the pixel arrangement relationship and extracts the direction extension vector, connects the direction vectors that meet the consistency to form a continuous path, adjusts the spatial position of the path pixels, and generates the image structure fusion path.
[0154] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. An image generation method, characterized in that: The following steps are involved: S1: Obtain the position of identifiable boundary pixels in the occluded area, identify the edge grayscale gradient direction of the pixel point, calculate the main direction vector of each pixel point in the pixel point set, extract the angle value between the direction vector pairs, establish a reverse extension path, and obtain the reverse extension path of the occluded area boundary; S2: Based on the reverse extension path of the occluded area boundary, extract the grayscale value change sequence of the pixel points in the reverse extension trajectory path by path, screen the continuous segments of the grayscale jump amplitude, and combine the angle value of the direction vector of each point with the starting point of the original vector to determine whether the angle reaches the boundary drift limit, thereby obtaining the occluded area boundary recovery node set; S3: Using the occlusion area boundary recovery node set, the image contour area is divided into multiple texture sub-blocks, the texture direction angle and phase change amplitude of each sub-block are analyzed, the main direction angle difference and phase mutation amplitude between adjacent sub-blocks are determined, and the path points where the phase change is concentrated are marked to obtain the texture cracking boundary trajectory; S4: using the texture cracking boundary trajectory, extracting the brightness gradient value, edge mutation frequency and texture direction vector difference of the pixels in the path coverage area, and dividing the level of the variation area to obtain the variation area distribution map.
2. The image generation method according to claim 1, wherein: The reverse extension path of the occlusion area boundary includes a set of boundary pixel points, a grayscale gradient direction, a set of grayscale gradient exceeding pixel points, a main direction vector, a direction vector angle value, and a reverse extension path. The occlusion area boundary recovery node set includes a grayscale value change sequence, a grayscale deviation value, a continuous segment of grayscale jump amplitude, a direction vector angle, a boundary drift limit, a jump amplitude offset and a direction angle position point within the reverse extension trajectory. The texture cracking boundary trajectory includes a texture sub-block, a texture direction angle, a phase change amplitude, a main direction angle difference between adjacent sub-blocks, a phase mutation amplitude, and a path point.
3. The image generation method according to claim 1, wherein: The steps for obtaining the reverse extension path of the occlusion area boundary are specifically as follows: S101: Obtain the positions of identifiable boundary pixels within the occlusion area, identify the grayscale gradient direction values of the pixels within the boundary range of the area, and refer to the comparison relationship between the grayscale gradient direction values and the gradient change rates of adjacent pixels to screen out a set of pixels whose grayscale gradient change rates exceed the boundary identification reference value to generate a set of boundary variant pixels; S102: Based on the grayscale gradient direction values of the pixels in the boundary variation pixel set, a continuous pixel sequence is called, and by performing a cosine value comparison on the direction vectors of two adjacent pixels, the main direction vector corresponding to each pixel direction vector is extracted, a direction structure in two-dimensional coordinates is established, and a main vector angle sequence is obtained; S103: Based on the main vector angle sequence, continuously changing direction segments in the angle value sequence are screened, and corresponding positions of the direction reversal are identified through sequential comparison. The direction position information and the spatial coordinate position of the boundary strong variation pixel set are called to construct a connection segment to obtain the reverse extension path of the occluded area boundary.
4. The image generation method according to claim 3, wherein: The steps for obtaining the occlusion region boundary recovery node set are specifically as follows: S201: Extending the path in reverse based on the boundary of the occluded area, extracting the grayscale values of consecutive pixels in the path path by path, arranging them in order to construct a grayscale value change sequence for each path, calling the sequence position index of the pixel points in the path, calculating the grayscale value difference between two adjacent points, and obtaining a continuous grayscale deviation sequence; The formula for calculating the grayscale value difference between two adjacent points is: Among them, ΔG i Represents the grayscale difference between adjacent pixels in the i-th path, G i Represents the gray value of the i-th pixel, G i+1 Represents the grayscale value of the i+1th pixel, G j represents the gray value of the jth pixel, n represents the total number of pixels in the path, G k Represents the grayscale value of the k-th pixel, represents the average grayscale value within the path, i represents the path point index, and j represents the index of the cumulative deviation; S202: Based on the difference between each deviation value in the continuous grayscale deviation sequence and the two deviation values before and after it, screen continuous pixel segments whose deviation value change rate is greater than the grayscale jump amplitude threshold, call the path coordinate index at the corresponding sequence position, extract the start and end coordinate points in the path, and generate a jump continuous segment coordinate set; S203: Calling the coordinates of each pixel point in the jump continuous segment coordinate set and the coordinates of the starting point position of the corresponding path, identifying the direction vector through the spatial coordinate difference, combining the original direction vector value in the reverse extension path of the occlusion area boundary, calculating the angle value between the two point by point, and obtaining a direction angle value sequence; S204: According to the direction angle value sequence, for each pixel point in the jump continuous segment coordinate set, determine whether the corresponding angle value in the direction angle value sequence is greater than the boundary drift limit threshold, and at the same time match whether the corresponding grayscale deviation value in the continuous grayscale deviation sequence is greater than the jump amplitude threshold, select the position points that meet the dual conditions as interruption nodes, and obtain the occlusion area boundary recovery node set.
5. The image generation method according to claim 4, characterized in that The steps for obtaining the texture cracking boundary trajectory are specifically as follows: S301: Recovering the coordinate position of the node set based on the boundary of the occluded area, dividing the image contour area into a plurality of independent sub-areas with the lines between the nodes as boundaries, extracting the grayscale value sequence of the pixel points in the sub-area, and identifying the main direction angle and phase change interval of the grayscale gradient in the sub-block by referring to the relationship between the two-dimensional coordinate position and the grayscale distribution, and generating a texture direction phase parameter set; S302: Based on the main direction angle and phase change interval of the texture sub-block in the texture direction phase parameter set, two spatially adjacent sub-blocks are called, and a joint judgment is performed based on the main direction angle difference and the difference between the corresponding phase change intervals. Sub-block combinations whose main direction angle difference exceeds the angle difference threshold and whose phase change interval difference exceeds the mutation amplitude threshold are selected to obtain a main direction difference sub-block pair set; S303: Based on the pixel coordinates on the sub-block boundary path in the main direction difference sub-block pair set, mark the pixel positions in the corresponding path whose phase change frequency exceeds the path mean frequency, call the continuous arrangement positions of the similar pixel points in the spatial coordinates, construct a pixel trajectory sequence, and obtain the texture cracking boundary trajectory.
6. The image generation method according to claim 5, characterized in that The steps for obtaining the variation region distribution map are specifically as follows: S401: Based on the texture cracking boundary trajectory, referring to the grayscale value distribution of pixels in the path coverage area, a grayscale difference sequence between each pixel and its adjacent pixels is obtained, and a corresponding gradient direction sequence is established according to the pixel coordinate position. After normalizing the pixel grayscale difference and direction sequence, the brightness change amplitude between pixels in adjacent directions is identified to generate an image brightness gradient value; S402: Calling the image brightness gradient value, combining it with the continuous distribution sequence of the grayscale change rate of each group of pixels in the path coverage area, detecting the number of grayscale jumps for each pair of adjacent pixels, and counting the number of jumps generated per unit pixel spacing to obtain the edge mutation frequency; S403: According to the edge mutation frequency, the texture direction vectors of the pixels in the path coverage area are extracted, and the direction vector difference sequence between the pixels is calculated. The difference sequence, the brightness gradient value and the mutation frequency value are combined according to the pixel number, and the difference distribution intensity of the three joint values between the pixels is compared. The difference degree between the pixels is divided into intervals to generate a variation area distribution map.
7. The image generation method according to claim 6, wherein: The formula for identifying the brightness variation of the pixel in adjacent directions is: in, Represents the brightness gradient value of the image at position (a, b), I a,b Represents the grayscale value of the pixel at position (a, b), I a+1,b Represents the grayscale value of the pixel at position (a+1,b), I a,b+1 Represents the grayscale value of the pixel at position (a, b+1), Δx represents the change in the horizontal coordinate, Δy represents the change in the vertical coordinate, and θ represents the calculation direction of the point. Indicates the total distance the image position changes.
8. The image generation method according to claim 1, wherein: The method further comprises step S5: S5: calculating the transition intensity change value sequence of the pixel point set in the variation region through the variation region distribution map, analyzing the direction of the structure extension path in the variation region, adjusting the pixel position based on the structure extension path, and obtaining the image structure fusion path; The image structure fusion path includes a pixel point set in a variation region, a transition intensity change value sequence, a structure extension path, and pixel position adjustment conditions.
9. The image generation method according to claim 8, characterized in that: The steps for obtaining the image structure fusion path are specifically as follows: S501: extracting a pixel point set based on the pixel area marked as a variation level in the variation region distribution map, sequentially extracting transition intensity values between adjacent pixel points, constructing a continuous transition intensity change sequence of the variation region pixel point set, and obtaining a variation transition intensity sequence; S502: Detecting the continuous distribution direction of the mutated pixel point set in the image based on the correspondence between the multiple change values in the mutated transition intensity sequence and the pixel space coordinates, and obtaining the structure extension path direction sequence by tracking the continuous points with the same intensity change direction; S503: Based on the spatial arrangement structure of each direction in the direction sequence of the structural extension path, the position index value of the pixel point in the original image is adjusted, and the continuous coordinate positions in the direction sequence are offset calibrated to perform coherent splicing of the pixels to obtain the image structure fusion path.
10. An image generation system, characterized in that The image generation method according to any one of claims 1 to 9, wherein the system comprises: The boundary extraction module obtains the boundary pixel position and corresponding grayscale value of the occlusion area, calculates the grayscale gradient value of each pixel in the horizontal and vertical directions, determines whether the angle between the gradient direction and the boundary tangent direction exceeds the boundary recognition angle reference value, and obtains the reverse extension path of the occlusion area boundary; The trajectory analysis module extends the path in reverse according to the boundary of the occlusion area, extracts the grayscale values of consecutive pixels on the path, calculates the grayscale difference between adjacent pixels, selects the path segments whose jump amplitude exceeds the grayscale jump amplitude reference value, and generates a node set for restoring the boundary of the occlusion area; The node recognition module recovers the node set according to the boundary of the occluded area, divides the occluded area into multiple texture sub-blocks, extracts the main direction value and grayscale phase value of the pixel direction vector in each sub-block, calculates the direction angle difference and phase mutation amplitude between adjacent sub-blocks, filters the path points that exceed the double threshold, and generates the texture cracking boundary trajectory; The cracking path module calls the texture cracking boundary trajectory, extracts the brightness gradient value, edge mutation frequency value and direction vector difference of the pixels within the path range, evaluates the mapping relationship between pixel pairs, classifies the pixel pairs into cracking level intervals according to the direction vector difference and offset degree in the matrix, and generates a variation area distribution map; The structural fusion module screens pixel position points whose cracking levels are within the mutation level interval according to the variation region distribution map, obtains the pixel arrangement relationship and extracts the direction extension vector, connects the direction vectors that meet the consistency to form a continuous path, adjusts the spatial position of the path pixels, and generates an image structure fusion path.
Citation Information
Cited By
Knitted label edge contour extraction and optimization method
CN121458748A
A method for knitted label edge profile extraction and optimization
CN121458748B