Image processing method and apparatus, terminal device, and storage medium

By filtering and displaying image thumbnails that meet the constraints in the image library, and allowing users to select target images for AI image generation processing, the problem of difficulty and inefficiency in selecting images from a massive amount of images is solved, thus improving the user's image selection efficiency and experience.

WO2026066463A1PCT designated stage Publication Date: 2026-04-02HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

In image processing, when users need to select suitable images from a massive number of images for AI image processing, the selection process is difficult and inefficient.

Method used

By filtering images that meet the constraints in the image library and displaying thumbnails on the image selection interface, users can select target images for AI image generation processing, including secondary composition operations such as scaling, cropping, and rotation, to meet preset conditions.

Benefits of technology

It reduces the difficulty for users to select images, improves image selection efficiency, simplifies the operation process, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025106301_02042026_PF_FP_ABST
    Figure CN2025106301_02042026_PF_FP_ABST
Patent Text Reader

Abstract

The present application is applicable to the technical field of data processing, and provides an image processing method and apparatus, a terminal device, and a storage medium. The method comprises: in response to a first operation, determining at least one first image from a gallery; displaying a thumbnail of the at least one first image in an image selection interface; and in response to a second operation, obtaining at least one second image on the basis of a target image among the at least one first image. In the embodiments of the present application, when a user opens an image selection interface of an application having an AI image processing function, images in a gallery can be screened so as to determine a first image that can be used for new AI image processing, reducing the number of displayed images, thereby reducing the difficulty for users in selecting images, and improving the operation efficiency of users.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, device, terminal equipment and storage medium

[0001] The present application claims priority from the Chinese patent application No. 202411383989.9 filed on September 27, 2024, and entitled "Image processing method, device, terminal equipment and storage medium", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] The present application belongs to the technical field of data processing, and particularly relates to an image processing method, device, terminal equipment and storage medium. BACKGROUND

[0003] With the continuous development of electronic device technology, the image processing capability is also improved. The electronic device can not only perform beautification processing on images, but also perform various types of processing on images through artificial intelligence (AI), such as image style transformation or image repair. Taking image style transformation as an example, AI image processing can transform the captured image into an animation style or a traditional style, thereby providing users with more interesting and diverse images.

[0004] However, as the user's use time increases, the number of images stored in the gallery also increases. When the user needs to perform AI image processing, the target image often needs to be selected from a large number of images, thereby greatly increasing the difficulty and efficiency of selecting images during AI image processing and reducing the user's experience. SUMMARY

[0005] The embodiments of the present application provide an image processing method, device, terminal equipment and storage medium, which can solve the problem of the existing image processing technology that when performing image style transformation, a suitable image needs to be selected from a large number of images, and the difficulty and efficiency of selecting images are low.

[0006] In a first aspect, the embodiments of the present application provide an image processing method, comprising:

[0007] In response to a first operation, at least one first image is determined from a gallery; the first image is an image satisfying a first constraint condition; the first operation is an operation of triggering display of a list of images satisfying the first constraint condition on a selection interface; and the first constraint condition is used to filter candidate images for AI image generation processing;

[0008] A thumbnail of the at least one first image is displayed in the selection interface;

[0009] In response to the second operation, at least one second image is obtained based on a target image in the at least one first image, the second image being obtained by processing the target image, the processing including AI image generation processing, and the target image being the first image selected by the second operation.

[0010] Implementing the embodiments of the present application has the following beneficial effects: the terminal device can screen the images in the image gallery to obtain the first images meeting the AI image generation function, and display the thumbnails of the first images in the image selection interface, so that the user can subsequently select the target image in the at least one first image for AI image generation processing, thereby reducing the number of images displayed in the image selection interface, and in turn reducing the difficulty of the user in selecting the image and improving the operation efficiency of the user.

[0011] In a possible implementation manner of the first aspect, the at least one first image is determined from the image gallery in response to a first operation, and the first operation includes:

[0012] The at least one first image is screened from the image gallery based on the first constraint condition;

[0013] If the foreground object in any first image screened does not meet a preset second constraint condition, the first image is subjected to secondary composition so that the foreground object in the first image after the secondary composition meets the second constraint condition.

[0014] In a possible implementation manner of the first aspect, in a case where the foreground object in the target image does not meet a preset second constraint condition, the processing further includes subjecting the target image to secondary composition so that the foreground object in the target image after the secondary composition meets the second constraint condition.

[0015] In a possible implementation manner of the first aspect, in a case where the foreground object in the target image does not meet a preset second constraint condition, before the at least one second image is obtained based on the target image in the at least one first image in response to the second operation, the method further includes:

[0016] In response to the selection operation on the target image, the target image is subjected to secondary composition so that the foreground object in the target image after the secondary composition meets the second constraint condition.

[0017] The target image after the secondary composition is displayed, and the second operation is an operation performed based on the target image after the secondary composition.

[0018] In a possible implementation manner of the first aspect, the secondary composition includes at least one of a zoom operation, a cropping operation, a rotation operation, and a content expansion operation.

[0019] In one possible implementation of the first aspect, the second constraint includes at least one of the following:

[0020] The area proportion of the foreground object is within a preset ratio range;

[0021] The area proportion of the key parts of the foreground object is within a preset ratio range;

[0022] The foreground object is on the axis of the first image;

[0023] The key part of the foreground object is on the axis of the first image;

[0024] The specified portion of the foreground object is not visible in the first image.

[0025] In one possible implementation of the first aspect, the first constraint includes at least one of the following:

[0026] The number of foreground objects contained in the first image is within a preset range;

[0027] The foreground object's pose is within a preset pose range, and the object pose includes the foreground object's facial pose and / or body pose.

[0028] The image quality index of the first image is within a preset index range, and the image quality index includes at least one of the following: image resolution, image brightness value, sharpness of the foreground object, and sharpness of key parts of the foreground object.

[0029] In one possible implementation of the first aspect, displaying thumbnails of the at least one first image in the image selection interface includes:

[0030] The image selection interface displays thumbnails of multiple images; the multiple images include at least one first image; the first image includes a marker; the marker is used to indicate that the first image is a candidate image for AI image generation processing.

[0031] In one possible implementation of the first aspect, the image style type of the second image is determined based on the foreground object in the target image.

[0032] In one possible implementation of the first aspect, the image style type is determined based on descriptive information of foreground objects in the target image.

[0033] In one possible implementation of the first aspect, the image style type is determined based on the foreground object of the target image and the scene information corresponding to the user of the terminal device when the second operation is initiated.

[0034] In a possible implementation manner of the first aspect, the description information is obtained by performing object recognition on the target image.

[0035] The description information is obtained by adjusting an identification result of the target image by a user; and the identification result is generated by performing object recognition on the target image.

[0036] In a possible implementation manner of the first aspect, the second image is generated according to a first pose of a foreground object in the target image and the image style type; and a second pose of the foreground object in the second image is the same as or different from the first pose.

[0037] In a possible implementation manner of the first aspect, the second pose is obtained by adjusting a pose of a specified part in the first pose under a condition that the first pose satisfies a preset pose adjustment condition; and the specified part in the second pose does not satisfy the pose adjustment condition.

[0038] In a possible implementation manner of the first aspect, the specified part is a hand; and the pose adjustment condition includes at least one of the following:

[0039] The hand in the first pose is in a raised hand pose.

[0040] The hand in the first pose is in a visible state.

[0041] The hand in the first pose is within a preset distance range from a face.

[0042] In a possible implementation manner of the first aspect, in a case that a first support object exists below the hand in the first pose, the processing further includes: replacing the first support object in the target image with a second support object.

[0043] In a possible implementation manner of the first aspect, the first pose is used to determine a conversion template matched with the image style type; and the AI image generation processing is performed on the target image by using the conversion template.

[0044] In a possible implementation manner of the first aspect, in a case that an occlusion object exists in the target image and occludes the foreground object, the processing further includes: removing the occlusion object in the target image.

[0045] In a possible implementation manner of the first aspect, the processing further includes a quality control processing, which is performed after the AI image generation processing.

[0046] In a possible implementation manner of the first aspect, the quality control processing includes at least one of a posture abnormality processing, a contour abnormality processing, a color abnormality processing, and a light and shadow abnormality processing.

[0047] In a possible implementation manner of the first aspect, the obtaining, in response to the second operation, of the at least one second image based on the target image in the at least one first image includes:

[0048] sending, to a server, an image generation indication, the image generation indication including the target image;

[0049] receiving the at least one second image sent by the server.

[0050] In a possible implementation manner of the first aspect, the image generation indication further includes description information of a foreground object of the target image, the description information being used to determine an image style type corresponding to the at least one second image to be generated.

[0051] In a possible implementation manner of the first aspect, the image generation indication further includes scene information corresponding to a user of the terminal device, the scene information being used to generate the at least one second image.

[0052] In a possible implementation manner of the first aspect, the obtaining, in response to the second operation, of the at least one second image based on the target image in the at least one first image includes:

[0053] In response to the second operation, determining at least one image style type corresponding to the target image;

[0054] processing the target image based on the image style type, to obtain the at least one second image matching the image style type.

[0055] In a possible implementation manner of the first aspect, the obtaining, in response to the second operation, of the at least one second image based on the target image in the at least one first image includes:

[0056] displaying a plurality of second images, the plurality of second images including second images of at least two different image style types;

[0057] In response to a third operation, adding part or all of the plurality of second images to a wallpaper library.

[0058] In a possible implementation manner of the first aspect, the method is executed by a first application in the terminal device.

[0059] A second aspect, an apparatus for image processing, includes:

[0060] a first image determining unit, configured to determine at least one first image from a gallery in response to a first operation; the first image is an image satisfying a first constraint condition; the first operation is an operation of triggering display of a list of images satisfying the first constraint condition on a selection interface; the first constraint condition is used for screening candidate images for an AI image generation process;

[0061] an image displaying unit, configured to display a thumbnail of the at least one first image in the selection interface;

[0062] an image obtaining unit, configured to obtain at least one second image based on a target image in the at least one first image in response to a second operation, the second image being obtained by processing the target image, the processing including an AI image generation process, the target image being the first image selected by the second operation.

[0063] In a possible implementation of the second aspect, the first image determining unit includes:

[0064] a second image determining unit, configured to screen the at least one first image from the gallery based on the first constraint condition;

[0065] a secondary composition unit, configured to perform secondary composition on any first image that does not satisfy a preset second constraint condition on a foreground object in the first image, so that the foreground object in the first image after the secondary composition satisfies the second constraint condition.

[0066] In a possible implementation of the second aspect, in a case where the foreground object in the target image does not satisfy a preset second constraint condition, the processing further includes performing secondary composition on the target image, so that the foreground object in the target image after the secondary composition satisfies the second constraint condition.

[0067] In a possible implementation of the second aspect, in a case where the foreground object in the target image does not satisfy a preset second constraint condition, the apparatus further includes:

[0068] an image selecting unit, configured to perform secondary composition on the target image in response to a selection operation on the target image, so that the foreground object in the target image after the secondary composition satisfies the second constraint condition;

[0069] a preview unit, configured to display the target image after the secondary composition, the second operation being an operation performed based on the target image after the secondary composition.

[0070] In a possible implementation manner of the second aspect, the composition adjustment operation includes at least one of a zoom operation, a crop operation, a rotation operation, and a content expansion operation.

[0071] In a possible implementation manner of the second aspect, the second constraint condition includes at least one of:

[0072] The area proportion of the foreground object is within a preset proportion range;

[0073] The area proportion of the key part of the foreground object is within a preset proportion range;

[0074] The foreground object is on an axis of the first image;

[0075] The key part of the foreground object is on an axis of the first image;

[0076] A specified part of the foreground object is invisible in the first image.

[0077] In a possible implementation manner of the second aspect, the first constraint condition includes at least one of:

[0078] The number of foreground objects contained in the first image is within a preset number range;

[0079] An object pose of the foreground object is within a preset pose range, and the object pose includes a face pose and / or a body pose of the foreground object;

[0080] An image quality indicator of the first image is within a preset indicator range, and the image quality indicator includes at least one of an image resolution, an image brightness value, a definition of the foreground object, and a definition of a key part of the foreground object.

[0081] In a possible implementation manner of the second aspect, the image display unit includes:

[0082] A gallery display unit, configured to display, in the image selection interface, thumbnails of a plurality of images; the plurality of images include the at least one first image; the first image includes a mark; and the mark is used to indicate that the first image is a candidate image for an AI image generation process.

[0083] In a possible implementation manner of the second aspect, an image style type of the second image is determined based on a foreground object in the target image.

[0084] In a possible implementation manner of the second aspect, the image style type is determined based on description information of a foreground object in the target image.

[0085] In a possible implementation manner of the second aspect, the image style type is determined based on a foreground object of the target image and scene information corresponding to a user of the terminal device when the second operation is initiated.

[0086] In a possible implementation manner of the second aspect, the description information is obtained by performing object recognition on the target image.

[0087] The description information is obtained by adjusting an identification result of the target image; and the identification result is generated by performing object recognition on the target image.

[0088] In a possible implementation manner of the second aspect, the second image is generated according to a first pose of a foreground object in the target image and the image style type; and a second pose of the foreground object in the second image is the same as or different from the first pose.

[0089] In a possible implementation manner of the second aspect, the second pose is obtained by adjusting a pose of a specified part in the first pose when the first pose meets a preset pose adjustment condition; and the specified part in the second pose does not meet the pose adjustment condition.

[0090] In a possible implementation manner of the second aspect, the specified part is a hand; and the pose adjustment condition includes at least one of the following:

