Image processing method based on AI algorithm
By performing pixel partitioning and grayscale acquisition of preset face images, the problem of parsing errors and local distortion in image edge point reconstruction optimization is solved, and better image pixel-level optimization and reconstruction effects are achieved.
Patent Information
- Application Number
- CN202411490691.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the reconstruction optimization of image edge points, prior art, image parsing errors and local image distortion are easily caused, especially when image enlargement and display.
By partitioning preset face images with different pixels, the pixel value difference of the central pixel point of different pixel partitions is obtained, the changes in the natural feature of the image are analyzed, and artificial intelligence algorithms are used to collect grays of larger ranges and angles in different pixel areas. degree values to ensure pixel-level optimization and reconstruction effects.
It effectively avoids parsing errors and local distortion during image enlargement, ensuring the overall quality and visual effect of the image.
Smart Images

Figure CN119399046A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method based on an AI algorithm. Background Art
[0002] With the development of modern AI image processing technology, especially for human images generated by AI in various occasions, under the background of the growing demand for high-precision and high-efficiency image processing, the complexity of facial image processing in human images continues to increase. The image processing methods based on AI algorithms mainly include pixel-level image optimization and reconstruction, AI photo generation technology, and AI high-definition image repair technology. Among them, for finished images, the most widely used is the pixel-level image optimization and reconstruction processing method, which can maintain the clarity of the image and optimize the visual effect. For the research on such technologies, the technical application number CN202410323369.X provides an image processing method based on AI algorithm. This technical application realizes accurate image processing by combining advanced deep learning technology and generative adversarial network (GAN), and uses convolutional neural network (CNN) to extract features from images. Its feature extraction focuses on key features in the image, such as edges, textures, and color distribution, so that image processing can improve the overall quality of the image while retaining important visual information. The existing technologies for optimizing image clarity and visual effects based on pixel-level image optimization and reconstruction mostly perform point-by-point diffusion optimization in the central point area of the image until they diffuse point-by-point to the edge of the image. At the edge of the image, by calculating the grayscale value changes of each row and / or column of image pixels, the points where the grayscale value changes can be found. These points constitute the edge of the image. However, the reconstruction optimization of the edge points of the image is mostly adjusted with reference to the image pixels of the adjacent points, while the image pixels of the adjacent points next to different image edge points are not consistent, and they will change based on the grayscale value changes of the pixels in the image. If the image needs to be enlarged and displayed later, it is easy to cause errors in image analysis and local image distortion. Summary of the invention
[0003] In view of the above problems existing in the technical field of existing image processing, the present invention is proposed.
[0004] Therefore, one of the objects of the present invention is to provide an image processing method based on an AI algorithm, which partitions a preset face image into different pixel areas and obtains the pixel value difference of the central pixel points of different pixel areas to analyze the changes in the natural features of the image under different difference conditions, and utilizes an artificial intelligence algorithm to collect corresponding grayscale values of different pixel areas of the preset face image in different gradients, so that in addition to the edge adjacent points within different pixel areas, the grayscale values of different pixel areas can be collected in a larger range and angle, thereby ensuring the effect of subsequent pixel-level optimization and reconstruction of the image.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] The image processing method based on AI algorithm includes the following steps:
[0007] S10: construct pixel partitions based on a preset face image, and obtain edge pixel data features of different pixel partitions;
[0008] S20: selecting any one of the pixel partitions, adjusting the pixel value of the pixel partition, and constructing a 3D face model after the pixel value adjustment, and collecting natural feature changes of the image in the 3D face model;
[0009] S30: classifying the adjusted pixel values into different levels, analyzing the variation rules of natural features of the images of other pixel partitions under the conditions of pixel values adjusted at different levels, uploading the variation rules to the 3D face model, and updating the 3D face model;
[0010] S40: When obtaining the variation law of the natural characteristics of the image of other pixel partitions, the different pixel partitions are separately segmented, and different pixel values are given in the segmented pixel partitions, and the correlation law of the variation of the natural characteristics of the image of each separately segmented pixel partition is analyzed under the given different pixel values.
[0011] As a preferred solution of the present invention, in S10, the pixel partition is partitioned according to the forehead edge pixel area, the zygomatic edge pixel area, the cheek edge pixel area, the eye and nose edge pixel area and the chin edge pixel area, and the central pixel point is collected in each pixel area, and the position coordinates of the central pixel point in the corresponding pixel area image are obtained at the same time, and the pixel value difference of the central pixel point of the different pixel area images is calculated, and it is calculated according to the following formula:
[0012] Wherein, H[X, Y] represents the axis coordinate of the pixel point in the image, and I represents the pixel value of the pixel point corresponding to the axis coordinate;
[0013] Where K and L represent the original pixel values of the central pixel points collected for the Kth and Lth times in different pixel areas, respectively, and f[K, L] represents the weight of the original pixel values of the central pixel points collected for the Kth and Lth times to the original pixel values of the central pixels of all pixel areas.
[0014] As a preferred solution of the present invention, in S20, the natural feature changes of the image include brightness, color and texture, and also include collecting image artificial features in the 3D face model, the image artificial features include image spectrum, specifically, the image spectrum is the image spectrum of other pixel areas not including the selected pixel partition;
[0015] The areas of different pixel regions are collected, the number of pixels is obtained based on the collected pixel region areas, and a pixel matrix is generated with the number of pixels, with every nine pixel points as a group, as follows:
[0016]
[0017] Among them, w x represents the x-th pixel area, I represents the pixel value of the central pixel point corresponding to the pixel area, and based on the generated pixel matrix, the grayscale values of the horizontal gradient, the vertical gradient and the diagonal gradient are calculated by the Prewitt operator, wherein the grayscale value of the horizontal gradient is calculated according to the following formula:
[0018] Among them, w x represents the x-th pixel area;
[0019] θ represents a horizontal angle, u represents a fixed brightness corresponding to the horizontal angle, and z1, z2, z3 represent the 1st, 2nd, and 3rd horizontal pixel points in the pixel matrix;
[0020] Referring to the above formula, the grayscale values of the vertical gradient and the diagonal gradient are calculated according to the following formula:
[0021]
[0022] And based on the calculated maximum grayscale value of the diagonal gradient, the difference between the grayscale value of the vertical gradient and the horizontal gradient is obtained; when the grayscale values of the vertical gradient and the horizontal gradient are greater than the grayscale value of the diagonal gradient, the difference is not obtained; otherwise, the grayscale values of the horizontal gradient and the vertical gradient are adjusted according to the difference until the grayscale values of the horizontal gradient and the vertical gradient are consistent with the grayscale value of the diagonal gradient.
[0023] As a preferred solution of the present invention, in said S30, the level division is performed in an incremental manner, and the incremental manner includes dividing at least by increasing the pixel density by 2 to 5 times, and analyzing the changes in the natural characteristics of the image of the pixel area under different levels.
[0024] Given brightness value based on preset occasions Wherein, n represents the nth brightness value, and the corresponding pixel area is enlarged based on each increase of 2 to 5 pixel densities, and the clarity difference of each pixel area after the enlargement process is collected.
[0025] As a preferred solution of the present invention, different clarity differences are divided into several evaluation indicators, and the evaluation indicators are divided into low clarity difference evaluation indicators, medium clarity difference evaluation indicators and high clarity difference evaluation indicators, and at the same time, the differently divided evaluation indicators are compared with the shadow part of the preset face image to obtain the clarity difference comparison result, and when the comparison result meets the low clarity difference evaluation indicator and the high clarity difference evaluation indicator, the comparison result is adjusted to meet the medium clarity difference evaluation indicator.
[0026] As a preferred solution of the present invention, the shadow part in the preset face image is collected and marked, and the marking method is to mark the shadow part corresponding to the forehead edge pixel area, zygomatic face edge pixel area, cheek face edge pixel area, eye and nose edge pixel area and chin edge pixel area, and obtain the clarity difference between each pixel area and the shadow part under the original pixel value.
[0027] As a preferred solution of the present invention, the Monte Carlo method is used to sample the clarity difference data, the sampled value is compared with the pixel area with the maximum brightness in the preset face image, and the weight of the compared data to the maximum brightness data of the pixel area is analyzed.
[0028] A terminal comprises a processor, an input interface, an output interface and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 8.
[0029] A computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 8.
[0030] Beneficial effects of the present invention: The present invention partitions a preset face image into different pixel areas and obtains the pixel value difference of the central pixel points of different pixel areas to analyze the changes in natural features of the image under different difference conditions, and uses an artificial intelligence algorithm to collect corresponding grayscale values of different pixel areas of the preset face image in different gradients, so that in addition to the edge adjacent points in different pixel areas, the grayscale values of different pixel areas can be collected in a larger range and angle. On this basis, the pixel values of the target pixels can be better adjusted, so that when the image is subsequently enlarged and displayed, errors in image analysis and local image distortion will not occur, thereby ensuring the effect of pixel-level optimization and reconstruction of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0032] Figure 1 A schematic diagram of a method flow chart of an embodiment of the present invention;
[0033] Figure 2 It is a schematic diagram of the process structure of an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0035] Since the existing technologies for reconstructing and optimizing image edge points mostly adjust the image pixels of adjacent points with reference to the image pixels of adjacent points, and the image pixels of adjacent points next to different image edge points are not consistent, they will change based on the grayscale value changes of the pixels in the image. If the image needs to be enlarged and displayed later, it is easy to cause errors in image analysis and local image distortion.
[0036] Based on this, the present invention proposes an image processing method based on an AI algorithm, which partitions the preset face image into different pixel areas and obtains the pixel value difference of the central pixel points of different pixel areas to analyze the changes in the natural features of the image under different difference conditions, and uses an artificial intelligence algorithm to collect corresponding grayscale values of different pixel areas of the preset face image in different gradients, so that in addition to the edge adjacent points within different pixel areas, the grayscale values of different pixel areas can be collected in a larger range and angle, thereby ensuring the effect of subsequent pixel-level optimization and reconstruction of the image.
[0037] The present invention is further described in detail below through embodiments and in conjunction with the accompanying drawings.
[0038] Reference Figure 1 to Figure 2 , is an embodiment of the present invention, which provides an image processing method based on an AI algorithm, comprising the following steps:
[0039] S10: construct pixel partitions based on a preset face image, and obtain edge pixel data features of different pixel partitions;
[0040] It should be noted that in this embodiment, the pixel area is divided into the forehead edge pixel area, the zygomatic edge pixel area, the cheek edge pixel area, the eye and nose edge pixel area and the chin edge pixel area, and the central pixel point is collected in each pixel area, and the position coordinates of the central pixel point in the corresponding pixel area image are obtained at the same time, and the pixel value difference of the central pixel point of the image of different pixel areas is calculated, and it is calculated according to the following formula:
[0041] Where H[X, Y] represents the axis coordinate of the pixel point in the image, and I represents the pixel value of the pixel point corresponding to the axis coordinate;
[0042] Where K and L represent the original pixel values of the central pixel points collected for the Kth and Lth times in different pixel areas, respectively, and f[K, L] represents the weight of the original pixel values of the central pixel points collected for the Kth and Lth times to the original pixel values of the central pixel points of all pixel areas;
[0043] S20: selecting any one of the pixel partitions, adjusting the pixel value of the pixel partition, and constructing a 3D face model after the pixel value adjustment, and at the same time collecting natural feature changes of the image in the 3D face model;
[0044] It should be emphasized in this embodiment that the natural feature changes of the image include brightness, color and texture, and also include collecting the image artificial features in the face 3D model. The image artificial features include the image spectrum. Specifically, the image spectrum is the image spectrum of other pixel areas that do not include the selected pixel partition.
[0045] The areas of different pixel regions are collected, the number of pixels is obtained based on the collected pixel region areas, and a pixel matrix is generated based on the number of pixels, with nine pixels as a group, as follows:
[0046]
[0047] Among them, w x represents the x-th pixel area, I represents the pixel value of the central pixel corresponding to the pixel area, and based on the generated pixel matrix, the grayscale values of the horizontal gradient, vertical gradient and diagonal gradient are calculated by the Prewitt operator, where the grayscale value of the horizontal gradient is calculated according to the following formula:
[0048] Among them, w x represents the x-th pixel area;
[0049] θ represents the horizontal angle, u represents the fixed brightness corresponding to the horizontal angle, z1, z2, z3 represent the 1st, 2nd and 3rd horizontal pixels in the pixel matrix;
[0050] Referring to the above formula, the grayscale values of the vertical gradient and the diagonal gradient are calculated according to the following formula:
[0051]
[0052] And based on the maximum grayscale value of the calculated diagonal gradient, the difference between the grayscale value of the vertical gradient and the horizontal gradient is obtained. When the grayscale values of the vertical gradient and the horizontal gradient are greater than the grayscale value of the diagonal gradient, the difference is not obtained. Otherwise, the grayscale values of the horizontal gradient and the vertical gradient are adjusted according to the difference until the grayscale values of the horizontal gradient and the vertical gradient are consistent with the grayscale value of the diagonal gradient.
[0053] S30: classifying the adjusted pixel values into different levels, analyzing the variation rules of natural features of the images in other pixel partitions under the conditions of pixel values adjusted at different levels, uploading the variation rules to the 3D face model, and updating the 3D face model;
[0054] Specifically, this embodiment includes performing level division in an incremental manner, wherein the incremental manner includes dividing at least by increasing the density of 2 to 5 pixels, and analyzing the changes in the natural characteristics of the image in the pixel area under different levels;
[0055] Based on the above, this embodiment gives brightness values ▽1, ▽2, ..., ▽ n , where n represents the nth brightness value, and the corresponding pixel area is amplified based on the increase of 2 to 5 pixel density, and the clarity difference of each pixel area after the amplification process is collected;
[0056] Furthermore, the present embodiment divides different definition differences into several evaluation indicators, and divides the evaluation indicators into low definition difference evaluation indicators, medium definition difference evaluation indicators, and high definition difference evaluation indicators. At the same time, the evaluation indicators of different divisions are compared with the shadow part of the preset face image to obtain the definition difference comparison result. When the comparison result meets the low definition difference evaluation indicator and the high definition difference evaluation indicator, the comparison result is adjusted to meet the medium definition difference evaluation indicator.
[0057] It should be noted in this embodiment that, according to photography experience, all human body images and / or facial images obtained by photography and / or portrait photography will have shadow parts. In portrait photography, the control factors of the shadow effect include the position of the light source and the direction of the person's face. For example, when a side light source is used, one side of the person's face will have highlights, while the other side will have shadows. By adjusting the direction of the face and the position of the light source, a shadow can be created on one side of the face, thereby highlighting certain features of the face or changing the overall visual effect. Therefore, in facial image processing, using the shadow part as a reference factor is an important step;
[0058] As mentioned above, it is common to have shadows in face images. This is not only due to the lighting techniques in photography, but also due to the special treatment of shadow areas in image processing technology. Its existence can enhance the artistic effect and recognition accuracy of the image.
[0059] On the basis of the above, this embodiment collects and marks the shadow part in the preset face image, and marks the shadow part corresponding to the forehead edge pixel area, the zygomatic edge pixel area, the cheek edge pixel area, the eye and nose edge pixel area, and the chin edge pixel area, and obtains the clarity difference between each pixel area and the shadow part under the original pixel value;
[0060] At the same time, the Monte Carlo method is used to sample the clarity difference data, and the sampling value is compared with the brightness of the pixel area with the maximum brightness in the preset face image, and the weight of the comparison data to the maximum brightness data of the pixel area is analyzed;
[0061] S40: When obtaining the variation law of natural characteristics of the image of other pixel partitions, the different pixel partitions are separately segmented, and different pixel values are given in the segmented pixel partitions, and the correlation law of the variation of natural characteristics of the image of each separately segmented pixel partition is analyzed under the given different pixel values.
[0062] A terminal comprises a processor, an input interface, an output interface and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute a method as claimed in any one of claims 1 to 8.
[0063] A computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method as claimed in any one of claims 1 to 8.
[0064] To summarize, the present invention partitions the preset face image into different pixel areas and obtains the pixel value difference of the central pixel points of different pixel areas to analyze the changes in the natural features of the image under different difference conditions, and uses an artificial intelligence algorithm to collect corresponding grayscale values of different pixel areas of the preset face image in different gradients, so that in addition to the edge adjacent points in different pixel areas, the grayscale values of different pixel areas can be collected in a larger range and angle. On this basis, the pixel values of the target pixels can be better adjusted, so that when the image is subsequently enlarged and displayed, there will be no errors in image analysis and local image distortion, thereby ensuring the effect of pixel-level optimization and reconstruction of the image.
[0065] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. An image processing method based on an AI algorithm, characterized in that: The following steps are involved: S10: construct pixel partitions based on a preset face image, and obtain edge pixel data features of different pixel partitions; S20: selecting any one of the pixel partitions, adjusting the pixel value of the pixel partition, and constructing a 3D face model after the pixel value adjustment, and collecting natural feature changes of the image in the 3D face model; S30: classifying the adjusted pixel values into different levels, analyzing the variation rules of natural features of the images of other pixel partitions under the conditions of pixel values adjusted at different levels, uploading the variation rules to the 3D face model, and updating the 3D face model; S40: When obtaining the variation law of the natural characteristics of the image of other pixel partitions, the different pixel partitions are separately segmented, and different pixel values are given in the segmented pixel partitions, and the correlation law of the variation of the natural characteristics of the image of each separately segmented pixel partition is analyzed under the given different pixel values.
2. The image processing method based on AI algorithm according to claim 1, characterized in that: In S10, the pixel partition is divided into the forehead edge pixel area, the zygomatic edge pixel area, the cheek edge pixel area, the eye and nose edge pixel area and the chin edge pixel area, and the central pixel point is collected in each pixel area, and the position coordinates of the central pixel point in the corresponding pixel area image are obtained at the same time, and the pixel value difference of the central pixel point of the different pixel area images is calculated, and it is calculated according to the following formula: Wherein, H[X, Y] represents the axis coordinate of the pixel point in the image, and I represents the pixel value of the pixel point corresponding to the axis coordinate; Where K and L represent the original pixel values of the central pixel points collected for the Kth and Lth times in different pixel areas, respectively, and f[K, L] represents the weight of the original pixel values of the central pixel points collected for the Kth and Lth times to the original pixel values of the central pixels of all pixel areas.
3. The image processing method based on AI algorithm according to claim 2, characterized in that: In the S20, the natural feature changes of the image include brightness, color and texture, and also include collecting image artificial features in the 3D face model, the image artificial features include image spectrum, specifically, the image spectrum is the image spectrum of other pixel areas not including the selected pixel partition; The areas of different pixel regions are collected, the number of pixels is obtained based on the collected pixel region areas, and a pixel matrix is generated with the number of pixels, with every nine pixel points as a group, as follows: Among them, w x represents the x-th pixel area, I represents the pixel value of the central pixel point corresponding to the pixel area, and based on the generated pixel matrix, the grayscale values of the horizontal gradient, the vertical gradient and the diagonal gradient are calculated by the Prewitt operator, wherein the grayscale value of the horizontal gradient is calculated according to the following formula: Among them, w x represents the x-th pixel area; θ represents a horizontal angle, u represents a fixed brightness corresponding to the horizontal angle, and z1, z2, z3 represent the 1st, 2nd, and 3rd horizontal pixel points in the pixel matrix; Referring to the above formula, the grayscale values of the vertical gradient and the diagonal gradient are calculated according to the following formula: And based on the calculated maximum grayscale value of the diagonal gradient, the difference between the grayscale value of the vertical gradient and the horizontal gradient is obtained; when the grayscale values of the vertical gradient and the horizontal gradient are greater than the grayscale value of the diagonal gradient, the difference is not obtained; otherwise, the grayscale values of the horizontal gradient and the vertical gradient are adjusted according to the difference until the grayscale values of the horizontal gradient and the vertical gradient are consistent with the grayscale value of the diagonal gradient.
4. The image processing method based on AI algorithm according to claim 1, characterized in that: In the S30, the level division is performed in an incremental manner, and the incremental manner includes dividing at least by increasing the pixel density by 2 to 5, and analyzing the changes in the natural characteristics of the image of the pixel area under different level conditions.
5. The image processing method based on AI algorithm according to claim 4, characterized in that: Given brightness value based on preset occasions Wherein, n represents the nth brightness value, and the corresponding pixel area is enlarged based on each increase of 2 to 5 pixel densities, and the clarity difference of each pixel area after the enlargement process is collected.
6. The image processing method based on AI algorithm according to claim 5, characterized in that: Different clarity differences are divided into several evaluation indicators, and the evaluation indicators are divided into a low clarity difference evaluation indicator, a medium clarity difference evaluation indicator and a high clarity difference evaluation indicator. At the same time, the differently divided evaluation indicators are compared with the shadow part of the preset face image to obtain the clarity difference comparison result. When the comparison result meets the low clarity difference evaluation indicator and the high clarity difference evaluation indicator, the comparison result is adjusted to meet the medium clarity difference evaluation indicator.
7. The image processing method based on AI algorithm according to claim 6, characterized in that: The shadow part in the preset face image is collected and marked. The marking method is to mark the shadow part corresponding to the forehead edge pixel area, the zygomatic face edge pixel area, the cheek edge pixel area, the eye and nose edge pixel area and the chin edge pixel area, and obtain the clarity difference between each pixel area and the shadow part under the original pixel value.
8. The image processing method based on AI algorithm according to claim 7, characterized in that: The clarity difference data is sampled using a Monte Carlo method, the sampled value is brightness-compared with the pixel area with the maximum brightness in the preset face image, and the weight of the comparison data in the maximum brightness data of the pixel area is analyzed.
9. The image processing method based on AI algorithm according to claim 1, characterized in that: A terminal, characterized in that it includes a processor, an input interface, an output interface and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 8.
10. The image processing method based on AI algorithm according to claim 1, characterized in that: A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image processing method based on AI algorithm
CN117934354A
Image reestablishing method and device
CN104574455A
Image analysis method and system based on deep learning
CN118429242A
