Image processing method and device
By generating processing templates through image processing models, the problem of high time and technical barriers for users in the image retouching process is solved, and fast and convenient image retouching effects are achieved.
Patent Information
- Application Number
- CN202511072087.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-18
AI Technical Summary
Users need to spend a lot of time and effort on detailed adjustments when editing photos, and their lack of editing experience makes it difficult to achieve the desired results. The current technology has a high barrier to entry.
The image processing model extracts local refined features from the sample image and generates a processing template corresponding to the object to be processed. Users can directly use the template to process the image.
It enables fast, convenient, and low-barrier image retouching, and can generate images that meet user needs.
Smart Images

Figure CN120976370A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment, and specifically relates to an image processing method and apparatus. Background Technology
[0002] With the development of electronic device technology, mobile phones and other electronic devices have functions such as shooting and image processing. Users can take pictures anytime and anywhere through electronic devices, and can easily edit the pictures to achieve satisfactory results.
[0003] However, due to the variability of the subject's facial expressions, actions, and background during shooting, users need to spend a lot of time and effort to refine the details of the images. In addition, the technical threshold for image editing is relatively high, and since most users lack the ability to operate in a refined manner and the experience in image editing, the editing effect is difficult to achieve the expected result. Summary of the Invention
[0004] The purpose of this application is to provide an image processing method and apparatus that can improve the efficiency and effectiveness of image processing.
[0005] In a first aspect, embodiments of this application provide an image processing method, including:
[0006] Receive the first input;
[0007] In response to the first input, acquire a sample image containing the object to be processed;
[0008] Feature values of at least one key region in a sample image are extracted using an image processing model;
[0009] Based on the feature values of at least one key region, a processing template corresponding to the object to be processed is generated.
[0010] The image to be processed is processed based on the processing template to obtain the processed image, which contains the object to be processed.
[0011] Secondly, embodiments of this application provide an image processing apparatus, including:
[0012] The receiving module is used to receive the first input;
[0013] The acquisition module is used to acquire a sample image containing the object to be processed in response to the first input;
[0014] The feature extraction module is used to extract feature values of at least one key region in a sample image using an image processing model;
[0015] The template generation module is used to generate a processing template corresponding to the object to be processed based on the feature values of at least one key region.
[0016] The processing module is used to process the image to be processed based on the processing template to obtain the processed image. The image to be processed contains the object to be processed.
[0017] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0018] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0019] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0020] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0021] In this embodiment, a first input is received, and a sample image containing an object to be processed is acquired in response to the first input. Feature values of at least one key region in the sample image are extracted using an image processing model. Based on the feature values of the at least one key region, a processing template corresponding to the object to be processed is generated. The image to be processed is then processed based on the processing template to obtain a processed image, where the image to be processed contains the object to be processed. According to this application, a local refined feature extraction is performed on a sample image containing an object to be processed using an image processing model. Based on the extracted features, a processing template corresponding to the object to be processed is generated. When retouching an image containing an object to be processed, the processing template corresponding to the object to be processed is directly used to process the image. This allows for fast, convenient, and low-threshold image retouching, resulting in a processed image that meets the user's needs. Attached Figure Description
[0022] Figure 1 This is a schematic flowchart of an image processing method provided in some embodiments of this application;
[0023] Figure 2 This is one of the schematic diagrams of the template editing interface provided in some embodiments of this application;
[0024] Figure 3 This is a second schematic diagram of the template editing interface provided in some embodiments of this application;
[0025] Figure 4 This is one of the schematic diagrams of the image editing interface provided in some embodiments of this application;
[0026] Figure 5 This is a second schematic diagram of an image editing interface provided in some embodiments of this application;
[0027] Figure 6 These are schematic diagrams of image processing apparatuses provided in some embodiments of this application;
[0028] Figure 7 These are block diagrams of electronic devices provided in some embodiments of this application;
[0029] Figure 8 These are schematic diagrams of the structure of electronic devices provided in some embodiments of this application. Detailed Implementation
[0030] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0031] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0032] Before providing a more detailed description of the embodiments of the present invention, the image processing methods in the related art will be introduced. In the related art, when retouching images, users can usually first use a general template to process the image, and then make fine adjustments to the details of the image according to actual needs. The whole process is cumbersome and time-consuming. In addition, due to the high technical threshold of image retouching, and due to the lack of fine operation ability and image retouching experience of users, the user may still not achieve the desired effect after making multiple adjustments to the image.
[0033] Therefore, to improve the efficiency and effectiveness of image processing, this application provides an image processing method and apparatus. The method involves extracting refined local features from a sample image containing the object to be processed using an image processing model. Based on the extracted features, a processing template corresponding to the object to be processed and meeting the user's needs is formed. Thus, when retouching an image containing the object to be processed, the user can directly use the processing template corresponding to the object to be processed. In this way, users can quickly, conveniently, and with low barriers to entry perform image retouching, thereby obtaining a processed image that meets their needs.
[0034] The image processing method and apparatus provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0035] The image processing method provided in this application can be applied to image retouching scenarios. The following section combines... Figures 1-5 The image processing method provided in the embodiments of this application will be described in detail. It should be noted that the image processing method provided in the embodiments of this application can be executed by an electronic device, which may include, but is not limited to, mobile phones, computers, etc. Below, the image processing method provided in the embodiments of this application is illustrated using an electronic device as an example.
[0036] See Figure 1 The above is a flowchart illustrating the image processing method provided in some embodiments of this application, such as... Figure 1 As shown, the method includes the following steps 110-150, which will be explained in detail below.
[0037] Step 110. The electronic device receives the user's first input.
[0038] In some embodiments, the electronic device is an electronic device with a display screen. Exemplarily, the electronic device may include, but is not limited to, a mobile phone, a desktop computer, a tablet computer, etc. The electronic device has an image storage application, which can display images stored in the image storage application. When a user needs to construct a processing template for an object to be processed, they can search for a sample image containing the object to be processed from the images stored in the image storage application. The image storage application may be, for example, a photo album app, a gallery app, a camera app, image processing software, etc.
[0039] The object to be processed refers to the object that needs to be adjusted during image processing. The type of object to be processed can include, but is not limited to, objects with facial features such as people and animals. Animals, for example, can include cats and dogs. Considering that different individuals have different characteristics and visual needs, in this application, different individuals are treated as different images to be processed. For example, although person A and person B both belong to the type of "person," they are two different objects to be processed. Similarly, although animal C and animal D both belong to the type of "animal," they are two different objects to be processed.
[0040] In some embodiments, when a user needs to find a sample image containing the object to be processed, the aforementioned first input can be used to select an image containing the object to be processed, i.e., a sample image. Exemplarily, the aforementioned first input includes, but is not limited to: a user clicking on an image containing the object to be processed in an image storage application using a touch device such as a finger or stylus; a voice command input by the user; a specific gesture input by the user; or other feasible inputs, which can be determined according to actual usage needs, and are not limited in this embodiment of the invention. The specific gesture in this embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input. For example, the aforementioned first input can be: a user clicking on an image containing the object to be processed in the album using a finger. The aforementioned first input can also be: a voice command issued by the user to an electronic device displaying an image containing the object to be processed, indicating that the current image is selected as a sample image.
[0041] In other embodiments, when a user needs to find a sample image containing an object to be processed, the aforementioned first input can be used to select the object to be processed. Exemplarily, the aforementioned first input includes, but is not limited to: a user's click input on an object contained in an image in an image storage application using a touch device such as a finger or stylus; a voice command input by the user; a specific gesture input by the user; or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not limit it. The specific gesture in this application embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this application embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input. For example, the aforementioned first input can be: a user's long-press input on an object contained in an image in an image storage application using a finger. The aforementioned first input can also be: a voice command issued by the user to an electronic device displaying an image, indicating that the object contained in the current image is the object to be processed.
[0042] Step 120. The electronic device responds to the first input by acquiring a sample image containing the object to be processed.
[0043] In some embodiments, when the first input is used to select an image containing the object to be processed, the electronic device responds to the first input, determines the image selected by the user, and obtains the image selected by the user as a sample image. For example, taking person A as the object to be processed, the user can open an image storage application in the electronic device and select one or more images containing person A from it, then the electronic device can obtain one or more images selected by the user as sample images.
[0044] In other embodiments, when the first input is used to select an object to be processed, the electronic device, in response to the first input, can determine the object selected by the user, take the user-selected object as the object to be processed, and automatically identify images containing the object to be processed in an image storage application using a model with image recognition capabilities, obtaining the identified images as sample images. For example, if a user opens an image storage application on the electronic device and selects a person A in an image, the electronic device can recognize the image, determine that it contains person A, identify person A as the object to be processed, and use a model with image recognition capabilities to identify images stored in the image storage application, filtering out one or more images containing person A, and obtaining one or more filtered images as sample images.
[0045] In some embodiments, the electronic device includes a template generation control. After the electronic device acquires a sample image, the user can click the template generation control in the electronic device. In response to the click of the template generation control, the electronic device generates a processing template based on the acquired sample image.
[0046] Step 130. The electronic device extracts feature values of at least one key region in the sample image using an image processing model.
[0047] Here, the image processing model refers to a model with image processing capabilities. This model can be a self-developed model or an open-source model; users can select a suitable model to extract features from sample images based on their actual needs. For example, the self-developed BlueHeart large model can be used as the image processing model.
[0048] When generating processing templates based on sample images, electronic devices can input the acquired sample images into an image processing model, and then extract features from the sample images through the image processing model to obtain the features of the sample images.
[0049] Considering that different regions within the same image often have different visual requirements—for example, the cheek area in a portrait needs to be soft while the eye area needs to be clear—feature extraction can be performed on at least one key region of the sample image using an image processing model. This yields feature values for at least one key region. By performing localized, refined feature extraction on the key regions of the sample image, the corresponding feature values for each key region can be extracted. Based on this, different feature values can be set for different key regions when generating processing templates, resulting in regionalized processing templates. Thus, image processing based on these templates allows for adjustments to each key region in the image to meet the different visual requirements of different regions, achieving refined adjustments and improving the precision and flexibility of image processing.
[0050] Here, the critical region refers to the image area that needs to be adjusted during image processing. The critical region may be different for different types of objects to be processed.
[0051] For example, for an object to be processed that belongs to the category of "person", the corresponding key area may include at least one of the following areas: chin area, mouth area, cheek area, nose area, eye area, ear area, forehead area, hairstyle area, and background area, where the background area refers to the image area outside the object to be processed.
[0052] For example, for an object to be processed that is an animal, the corresponding key area may include at least one of the following areas: mouth area, cheek area, nose area, eye area, ear area, forehead area, torso area, limbs area, and background area, where the background area refers to the image area outside the object to be processed.
[0053] The feature values of the key region may include at least one of the following: geometric shape, pixel distribution, visual features, etc., where visual features may include, but are not limited to: brightness value, color value, contrast value, sharpness value, texture, etc.
[0054] In some embodiments, when the image processing model extracts feature values of at least one key region in a sample image, for each sample image, it can first perform image segmentation to segment out at least one key region, and then perform feature extraction on each key region to obtain the feature value of each key region. If there is only one sample image, then for each key region, the feature value of the key region extracted from that sample image is determined as the final feature value of that key region. If there are multiple sample images, then for each key region, feature fusion can be performed on the feature values of the key region extracted from multiple sample images to obtain the final feature value of that key region.
[0055] In some embodiments, the sample images can be segmented manually.
[0056] In some embodiments, the sample image can be segmented using an automatic segmentation algorithm, which may employ threshold segmentation, edge detection, clustering segmentation, etc.
[0057] Step 140. The electronic device generates a processing template corresponding to the object to be processed based on the feature values of at least one key region.
[0058] After extracting feature values of at least one key region from the sample image, an image processing scheme corresponding to the object to be processed is generated based on the extracted feature values, and this image processing scheme serves as the processing model. The processing model may include the feature values of the aforementioned at least one key region. Based on this, image processing can be performed quickly and efficiently using the processing model, thereby reducing user operations and image processing time.
[0059] In this application, for each object to be processed, a processing template corresponding to that object is generated based on a sample image containing that object. In this way, different processing templates can be generated for different objects, and different processing templates can be used for image processing, thus adapting to the different visual needs of different individuals.
[0060] Step 150. The electronic device processes the image to be processed based on the processing template to obtain the processed image, which contains the object to be processed.
[0061] Here, the image to be processed can be an image selected by the user from an image storage application that needs to be processed, and the image to be processed contains the object to be processed.
[0062] When a user needs to process an image, the electronic device can obtain a processing template corresponding to the object to be processed contained in the image to be processed, and adjust the image to be processed based on the processing template to obtain the processed image.
[0063] The image processing method provided in this application receives a first input from a user, acquires a sample image in response to the first input, the sample image contains an object to be processed, extracts feature values of at least one key region in the sample image using an image processing model, generates a processing template corresponding to the object to be processed based on the feature values of the at least one key region, and processes the image to be processed based on the processing template to obtain a processed image, where the image to be processed contains the object to be processed. According to this application, a local refined feature extraction is performed on a sample image containing an object to be processed using an image processing model, and a processing template corresponding to the object to be processed is generated based on the extracted features. When retouching an image containing an object to be processed, the processing template corresponding to the object to be processed is directly used to process the image. This allows for fast, convenient, and low-threshold image retouching, thereby obtaining a processed image that meets the user's needs.
[0064] In some embodiments, in order to improve the flexibility of image processing, before step 150 above, the user can first decide whether to use a processing template to process the image to be processed. If it is determined that the processing template will be used to process the image to be processed, then step 150 above will be performed.
[0065] In some embodiments, the electronic device may include a template retouching control. Before step 150 above, after determining the image to be processed, the electronic device may display the template retouching control and receive trigger input to the template retouching control. In response to receiving the trigger input, it is determined that the image to be processed needs to be processed using the processing template; otherwise, it is determined that the image to be processed does not need to be processed using the processing template. The trigger input may include, but is not limited to, a single click or double click by the user on the template retouching control.
[0066] In some embodiments, considering that the image processing effect of the processing template directly generated based on the extracted feature values may not meet the actual needs of the user, in order to generate a processing template that better meets the user's needs, the processing template can be generated in step 140 above through the following steps 1401-1404.
[0067] Step 1401. The electronic device generates an initial processing template based on the feature values of at least one key region, the initial processing template including the feature values of at least one key region.
[0068] After obtaining the feature values of at least one key region through step 130, an image processing scheme is generated based on the feature values. This image processing scheme is used as an initial processing template, which includes the feature values of at least one key region.
[0069] Step 1402. The electronic device generates a template preview image based on the initial processing template, the template preview image including at least one key region.
[0070] In some embodiments, in order to enable users to intuitively understand the image processing effect of the processing template and determine whether the processing template meets their needs, after obtaining the initial processing template, the electronic device can generate a template preview image based on the initial processing template and display the template preview image.
[0071] In some embodiments, when generating a template preview image based on an initial processing template, an initial image containing the frontal face of the object to be processed can be generated based on a sample image. The initial image is then segmented to obtain at least one key region. For each key region in the initial image, the feature value of the key region is set to the corresponding feature value in the initial processing template, thereby obtaining the template preview image.
[0072] For example, taking person A as the object to be processed, an initial image containing person A's frontal face is generated based on a sample image of person A. This initial image is then segmented to obtain the chin region, mouth region, cheek region, nose region, eye region, ear region, forehead region, hairstyle region, and background region. The feature values of these regions are then set as the corresponding feature values in the initial processing template, thus obtaining... Figure 2 The template preview image 200 shown includes a chin area 201, a mouth area 202, a cheek area 203, a nose area 204, an eye area 205, an ear area 206, a forehead area 207, a hairstyle area 208, and a background area 209.
[0073] Users can check the template preview image to determine if the processing effect of the initial processing template meets their needs. If it does, the initial processing template can be directly saved as the processing template for the object to be processed. If it does not meet the needs, the initial processing template can be further edited through steps 1401-1404 to obtain a processing template that meets the user's requirements.
[0074] Step 1401. The electronic device displays a template preview image through the template editing interface.
[0075] In some embodiments, during the generation of an initial processing template based on a sample image, the electronic device may display a template editing interface, which is used to edit the processing template. Therefore, after generating a template preview image based on the initial processing template, the template preview image can be displayed in the template editing interface. The template editing interface can be displayed via a pop-up window.
[0076] In some embodiments, a prompt message indicating that the template is being generated can be displayed in the template editing interface before generating a template preview image.
[0077] Step 1402. The electronic device receives adjustment input from the user to adjust the template preview image.
[0078] Users can view the template preview image through the template editing interface to determine whether the display effect of the template preview image meets expectations. If the effect of the template preview image does not meet expectations, users can adjust the template preview image to make the display effect meet their needs.
[0079] When a user adjusts the template preview image, the above adjustment input is used to adjust the template preview image.
[0080] Step 1403. The electronic device responds to the adjustment input by adjusting the template preview image to obtain the adjusted template preview image.
[0081] The electronic device responds to the user's input on adjusting the template preview image, thereby obtaining an adjusted template preview image whose display effect meets the user's needs.
[0082] Step 1404. The electronic device generates a processing template corresponding to the object to be processed based on the adjusted template preview image.
[0083] After obtaining an adjusted template preview image that meets the user's display requirements, the electronic device can generate a processing template based on the feature values of each key area in the adjusted template preview image, and determine the processing template as the processing template corresponding to the object to be processed.
[0084] Using the above method, a template preview image is generated based on the initial processing template. Users can adjust the initial processing template by adjusting the template preview image, thus lowering the technical barrier to template adjustment. Moreover, by displaying the template preview image, users can make template adjustments based on the intuitive display effect, improving the efficiency of template adjustment.
[0085] In some embodiments, the aforementioned adjustment input is a second input from the user to the first key area in the template preview image. When the user needs to edit the template preview image, the aforementioned second input can be used to select the key area to be edited, i.e., select the first key area. Exemplarily, the aforementioned second input includes, but is not limited to: a user clicking on the first key area in the template preview image using a touch device such as a finger or stylus, a voice command input by the user, a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not limit it. The specific gesture in this embodiment can be any one of a single-click gesture, a sliding gesture, a dragging gesture, a pressure recognition gesture, a long-press gesture, an area change gesture, a double-press gesture, or a double-click gesture; the click input in this embodiment can be a single-click input, a double-click input, or any number of clicks, and can also be a long-press input or a short-press input. For example, the aforementioned second input can be: a user clicking on the first key area in the template preview image using a finger. As another example, the aforementioned second input can also be: a voice command issued by the user to the electronic device displaying the template preview image, indicating selection of the first key area.
[0086] When the input is adjusted to the second input mentioned above, in step 1403, the electronic device can adjust the feature value of the first key region in the template preview image in response to the second input, and obtain the adjusted template preview image.
[0087] Upon receiving the second input, the electronic device determines that the first key area in the template preview image needs to be edited. Based on this, in response to the second input, it adjusts the feature values of the first key area so that the display effect of the adjusted first key area meets the user's needs, thereby obtaining the adjusted template preview image.
[0088] In some embodiments, the electronic device, in response to a second input, may adjust the first key region through steps a1-a3.
[0089] Step a1. In response to the second input, the electronic device displays a template editing tool in the template editing interface. The template editing tool includes a first effect selection list corresponding to the first key area, and the first effect selection list includes at least one effect control.
[0090] Here, the template editing tool is a tool that can adjust the feature values of an image.
[0091] The first effect selection list refers to the list of effects displayed in the template editing interface. This list may include one or more effect controls, each corresponding to a different display effect. Selecting different effect controls allows the first key area to exhibit different display effects. Because different key areas can display different effects, the first effect selection list for different key areas may include different types and / or numbers of effect controls.
[0092] In some embodiments, an effect control may also include multiple optional sub-controls, with different sub-controls corresponding to different effects.
[0093] For example, the effect selection list for the chin area includes the following four display effect controls: Original Effect, Rounded Effect, V-Shaped Effect, and Stepped Effect. The Original Effect refers to the display effect of the unadjusted initial processing template.
[0094] For example, the effect selection list for the mouth area includes five effect controls for the following five effects: original effect, size effect, thickness effect, smile effect, and exaggerated smile effect.
[0095] For example, the effect selection list for the cheek area includes seven effect controls for the following seven effects: Original Effect, Golden Ratio Face Size Effect, Blush Effect, Skin Smoothing Effect, Smoothing Effect, Whitening Effect, and Age Effect.
[0096] For example, the effect selection list for the nose area includes four effect controls for the following four effects: original effect, nose bridge height effect, width effect, and golden ratio symmetry effect.
[0097] For example, the effect selection list for the eye area includes eight effect controls for the following eight effects: Original Effect, Golden Ratio Eye Shape Effect, Best Size Effect, Best Eye Distance Effect, Willow Leaf Eyebrow Effect, Straight Sword Eyebrow Effect, Colored Contact Lens Effect, and Glasses Effect. The Colored Contact Lens Effect control further includes multiple sub-controls, each corresponding to a different colored contact lens style. Similarly, the Glasses Effect control also includes multiple sub-controls, each corresponding to a different glasses style.
[0098] For example, the effect selection list for the ear area includes five effect controls for the following five effects: Original Effect, Best Ear Lobe, Golden Ratio Effect, Symmetry Effect, and Earring Effect.
[0099] For example, the effect selection list for the forehead area includes six effect controls for the following six effects: original effect, texture effect, whitening effect, shadow effect, highlight effect, and matte effect.
[0100] For example, the effect selection list for the hairstyle area includes six effect controls for the following six effects: Original Effect, Short Hair Effect, Long Hair Effect, Perm Effect, Color Effect, and Bangs Effect. The Perm Effect control further includes multiple sub-controls, each corresponding to a different perm style. For example, it could include sub-controls for various perm styles such as large waves, ionic perm, spiral curls, and foil perm. Similarly, the Color Effect control can also include multiple sub-controls, each corresponding to a different color. Likewise, the Bangs Effect control can also include multiple sub-controls, each corresponding to a different bangs style.
[0101] For example, the effect selection list for the background area includes four effect controls for the following four effects: original effect, brightness effect, saturation effect, and color effect.
[0102] Step a2. The electronic device receives a third input to the first effect control in the first effect selection list.
[0103] In some embodiments, when a user needs to replace the display effect of the first key area, the aforementioned third input can be used to select the effect control corresponding to the desired effect, i.e., the first effect control. Exemplarily, the aforementioned third input includes, but is not limited to: a user clicking on the first effect control in the first effect selection list using a touch device such as a finger or stylus; a voice command input by the user; a specific gesture input by the user; or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0104] For example, the aforementioned third input could be: a user clicking on the first effect control or a sub-control within the first effect selection list using their finger. Alternatively, the aforementioned third input could be: a voice command issued by the user to the electronic device displaying the first effect selection list, based on the template editing interface, indicating that the first effect control or a sub-control within the first effect control has been selected.
[0105] Step a3. The electronic device responds to the third input by adjusting the feature value of the first key area in the template preview image to the feature value corresponding to the first effect control, thereby obtaining the adjusted template preview image.
[0106] The electronic device responds to the third input and determines that the user wants to adjust the display effect of the first key area in the template preview image to the effect corresponding to the first effect control. Based on this, the feature value of the first key area in the template preview image is adjusted to the feature value corresponding to the first effect control, thereby adjusting the display effect of the first key area to the effect corresponding to the first effect control.
[0107] In some embodiments, when adjusting the template preview image, different key regions can be selected as the first key region, thereby adjusting multiple key regions. Finally, a processing template corresponding to the object to be processed is generated based on the template preview image obtained after final adjustment.
[0108] In some embodiments, in order to achieve more refined adjustments to the template, the template editing tool may also include a first effect adjustment control for adjusting the effect intensity. Based on this, when the intensity of the effect corresponding to the first effect control is adjustable, in step a3 above, the electronic device can adjust the feature value of the first key area in the template preview image through the following steps a31-a34.
[0109] Step a31. In response to the third input, the electronic device adjusts the feature value of the first key region in the template preview image to the default feature value corresponding to the first effect control.
[0110] Here, the first effect control is the effect control corresponding to the effect with adjustable intensity.
[0111] In some embodiments, for each key area, in the first effect control list, the intensity of all effects can be adjusted except for the intensity of the original effect, which is not adjustable.
[0112] In some embodiments, the default feature value corresponding to the first effect control is the feature value corresponding to the effect intensity of the first effect control when the intensity is the default intensity. The default intensity of each effect can be set according to actual conditions. For example, if the intensity range of each effect is [-10, 10], where -10 is the minimum intensity and 10 is the maximum intensity, then the default intensity can be set to 0.
[0113] Step a32. The electronic device receives a fourth input to the first effect adjustment control.
[0114] In some embodiments, when a user needs to adjust the intensity of the effect corresponding to the first effect control, the aforementioned fourth input can be used to adjust the intensity of the effect corresponding to the first effect control. Exemplarily, the aforementioned fourth input includes, but is not limited to: dragging the first effect adjustment control by the user with a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this application embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this application embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0115] For example, the first effect adjustment control is as follows Figure 3 As shown, this includes a slider 321 and a track 322. The track 322 is used to display the start and end points of the intensity adjustment range. The intensity of the effect can be adjusted by dragging the slider 321 along the track 322. Based on this, the aforementioned fourth input can be: the user dragging the slider in the first effect adjustment control with their finger. The aforementioned fourth input can also be: a voice command issued by the user to the electronic device displaying the first effect adjustment control, indicating that the intensity should be adjusted to a certain intensity value.
[0116] Step a33. In response to the fourth input, determine the effect intensity corresponding to the first effect control.
[0117] In some embodiments, after the effect intensity is adjusted by the fourth input, the adjusted effect intensity is determined as the effect intensity corresponding to the first effect control.
[0118] Step a34. Based on the effect intensity, adjust the feature values of the first key region to obtain the adjusted template preview image.
[0119] In some embodiments, after determining the effect intensity after the first effect control is adjusted, the feature value of the first key region is adjusted to the feature value corresponding to the effect intensity.
[0120] For example, taking the adjustment of the initial processing template corresponding to character A as an example, see [link to relevant documentation]. Figure 3In response to receiving a second input on the chin area, a template editing tool is displayed in the template editing interface 300. The template editing tool includes a first effect selection list 310 and a first effect adjustment control 320 corresponding to the chin area. The first effect selection list 310 includes four effect controls, namely a control 311 for the original effect, a control 312 for the rounded effect, a control 313 for the V-shaped effect, and a control 314 for the stepped effect. In response to the user's third input to control 312, the display effect of the chin area in the template preview image 200 is adjusted to the default intensity of 0, which is the same as the rounding effect. If the user is not satisfied with the adjusted chin area, they can make a fourth input to the slider 321 in the first effect adjustment control. The fourth input controls the slider 321 to slide on the track 322. Sliding the slider 321 to the left will reduce the intensity of the rounding effect of the chin area in the template preview image 200, and sliding the slider 321 to the right will increase the intensity of the rounding effect of the chin area in the template preview image 200, until the effect of the chin area meets the user's needs. Then, the user can click the save control 330 in the template editing interface 300 to complete the adjustment of the chin area. After that, other areas can be adjusted as needed, or a processing template corresponding to person A can be directly generated based on the adjusted template preview image.
[0121] In some embodiments, for ease of subsequent use, a processing template corresponding to the object to be processed can be stored. To facilitate the differentiation of different processing templates, a corresponding template identifier can be set for each processing template during storage. The template identifier can be information that uniquely identifies the template, and may specifically include at least one of the following: name, symbol, or image.
[0122] In some embodiments, as described above, the generated processing template includes feature values of at least one key region. Based on this, in step 150 above, the electronic device can process the image to be processed based on the processing template through steps 1501-1503 as follows.
[0123] Step 1501. The electronic device adjusts the feature values of the corresponding key regions in the image to be processed based on the feature values of at least one key region to obtain a preview image.
[0124] In some embodiments, the image to be processed is segmented to obtain at least one key region in the image. For each key region in the image, a feature value corresponding to that key region is obtained from a processing template, and the current feature value of the key region is adjusted based on the obtained feature value. After all key regions have been adjusted, an image is generated based on the adjusted feature values of each key region and the original feature values of other regions in the image to be processed, excluding the key regions, and this image is used as a preview image.
[0125] Step 1502. The electronic device displays a preview image in the image editing interface.
[0126] In some embodiments, the image editing interface is an interface for editing the image to be processed. After obtaining the preview image, the preview image is displayed in the image editing interface, so that the user can intuitively see the effect of the modified image to be processed.
[0127] Step 1503. The electronic device generates a processed image based on the preview image.
[0128] In some embodiments, users can view a preview image to determine whether the modified image to be processed meets their needs. If it does, they can directly save or share the preview image, and use the saved or shared image as the processed image.
[0129] As shown above, the feature values in the processing template are set based on the user's needs. Therefore, by adjusting the feature values of the image to be processed based on the feature values in the processing template, a processed image that meets the user's needs can be generated quickly.
[0130] In some embodiments, considering that changes in user needs or inaccurate feature values in the processing template may cause some details of the preview image generated based on the processing template to not meet user requirements, in order to make the processed image more in line with the user's actual needs and improve the flexibility of image processing, in step 1502 above, the electronic device can generate the processed image through the following steps b1-b3.
[0131] Step b1. The electronic device receives the user's fifth input on the second key area in the preview image.
[0132] In some embodiments, when a user needs to edit the preview image, the fifth input can be used to select the key area to be edited, i.e., select the second key area. Exemplarily, the fifth input includes, but is not limited to: a user clicking on the first key area in the preview image using a touch device such as a finger or stylus, a voice command input by the user, a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0133] For example, the fifth input mentioned above could be: the user clicking on the second key area in the preview image with their finger.
[0134] For example, in an image editing interface, in addition to including the preview image, it can also include feature information corresponding to each key region in the preview image. This feature information can be related to the display effect of the key regions. For example, see... Figure 4 In the image editing interface 400, below the preview image 410, there is feature information corresponding to each key region in the preview image 410. This feature information is used to indicate the current effect of the key regions. Based on this, the fifth input mentioned above can also be: the user clicking on the feature information of the second key region in the preview image with their finger.
[0135] Step b2. In response to the fifth input, the electronic device adjusts the feature values of the second key region in the preview image to obtain the adjusted preview image.
[0136] The electronic device responds to the fifth input and determines that the second key region in the preview image needs to be edited. At this point, the feature values of the second key region in the preview image can be adjusted using an image editing tool to make the display effect of the adjusted second key region meet the user's needs, thus obtaining the adjusted preview image. The image editing tool is a tool capable of adjusting the feature values of an image.
[0137] In some embodiments, in step b2 above, the electronic device can adjust the first key area through steps b21-b23.
[0138] Step b21. In response to the fifth input, the electronic device displays an image editing tool in the image editing interface. The image editing tool includes a second effect selection list corresponding to the second key area, and the effect selection list includes at least one effect control.
[0139] The second effect selection list refers to the list of effects displayed in the image editing interface. This list may include one or more effect controls, each corresponding to a different display effect. Selecting different effect controls will result in different display effects for the second key area. Since different key areas can display different effects, different second effect selection lists for the same key area may include different types and / or numbers of effect controls. The first and second effect selection lists for the same key area can be the same.
[0140] Step b22. The electronic device receives the user's sixth input to the second effect control in the second effect selection list.
[0141] In some embodiments, when a user needs to replace the display effect of the second key area, the sixth input can be used to select the effect control corresponding to the desired effect, i.e., the second effect control. Exemplarily, the sixth input includes, but is not limited to: a user clicking on the second effect control in the second effect selection list using a touch device such as a finger or stylus; a voice command input by the user; a specific gesture input by the user; or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0142] For example, the sixth input mentioned above could be: a user clicking on a second effect control or a sub-control within the second effect selection list using their finger. Alternatively, the sixth input could be a voice command issued by the user to the electronic device displaying the second effect selection list, based on the template editing interface, indicating that the second effect control or a sub-control within the second effect control has been selected.
[0143] Step b23. In response to the sixth input, the electronic device adjusts the feature value of the second key region in the preview image to the feature value corresponding to the second effect control, thereby obtaining the adjusted preview image.
[0144] The electronic device responds to the sixth input and determines that the user wants to adjust the display effect of the second key area in the preview image to the effect corresponding to the second effect control. Based on this, the feature value of the second key area in the preview image is adjusted to the feature value corresponding to the second effect control, thereby adjusting the display effect of the second key area to the effect corresponding to the second effect control.
[0145] In some embodiments, when adjusting the preview image, the user can select different key areas as second key areas based on their own needs, so that different key areas can be adjusted separately. Finally, the processed image is generated based on the preview image obtained from the final adjustment.
[0146] In some embodiments, to achieve more refined adjustments to the image, the image editing tool may further include a second effect adjustment control for adjusting the effect intensity. Based on this, when the intensity of the effect corresponding to the second effect control is adjustable, in step b23 above, the electronic device can adjust the feature values of the second key region in the preview image through steps b231-b235.
[0147] Step b231. In response to the sixth input, the electronic device adjusts the feature value of the second key region in the preview image to the default feature value corresponding to the second effect control.
[0148] Here, the second effect control is the effect control corresponding to the effect with adjustable intensity.
[0149] In some embodiments, for each key area, the intensity of the second effect control list can be adjusted, except for the intensity of the original effect, which is not adjustable.
[0150] In some embodiments, the default feature value corresponding to the second effect control is the feature value corresponding to the effect intensity of the second effect control when the intensity is the default intensity. The default intensity of each effect can be set according to actual conditions. For example, if the intensity range of each effect is [-10, 10], where -10 is the minimum intensity and 10 is the maximum intensity, then the default intensity can be set to 0.
[0151] Step b232. The electronic device receives a seventh input to the second effect adjustment control.
[0152] In some embodiments, when it is necessary to adjust the intensity of the effect corresponding to the second effect control, the aforementioned seventh input can be used to adjust the intensity of the effect corresponding to the second effect control. Exemplarily, the aforementioned seventh input includes, but is not limited to: dragging input of the second effect adjustment control by the user using a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this application embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this application embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0153] For example, the second effect adjustment control has the same function as the first effect adjustment control, but the application scenarios are different. The second effect adjustment control is as follows: Figure 3 As shown, this includes a slider 321 and a track 322. The track 322 is used to display the start and end points of the intensity adjustment range. The intensity of the effect can be adjusted by dragging the slider 321 along the track 322. Based on this, the aforementioned seventh input can be: the user dragging the slider in the second effect adjustment control with their finger. The aforementioned seventh input can also be: a voice command issued by the user to the electronic device displaying the second effect adjustment control, indicating that the intensity should be adjusted to a certain intensity value.
[0154] Step b233. The electronic device responds to the seventh input and determines the effect intensity corresponding to the second effect control.
[0155] In some embodiments, after adjusting the effect intensity via the seventh input, the adjusted effect intensity is determined as the effect intensity corresponding to the second effect control.
[0156] Step b234. The electronic device adjusts the feature values of the second key region based on the effect intensity to obtain the adjusted preview image.
[0157] In some embodiments, after determining the effect intensity after the second effect control is adjusted, the feature value of the second key region is adjusted to the feature value corresponding to the effect intensity.
[0158] Step b235. The electronic device generates the processed image based on the adjusted preview image.
[0159] Once it is determined that the adjusted preview image meets the user's needs, the adjusted preview image can be saved or shared, and the saved or shared image will be used as the processed image.
[0160] For example, taking the image processing of an image containing person A as an example, the image is processed based on the processing template corresponding to person A, resulting in the following: Figure 4 The preview image 410 shown is displayed in the image editing interface 400. Feature information of each key region in the preview image 410 is displayed below the preview image 410, where the feature information indicates the current effect of the key region. In response to receiving a fifth input on the chin region, image editing tools are displayed in the image editing interface 400, such as... Figure 5As shown, the image editing tool is displayed in a pop-up window. The image editing tool includes a second effect selection list 510 corresponding to the chin area and a second effect adjustment control. The second effect selection list 510 includes four effect controls, namely the control 511 corresponding to the original effect, the control 512 corresponding to the rounded effect, the control 513 corresponding to the V-shaped effect, and the control 514 corresponding to the stepped effect. In response to the user's sixth input to control 512, the display effect of the chin area in the preview image 410 is adjusted to the default intensity of 0, which is the same as the rounding effect. If the user is not satisfied with the adjusted chin area, a seventh input can be made to the second effect adjustment control 520. The second effect adjustment control includes a slider 521 and a track 522. The seventh input controls the slider 521 to slide on the track 522. Sliding the slider 521 to the left can reduce the intensity of the rounding effect of the chin area in the preview image 410, and sliding the slider 521 to the right can increase the intensity of the rounding effect of the chin area in the preview image 410, until the effect of the chin area meets the user's needs. Then, the user can click to save the control 530 to complete the adjustment of the chin area. After that, other areas can be adjusted as needed, or a processed image can be generated directly based on the adjusted preview image.
[0161] In this way, users can adjust the local details of the preview image according to their actual needs, thereby improving the flexibility of image processing and making the final processed image more in line with the user's actual needs.
[0162] In some embodiments, the sample images acquired in step 110 may include at least two images with different styles. Considering the different visual requirements of images with different styles, before step 130, the acquired at least two sample images can be divided into at least two image groups according to the image style. Each image group corresponds to one style, and different image groups correspond to different styles. Each image group may contain at least one sample image of the same style. Based on this, in steps 130 and 140, the sample images in each image group can be processed separately, thereby generating a processing template corresponding to the object to be processed based on each image group. In this way, at least two processing templates corresponding to the object to be processed can be obtained, with each processing template corresponding to one style and different processing templates corresponding to different styles.
[0163] Accordingly, when the number of processing templates corresponding to the object to be processed is at least two, in step 150 above, the electronic device can perform image processing through the following steps 1501-1502.
[0164] Step 1501. The electronic device receives the user's eighth input to the first template control in the template selection interface.
[0165] Here, the template selection interface is used to select a processing template. The template selection interface includes at least two template controls; each template control corresponds to a processing template for the object to be processed, and different template controls correspond to different processing templates. Based on this, the user can determine the processing template that meets their needs from the at least two processing templates corresponding to the object to be processed based on the template selection interface, and then input the eighth parameter into the first template control corresponding to that processing template. That is, the first template control is the template control corresponding to the processing template that meets the user's needs.
[0166] In some embodiments, the eighth input is used to select a processing template that meets the user's needs, and the eighth input can be a first operation. Exemplarily, the eighth input includes, but is not limited to: a user clicking on a first template control in the template selection interface using a touch device such as a finger or stylus; a voice command input by the user; a specific gesture input by the user; or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment of the invention does not impose limitations. The specific gesture in this embodiment can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long-press gesture, an area-change gesture, a double-press gesture, or a double-tap gesture; the click input in this embodiment can be a single-click input, a double-tap input, or any number of clicks, and can also be a long-press input or a short-press input.
[0167] For example, the eighth input mentioned above could be: a user clicking on the first template control in the template selection interface with their finger. Alternatively, the eighth input could be: a voice command issued by the user to the electronic device displaying the template selection interface, indicating that the first template control has been selected.
[0168] In some embodiments, to facilitate users in quickly selecting a processing template that meets their needs, the template selection interface may contain only the template control corresponding to the object to be processed.
[0169] In some embodiments, the electronic device can pre-generate and store multiple processing templates corresponding to different objects to be processed. The electronic device can store the processing templates and their corresponding objects to be processed in a corresponding manner. Based on this, in order to ensure that the template selection interface only contains the template control corresponding to the object to be processed, the objects to be processed in the image to be processed can be determined before displaying the template selection interface. Then, based on the correspondence between the processing templates and the objects to be processed, the processing template corresponding to the object to be processed is determined. The corresponding template selection interface is then generated and displayed based on the determined processing template. In this way, it can be ensured that the template selection interface only contains the processing template corresponding to the object to be processed.
[0170] In some embodiments, the user can select the objects to be processed from the image to be processed. This allows for precise image processing when the image contains multiple objects.
[0171] Step 1502. The electronic device responds to the eighth input and processes the image to be processed based on the processing template corresponding to the first template control to obtain the processed image.
[0172] The electronic device responds to the eighth input, determines the processing template corresponding to the first template control selected by the eighth input as the processing template that meets the user's needs, and processes the object to be processed based on the processing template, thereby quickly obtaining the processed image that meets the user's needs.
[0173] Therefore, by setting different style processing templates, users can directly apply the corresponding style template for image processing without repeatedly adjusting the image, which can greatly shorten the processing time. Moreover, by setting different style processing templates, it is possible to adapt to the diverse needs of users.
[0174] The image processing method provided in this application can be executed by an image processing device. This application uses an image processing device executing the image processing method as an example to illustrate the image processing device provided in this application.
[0175] See Figure 6 The above is a schematic diagram of an image processing apparatus provided in some embodiments of this application, such as... Figure 6 As shown, the device 600 includes the following modules:
[0176] Receiver module 601 is used to receive the first input;
[0177] The acquisition module 602 is used to acquire a sample image containing the object to be processed in response to the first input;
[0178] Feature extraction module 603 is used to extract feature values of at least one key region in a sample image through an image processing model;
[0179] The template generation module 604 is used to generate a processing template corresponding to the object to be processed based on the feature values of at least one key region.
[0180] The processing module 605 is used to process the image to be processed based on the processing template to obtain the processed image, wherein the image to be processed contains the object to be processed.
[0181] The image processing apparatus provided in this application receives a first input, acquires a sample image in response to the first input, the sample image contains an object to be processed, extracts feature values of at least one key region in the sample image using an image processing model, generates a processing template corresponding to the object to be processed based on the feature values of the at least one key region, and processes the image to be processed based on the processing template to obtain a processed image, the image to be processed containing the object to be processed. According to this application, a local refined feature extraction is performed on a sample image containing an object to be processed using an image processing model, and a processing template corresponding to the object to be processed is generated based on the extracted features. When retouching an image containing an object to be processed, the processing template corresponding to the object to be processed is directly used to process the image. Thus, image retouching can be performed quickly, conveniently, and with low barriers to entry, thereby obtaining a processed image that meets the user's needs.
[0182] In some embodiments, the template generation module 604 includes:
[0183] An initial generation submodule is used to generate an initial processing template based on the feature values of at least one key region.
[0184] The preview generation submodule is used to generate a template preview image based on the initial processing template. The template preview image includes at least one key region.
[0185] The display submodule is used to display template preview images through the template editing interface;
[0186] The receiving submodule is used to receive adjustment input from the user regarding adjustments to the template preview image;
[0187] The adjustment submodule is used to adjust the template preview image in response to the adjustment input, so as to obtain the adjusted template preview image;
[0188] The template generation submodule is used to generate a processing template corresponding to the object to be processed based on the adjusted template preview image.
[0189] In some embodiments, the adjustment input is a second input from the user to a first key region in the template preview image, and the adjustment submodule is specifically used for:
[0190] In response to the second input, the feature values of the first key region in the template preview image are adjusted to obtain the adjusted template preview image.
[0191] In some embodiments, the adjustment submodule is specifically used for:
[0192] In response to the second input, a template editing tool is displayed in the template editing interface. The template editing tool includes a first effect selection list corresponding to the first key area. The first effect selection list includes at least one effect control.
[0193] Receive a third input to the first effect control in the first effect selection list;
[0194] In response to the third input, the feature value of the first key region in the template preview image is adjusted to the feature value corresponding to the first effect control, resulting in the adjusted template preview image.
[0195] In some embodiments, the template editing tool further includes a first effect adjustment control, an adjustment submodule, specifically used for:
[0196] In response to the third input, the feature value of the first key region in the template preview image is adjusted to the default feature value corresponding to the first effect control;
[0197] Receive the fourth input to the first effect adjustment control;
[0198] In response to the fourth input, determine the intensity of the effect corresponding to the first effect control;
[0199] Based on the effect intensity, the feature values of the first key region are adjusted to obtain the adjusted template preview image.
[0200] In some embodiments, the object to be processed is a person, and the key area includes at least one of the following areas:
[0201] The image includes the chin area, mouth area, cheek area, nose area, eye area, ear area, forehead area, hairstyle area, and background area. The background area refers to the image area outside the object to be processed.
[0202] In some embodiments, the processing template includes feature values of at least one key region;
[0203] Processing module 605 includes:
[0204] The initial adjustment submodule is used to adjust the feature values of the corresponding key regions in the image to be processed based on the feature values of at least one key region, so as to obtain a preview image;
[0205] The display submodule is used to display preview images in the image editing interface;
[0206] The generation submodule is used to generate processed images based on the preview images.
[0207] In some embodiments, the generation submodule is specifically used for:
[0208] Receive the fifth input for the second key region in the preview image;
[0209] In response to the fifth input, the feature values of the second key region in the preview image are adjusted to obtain the adjusted preview image;
[0210] The processed image is generated based on the adjusted preview image.
[0211] In some embodiments, the generation submodule is specifically used for:
[0212] In response to the fifth input, an image editing tool is displayed in the image editing interface. The image editing tool includes a second effect selection list corresponding to the second key area. The effect selection list includes at least one effect control.
[0213] Receive the sixth input to the second effect control in the second effect selection list;
[0214] In response to the sixth input, the feature value of the second key region in the preview image is adjusted to the feature value corresponding to the second effect control, resulting in the adjusted preview image.
[0215] In some embodiments, the image editing tool further includes a second effect adjustment control, a generation submodule, specifically used for:
[0216] In response to the sixth input, the feature value of the second key region in the preview image is adjusted to the default feature value corresponding to the second effect control;
[0217] Receive the seventh input to the second effect adjustment control;
[0218] In response to the seventh input, determine the intensity of the effect corresponding to the second effect control;
[0219] Based on the effect intensity, the feature values of the second key region are adjusted to obtain the adjusted preview image.
[0220] In some embodiments, the number of processing templates corresponding to the object to be processed is at least two, and the processing module 605 is specifically used for:
[0221] The system receives an eighth input to a first template control in a first interface. The first interface includes at least one template control, and each template control corresponds to a processing template of an object to be processed. The at least one template control includes the first template control.
[0222] In response to the eighth input, the image to be processed is processed based on the processing template corresponding to the first template control to obtain the processed image.
[0223] The image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0224] The image processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.
[0225] The image processing apparatus provided in this application embodiment can achieve... Figures 1 to 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0226] In some embodiments, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701 and a memory 702. The memory 702 stores a program or instructions that can run on the processor 701. When the program or instructions are executed by the processor 701, they implement the various steps of the above-described image processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0227] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0228] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0229] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.
[0230] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0231] The user input unit 807 is used to receive the first input;
[0232] Processor 810 is configured to acquire a sample image containing the object to be processed in response to a first input;
[0233] The processor 810 is also used to extract feature values of at least one key region in a sample image through an image processing model;
[0234] The processor 810 is also used to generate a processing template corresponding to the object to be processed based on the feature values of at least one key region.
[0235] The processor 810 is also used to process the image to be processed based on the processing template to obtain a processed image, wherein the image to be processed contains the object to be processed.
[0236] The electronic device provided in this application receives a first input and, in response to the first input, acquires a sample image containing an object to be processed. It extracts feature values of at least one key region from the sample image using an image processing model, generates a processing template corresponding to the object to be processed based on the feature values of the at least one key region, and processes the image to be processed based on the processing template to obtain a processed image, where the image to be processed contains the object to be processed. According to this application, a local refined feature extraction is performed on a sample image containing an object to be processed using an image processing model. Based on the extracted features, a processing template corresponding to the object to be processed is generated. When retouching an image containing an object to be processed, the processing template corresponding to the object to be processed is directly used to process the image. This allows for fast, convenient, and low-threshold image retouching, thereby obtaining a processed image that meets the user's needs.
[0237] In some embodiments, the processor 810 is specifically used for:
[0238] An initial processing template is generated based on the feature values of at least one key region;
[0239] A template preview image is generated based on the initial processing template. The template preview image includes at least one key region.
[0240] Display unit 806 is used to display a template preview image through the template editing interface;
[0241] User input unit 807 is used to receive adjustment input from the user to adjust the template preview image;
[0242] Processor 810 is used to adjust the template preview image in response to adjustment input to obtain the adjusted template preview image;
[0243] Processor 810 is used to generate a processing template corresponding to the object to be processed based on the adjusted template preview image.
[0244] In some embodiments, the input is adjusted to a second user input to a first key region in a template preview image, and the processor 810 is specifically used for:
[0245] In response to the second input, the feature values of the first key region in the template preview image are adjusted to obtain the adjusted template preview image.
[0246] In some embodiments, the processor 810 is specifically used for:
[0247] In response to the second input, a template editing tool is displayed in the template editing interface. The template editing tool includes a first effect selection list corresponding to the first key area. The first effect selection list includes at least one effect control.
[0248] Receive a third input to the first effect control in the first effect selection list;
[0249] In response to the third input, the feature value of the first key region in the template preview image is adjusted to the feature value corresponding to the first effect control, resulting in the adjusted template preview image.
[0250] In some embodiments, the template editing tool further includes a first effect adjustment control, processor 810, specifically used for:
[0251] In response to the third input, the feature value of the first key region in the template preview image is adjusted to the default feature value corresponding to the first effect control;
[0252] Receive the fourth input to the first effect adjustment control;
[0253] In response to the fourth input, determine the intensity of the effect corresponding to the first effect control;
[0254] Based on the effect intensity, the feature values of the first key region are adjusted to obtain the adjusted template preview image.
[0255] In some embodiments, the object to be processed is a person, and the key area includes at least one of the following areas:
[0256] The image includes the chin area, mouth area, cheek area, nose area, eye area, ear area, forehead area, hairstyle area, and background area. The background area refers to the image area outside the object to be processed.
[0257] In some embodiments, the processing template includes feature values of at least one key region;
[0258] The 810 processor is specifically used for:
[0259] Based on the feature values of at least one key region, the feature values of the corresponding key region in the image to be processed are adjusted to obtain a preview image;
[0260] The display unit 806 is also used to display a preview image in the image editing interface;
[0261] Processor 810 is used to generate processed images based on preview images.
[0262] In some embodiments, the user input unit 807 is configured to receive a fifth input on the second key region in the preview image;
[0263] The 810 processor is specifically used for:
[0264] In response to the fifth input, the feature values of the second key region in the preview image are adjusted to obtain the adjusted preview image;
[0265] The processed image is generated based on the adjusted preview image.
[0266] In some embodiments, the processor 810 is configured to display an image editing tool in an image editing interface in response to a fifth input. The image editing tool includes a second effect selection list corresponding to a second key region. The effect selection list includes at least one effect control.
[0267] User input unit 807 is used to receive a sixth input to the second effect control in the second effect selection list;
[0268] Processor 810 is used to adjust the feature value of the second key region in the preview image to the feature value corresponding to the second effect control in response to the sixth input, so as to obtain the adjusted preview image.
[0269] In some embodiments, the image editing tool further includes a second effect adjustment control, processor 810, for adjusting the feature value of the second key region in the preview image to a default feature value corresponding to the second effect control in response to a sixth input;
[0270] User input unit 807 is used to receive a seventh input to the second effect adjustment control;
[0271] The processor 810 is configured to: respond to the seventh input, determine the effect intensity corresponding to the second effect control, and adjust the feature value of the second key region based on the effect intensity to obtain the adjusted preview image.
[0272] In some embodiments, the number of processing templates corresponding to the object to be processed is at least two. The user input unit 807 is also used to receive an eighth input to the first template control in the first interface. The first interface includes at least one template control. One template control corresponds to one processing template of the object to be processed. The at least one template control includes the first template control.
[0273] The processor 810 is used to process the image to be processed based on the processing template corresponding to the first template control in response to the eighth input, so as to obtain the processed image.
[0274] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0275] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 809 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 809 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0276] Processor 810 may include one or more processing units; optionally, processor 810 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 810.
[0277] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0278] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0279] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0280] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0281] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image processing method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0282] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0283] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0284] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An image processing method, characterized in that, include: Receive the first input; In response to the first input, a sample image containing the object to be processed is acquired; Feature values of at least one key region in the sample image are extracted using an image processing model; Based on the feature values of the at least one key region, a processing template corresponding to the object to be processed is generated; The image to be processed is processed based on the processing template to obtain a processed image, wherein the image to be processed contains the object to be processed.
2. The method according to claim 1, characterized in that, The step of generating a processing template corresponding to the object to be processed based on the feature values of the at least one key region includes: An initial processing template is generated based on the feature values of the at least one key region; A template preview image is generated based on the initial processing template, and the template preview image includes the at least one key region; The template preview image is displayed through the template editing interface; Receive adjustment input from the user regarding adjustments to the template preview image; In response to the adjustment input, the template preview image is adjusted to obtain the adjusted template preview image; Based on the adjusted template preview image, a processing template corresponding to the object to be processed is generated.
3. The method according to claim 2, characterized in that, The adjustment input is a second input from the user to the first key area in the template preview image. The step of adjusting the template preview image in response to the adjustment input to obtain the adjusted template preview image includes: In response to the second input, the feature values of the first key region in the template preview image are adjusted to obtain the adjusted template preview image.
4. The method according to claim 3, characterized in that, The step of adjusting the feature values of the first key region in the initial processing template in response to the second input to obtain an adjusted template preview image includes: In response to the second input, a template editing tool is displayed on the template editing interface. The template editing tool includes a first effect selection list corresponding to the first key area. The first effect selection list includes at least one effect control. Receive a third input to the first effect control in the first effect selection list; In response to the third input, the feature value of the first key region in the template preview image is adjusted to the feature value corresponding to the first effect control, thereby obtaining the adjusted template preview image.
5. The method according to any one of claims 1-4, characterized in that, The object to be processed is a person, and the key area includes at least one of the following areas: The image includes the chin area, mouth area, cheek area, nose area, eye area, ear area, forehead area, hairstyle area, and background area, where the background area refers to the image area other than the object to be processed.
6. The method according to any one of claims 1-4, characterized in that, The processing template includes feature values for at least one key region; The step of processing the image to be processed based on the processing template to obtain the processed image includes: Based on the feature values of the at least one key region, the feature values of the corresponding key regions in the image to be processed are adjusted to obtain a preview image; The preview image is displayed in the image editing interface; The processed image is generated based on the preview image.
7. An image processing apparatus, characterized in that, include: The receiving module is used to receive the first input; The acquisition module is configured to acquire a sample image containing the object to be processed in response to the first input; The feature extraction module is used to extract feature values of at least one key region in the sample image through an image processing model; The template generation module is used to generate a processing template corresponding to the object to be processed based on the feature values of the at least one key region. The processing module is used to process the image to be processed based on the processing template to obtain a processed image, wherein the image to be processed contains the object to be processed.
8. The apparatus according to claim 7, characterized in that, The template generation module includes: An initial generation submodule is used to generate an initial processing template based on the feature values of the at least one key region. A preview generation submodule is used to generate a template preview image based on the initial processing template, the template preview image including the at least one key region; The display submodule is used to display the template preview image in the template editing interface; The adjustment submodule is used to adjust the template preview image to obtain the adjusted template preview image; The template generation submodule is used to generate a processing template corresponding to the object to be processed based on the adjusted template preview image.
9. The apparatus according to claim 8, characterized in that, The adjustment submodule is specifically used for: Receive a second input on a first key region in the template preview image; In response to the second input, the feature values of the first key region in the template preview image are adjusted to obtain the adjusted template preview image.
10. The apparatus according to claim 9, characterized in that, The adjustment submodule is specifically used for: In response to the second input, a template editing tool is displayed on the template editing interface. The template editing tool includes a first effect selection list corresponding to the first key area. The first effect selection list includes at least one effect control. Receive a third input to the first effect control in the first effect selection list; In response to the third input, the feature value of the first key region in the template preview image is adjusted to the feature value corresponding to the first effect control, thereby obtaining the adjusted template preview image.
11. The apparatus according to any one of claims 7-10, characterized in that, The object to be processed is a person, and the key area includes at least one of the following areas: The image includes the chin area, mouth area, cheek area, nose area, eye area, ear area, forehead area, hairstyle area, and background area, where the background area refers to the image area outside the object to be processed.
12. The apparatus according to any one of claims 7-10, characterized in that, The processing template includes feature values for at least one key region; The processing module includes: The initial adjustment submodule is used to adjust the feature values of the corresponding key regions in the image to be processed based on the feature values of the at least one key region, so as to obtain a preview image; The display submodule is used to display the preview image in the image editing interface; The generation submodule is used to generate the processed image based on the preview image.