[0091] The hand in the first pose is in a raised hand pose.

[0092] The hand in the first pose is in a visible state.

[0093] The distance between the hand and a face in the first pose is within a preset distance range.

[0094] In a possible implementation manner of the second aspect, when a first support object exists below the hand in the first pose, the processing further includes: replacing the first support object in the target image with a second support object.

[0095] In a possible implementation manner of the second aspect, the first pose is used to determine a conversion template matched with the image style type; and the AI image generation processing is AI image generation processing performed on the target image by using the conversion template.

[0096] In a possible implementation manner of the second aspect, when an occlusion object exists in the target image and occludes the foreground object, the processing further includes: removing the occlusion object in the target image.

[0097] In a possible implementation manner of the second aspect, the processing further includes a quality control processing, which is performed after the AI image generation processing.

[0098] In a possible implementation manner of the second aspect, the quality control processing includes at least one of a posture abnormality processing, a contour abnormality processing, a color abnormality processing, and a light and shadow abnormality processing.

[0099] In a possible implementation manner of the second aspect, the image obtaining unit includes:

[0100] an indication sending unit, configured to send, to a server, an image generation indication, the image generation indication including the target image;

[0101] an image receiving unit, configured to receive the at least one second image sent by the server.

[0102] In a possible implementation manner of the second aspect, the image generation indication further includes description information of a foreground object of the target image, the description information being used to determine an image style type corresponding to the at least one second image to be generated.

[0103] In a possible implementation manner of the second aspect, the image generation indication further includes scene information corresponding to a user of the terminal device, the scene information being used to determine the at least one second image.

[0104] In a possible implementation manner of the second aspect, the image obtaining unit includes:

[0105] a style type determining unit, configured to determine, in response to the second operation, at least one image style type corresponding to the target image;

[0106] a style converting unit, configured to perform the processing on the target image based on the image style type, to obtain the at least one second image matching the image style type.

[0107] In a possible implementation manner of the first aspect, the image obtaining unit includes:

[0108] a multi-image displaying unit, configured to display a plurality of second images, the plurality of second images including at least two second images of different image style types;

[0109] a wallpaper adding unit, configured to add, in response to a third operation, part or all of the plurality of second images to a wallpaper library.

[0110] In a possible implementation manner of the second aspect, the method is executed by a first application in the terminal device.

[0111] In a third aspect, an embodiment of the present application provides a method for image processing, comprising:

[0112] obtaining at least one second image based on a target image in the at least one first image in response to a second operation, the second image being obtained by processing the target image, the first image being an image in a gallery that meets a first constraint condition, the first constraint condition being used to screen candidate images for AI image generation processing, the processing including AI image generation processing, and the target image being the first image selected by the second operation.

[0113] Implementing the embodiments of the present application has the following beneficial effects: the electronic device can perform AI image generation processing on the target image selected by the user, thereby obtaining at least one second image, and since the target image selected by the user is obtained by screening the gallery, the efficiency of selecting an image by the user can be improved, and the operation difficulty of the user can be reduced.

[0114] In a possible implementation manner of the third aspect, the image style type of the second image is determined based on a foreground object in the target image.

[0115] In a possible implementation manner of the third aspect, the image style type is determined based on description information of a foreground object in the target image.

[0116] In a possible implementation manner of the third aspect, the image style type is determined based on the foreground object in the target image and scene information corresponding to a user of the terminal device when the second operation is initiated.

[0117] In a possible implementation manner of the third aspect, the description information is obtained by performing object recognition on the target image; or

[0118] The description information is obtained by adjusting an identification result of the target image by the user; and the identification result is generated by performing object recognition on the target image.

[0119] In a possible implementation manner of the third aspect, the second image is generated according to a first pose of a foreground object in the target image and the image style type; and a second pose of the foreground object in the second image is the same as or different from the first pose.

[0120] In a possible implementation manner of the third aspect, the second pose is obtained by adjusting a pose of a specified part in the first pose under a condition that the first pose meets a preset pose adjustment condition; and the specified part in the second pose does not meet the pose adjustment condition.

[0121] In a possible implementation manner of the third aspect, the specified part is a hand; and the posture adjustment condition comprises at least one of the following:

[0122] the hand in the first posture is a raised hand posture;

[0123] the hand in the first posture is in a visible state;

[0124] the distance between the hand and the face in the first posture is within a preset distance range.

[0125] In a possible implementation manner of the third aspect, in a case where a first supporting object exists below the hand in the first posture, the processing further comprises: replacing the first supporting object in the target image with a second supporting object.

[0126] In a possible implementation manner of the third aspect, the first posture is used to determine a conversion template matching the image style type; and the AI image generation processing is AI image generation processing on the target image through the conversion template.

[0127] In a possible implementation manner of the third aspect, in a case where an occlusion exists in the target image and occludes the foreground object, the processing further comprises: removing the occlusion in the target image.

[0128] In a possible implementation manner of the third aspect, the processing further comprises quality control processing, which is executed after the AI image generation processing.

[0129] In a possible implementation manner of the third aspect, the quality control processing comprises at least one of posture anomaly processing, contour anomaly processing, color anomaly processing, and light and shadow anomaly processing.

[0130] In a possible implementation manner of the third aspect, the obtaining at least one second image based on a target image in the at least one first image in response to a second operation comprises:

[0131] sending an image generation instruction to a server, the image generation instruction comprising the target image;

[0132] receiving the at least one second image sent by the server.

[0133] In a possible implementation manner of the third aspect, the image generation instruction further comprises description information of a foreground object of the target image, the description information being used to determine an image style type corresponding to the at least one second image to be generated.

[0134] In a possible implementation manner of the third aspect, the image generation indication further includes scene information corresponding to a user of the terminal device, and the scene information is used to determine generation of the at least one second image.

[0135] In a possible implementation manner of the third aspect, the obtaining, in response to the second operation, of the at least one second image based on the target image in the at least one first image includes:

[0136] In response to the second operation, determining at least one image style type corresponding to the target image;

[0137] Performing the processing on the target image based on the image style type, to obtain the at least one second image matching the image style type.

[0138] In a possible implementation manner of the third aspect, the obtaining, in response to the second operation, of the at least one second image based on the target image in the at least one first image includes:

[0139] Displaying a plurality of second images, and the plurality of second images include second images of at least two different image style types;

[0140] In response to a third operation, adding part or all of the plurality of second images to a wallpaper library.

[0141] In a possible implementation manner of the third aspect, the method is performed by a first application in the terminal device.

[0142] A fourth aspect is an apparatus for image processing, including:

[0143] An image obtaining unit is configured to obtain, in response to a second operation, at least one second image based on a target image in at least one first image, the second image being obtained by processing the target image, the first image being an image in a gallery satisfying a first constraint condition, the first constraint condition being used to filter candidate images for AI image generation processing, the processing including AI image generation processing, and the target image being the first image selected by the second operation.

[0144] In a possible implementation manner of the fourth aspect, an image style type of the second image is determined based on a foreground object in the target image.

[0145] In a possible implementation manner of the fourth aspect, the image style type is determined based on description information of a foreground object in the target image.

[0146] In a possible implementation manner of the fourth aspect, the image style type is determined based on a foreground object of the target image and scene information corresponding to a user of the terminal device when the second operation is initiated.

[0147] In a possible implementation manner of the fourth aspect, the description information is obtained by performing object recognition on the target image.

[0148] The description information is obtained by adjusting an identification result of the target image; and the identification result is generated by performing object recognition on the target image.

[0149] In a possible implementation manner of the fourth aspect, the second image is generated according to a first pose of a foreground object in the target image and the image style type; and a second pose of the foreground object in the second image is the same as or different from the first pose.

[0150] In a possible implementation manner of the fourth aspect, the second pose is obtained by adjusting a pose of a specified part in the first pose when the first pose meets a preset pose adjustment condition; and the specified part in the second pose does not meet the pose adjustment condition.

[0151] In a possible implementation manner of the fourth aspect, the specified part is a hand; and the pose adjustment condition includes at least one of the following:

[0152] The hand in the first pose is in a raised hand pose.

[0153] The hand in the first pose is in a visible state.

[0154] The distance between the hand and a face in the first pose is within a preset distance range.

[0155] In a possible implementation manner of the fourth aspect, when a first support object exists below the hand in the first pose, the processing further includes: replacing the first support object in the target image with a second support object.

[0156] In a possible implementation manner of the fourth aspect, the first pose is used to determine a conversion template matched with the image style type; and the AI image generation processing is AI image generation processing performed on the target image by using the conversion template.

[0157] In a possible implementation manner of the fourth aspect, when an occlusion object exists in the target image and occludes the foreground object, the processing further includes: removing the occlusion object in the target image.

[0158] In a possible implementation manner of the fourth aspect, the processing further includes a quality control processing, which is performed after the AI image generation processing.

[0159] In a possible implementation manner of the fourth aspect, the quality control processing includes at least one of a posture abnormality processing, a contour abnormality processing, a color abnormality processing, and a light and shadow abnormality processing.

[0160] In a possible implementation manner of the fourth aspect, the image obtaining unit includes:

[0161] An indication sending unit, configured to send an image generation indication to a server, the image generation indication including the target image;

[0162] An image receiving unit, configured to receive the at least one second image sent by the server.

[0163] In a possible implementation manner of the fourth aspect, the image generation indication further includes description information of a foreground object of the target image, the description information being used to determine an image style type corresponding to the at least one second image to be generated.

[0164] In a possible implementation manner of the fourth aspect, the image generation indication further includes scene information corresponding to a user of the terminal device, the scene information being used to determine the at least one second image.

[0165] In a possible implementation manner of the fourth aspect, the image obtaining unit includes:

[0166] A style type determining unit, configured to determine at least one image style type corresponding to the target image in response to the second operation;

[0167] A style converting unit, configured to perform the processing on the target image based on the image style type, to obtain the at least one second image matching the image style type.

[0168] In a possible implementation manner of the fourth aspect, the image obtaining unit includes:

[0169] A multiple-image displaying unit, configured to display multiple second images, the multiple second images including at least two second images of different image style types;

[0170] A wallpaper adding unit, configured to add part or all of the multiple second images to a wallpaper library in response to a third operation.

[0171] In a possible implementation manner of the fourth aspect, the method is executed by a first application in the terminal device.

[0172] In a fifth aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a program stored in the memory, wherein the processor implements the steps of the image processing method of any one of the first aspect or the steps of the image processing method of any one of the third aspect when executing the program.

[0173] In a sixth aspect, an embodiment of the present application provides a readable storage medium, wherein the readable storage medium stores a program, and the program, when executed by a processor, implements the steps of the image processing method of any one of the first aspect or the steps of the image processing method of any one of the third aspect.

[0174] In a seventh aspect, an embodiment of the present application provides a program product, which, when running on a device, causes the device to perform the steps of the display method of any one of the first aspect or the steps of the image processing method of any one of the third aspect.

[0175] In an eighth aspect, an embodiment of the present application provides an image processing system, comprising a terminal device and a server.

[0176] The terminal device is configured to determine at least one first image from a gallery in response to a first operation, wherein the first image is an image satisfying a first constraint condition, and the first operation is an operation of triggering display of a list of images satisfying the first constraint condition on a selection interface, and the first constraint condition is used to filter candidate images for AI image generation processing.

[0177] The terminal device is configured to display a thumbnail of the at least one first image in the selection interface.

[0178] The terminal device is configured to send an image generation instruction to the server in response to a second operation, wherein the image generation instruction comprises a target image, and the target image is the first image selected by the second operation.

[0179] The server is configured to process the target image to obtain at least one second image, wherein the processing comprises AI image generation processing.

[0180] The terminal device is further configured to receive the at least one second image sent by the server.

[0181] In a possible implementation manner of the eighth aspect, the image generation instruction further comprises description information of a foreground object of the target image, and the description information is used to determine an image style type corresponding to the at least one second image to be generated.

[0182] In a possible implementation manner of the eighth aspect, the image generation indication further includes scene information corresponding to a user of the terminal device, and the scene information is used to determine generation of the at least one second image.

[0183] In the embodiment of the present application, the terminal device can screen images in the image gallery to obtain at least one first image, thereby reducing the number of image selection by the user and improving the efficiency of selecting a target image. The terminal device can select a target image that needs to be processed by AI image generation, and then send the target image to the server to complete the AI image generation processing by the server, so as to achieve the purpose of AI image generation. Since the server has strong computing power, the efficiency of AI image generation processing can be improved, and the computing pressure of the terminal device can be reduced.

[0184] Other implementations can refer to the foregoing aspects and will not be described herein.

[0185] The beneficial effects of the above aspects can be mutually referred to and will not be described herein. BRIEF DESCRIPTION OF DRAWINGS

[0186] FIG. 1 is an operation flowchart of an existing image style transformation;

[0187] FIG. 2 is a flowchart of an image style transformation provided by an embodiment of the present application;

[0188] FIG. 3 is an implementation flowchart of a preprocessing stage of an image processing method provided by an embodiment of the present application;

[0189] FIG. 4 is an implementation flowchart of constructing an image feature library provided by an embodiment of the present application;

[0190] FIG. 5 is a schematic diagram of image screening by a first constraint condition provided by an embodiment of the present application;

[0191] FIG. 6 is a specific implementation flowchart of S302 in the image processing method provided by an embodiment of the present application;

[0192] FIG. 7 is a composition adjustment schematic diagram when condition 2.1 is not met provided by an embodiment of the present application;

[0193] FIG. 8 is a composition adjustment schematic diagram when conditions 2.1 and 2.2 are not met provided by an embodiment of the present application;

[0194] FIG. 9 is a transformation schematic diagram of images in the image gallery in the preprocessing stage provided by an embodiment of the present application;

[0195] FIG. 10 is a flowchart of secondary composition provided by an embodiment of the present application;

[0196] FIG. 11 is a display flowchart of a first image provided by an embodiment of the present application;

[0197] FIG. 12 is a schematic diagram of an album interface according to an embodiment of the present application;

[0198] FIG. 13 is a schematic diagram of an image set according to an embodiment of the present application;

[0199] FIG. 14 is a flowchart of an implementation of a style transformation stage of an image processing method according to an embodiment of the present application;

[0200] FIG. 15 is a schematic diagram of a second operation according to an embodiment of the present application;

[0201] FIG. 16 is a schematic diagram of a second operation according to another embodiment of the present application;

[0202] FIG. 17 is a flowchart of a process of processing a target image based on a terminal device according to an embodiment of the present application;

[0203] FIG. 18 is a schematic diagram of a foreground object and a style type according to an embodiment of the present application;

[0204] FIG. 19 is a schematic diagram of adjustment of an object feature according to an embodiment of the present application;

[0205] FIG. 20 is a schematic diagram of determination of an image style type according to an embodiment of the present application;

[0206] FIG. 21 is a schematic diagram of a structure of an image style model according to an embodiment of the present application;

[0207] FIG. 22 is a schematic diagram of adjustment of a hand of a foreground object in an image according to an embodiment of the present application;

[0208] FIG. 23 is a schematic diagram of replacement of a hand support of a foreground object in an image according to an embodiment of the present application;

[0209] FIG. 24 is a schematic diagram of removal of an occlusion of a foreground object in an image according to an embodiment of the present application;

[0210] FIG. 25 is a schematic diagram of control of a style transformation result of an image by a template according to an embodiment of the present application;

[0211] FIG. 26 is a flowchart of an image style conversion according to an embodiment of the present application;

[0212] FIG. 27 is a flowchart of an interaction between a terminal device and an electronic device when a second image is generated based on a server according to an embodiment of the present application;

[0213] FIG. 28 is a schematic diagram of a display interface of a second image according to an embodiment of the present application;

[0214] FIG. 29 is a schematic diagram of selection of a second image according to an embodiment of the present application;

[0215] FIG. 30 is a structural block diagram of an image processing apparatus according to an embodiment of the present application;

[0216] FIG. 31 is a structural schematic diagram of a terminal device according to an embodiment of the present application. DETAILED DESCRIPTION

[0217] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the application with unnecessary detail.

[0218] It is to be understood that the terminology "includes", "has", "holds", "contains" and / or "comprising", "comprised of", "comprising", "comprises" when used in this specification and in the following claims, specifies the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0219] It is also to be understood that the terminology "and / or" when used in this specification and in the following claims, refers to at least one of the items, or any combination of the items, listed after the term in the various aspects.

[0220] As used in this specification and in the claims, the term "if" can be construed to mean "when" or "once" or "in response to determining" or "in response to detecting", depending on the context. In this sense, the term "if" can be interpreted as meaning "once if" or "in response to if". Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be construed to mean "once determined" or "in response to determining" or "once [the described condition or event] is detected" or "in response to detecting [the described condition or event]".

[0221] In addition, in the description of the application and in the following claims, the terms "first", "second", "third", etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0222] Reference throughout this application to "one embodiment" or "an embodiment" or "a specific embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in additional embodiments," and so on, in various places throughout this specification are not necessarily all referring to the same embodiment, unless otherwise specifically specified. The terms "including," "comprising," "having," and variations thereof, are meant to encompass the items listed thereafter, and any equivalent thereof, as well as additional items. The terms "comprise," "comprising," "include," "including," and "includes" are used interchangeably in this disclosure.

[0223] With the continuous development of terminal device technology, the ability of the device for image processing is also improved. The terminal device can not only adjust the related parameters of the image, such as adjusting the brightness, resolution, definition, saturation, etc. of the image, but also can generate image content through artificial intelligence, that is, AI image processing. AI image processing can include image expansion, image style transformation, and portrait face changing, etc. For example, FIG. 1 shows an operation flowchart of triggering AI image processing. Referring to FIG. 1, when a user needs to perform AI image processing on an image, the following steps can be included:

[0224] Step 1: Open the application

[0225] Referring to (a) in FIG. 1, the user can install an application with AI image processing function in the terminal device, such as a "Meitu" application, and the corresponding control in the main interface is an icon control 11. The user can start the "Meitu" application by clicking the above icon control 11, and generate a corresponding operation interface.

[0226] Step 2: Select image style

[0227] Referring to (b) in FIG. 1, after the user opens the "Meitu" application, the user can select the image style to be transformed in the corresponding operation interface, such as the control 12 corresponding to the "cartoon style", the control 13 corresponding to the "ancient style", and the control 14 corresponding to the "mechanical style", etc. After the user selects the image style to be transformed, the user can click the next control 15 to enter the image selection interface.

[0228] Step 3: Select target image

[0229] Referring to (c) in FIG. 1, after the user selects the image style, the application can read all images stored in the gallery of the terminal device, and generate an image selection interface. The user can select a target image in the image selection interface, such as image 16, which needs to be transformed in style, and click the next control 17.

[0230] Step 4: style transformation processing

[0231] After the terminal device determines that the user selects the target image, the terminal device can perform style processing on the target image through the photo editing application, for example, transforming the face in the image into another image with a classical style.

[0232] Step 5: generating an image

[0233] After the terminal device generates an image with the corresponding style, the terminal device can display the image after style transformation, as shown in (d) in FIG. 1. The user can choose to save the image after style transformation to the gallery, such as clicking the "save" control 18, or can choose to set the image as a wallpaper, such as clicking the "set wallpaper" control 19. The user can choose to click the corresponding control according to the actual needs of the user.

[0234] Although the above application can perform style transformation on the image selected by the user to improve the interestingness and richness of the image, the above operation steps are complex, especially when the number of images in the gallery is large, the user needs to spend a lot of time selecting images. Generally, a gallery often stores hundreds or thousands of images. If the thumbnail size of each image in the selection interface is small, although the number of images on the same screen increases, the time required by the user to distinguish each image will increase. If the size of the thumbnail of each image in the selection interface is large, the user needs to repeatedly swipe to select the target image.

[0235] In addition, the gallery often contains images that are not suitable for AI image processing, but as shown in (c) in FIG. 1, the image 20 is a solid color background image, and the image style selected by the user is "classical style". The image 20 does not have an object for style transformation, and the application program cannot perform style transformation on this type of image. For example, image 21 has a low resolution and obvious mosaic, which cannot meet the image quality requirements of the application, and the user will also not choose this type of image for style transformation. As can be seen, although the gallery contains a large number of images, not all images are suitable for AI image processing, and this type of image is still retained in the image selection interface, occupying unnecessary display area, thereby increasing the difficulty of selecting the target image for the user and reducing the efficiency of image selection.

[0236] Embodiment one:

[0237] In order to solve the problems existing in the image processing technology, the embodiment of the present application provides an image processing method, which can filter the images in the image library through the preset first constraint condition to obtain the first images used for AI image generation processing, and display the filtered first images in the image selection interface, so that the images in the image library can be filtered before the user initiates the operation of triggering the AI image processing function, and the invalid images that do not meet the AI image processing function can be avoided in the image selection interface, thereby improving the efficiency of the user selecting the target image and reducing the difficulty and efficiency of image selection. The image processing method can be applied to a terminal device with a display module, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart watch and the like, and the user can display the filtered first images in the image library through the display module, and then the user can select the target image for AI image processing through the interactive module on the terminal device, so as to improve the diversity and interest of the image.

[0238] The AI image generation processing in the embodiment of the present application can be specifically realized by the artificial intelligence generated content (AIGC) technology.

[0239] In the process of AI image processing of the images in the image library by the user, there are at least two stages, which are respectively a preprocessing stage and a style transformation stage. For example, FIG. 2 shows a flowchart of AI image processing provided by an embodiment of the present application. Referring to FIG. 2, the user can start an application with AI image processing function through the terminal device, and when the terminal device receives the start of the related application, the preprocessing stage 21 is entered, that is, the preprocessing operation is performed on the image library in the terminal device. The preprocessing operation includes image filtering 211 operation. In some implementations, the preprocessing operation also includes secondary composition operation 212.

[0240] After the preprocessing operation of the image library is completed, the terminal device can generate an image selection interface, and the first images filtered in the image selection interface can be displayed. The user can select one or more first images as target images for AI image processing operation in the image selection interface. After the user completes the image selection, the second stage of the AI image processing flow, that is, the AI image processing stage 22 is entered. The AI image processing stage 22 includes the operations of determining the image style type 221 and controlling the processing result 222, so that the second image after AI image processing of the target image can be obtained.

[0241] In this embodiment, through the correlation operation of the above two stages, not only can the invalid image that cannot be used for AI image processing be avoided from being displayed on the image selection interface, thereby improving the efficiency of the user selecting the target image, but also the appropriate image style type can be matched according to the image selected by the user, and the processing effect of the final output second image is guaranteed through the processing result control operation, while taking into account the diversity of the style type and the controllability of the processing result, thereby improving the use experience of the AI image processing function.

[0242] The specific implementation process of each operation in each stage of the above AI image processing process is described below:

[0243] Stage 1: Preprocessing stage

[0244] Exemplarily, FIG. 3 shows an implementation flowchart of the method for image processing provided by an embodiment of the present application in the preprocessing stage. Referring to FIG. 3, in the preprocessing stage, the method for image processing provided by the embodiment of the present application specifically includes the following steps:

[0245] In S301, a first operation initiated by a user in a first application is received, and the first operation is an operation of triggering display of a list of images satisfying a first constraint condition on an image selection interface.

[0246] In this embodiment, the above first application is specifically an application program having an AI image processing function, or an application program capable of realizing an AI image processing function through a server. Exemplarily, the above first application can be a beauty application, such as “Meitu Xiu Xiu TM ”, “Meiyan Camera TM ”, etc.

[0247] Exemplarily, the above first application can be a wallpaper application or a theme application, wherein the theme application can be used to set a wallpaper in a theme. Taking the theme application as an example, the theme application can also perform AI image processing on the target image selected by the user, and the image obtained through AI image processing in the theme application can be added to the wallpaper library to provide a plurality of wallpapers having strong correlation. For example, the theme application can set the target image selected by the user as a wallpaper in a screen-off state, and set the second image obtained by performing AI image processing on the target image as a wallpaper of the terminal device in different screen-on scenarios.

[0248] In some scenarios, the terminal device can be a system application to which the above AI image processing function can be added, for example, a photo album application or a wallpaper management application in the terminal device can be added with a functional control of AI image processing, so that the user can realize AI image processing in the local system application without installing other applications, thereby improving the AI image processing. In some implementations, the above system application can realize AI image processing through a server.

[0249] In this embodiment, when the user needs to perform AI image processing, the first operation can be initiated through the first application to trigger the display of an image list that can be used for AI image generation processing on the image selection interface of the first application. For example, when the user clicks on the photo editing application, an operation interface including a "select image" control can be opened, and the first operation can be clicking on the "select image" control to display the image selection interface in the photo editing application.

[0250] For example, if the terminal device is a smartphone, the first operation can be clicking on the icon control of the first application with AI image processing function, such as clicking on the icon control 11 in (a) of FIG. 1, thereby starting the corresponding application program. In the case of a smartphone terminal device, the first operation can be a touch operation.

[0251] For example, if the terminal device is a notebook computer, the first operation can be moving the cursor displayed on the screen to the icon shortcut of the first application with AI image processing function by controlling the mouse, and double-clicking on the icon shortcut, thereby starting the corresponding application program. In the case of a notebook computer terminal device, the first operation can be a keyboard and mouse operation.

[0252] In S302, at least one first image is determined from the gallery in response to the first operation; the first image is an image in the gallery that meets the first constraint condition; the first constraint condition is used to filter images for AI image processing.

[0253] In this embodiment, after receiving the first operation initiated by the user in the first application, the terminal device can perform image filtering on the images stored in the gallery of the terminal device according to the preset first constraint condition before opening the image selection interface corresponding to the first application, thereby obtaining images for AI image processing.

[0254] In some implementations, in order to improve the operation efficiency of the gallery filtering, the terminal device can construct a corresponding image feature library for the images in the gallery. Specifically, FIG. 4 shows an implementation flowchart for constructing an image feature library according to an embodiment of the present application. Referring to FIG. 4, the above-mentioned method of constructing an image feature library specifically includes:

[0255] In S41, the terminal device acquires any image in the gallery.

[0256] In S42, the terminal device determines the feature label of any image in the gallery through a feature extraction algorithm.

[0257] In this embodiment, the terminal device can be provided with one or more feature dimensions. Exemplarily, the feature dimensions include: a face feature dimension, an image quality feature dimension, a pose feature dimension, an aesthetic evaluation dimension, etc.

[0258] The face feature dimension can be used to determine whether the image contains a face, and in the case of containing a face, determine the number of faces, the proportion of faces, etc.

[0259] The image quality dimension can be used to determine quality-related index parameters of the image, such as resolution, sharpness, brightness, etc.

[0260] The pose feature dimension can be used to determine the pose information of the foreground object in the image, such as the torso pose, the hand pose, the face pose, etc.

[0261] The aesthetic evaluation dimension can be used to determine the aesthetic index calculated based on a preset aesthetic evaluation algorithm.

[0262] In this embodiment, different feature dimensions can correspond to one feature extraction algorithm, or one feature extraction algorithm can be used to extract one or more feature dimensions, which can be determined according to actual conditions. When the terminal device adds a new image in the gallery, the image can be imported into the above-mentioned feature extraction algorithm, thereby generating the feature label corresponding to the image.

[0263] In S43, based on the feature labels corresponding to each image in the gallery, the image feature library corresponding to the gallery is constructed.

[0264] In this embodiment, after the terminal device determines the feature label corresponding to each image, the correspondence between the feature label and the image can be established, and the image feature library is determined based on all the correspondences.

[0265] In S44, the terminal device can match the feature labels corresponding to the image in the image feature library with the first constraint condition, to realize image screening.

[0266] In this embodiment, the terminal device can match the feature labels recorded in the image feature library with the first constraint condition, to determine whether the image satisfies the first constraint condition. If each feature label in the image satisfies the first constraint condition, the image is identified as the first image, and is added to the image list of the selected image interface. Otherwise, if a feature label in the image does not satisfy the first constraint condition, the image is not added to the image list of the selected image interface.

[0267] In some implementations, the first constraint condition can be one of the following conditions or a combination of two or more of the following conditions:

[0268] Condition 1.1: the number of foreground objects is within a preset number range. In order to improve the effect and accuracy of AI image processing, the number range can be no more than 1, preferably, the number of foreground objects is 1.

[0269] Condition 1.2: the object pose of the foreground object is within a preset pose range. The object pose can be a face pose, for example, if the first image needs to contain facial features, the face pose can be within a preset pose angle range, for example, the face pose angle is between-30° and 30°, or the object pose can also be a body pose, for example, the body pose needs to be a standing pose or a sitting pose.

[0270] Condition 1.3: the image quality index is within a preset index range. In order to meet the quality requirements of AI image processing, that is, to avoid the generated image being too blurred or unable to accurately identify the contour of the foreground object, the image quality index of the image to be processed by AI needs to be within a preset range. The image quality index can include at least one of image resolution, image brightness value, foreground object clarity, and key part clarity of the foreground object. For example, the image resolution is required to be greater than a preset resolution threshold, and the image brightness value is required to be within a preset brightness range to avoid the image being too bright or too dark.

[0271] The clarity of the foreground object can be represented by the resolution of the image in the circumscribed rectangular region of the foreground object, or by the image size of the image in the circumscribed rectangular region of the foreground object. The clarity of the key part of the foreground object can be represented by the resolution of the key part in the image, or by the image size of the image in the circumscribed rectangular region of the key part of the foreground object. The key part of the foreground object can be the face, head or upper body of the foreground object.

[0272] Exemplarily, FIG. 5 shows a schematic diagram of image screening by the first constraint condition according to an embodiment of the present application. Referring to FIG. 5, the first constraint condition includes four dimension conditions, which are a face feature dimension, an image quality dimension, a face posture dimension, and a body posture dimension. The constraint condition corresponding to the face feature dimension is that the image contains a face and a single person. The constraint condition corresponding to the image quality dimension is that the resolution is not less than 300 dots per inch (dpi) and the brightness value is greater than 125. The constraint condition corresponding to the face posture dimension is that the face region ratio is not less than 1 / 15, the face completeness is greater than 70%, the face posture angle is between -30° and 30°, the face expression is within a preset range, and the preset range is [smile, calm]. The constraint condition corresponding to the body posture dimension is that the trunk posture is within a preset first posture range, the hand posture is within a preset second posture range, and the limb posture is within a preset third posture range.

[0273] It should be noted that the values of the respective feature dimensions in the first constraint condition can be set according to actual conditions, and the above values are only used for example description, and do not limit the implementation parameters of the embodiment.

[0274] The terminal device can match the respective dimension conditions in the first constraint condition according to the labels of the image in the image feature library. For example, the feature labels corresponding to image 1 in FIG. 5 are {“portrait” “single person” “resolution 600 dpi” “brightness 175” “face ratio 1 / 4” “face completeness 85%” “face posture angle 10°” “laughing”…}. The terminal device can match the respective feature labels with the constraint conditions of the corresponding dimensions, and can determine that the feature label of the face feature dimension in the image 1 matches the constraint condition corresponding to the face feature dimension in the first constraint condition. Similarly, the feature label of the image quality dimension in the image 1 also matches the constraint condition corresponding to the image quality dimension in the first constraint condition. However, the expression label in the feature label of the face posture dimension in the image 1 does not match the expression range in the face posture dimension in the first constraint condition. Therefore, the image 1 is determined to not match the first constraint condition, and the image 1 is not added to the image set. The feature labels corresponding to the image 2 are {“portrait” “single person” “resolution 600 dpi” “brightness 175” “face ratio 1 / 4” “face completeness 85%” “face posture angle 10°” “smile”…}, and each feature label matches the first constraint condition. At this time, the image 2 can be identified as the first image, and is added to the image set.

[0275] In some implementations, the first constraint condition is determined according to an application that provides the AI image processing function. For example, the application can not only perform AI image processing on an image with a human face in the foreground, but also perform AI image processing on an image with a pet in the foreground. For example, a partial pet photo application, the face feature dimension in the first constraint condition can be adjusted, which can be changed to a face feature dimension, and the corresponding range includes a human face or a pet face, and other conditions can also be adjusted accordingly. For example, an application has an image repair function, that is, the resolution requirement of the image is low, and the pixel points can be completed. The lower limit value of the resolution range in the first constraint condition can also be reduced, such as a resolution of not less than 100 dpi. Based on this, the terminal device can determine the first constraint condition corresponding to the first application initiated by the user according to the first operation, and perform image screening through the first constraint condition corresponding to the first application to obtain a candidate image for AI image generation processing of the first application, and determine an image list in the image selection interface based on the first image.

[0276] In some implementations, the first constraint condition is determined according to an application that provides the AI image processing function. For example, the application can not only perform AI image processing on an image with a human face in the foreground, but also perform AI image processing on an image with a pet in the foreground. For example, a partial pet photo application, the face feature dimension in the first constraint condition can be adjusted, which can be changed to a face feature dimension, and the corresponding range includes a human face or a pet face, and other conditions can also be adjusted accordingly. For example, an application has an image repair function, that is, the resolution requirement of the image is low, and the pixel points can be completed. The lower limit value of the resolution range in the first constraint condition can also be reduced, such as a resolution of not less than 100 dpi. Based on this, the terminal device can determine the first constraint condition corresponding to the first application initiated by the user according to the first operation, and perform image screening through the first constraint condition corresponding to the first application to obtain a candidate image for AI image generation processing of the first application, and determine an image list in the image selection interface based on the first image.

[0277] Method 1: online acquisition

[0278] In this embodiment, if the terminal device can access the Internet, the terminal device can send an acquisition request to the server corresponding to the first application that provides the AI image processing function. The server can send the first constraint condition corresponding to the first application to the terminal device. Since the screening condition of the first application for the image can be changed according to the version update or algorithm adjustment of the first application, based on this, the terminal device can send the acquisition request to the server of the first application to obtain the first constraint condition corresponding to the application when receiving the first operation initiated by the user, or after the first application is started, and then screen the images in the image gallery through the first constraint condition.

[0279] Method 2: offline acquisition

[0280] In this embodiment, if the terminal device cannot access the Internet temporarily, the terminal device can screen the images in the image gallery through the locally stored first constraint condition. It should be noted that the terminal device can be installed with multiple first applications having AI image processing function. In this case, the terminal device can store the first constraint conditions corresponding to different first applications respectively. When the user initiates the first operation on a certain first application, the image screening can be performed through the locally stored first constraint condition of the first application to obtain an image list corresponding to the first application.

[0281] In some implementations, the first constraint conditions of different first applications can be multiplexed with each other when the terminal device is in an offline state. Illustratively, the terminal device has at least two first applications with AI image processing functions installed therein, which are application A and application B respectively. The terminal device stores a first constraint condition corresponding to application A, i.e., condition A. When the user starts application B and the terminal device is in an offline state, the first constraint condition corresponding to application B, such as condition B, cannot be obtained immediately. In this case, the terminal device can filter the images in the image gallery based on condition A, i.e., the image list displayed in the image selection interface in application B is based on the filtering result of condition A. Subsequently, when the terminal device accesses the Internet again, condition B corresponding to application B can be obtained and stored. Subsequently, when application B is used again, the images in the image gallery can be filtered based on condition B.

[0282] Further, as another embodiment of the present application, the terminal device can further perform secondary composition on the first images that do not satisfy the second constraint condition in the first images before determining the first images and displaying the image selection interface, so that the first images displayed in the image selection interface all satisfy the second constraint condition. Illustratively, FIG. 6 shows a specific implementation flowchart of S302 in the image processing method according to an embodiment of the present application. Referring to FIG. 6, S302 in the image processing method specifically includes S302.1 and S302.2, which are specifically described as follows:

[0283] In S302.1, at least one first image is filtered from the image gallery based on the first constraint condition; the first image is an image in the image gallery that satisfies the first constraint condition.

[0284] In this embodiment, the terminal device can filter the images in the image gallery based on the first constraint condition, and the filtered images are the first images described above. The process of filtering the images in the image gallery based on the first constraint condition can be referred to the description above, which is not repeated here.

[0285] In S302.2, if the foreground object in any first image does not satisfy the preset second constraint condition, the first image is subjected to secondary composition so that the foreground object in the first image after secondary composition satisfies the second constraint condition.

[0286] In this embodiment, the terminal device can determine whether there is a first image that does not satisfy the second constraint condition in the screened first image. If there is a second image that does not satisfy the second constraint condition, the first image can be re-composed, so that the foreground object in the second-optimized first image is in a suitable position in the image, thereby improving the processing effect of subsequent AI image processing, without the need for the user to adjust the composition again after the style transformation, reducing the operations required by the user during the AI image processing process, and improving the operation efficiency of the user.

[0287] The second constraint condition is specifically used to make the foreground object in the image in a suitable size and a suitable position. For example, after the second constraint condition is used to re-compose the image, the foreground object in the obtained image is displayed in the center and the area ratio of the foreground object is within a preset ratio range.

[0288] In some implementations, the second constraint condition can include one or a combination of the following conditions:

[0289] Condition 2.1: The area ratio of the foreground object is within a preset ratio range.

[0290] By limiting the area ratio of the foreground object, it can be ensured that the foreground object in the image after composition processing is in a clear and visible state, that is, the foreground object is not too large or too small. For example, if the foreground object is too large, it only contains the face area and cannot reflect the matching degree between the target image style and the clothing or accessories by changing the clothing or accessories, and can only adjust the makeup of the face, so the content that can be adjusted is less, thereby reducing the matching degree between the image after AI image processing and the image style type. For another example, if the foreground object is too small, it will increase the difficulty and visibility of adding image style content. For example, the image needs to be transformed into an ancient style, so a "paper umbrella" that matches the ancient style is added to the image. If the foreground object is too small, it will increase the difficulty of adding a paper umbrella and reduce the visibility of the paper umbrella in the image, thereby reducing the matching degree between the image and the image style type.

[0291] In this embodiment, the terminal device can be provided with a corresponding ratio range. The second image obtained by screening through the first constraint condition can be identified for the foreground object, and the area ratio of the foreground object in the second image is determined according to the area of the region where the foreground object is located in the second image and the total image area of the second image. Whether the area ratio is within the above-mentioned ratio range is determined to determine whether the second image satisfies the second constraint condition.

[0292] Condition 2.2: The area ratio of the key part of the foreground object is within a preset ratio range.

[0293] In this embodiment, in addition to the area ratio of the foreground object can be used as the standard for secondary composition, the area ratio of the key part of the foreground object can also be used as the standard for secondary composition, wherein the key part can include the face, such as judging whether the area ratio of the face of the foreground object in the first image is within the preset proportion range. The proportion range corresponding to the area ratio of the key part can be different from the proportion range of the area ratio of the foreground object, or can be the same, which can be set according to actual conditions, which is not limited here.

[0294] Condition 2.3: The foreground object is on the axis of the image.

[0295] Generally, when AI image processing is performed, the image with a portrait or a pet is often subjected to style transformation, that is, the visual focus of the picture is the foreground object. Based on this, in order to be able to propose the visual focus in the picture, when secondary composition is performed, it can be judged whether the foreground object in the image is displayed centrally, that is, whether the foreground object is on the axis of the image.

[0296] Condition 2.4: The specified part of the foreground object is not visible in the image.

[0297] Since in AI image processing, part of the body part is prone to abnormal transformation, for example, when the image contains fingers, after AI image processing, the output image may have multiple fingers or fewer fingers, or the finger posture is abnormal, thereby affecting the final image output effect. Therefore, in order to reduce the occurrence of the above situation, the terminal device can avoid the image to appear the specified part when performing AI image processing. The terminal device can store a list of specified parts, and can perform image recognition on the second image passing the first constraint condition, judge the part contained in the foreground object in the second image, and then judge whether the part appearing in the foreground object has the specified part, so as to be able to judge whether the second image satisfies the above condition 2.3.

[0298] In this embodiment, the terminal device can perform condition judgment on the first image screened by the second constraint condition, if the first image satisfies each condition in the second constraint condition, it can not need to perform secondary composition processing, and directly add it to the image list of the selection interface. On the contrary, if the first image does not satisfy any condition in the second constraint condition, the first image can be subjected to secondary composition, so that the first image after secondary composition satisfies all the second constraint conditions, and then the first image after secondary composition is added to the image list of the selection interface.

[0299] In some implementations, the above-mentioned secondary composition includes, but is not limited to, zooming operation, cropping operation and content expansion operation. When the terminal device performs secondary composition on the second image, one or more than one composition adjustment operation can be used to adjust the second image, and the specific operation can be determined according to actual conditions.

[0300] For example, FIG. 7 shows a composition adjustment schematic diagram when condition 2.1 is not met according to an embodiment of the present application. If the first image does not meet condition 1, referring to (a) in FIG. 7, the foreground object 1 in the image 1 is located on the left side of the axis, and the entire foreground object is not on the axis of the image. At this time, the image 1 does not meet the above-mentioned condition 2.1. In this case, the terminal device can process the image 1 through image cropping, and enlarge the image size to the screen size of the terminal device through zooming operation, so as to obtain the image 2, as shown in (b) in FIG. 7. The foreground object 1 in the adjusted image 2 is on the axis, and at this time, it can be judged that the adjusted image 2 meets the above-mentioned condition 1, and is identified as the first image.

[0301] For example, FIG. 8 shows a composition adjustment schematic diagram when conditions 2.1 and 2.2 are not met according to an embodiment of the present application. Since the first image does not meet the above-mentioned two conditions at the same time, as shown in (a) in FIG. 8, the portrait area proportion in the image 1 is small. The terminal device can first adjust the portrait area proportion in the image 1 through zooming operation, to obtain the image 2, as shown in (b) in FIG. 8. After zooming adjustment, the portrait is still not centered, and then the image 2 can be adjusted through cropping operation to obtain the image 3, as shown in (c) in FIG. 8. The portrait in the image 3 meets the two conditions of portrait centering and appropriate portrait area proportion at the same time, and at this time, the above-mentioned image 3 can be added to the image set.

[0302] In the embodiment of the present application, after the terminal device obtains the first image by screening the images in the image gallery through the first constraint condition, in order to further improve the image quality of subsequent image style processing and reduce the need for image composition adjustment again, the terminal device can perform secondary composition on the first image that does not meet the second constraint condition through the preset second constraint condition, so as to obtain the first image that meets the aesthetic requirements. The first image obtained through screening and secondary composition is added to the image list of the selection interface, and the probability of user's need for image composition adjustment after transformation is reduced.

[0303] Exemplarily, FIG. 9 shows a schematic diagram of transformation of images in a gallery in a preprocessing stage according to an embodiment of the present application. Referring to (a) in FIG. 9, before image screening, the gallery includes a plurality of images, including an image 91 of a landscape, images 92-94 of human figures, wherein the image 93 includes a plurality of human figures, and the human figures in the image 94 are small. After the terminal device screens the images in the gallery according to the first constraint condition, the image 91 of the landscape and the image 93 including a plurality of human figures are excluded, and the images screened are the image 92 and the image 94, as shown in (b) in FIG. 9. After the screening is completed, the screened images can be subjected to secondary composition. For example, the human figure area in the image 94 accounts for a small proportion, and the image 94 can be adjusted through a composition adjustment operation. Finally, the corresponding image set is obtained through screening and secondary composition, as shown in (c) in FIG. 9, the image 92 and the image 94 obtained through secondary composition. The secondary composition operation does not reduce the number of the first images screened, but adjusts the first images that do not meet the second constraint condition. The number of images obtained through secondary composition after the second constraint condition is consistent with the number of images screened based on the first constraint condition.

[0304] For ease of understanding, FIG. 10 shows a flowchart of secondary composition according to an embodiment of the present application. Referring to FIG. 10, the input of the secondary composition module is the first images screened and the screen size corresponding to the terminal device. The screen size can be used to determine whether the foreground object is centered and whether the area proportion is within a preset proportion range. Then, the foreground object in the first image can be determined through an object detection unit in the secondary composition module, and whether the foreground object in the first image meets the requirement can be determined through a second constraint condition in a composition rule unit. In the case that the second constraint condition is not met, the first image is subjected to secondary composition through a scaling unit, an image expansion unit, a cropping unit, and a rotation unit, and finally the first image after secondary composition is obtained.

[0305] In S303, display the thumbnail of the at least one first image in the selected image interface.

[0306] In this embodiment, after the terminal device filters the images in the image gallery, the terminal device obtains a corresponding image list, and displays a thumbnail of a first image in the image list in the image selection interface. For example, FIG. 11 shows a display flowchart of the first image according to an embodiment of the present application. As shown in (a) of FIG. 11, the main interface of the terminal device displays various icon controls, including an icon control 111 of "wallpaper". When the icon control 111 is clicked, the terminal device identifies that the user initiates a first operation. Before displaying the image selection interface of the wallpaper application, the terminal device can determine the image list corresponding to the image selection interface by using the image processing method provided in this embodiment, and display only the first image obtained by filtering when the interface of the wallpaper application is opened, as shown in (b) of FIG. 11.

[0307] In some implementations, if the user needs to select a corresponding function control when the wallpaper application is started for the first time, as shown in (c) of FIG. 11, the terminal device can determine the first image again when the user clicks the function control 112 of "multi-style wallpaper transformation", and display the first image in the image set again when the interface of the target image for the "multi-style wallpaper transformation" operation is selected, as shown in (b) of FIG. 11.

[0308] In some implementations, if the photo album application of the terminal device has an AI image processing function, in this case, the user can also determine the first image by using the image processing method provided in this embodiment when the interface of the photo album application is opened, and display the first image and other images that do not meet the first constraint condition in the interface of the photo album application. In order to distinguish the first image that meets the first constraint condition and the other images that do not meet the first constraint condition, the first image can be highlighted by using a preset marker in the interface of the photo album application, and the marker is used to indicate that the first image is an alternative image for AI image generation processing.

[0309] For example, FIG. 12 shows a schematic diagram of a photo album interface according to an embodiment of the present application. As shown in (a) of FIG. 12, the interface of the photo album application can display various images in the image gallery, including images that meet the first constraint condition, such as image 121 and image 122, and images that do not meet the first constraint condition, such as image 123. In order to distinguish which images can be processed by AI image processing, the first images can be marked by using a star marker, such as the star markers of the image 121 and the image 122, and the image 123 does not have a star marker.

[0310] When the user clicks on the image with the asterisk mark, such as clicking on the image 121, the corresponding preview interface is entered, as shown in (b) of FIG. 12, which includes operation controls of AI image processing, such as the control 124 of "style transformation". If the user clicks on the image without the asterisk mark, such as clicking on the image 123, the preview interface entered is as shown in (c) of FIG. 12, which does not include the control of "style transformation" described above, that is, the user cannot perform AI image processing on this type of image.

[0311] In some implementations, the first image can also be clustered to obtain a plurality of image sets, and different image sets can correspond to different objects. Specifically, when constructing the image feature library corresponding to the gallery, the image feature library described above contains object labels, which can be determined based on the face features of the foreground object in the image, that is, used to determine the object that appears in the image. For example, user A and pet B appear in a certain image, and after extracting the face features of the image, the corresponding object labels "user A" and "pet B" can be added to the image. Correspondingly, other images can also add corresponding object labels according to the objects they contain. The terminal device can divide the first image into different image sets according to the object label corresponding to the first image when determining the image set; wherein each image set can correspond to an object label.

[0312] Exemplarily, FIG. 13 shows a schematic diagram of an image set provided by an embodiment of the present application. Referring to (a) of FIG. 13, if the object label is divided based on the gender and age of the foreground object, the image set can include the image set 131 of "young men", the image set 132 of "young women", and the image set 133 of "children". Referring to (b) of FIG. 13, if the object label is divided based on the face features, the image set can include the image set 134 of "user A", the image set 135 of "user B", and the image set 136 of "pet C", etc. Specifically, the way of dividing the image set can be determined according to actual conditions, which is not limited here.

[0313] As can be seen from the above, the terminal device can filter the images in the gallery when the user needs to open the image selection interface of the application with AI image processing, so as to determine the first image that can meet the AI image processing, and display the first image in the image selection interface, thereby reducing the number of displayed images, and then reducing the difficulty of the user to select the image, thereby improving the operation efficiency of the user.

[0314] Stage 2: Style transformation stage

[0315] Exemplarily, FIG. 14 shows an implementation flowchart of the method for image processing in the style transformation stage according to an embodiment of the present application. Referring to FIG. 14, in the preprocessing stage, the method for image processing provided by the embodiment of the present application specifically includes the following steps:

[0316] In S1401, at least one second image is obtained based on a target image in the at least one first image in response to a second operation. In the embodiment, the terminal device can display the first image filtered on the image selection interface, and the user can select a target image for AI image processing from the first image. The second operation is specifically an operation of triggering the AI image generation function on the target image. Exemplarily, FIG. 15 shows a schematic diagram of the second operation according to an embodiment of the present application. Referring to (a) of FIG. 15, the interface is an image selection interface in an application with an AI image processing function, and the image selection interface can display the first image capable of AI image processing filtered by the first constraint condition. The user can select a target image for AI image processing operation in the image, for example, the user can click the image 151 in the interface as the target image for AI image processing, and after the selection is completed, the user clicks the next control 152. The terminal device recognizes that the user has completed the selection, can determine that the image 151 is the target image for AI image processing, and executes the subsequent processing flow. It should be noted that the user can also select multiple images in the interface as target images for AI image processing operation, for example, the image 151 and the image 153 can be selected at the same time, as shown in (b) of FIG. 15, and then the next control 152 is clicked. The user-selected target image can be prompted by the bold method.

[0317] The AI image generation processing on the target image specifically refers to AI image generation based on the target image to obtain a new image, such as a second image.

[0318] In some possible implementations, after the user selects the target image, a preview interface for the target image can be included, that is, after the user-selected target image is displayed, the first operation is initiated in the preview interface, that is, before S1401, the method can further include:

[0319] In S1400, the target image is displayed in response to the selection operation of the target image.

[0320] In the embodiment, the user can initiate a selection operation from the image selection interface, that is, select a target image for AI image processing from the at least one first image.

[0321] In some possible implementation manners, before displaying the thumbnail of the first image on the image selection interface, the first image can not be secondly composed, and after the user initiates the selection operation, it is determined whether the target image needs to be secondly composed through the second constraint condition. If the target image selected by the user does not meet the second constraint condition, the target image can be secondly composed, and the target image after the second composition can be displayed. The specific process of the second composition can be referred to the related description of S302.2 above, and details are not described herein again.

[0322] Exemplarily, FIG. 16 shows a schematic diagram of a second operation provided by another embodiment of the present application. After the user clicks the control of "multi-style wallpaper transformation" as shown in FIG. 11, an image selection interface as shown in (a) of FIG. 16 can be displayed, which can display the first images capable of AI image processing obtained through the first constraint condition. The user can click the image 161 in the interface as the target image for AI image processing, that is, the selection operation is initiated to the image 161. At this time, the preview interface corresponding to the target image can be displayed, as shown in (b) of FIG. 16. At this time, if the image 161 does not meet the second constraint condition, the image 161 can be secondly composed at this time, and the image 161 after the second composition can be displayed in the preview interface. If the user determines to set the image 161 as the wallpaper, the control 162 of "set as wallpaper" can be clicked, and the terminal device recognizes that the user has completed the selection, and performs subsequent processing operations.

[0323] In this embodiment, after the second operation is initiated, the electronic device can obtain at least one second image, which is obtained by processing the target image, and the processing includes AI image processing. It should be noted that the processing can be implemented by the electronic device, or can be implemented by a server.

[0324] In some possible implementation manners, FIG. 17 shows a flowchart of processing a target image based on a terminal device provided by an embodiment of the present application. Referring to FIG. 17, in the process of processing the target image to obtain a second image, in the case of implementing locally in the terminal device, S1401 further includes the following steps.

[0325] In S1701, in response to the second operation, at least one image style type corresponding to the target image is determined.

[0326] In this embodiment, when the terminal device determines the target image specified by the second operation, the image style type matched with the target image can be determined.

[0327] In some embodiments, the image style type can be determined according to a foreground object in the target image. For example, different users can correspond to different image style lists. The terminal device can determine a user identifier corresponding to the foreground object, determine the image style list corresponding to the user identifier, and select one or more image style types from the image style list as the image style type used in this processing.

[0328] In some embodiments, the image style type can also be determined according to description information of the foreground object in the target image. The terminal device can determine the foreground object in the first image, perform object recognition on the foreground object, determine the description information of the foreground object, and select an image style type matching the description information as the image style type used in processing the target image. The description information can be the age and / or gender of the foreground object. The age can be an age range to which the foreground object belongs, or a predicted age value.

[0329] In some embodiments, after the terminal device selects the target image and determines the corresponding image style type, the terminal device can directly process the target image according to the image style type, that is, perform the operation of S1702.

[0330] In some embodiments, after the terminal device selects the target image and determines the corresponding image style type, the terminal device can display the image style type matching the target image.

[0331] Exemplarily, FIG. 18 shows a schematic diagram of a foreground object and a style type according to an embodiment of the present application. Referring to (a) of FIG. 18, if the foreground object in the target image is a young woman, the matching image style type can include: ancient style, mechanical style, and Xiyu style. Referring to (b) of FIG. 18, if the foreground object in the target image is a young man, the matching image style type can include: warrior style, mech style, and scholar style. Referring to (c) of FIG. 18, if the foreground object in the target image is a child, the matching image style type can include: elf style and ancient style.

[0332] In some implementations, since the terminal device constructs a corresponding image feature library for the images in the image library, the feature labels corresponding to the images are recorded in the image feature library, and the first image is obtained by screening the image library according to the first constraint condition, that is, the feature label of the target image is also recorded in the image feature library. The terminal device can determine the description information of the foreground object in the target image according to the feature label of the target image, and then determine the image style type through the description information, without performing image recognition on the first image again to determine the foreground feature, so that the feature label in the already constructed image feature library can be directly reused, thereby improving the efficiency of image style type determination and reducing the operation amount of the terminal device.

[0333] In some implementations, the image style type matched with the target image can include multiple image style types, in which case the user can select one of the multiple image style types as a target image style type, and then the description information image can be converted into a second image matched with the target image style type selected by the user. As shown in FIG. 18, if the foreground object is a female, the user can select one of the ancient style, mechanical style, and Outer Mongolia style as the target style type, for example, select the ancient style, and then generate a second image matched with the ancient style.

[0334] In some implementations, the image style type matched with the target image can include multiple image style types, in which case the user can select two or more image style types as target image style types, and correspondingly, multiple second images with different image style types can be generated. As an example, as shown in FIG. 18, if the foreground object is a female, the user can select the ancient style and the mechanical style as the target style types, and click the “next step” control 181, and then the terminal device generates fourth images corresponding to the selected image style types, such as an ancient style fourth image and a mechanical style fourth image.

[0335] In this embodiment, the terminal device can determine the image style type corresponding to the target image according to the description information of the foreground object in the target image. The description information can be an object label in the image feature library, or the first image can be processed by a preset object recognition algorithm, for example, facial features in the first image are extracted, and the description information is generated according to the facial features. The specific way of determining the object features can be determined according to actual conditions, which is not limited herein.

[0336] In some implementations, the terminal device can display the description information of the foreground object and the image style type matched by the first image. Continuing to refer to the images shown in FIG. 16, the description information of “young woman” can be displayed, the description information of “young man” and the description information of “child” can be displayed.

[0337] In this embodiment, the terminal device can adjust the description information in response to an adjustment operation on the description information. For example, FIG. 19 shows an adjustment diagram of the description information provided by an embodiment of the present application. Referring to (a) in FIG. 19, an adjustment control 191 can be included in the interface for displaying the image style type. Since the foreground object in the image 192 is a short-haired portrait, the terminal device can identify it as a young man, but in fact the object being photographed is a woman, and the description information needs to be adjusted. At this time, the user can click the adjustment control 191, and then a corresponding attribute adjustment interface can be displayed, as shown in (b) in FIG. 19. The user can edit the attributes from the related controls in the adjustment interface, for example, adjust the corresponding gender through the gender adjustment control 193, and adjust the corresponding age type through the age category control 194. Alternatively, in addition to adjusting the description information through a selection operation, the description information can also be input through text input. For example, the user can click the direct input control 195 to input the description information set by the user.

[0338] Since the above is a gender recognition operation, the user can click the gender adjustment control 193 to select the correct gender, and complete the adjustment operation by clicking the “complete” control 196 after the adjustment is completed. At this time, the terminal device can determine the image style type corresponding to the target image according to the description information input by the user, as shown in (c) in FIG. 19.

[0339] In some implementations, the terminal device can also obtain the current scene information when determining the image style type corresponding to the target image. The above scene information can include weather information, time information, location information, and the like. The time information can include the time when the first operation is initiated, the date, the festival, the solar term, and the like. The terminal device can determine the image style type matched by the description information of the foreground object and the above scene information. For example, if the current weather is winter, the corresponding image style type can be “winter ancient style”; if the current date is the Qixi Festival, the corresponding image style type can be “Qixi ancient style”; if the current location of the user is Huashan, the corresponding image style type can be “mountain climbing ancient style”, so that the image obtained by subsequent AI image processing has a certain relevance with the scene information corresponding to the user when the user initiates the second operation, thereby improving the relevance between the transformed image and the scene, and also improving the diversity of the image obtained after transformation.

[0340] For example, FIG. 20 shows a schematic diagram of determining an image style type according to an embodiment of the present application. As shown in FIG. 20, the terminal device can determine at least one style keyword matching the description information of the foreground object in the target image according to the description information of the foreground object in the target image. For example, for a young woman, the corresponding style keywords can include two style keywords of “ancient style” and “Xiyu”. Then, the terminal device can obtain the scene information corresponding to the current user, so as to obtain the scene keywords related to the scene, such as the keywords related to the festival, such as “Mid-Autumn Festival”, and the keywords related to the weather, such as “sunny day”, etc. Finally, the image style type matching the target image is determined according to the above style keywords and scene keywords. Since the scene keywords can be changed according to the scene information of initiating the second operation, the purpose of dynamically updating the image style type can be achieved.

[0341] In S1702, the target image is processed based on the image style type, and the at least one second image matching the image style type is obtained.

[0342] In this embodiment, after the terminal device determines the image style type corresponding to the target image, the terminal device can process the target image through a preset AI image processing algorithm, so as to transform the target image into a second image matching the image style type. The processing includes AI image processing, so as to achieve the purpose of image style transformation.

[0343] In this embodiment, the operation of the AI image processing can be implemented through a preset AI image processing model. The terminal device can input the target image requiring style transformation into the AI image processing model, and output the second image. It should be noted that different image style types can correspond to different AI image processing models. After the terminal device determines the image style type corresponding to the target image, the terminal device can process the target image through the AI image processing model corresponding to the image style type. Different image style types can also correspond to the same AI image processing model. In this case, before the terminal device inputs the target image into the AI image processing model, the terminal device can input the image style type into the AI image processing model at the same time, so as to adjust the related conversion parameters of the AI image processing model, so as to be able to output the second image of the specified image style type.

[0344] Exemplarily, FIG. 21 shows a structural schematic diagram of an image style model provided by an embodiment of the present application. The image style model can include the following units: a pose processing unit 211, a semantic understanding unit 212, a style transformation unit 213, and a quality control unit 214. The terminal device can input a target image into the pose processing unit 211 and the semantic understanding unit 212, determine the object pose and contour information of the foreground object in the target image through the pose processing unit 211, and import them into the pose correction unit to perform pose correction on the foreground object, output the pose data of the foreground object in the target image, and send the pose data to the style transformation unit 213. At the same time, the semantic understanding unit 212 can also perform semantic understanding on the target image, determine the semantic expression corresponding to the target image, such as the semantic keywords corresponding to the input target image in FIG. 21, including “snow mountain”, “young man”, “woman”, “long hair”, “T-shirt”, etc., and perform sentence integration on the above-mentioned semantic keywords through a sentence description integration algorithm. The semantic description can be expressed as “a young woman with long hair wearing a T-shirt on a snow mountain”, and then the corresponding semantic data is sent to the style transformation unit 213.

[0345] In the embodiment, the pose data obtained by the pose processing unit 211 and the semantic data obtained by the semantic understanding unit 212 can ensure that the second image obtained after AI image processing is consistent with the foreground object in the target image, can realize style diversity while retaining the personalized features of the foreground object in the target image, avoid uncontrollable generation results after style transformation, and improve the efficiency of AI image processing.

[0346] In this embodiment, the style transformation unit 213 can perform AI image processing on the target image through the pose data and the semantic data to obtain a second image of a specified image style type, so that the foreground object in the target image and the foreground object in the second image obtained by style transformation have the same characteristics in the preset characteristic dimension, and the characteristic dimension with the same characteristics is determined according to the pose data and the semantic data. For example, it is necessary to maintain the same facial pose and body pose of the foreground object in the target image and the second image, and then the facial pose and body pose of the foreground object can be determined according to the pose data, so that the foreground objects in the two images after style conversion have the same facial pose and body pose. For another example, it is necessary to maintain the same headwear of the foreground object in the target image and the second image, and then the headwear is determined to be a hat in the semantic description "child wearing a hat" corresponding to the semantic data, so that the hat worn by the foreground object in the target image can be retained in the second image, so that the two images have the same headwear. By importing the style transformation unit 213 through the pose data and the semantic data, the result of AI image processing can be controlled, and consistency of the specified characteristic dimension of the foreground object can be ensured while meeting the image diversity.

[0347] It should be noted that the image style module can directly output the image output by the style transformation unit 213, that is, the image output by the style transformation unit 213 is taken as the second image, that is, the quality control processing of the second image by the quality control unit 214 can be omitted, and the second image output by the style transformation unit 213 can be directly displayed and stored.

[0348] In this embodiment, the style transformation unit 213 can input the second image after style transformation into the quality control unit 214, and perform quality control processing on the second image after style transformation through the quality control unit 214, including pose abnormality processing, contour abnormality processing, color abnormality processing, and light and shadow abnormality processing. If it is detected that the second image has conversion abnormalities (such as pose abnormalities, contour abnormalities, color abnormalities, or light and shadow abnormalities), the region with conversion abnormalities in the second image is subjected to quality control processing, and the second image after quality control processing is output; if it is detected that the second image does not have conversion abnormalities, the second image of the style transformation unit 213 is output. Since there may be conversion abnormalities in the process of style transformation, the above-mentioned style transformation unit 214 can perform secondary abnormality detection, improve the accuracy of AI image processing, and reduce the probability of abnormal images that do not conform to aesthetic sense and common sense cognition.

[0349] Exemplarily, if the target image input to the AI image processing unit 213 contains a finger of the foreground object, after style conversion, multiple fingers or fewer fingers may appear, or if the target image contains the head of the foreground object, after style conversion, multiple heads or multiple faces may appear, and the above abnormal situations are all incorrect situations that do not conform to common sense cognition. The quality control unit 214 can be used for secondary abnormality detection, for example, the contour recognition algorithm is used to extract the contour data of the foreground object in the second image, and whether there is a contour abnormality such as multiple fingers, fewer fingers, multiple heads, and multiple faces is determined according to the contour data, and the quality control processing is performed when the contour abnormality occurs.

[0350] In some implementations, the quality control unit 214 can also include a posture detection algorithm. The posture of the foreground object in the second image of the foreground object in the style conversion unit 213 is determined by posture recognition, and whether the object posture meets the preset posture condition is determined, so that the posture deformity after AI image processing can be identified. If the object posture of the foreground object in the second image does not meet the posture condition, the posture of the foreground object can be adjusted, and the second image after posture adjustment is output.

[0351] In some implementations, the quality control unit 214 can also be configured with a sensitive content recognition algorithm. When the second image input by the AI image processing unit 214 is imported into the quality control unit 214, the quality control unit 214 can determine whether the second image contains any content in the preset sensitive content list, such as yellow, violence, and religious sensitive content, by the sensitive content recognition algorithm. If the quality control unit 214 detects that the second image contains sensitive content, the region of the sensitive content in the second image can be adjusted so that the output second image does not contain sensitive content.

[0352] It should be noted that the above contour abnormality processing, posture abnormality processing, and sensitive content processing can be processed in parallel, or one or more of them can be processed in sequence based on a preset processing order. The specific processing can be set according to the actual situation, which is not limited here.

[0353] In some implementations, in order to achieve the controllable purpose of AI image processing results, the posture processing unit 211 can use one or a combination of the following two ways to process the input target image and send the processed posture data to the style conversion unit 213. The two ways can include:

[0354] Method 1: Posture control

[0355] In this embodiment, the posture processing unit 211 can determine the posture type of the foreground object in the input target image through posture recognition of the foreground object. If the posture type of the foreground object is within the preset posture adjustment range, the posture processing unit 211 can adjust the posture of the foreground object in the target image, thereby ensuring that the posture of the foreground object in the image is within a controllable range when the image style conversion is performed, which can not only increase the number of templates that can be selected when the image style conversion is performed, but also improve the accuracy of subsequent algorithm processing.

[0356] Case 1: The foreground object in the target image has a hand

[0357] In this embodiment, the posture processing unit 211 can obtain the contour information and posture information of the foreground object in the target image. The contour information can be used to determine whether the hand of the foreground object appears in the target image. If the hand of the foreground object appears in the target image, that is, the contour information includes the hand contour, the posture of the hand of the foreground object in the target image can be adjusted.

[0358] For example, FIG. 22 shows an adjustment diagram of the hand of the foreground object in the image according to an embodiment of the present application. As shown in FIG. 22, the hand of the object 1 in the image 1 is in a raised hand posture. Since the image with the hand is prone to have multiple fingers, fewer fingers, and other abnormal situations after AI image processing, or the hand posture may not conform to common sense. Therefore, in order to reduce the probability of the occurrence of the above abnormal situations, when the posture processing unit 211 detects that the hand of the foreground object appears in the target image and the hand posture is a raised hand posture, the hand posture can be adjusted to a vertical downward posture, for example, the hand of the object 1 in the image 2 is adjusted to a vertical downward posture, and the postures of other parts remain unchanged. Since the posture of the object 1 in the image 1 is adjusted by the posture processing unit 211, the hand posture is changed from the raised hand posture to the vertical downward posture, the fingers are in a close posture or invisible, and the posture data after the adjustment is sent to the style conversion unit 213, so that the foreground object in the image output by the style conversion unit 213 is generated based on the adjusted posture, for example, the hand posture of the object 1 in the image 3 is the same as that of the object 1 in the image 2, both of which are vertical downward postures, rather than consistent with the posture of the object 1 in the original posture (i.e., the image 1). After the posture of the foreground object is adjusted by the posture processing unit 211, the style conversion unit 213 is used for processing, thereby avoiding the occurrence of multiple fingers and fewer fingers due to subsequent image style conversion.

[0359] Case 2: The hand of the foreground object in the target image has a support

[0360] In this embodiment, after the contour information of the foreground object in the target image is obtained by the posture processing unit 211, if it is determined through the contour information that the foreground object in the target image contains a hand contour, and there is a support under the hand contour, the support can be replaced. For example, the support in the target image is replaced with a support matching the image style type.

[0361] Exemplarily, FIG. 23 shows a schematic diagram of replacing the hand support of the foreground object in the image according to an embodiment of the present application. Referring to FIG. 23, there is a support under the hand of object 1 in image 1, which is the knee of object 1. In this case, the converted image style type is the ancient style type, and then a table can be selected as the replaced support, and the knee of object 1 in image 1 is replaced with a table, as shown in the support under the hand of object 1 in image 2 in FIG. 23. The posture processing unit 211 can send the target image with the replaced support to the style conversion unit 213, so that the image after the style conversion contains the replaced support, as shown in the support under the hand of object 1 in image 3 in FIG. 23, which is the same as that in image 2, and is a table.

[0362] In some implementations, in the case where it is determined that there is a support under the hand, it can be judged whether the support matches the image style type to be converted. If the support under the hand of the foreground object in the target image matches the image style type, the support can be kept, that is, the support replacement is not performed; otherwise, if the support under the hand of the foreground object in the target image does not match the image style type, the support can be replaced with a support matching the image style type.

[0363] Case 3: The foreground object in the target image is occluded by an occlusion

[0364] In this embodiment, after the contour information of the foreground object in the target image is obtained by the posture processing unit 211, it can be judged whether the contour of the foreground object is continuous. If the contour of the foreground object is not continuous, it indicates that the foreground object in the target image is occluded by other objects, that is, there is an occlusion, and at this time, the occlusion in the target image can be removed; otherwise, if the contour of the foreground object is continuous, it indicates that the foreground object in the first object is not occluded, and at this time, the judgment of other cases (such as the judgment of case 1 and case 2) can be performed, or the image processing can be performed by the style conversion unit 213.

[0365] Exemplarily, FIG. 24 shows a schematic diagram of removing an occluder of a foreground object in an image according to an embodiment of the present application. Referring to FIG. 24, object 1 in image 1 holds a doll 241 in hand, which occludes part of the area 242 of object 1. In this case, the doll 241 can be removed by the pose processing unit 211, and the missing area is automatically filled by the content filling algorithm, as shown in image 2 in FIG. 24, where the hand of object 1 no longer holds the doll 241, and the content of area 243 is supplemented. After subsequent image processing by the style transformation unit 213, image 3 in FIG. 24 is obtained, where the hand of object 1 in image 3 no longer holds the doll 241, i.e., the occluder is removed, thereby improving the integrity of the foreground object after image style conversion.

[0366] In the embodiment, the terminal device can control the pose of the foreground object in the input target image, so that when subsequent AI image processing is performed, the probability of conversion abnormality caused by object pose can be reduced, the diversity of the image after style transformation is ensured, and the conversion result is controllable, thereby improving the effect and accuracy of style conversion.

[0367] Mode 2: Template control

[0368] In the embodiment, the pose processing unit can extract the object pose of the foreground object in the target image, and select one candidate conversion template matching the object pose from the conversion template library as a target conversion template. Then, when the style transformation unit 213 performs image processing on the target image, the target conversion template can be used, and the corresponding image can be output. The pose of the foreground object in the image output by the target conversion template is consistent with the object pose in the target conversion template.

[0369] In some implementations, the conversion template library is determined according to the image style type required to be converted by the target image, i.e., different image style types can correspond to different conversion template libraries, so that the target conversion template selected can match the image style type corresponding to the target image.

[0370] In some implementations, the terminal device can determine the template pose corresponding to each candidate conversion template, and calculate the pose similarity between the object pose of the foreground object in the target image and the template pose, so as to select one candidate conversion template with the highest pose similarity as the target conversion template.

[0371] Exemplarily, FIG. 25 shows a schematic diagram of controlling the AI image processing result by the template according to an embodiment of the present application. Referring to FIG. 25, the object 1 in the image 1 is in a pose 1, and the conversion template library contains at least two conversion templates, which are template 1 and template 2 respectively, wherein the template pose in the template 1 is pose 2, and the template pose in the template 2 is pose 3. Since the similarity between the pose 2 in the template 1 and the pose 1 of the object 1 in the image 1 is high, the template 1 can be determined as the target conversion template. Then, the AI image processing is performed on the image 1 by the template 1, and the image 2 is obtained. Wherein, the pose 4 of the object 1 in the image 2 is the same as the pose 2 in the template 1, so that the pose of the object after conversion can be kept unchanged, the controllability of the conversion result is improved, and at the same time, the style conversion image with the same image style type as the target conversion template can be generated.

[0372] In some implementations, when generating the second image by the conversion template, the face replacement manner can be used to generate the second image, that is, the face image of the foreground object is extracted from the first image, and the face image is fused with the conversion template, so that the second image is obtained, so that the first image and the second image have the same face features.

[0373] In some implementations, when generating the second image by the conversion template, the face features of the first image can also be extracted, the face features of the foreground object of the second image are generated based on the feature vector of the face features of the first image, and the face features of the second image are fused with the conversion template to obtain the second image, so that the first image and the second image have the same face features.

[0374] In the embodiments of the present application, the terminal device can create a conversion template library, so that when performing AI image processing, a candidate conversion template with the same object pose as the foreground object in the target image can be selected as the target conversion template, so that the controllability of the conversion result can be improved. By continuously expanding and updating the number of candidate conversion templates in the conversion template library, the diversity of image style conversion can be increased.

[0375] It should be noted that when performing image style conversion, the object pose can be adjusted by the above-mentioned manner 1 according to the object pose of the foreground object in the target image, so that the style conversion result is controllable, or the target conversion template can be selected by the above-mentioned manner 2 to perform AI image processing on the target image, so that the style conversion result is controllable.

[0376] In some implementations, the terminal device can also combine manner 1 and manner 2, so that the image style conversion result is controllable. For example, FIG. 26 shows a flowchart of image style conversion according to an embodiment of the present application. Referring to FIG. 26, the hand state of object 1 in image 1 is a hand-raising posture, in which case object 1 satisfies case 1 in manner 1, and the posture of object 1 in image 1 can be adjusted by a corresponding posture adjustment manner to obtain image 2. Then, template 1 is determined as a target conversion template according to the object posture of object 1 in image 2, and image 2 is processed by AI image processing based on template 1 to obtain image 3, thereby improving the controllability of the AI image processing result.

[0377] In some implementations, if there is a large blank area in the image after style conversion, such as a pure color background, the quality judgment unit 214 can also add corresponding decorations in the blank area according to the image style type, such as adding a hat that conforms to the image style type for the foreground object, or adding decorations, such as a classical style, which can add red lanterns, city towers, drum towers, and other background objects with classical features in the background.

[0378] In another implementation, the process of processing the target image can be implemented by a server. For example, FIG. 27 shows an interaction flowchart of a terminal device and an electronic device when generating a second image based on a server. Referring to FIG. 27, S1401 can include:

[0379] In S2701, the terminal device sends an image generation instruction to the server in response to the second operation, and the image generation instruction includes the target image.

[0380] In this embodiment, the server can be a server corresponding to the first application, or a server providing an AI image processing function. The terminal device can send an image generation instruction to the server to generate a second image corresponding to the target image through the server.

[0381] In some implementations, the terminal device can send the target image selected by the user directly to the server, or send the target image obtained by secondary composition based on the second constraint condition to the server.

[0382] In some implementations, the terminal device can also determine the image style type of the target image, in which case the image generation instruction sent can also include the image style type.

[0383] In some implementations, the terminal device can further add the corresponding scene information when initiating the second operation to the image generation indication described above, and send the image generation indication to the server, so that the server generates a second image according to the scene information.

[0384] In S2702, the server processes the target image to obtain at least one second image, and the processing includes AI image generation processing.

[0385] In this embodiment, the server can process the target image, and the processing includes AI image generation processing. The implementation process of the specific processing can be referred to the related description of the processing of the target image by the terminal device in S1401, and will not be described here. For example, the server can be configured with an image style model as shown in FIG. 21, and the target image is processed by the image style model to obtain a second image. It should be noted that the above processing can further include secondary composition, replacement of support, posture adjustment processing, removal of occlusion, quality control processing and the like.

[0386] In S2703, the terminal device receives at least one second image sent by the server.

[0387] In the embodiment of the present application, the terminal device can filter the images in the image gallery to obtain at least one first image, reduce the number of user image selection, and improve the efficiency of selecting the target image. The target image which needs to be processed by the AI image generation can be obtained, and then the terminal device sends the target image to the server to complete the AI image generation processing by the server, so as to achieve the purpose of AI image generation. Since the server has strong computing power, the efficiency of AI image generation processing can be improved, and the computing pressure of the terminal device can be reduced.

[0388] In S1402, at least one second image is displayed.

[0389] In this embodiment, after the terminal device generates the second image after the style conversion of the target image, the terminal device can display the second image. For example, FIG. 28 shows a display interface of a second image according to an embodiment of the present application. As shown in (a) of FIG. 28, the interface displays the converted image 281, and further includes a save control 282 and a wallpaper setting control 283. The interface can further include a re-conversion control 284. If the user wants to save the image 281, the user can click the save control 282 to add the image 282 to the image gallery of the terminal device, or click the wallpaper setting control 283 to quickly set the image as the desktop wallpaper of the terminal device, or add the selected second image to the wallpaper gallery.

[0390] In some embodiments, the terminal device can add the image 281 to the wallpaper library of the terminal device after the user clicks the save control 282 described above. During use of the terminal device, the terminal device can update the wallpaper in the home interface and / or the lock screen interface of the terminal device by using the images stored in the wallpaper library.

[0391] In some embodiments, if the user needs to re-perform the style conversion, for example, is not satisfied with the style conversion result, the user can click the control 284 described above, so that the selection interface of the image style type can be fed back at this time, as shown in (b) of FIG. 28, the user can re-determine the image style type, and then perform the operation of AI image processing again.

[0392] In some embodiments, when determining the image style type corresponding to the target image, the terminal device can determine two or more image style types for the target image, and each image style type can output one or more second images. In this case, the terminal device can display all obtained second images, and the user can select the second image to be saved from all second images.

[0393] For example, FIG. 29 shows a schematic diagram of selection of a second image according to an embodiment of the present application. Referring to FIG. 29, the terminal device can generate multiple images with different image style types according to the input image 1, such as image 291 and image 292. The user can select one or more of them to save according to the needs, and the selected image can be displayed by means of a thickened border, for example, the user selects the image 291, and the border of the image 291 becomes thickened. After the user completes the selection, the user can click the save control 293 to save the selected image, for example, the image 291 described above.

[0394] As can be seen from the above, the terminal device can filter the images in the gallery to obtain the first images that can be used for AI image generation processing, and display the thumbnails of the first images in the image selection interface. Subsequently, the user can select a target image for AI image generation processing from the at least one first image, which reduces the number of images displayed in the image selection interface, thereby reducing the difficulty of image selection for the user and improving the operation efficiency of the user.

[0395] Embodiment Two:

[0396] Corresponding to the implementation process of the method of image processing according to the above embodiment one, FIG. 30 shows a structural block diagram of an apparatus for image processing according to an embodiment of the present application. For ease of illustration, only the parts related to the embodiments of the present application are shown.

[0397] Referring to FIG. 30, the apparatus for image processing includes:

[0398] The first image determination unit 301 is configured to determine at least one first image from a gallery in response to a first operation, the first image being an image satisfying a first constraint condition, the first operation being an operation of triggering display of a list of images satisfying the first constraint condition on a selection interface, and the first constraint condition being used for screening candidate images for an AI image generation process.

[0399] The image display unit 302 is configured to display a thumbnail of the at least one first image in the selection interface.

[0400] The image obtaining unit 303 is configured to obtain at least one second image based on a target image in the at least one first image in response to a second operation, the second image being obtained by processing the target image, the processing including an AI image generation process, and the target image being the first image selected by the second operation.

[0401] Optionally, the first image determination unit includes:

[0402] The second image determination unit is configured to screen the at least one first image from the gallery based on the first constraint condition.

[0403] The secondary composition unit is configured to perform secondary composition on the first image if a foreground object in any of the screened first images does not satisfy a preset second constraint condition, so that the foreground object in the first image after the secondary composition satisfies the second constraint condition.

[0404] Optionally, in a case where a foreground object in the target image does not satisfy a preset second constraint condition, the processing further includes performing secondary composition on the target image so that the foreground object in the target image after the secondary composition satisfies the second constraint condition.

[0405] Optionally, in a case where a foreground object in the target image does not satisfy a preset second constraint condition, the apparatus further includes:

[0406] The image selection unit is configured to perform secondary composition on the target image in response to a selection operation on the target image, so that a foreground object in the target image after the secondary composition satisfies the second constraint condition.

[0407] The preview unit is configured to display the target image after the secondary composition, and the second operation is an operation performed based on the target image after the secondary composition.

[0408] Optionally, the composition adjustment operation includes at least one of a zoom operation, a crop operation, a rotation operation, and a content expansion operation.

[0409] Optionally, the second constraint condition comprises at least one of the following:

[0410] The area proportion of the foreground object is within a preset proportion range.

[0411] The area proportion of the key part of the foreground object is within a preset proportion range.

[0412] The foreground object is on an axis of the first image.

[0413] The key part of the foreground object is on an axis of the first image.

[0414] A specified part of the foreground object in the first image is invisible.

[0415] Optionally, the first constraint condition comprises at least one of the following:

[0416] The number of foreground objects contained in the first image is within a preset number range.

[0417] The object pose of the foreground object is within a preset pose range, and the object pose comprises a face pose and / or a body pose of the foreground object.

[0418] An image quality index of the first image is within a preset index range, and the image quality index comprises at least one of the following: image resolution, image brightness value, clarity of the foreground object, and clarity of the key part of the foreground object.

[0419] Optionally, the image display unit comprises:

[0420] A gallery display unit, configured to display thumbnails of a plurality of images in the image selection interface; the plurality of images comprise the at least one first image; the first image comprises a mark; and the mark is used to indicate that the first image is an alternative image for AI image generation processing.

[0421] Optionally, the image style type of the second image is determined based on a foreground object in the target image.

[0422] Optionally, the image style type is determined based on description information of a foreground object in the target image.

[0423] Optionally, the image style type is determined based on a foreground object of the target image and scene information corresponding to a user of the terminal device when the second operation is initiated.

[0424] Optionally, the description information is obtained by performing object recognition on the target image; or

[0425] The description information is obtained after a user adjusts an identification result of the target image; and the identification result is generated by performing object identification on the target image.

[0426] Optionally, the second image is generated according to a first pose of a foreground object in the target image and the image style type; and a second pose of the foreground object in the second image is the same as or different from the first pose.

[0427] Optionally, the second pose is obtained by adjusting a pose of a specified part in the first pose when the first pose satisfies a preset pose adjustment condition; and the specified part in the second pose does not satisfy the pose adjustment condition.

[0428] Optionally, the specified part is a hand; and the pose adjustment condition includes at least one of the following:

[0429] The hand in the first pose is in a raised hand pose;

[0430] The hand in the first pose is in a visible state;

[0431] The distance between the hand and a face in the first pose is within a preset distance range.

[0432] Optionally, when a first support object exists below the hand in the first pose, the processing further includes: replacing the first support object in the target image with a second support object.

[0433] Optionally, the first pose is used to determine a conversion template matched with the image style type; and the AI image generation processing is performed on the target image through the conversion template.

[0434] Optionally, when an occlusion object exists in the target image and occludes the foreground object, the processing further includes: removing the occlusion object in the target image.

[0435] Optionally, the processing further includes a quality control processing, which is performed after the AI image generation processing.

[0436] Optionally, the quality control processing includes at least one of the following: pose abnormality processing, contour abnormality processing, color abnormality processing, and light and shadow abnormality processing.

[0437] Optionally, the image obtaining unit includes:

[0438] An indication sending unit is configured to send an image generation indication to a server, where the image generation indication includes the target image.

[0439] An image receiving unit is configured to receive the at least one second image sent by the server.

[0440] Optionally, the image generation instruction further includes description information of a foreground object of the target image, and the description information is used to determine an image style type corresponding to the at least one second image to be generated.

[0441] Optionally, the image generation instruction further includes scene information corresponding to a user of the terminal device, and the scene information is used to determine the at least one second image.

[0442] Optionally, the image obtaining unit includes:

[0443] A style type determining unit is configured to determine at least one image style type corresponding to the target image in response to the second operation.

[0444] A style converting unit is configured to perform the processing on the target image based on the image style type, to obtain the at least one second image matching the image style type.

[0445] In a possible implementation of the first aspect, the image obtaining unit includes:

[0446] A multi-image displaying unit is configured to display a plurality of second images, and the plurality of second images include at least two second images of different image styles.

[0447] A wallpaper adding unit is configured to add part or all of the plurality of second images to a wallpaper library in response to a third operation.

[0448] Optionally, the method is executed by a first application in the terminal device.

[0449] FIG. 31 is a structural schematic diagram of a terminal device according to an embodiment of the present application. As shown in FIG. 31, the terminal device 31 according to the embodiment includes at least one processor 310 (only one processor is shown in FIG. 31, and the number of processors can match the number of chips actually included in the terminal device in the embodiment), a memory 311, and a program 312 stored in the memory 311 and executable on the at least one processor 310, wherein the processor 310 executes the program 312 to implement the steps in the method embodiments of any of the above image processing methods.

[0450] The terminal device 31 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc. The terminal device can include, but is not limited to, a processor 310, a memory 311. Those skilled in the art can understand that FIG. 31 is only an example of the terminal device 31, and does not constitute a limitation on the terminal device 31, and can include more or fewer components than the diagram, or combine certain components, or different components, for example, can also include an input / output terminal device, a network access terminal device, etc.

[0451] The processor 310 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or can also be any conventional processor.

[0452] The memory 311 can be an internal storage unit of the terminal device 31 in some embodiments, for example, a hard disk or a memory of the terminal device 31. The memory 311 can also be an external storage terminal device of the terminal device 31 in other embodiments, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 311 can include both the internal storage unit and the external storage terminal device of the terminal device 31. The memory 311 is used to store an operating system, an application program, a boot loader, data, and other programs, for example, program codes of the programs, etc. The memory 311 can also be used to temporarily store data that has been output or will be output.

[0453] It should be noted that the information interaction, execution process, etc. between the above apparatuses / units, since based on the same concept as the method embodiments of the present application, the specific functions and the brought technical effects can be referred to the method embodiments part, and will not be described here.

[0454] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit or module in the embodiment can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit, and the integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific name of each functional unit or module is only for convenient distinction, and does not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0455] The embodiment of the present application further provides a terminal device, which comprises at least one processor, a memory and a computer program stored in the memory and executable on the at least one processor, and the processor implements the steps in any of the method embodiments described above when executing the computer program.

[0456] The embodiment of the present application further provides a readable storage medium, which stores a program, and the program is executed by a processor to implement the steps in any of the method embodiments described above.

[0457] The embodiment of the present application provides a program product, which, when running on a terminal device, enables the terminal device to implement the steps in any of the method embodiments described above.

[0458] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program. The computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the photographing device / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.

[0459] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0460] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method of image processing, characterized by, The method is applied to a terminal device and includes the following steps: In response to a first operation, at least one first image is determined from a gallery; the first image is an image meeting a first constraint condition; the first operation is an operation of triggering display of a list of images meeting the first constraint condition on a selection interface; the first constraint condition is used to screen candidate images for AI image generation processing; A thumbnail of the at least one first image is displayed on the selection interface; In response to a second operation, at least one second image is obtained based on a target image in the at least one first image; the second image is obtained by processing the target image; the processing includes AI image generation processing; the target image is selected by the second operation from the first images.

2. The method of claim 1, wherein, The step of determining at least one first image from a gallery in response to a first operation includes the following steps: The at least one first image is screened from the gallery based on the first constraint condition; If a foreground object in any first image screened does not meet a preset second constraint condition, the first image is subjected to secondary composition so that the foreground object in the first image after secondary composition meets the second constraint condition.

3. The method of claim 1, wherein, In the case that a foreground object in the target image does not meet a preset second constraint condition, the processing further includes secondary composition of the target image so that the foreground object in the target image after secondary composition meets the second constraint condition.

4. The method of claim 1, wherein, In the case that a foreground object in the target image does not meet a preset second constraint condition, before the step of obtaining at least one second image based on a target image in the at least one first image in response to a second operation, the method further includes the following steps: In response to a selection operation on the target image, the target image is subjected to secondary composition so that the foreground object in the target image after secondary composition meets the second constraint condition; The target image after secondary composition is displayed; the second operation is an operation performed based on the target image after secondary composition.

5. The method according to any one of claims 2-4, characterized in that, The secondary composition includes at least one of a zoom operation, a cropping operation, a rotation operation and a content expansion operation.

6. The method according to any one of claims 2-4, characterized in that, The second constraint condition includes at least one of the following: A region proportion of the foreground object is within a preset proportion range; A region proportion of a key part of the foreground object is within a preset proportion range; The foreground object is on an axis of the first image; A key part of the foreground object is on an axis of the first image; A specified part of the foreground object is invisible in the first image.

7. The method according to any one of claims 1 to 6, characterized in that, The first constraint condition includes at least one of the following: A number of foreground objects contained in the first image is within a preset number range; An object posture of the foreground object is within a preset posture range, the object posture including a face posture and / or a body posture of the foreground object; An image quality indicator of the first image is within a preset indicator range, the image quality indicator including at least one of the following: image resolution, image brightness value, definition of the foreground object, definition of a key part of the foreground object.

8. The method according to any one of claims 1 to 7, characterized in that, The displaying the thumbnail of the at least one first image in the image selection interface comprises: The displaying the thumbnails of a plurality of images in the image selection interface; the plurality of images comprises the at least one first image; the first image comprises a mark; the mark is used to indicate that the first image is an alternative image for an AI image generation process.

9. The method according to any one of claims 1 to 8, characterized in that, The image style type of the second image is determined based on a foreground object in the target image.

10. The method of claim 9, wherein, The image style type is determined based on description information of a foreground object in the target image.

11. The method according to claim 9 or 10, characterized in that, The image style type is determined based on a foreground object of the target image and scene information corresponding to a user of the terminal device when the second operation is initiated.

12. The method of claim 10, wherein, The description information is obtained by performing object recognition on the target image; or The description information is obtained by adjusting an identification result of the target image by a user; the identification result is generated by performing object recognition on the target image.

13. The method according to any one of claims 9-12, characterized in that, The second image is generated according to a first pose of a foreground object in the target image and the image style type; a second pose of the foreground object in the second image is the same as or different from the first pose.

14. The method of claim 13, wherein, The second pose is obtained by adjusting a pose of a specified part in the first pose under a condition that the first pose satisfies a preset pose adjustment condition; the specified part in the second pose does not satisfy the pose adjustment condition.

15. The method of claim 14, wherein, The specified part is a hand; and the pose adjustment condition comprises at least one of the following: The hand in the first pose is in a raised hand pose; The hand in the first pose is in a visible state; The distance between the hand and a face in the first pose is within a preset distance range.

16. The method of claim 13, wherein, In a case that a first support object exists below the hand in the first pose, the processing further comprises: replacing the first support object in the target image with a second support object.

17. The method of claim 13, wherein, The first pose is used to determine a conversion template matched with the image style type; and the AI image generation process is an AI image generation process on the target image through the conversion template.

18. The method of any one of claims 1-17, wherein, In a case that an occlusion object exists in the target image and occludes the foreground object, the processing further comprises: removing the occlusion object in the target image.

19. The method according to any one of claims 1 to 18, characterized in that, The processing further comprises a quality control process, which is executed after the AI image generation process.

20. The method of claim 19, wherein, The quality control process comprises at least one of the following: a pose abnormality processing, a contour abnormality processing, a color abnormality processing, and a light and shadow abnormality processing.

21. The method of any one of claims 1-20, wherein, The obtaining the at least one second image based on a target image in the at least one first image in response to a second operation comprises: sending an image generation instruction to a server, the image generation instruction comprising the target image; receiving the at least one second image sent by the server.

22. The method of claim 21, wherein, The image generation instruction further comprises description information of a foreground object of the target image, the description information being used to determine an image style type corresponding to the at least one second image to be generated.

23. The method of claim 21 or 22, wherein, The image generation instruction further includes scene information corresponding to a user of the terminal device, and the scene information is used to determine the generation of the at least one second image.

24. The method of any one of claims 1-20, wherein, The obtaining of the at least one second image based on the target image in the at least one first image in response to the second operation includes: In response to the second operation, determining at least one image style type corresponding to the target image; The processing of the target image based on the image style type to obtain the at least one second image matching the image style type.

25. The method of any one of claims 1-24, wherein, The obtaining of the at least one second image based on the target image in the at least one first image in response to the second operation includes: Displaying a plurality of second images; the plurality of second images include second images of at least two different image style types; In response to a third operation, adding part or all of the plurality of second images to a wallpaper library.

26. The method of any one of claims 1-25, wherein, The method is executed by a first application in the terminal device.

27. A terminal device, comprising: The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to any one of claims 1 to 26 when executing the computer program.

28. A computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method according to any one of claims 1 to 26.

29. A system for image processing, characterized by The system includes a terminal device and a server; The terminal device is configured to: In response to a first operation, determining at least one first image from a gallery; the first image is an image satisfying a first constraint condition; the first operation is an operation of triggering display of a list of images satisfying the first constraint condition on a selection interface; the first constraint condition is used to filter candidate images for AI image generation processing; Displaying a thumbnail of the at least one first image in the selection interface; In response to a second operation, sending an image generation instruction to the server, the image generation instruction including a target image; the target image is the first image selected by the second operation; The server is configured to: Processing the target image to obtain at least one second image, the processing including AI image generation processing; Sending the at least one second image to the terminal device; The terminal device is further configured to receive the at least one second image sent by the server.

30. The system of claim 29, wherein, The image generation instruction further includes description information of a foreground object of the target image, and the description information is used to determine an image style type corresponding to the at least one second image to be generated.

31. The system of claim 29 or 30, wherein, The image generation instruction further includes scene information corresponding to a user of the terminal device, and the scene information is used to determine the generation of the at least one second image.

Citation Information

Patent Citations

  • Cutting composition control method, control device and electronic apparatus thereof

    CN106875433A

  • Image display method and electronic equipment

    CN110543579A

  • Human-object interaction image generation method based on relational triples

    CN112233054A

  • Image processing method and device, electronic equipment and storage medium

    CN117979152A

  • Image processing device, image processing method, and program

    US20220292751A1