Image processing method, apparatus, device and medium
By obtaining the object type of the target object in the image and determining the target area to be processed, and using the corresponding image processing model to generate the target image, the problem of lack of targetedness in the existing photo editing function is solved, and better photo editing effects are achieved.
Patent Information
- Application Number
- PCT/CN2024/131642
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-11-16
- Filing Date
- 2024-11-12
- Publication Date
- 2025-05-22
AI Technical Summary
The existing photo editing function lacks targeting when processing specific body parts of the target object in the image, resulting in poor photo editing.
By obtaining the object type of the target object in the image, determining the target area to be processed, and generating the target image using the corresponding image processing model, the target area is different from the target area in the original image.
Targeted photo editing processing for different target object types is realized, improving the photo editing effect and ensuring the targeted and effective image processing.
Smart Images

Figure CN2024131642_22052025_PF_FP_ABST
Abstract
Description
Image processing method, device, equipment and medium
[0001] This application claims priority to the Chinese invention patent application entitled “Image processing method, device, equipment and medium” and application number 202311532535.9 filed on November 16, 2023. The entire contents of that application are incorporated by reference into this application. Technical Field
[0002] The present disclosure relates to the field of computer technology, and in particular to an image processing method, apparatus, device, and medium. Background Art
[0003] Photo editing features are widely used in a variety of applications, including image editing software, photo taking software, and video live streaming platforms. Users can adjust images as needed, such as beautifying specific body parts of a person in an image. However, existing photo editing features still need to be optimized.
[0004] Summary of the Invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method, apparatus, device and medium.
[0006] An embodiment of the present disclosure provides an image processing method, comprising: obtaining an original image to be processed; obtaining an object type to which a target object contained in the original image belongs; determining a target area to be processed in the target object based on the object type to which the target object belongs; and generating a target image based on the original image and the target area in the original image; wherein the target area in the target image is different from the target area in the original image.
[0007] Optionally, obtaining the object type to which the target object contained in the original image belongs includes: obtaining attribute characteristics of the target object contained in the original image; determining the object type to which the target object belongs based on the attribute characteristics of the target object and a preset first correspondence; wherein the first correspondence is used to indicate the object type to which each of multiple attribute characteristics corresponds.
[0008] Optionally, obtaining the attribute characteristics of the target object contained in the original image includes: when the target part of the target object contained in the original image is detected, obtaining the target part characteristics of the target object, so as to obtain the attribute characteristics of the target object based on the target part characteristics; when the target part of the target object contained in the original image is not detected, obtaining the body characteristics of the target object, so as to obtain the attribute characteristics of the target object based on the body characteristics.
[0009] Optionally, determining the target area to be processed in the target object based on the object type to which the target object belongs includes: determining the target area to be processed in the target object based on the object type to which the target object belongs and a preset second correspondence; wherein the second correspondence is used to indicate the areas to be processed corresponding to each of multiple object types.
[0010] Optionally, generating a target image based on the original image and the target area in the original image includes: obtaining an image processing model corresponding to the object type to which the target object belongs; obtaining an original mask image corresponding to the target area in the original image; and generating the target image using the image processing model based on the original image and the original mask image corresponding to the target area.
[0011] Optionally, the target image is generated using the image processing model based on the original image and the original mask image corresponding to the target area, including: determining the object area to be cropped in the original image according to the target object in the original image; wherein the object area contains at least a partial area of the target object, and the partial area contains the target area; cropping the original image according to the object area to obtain an object image; cropping the original mask image corresponding to the target area according to the object image to obtain a target mask image corresponding to the target area; wherein the size of the target mask image is consistent with the size of the object image; and generating the target image based on the object image and the target mask image corresponding to the target area using the image processing model.
[0012] Optionally, different object types correspond to different image processing models.
[0013] Optionally, obtaining the original mask image corresponding to the target area in the original image includes: generating a regional mask image based on the target area in the original image; wherein the regional mask image is consistent with the size of the original image, and the target area to be processed identified by the regional mask image is consistent with the target area in the original image; and performing expansion processing on the target area identified by the regional mask image to obtain the original mask image corresponding to the target area in the original image.
[0014] Optionally, generating a target image using the image processing model based on the original image and the original mask image corresponding to the target area includes: obtaining image processing parameters; wherein the image processing parameters include parameters for indicating the degree of difference between the target area in the target image and the target area in the original image; generating a target image using the image processing model based on the original image, the original mask image corresponding to the target area and the image processing parameters.
[0015] Optionally, the method further includes: performing color migration processing on the target image based on color information of the original image to obtain a target image after color migration processing.
[0016] Optionally, the difference between the target area in the target image and the target area in the original image includes: the difference in edge contours between the target area in the target image and the target area in the original image, and / or the difference in texture lines within the target area in the target image and the target area in the original image.
[0017] An embodiment of the present disclosure also provides an image processing device, including: an original image acquisition module, used to acquire an original image to be processed; an object type acquisition module, used to acquire the object type to which a target object contained in the original image belongs; a target area determination module, used to determine a target area to be processed in the target object based on the object type to which the target object belongs; and a target image generation module, used to generate a target image based on the original image and the target area in the original image; wherein the target area in the target image is different from the target area in the original image.
[0018] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method provided by the embodiment of the present disclosure.
[0019] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the image processing method provided by the embodiment of the present disclosure.
[0020] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the image processing method provided in the embodiments of the present disclosure when executed by a processor.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0024] FIG1 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure;
[0025] FIG2 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure;
[0026] FIG3 is a comparative schematic diagram provided by an embodiment of the present disclosure;
[0027] FIG4 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure;
[0028] FIG5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0031] As will be more clearly understood from the following description, the technical solutions provided by the embodiments of the present disclosure can determine the target area to be processed based on the object type of the target object in the original image to be processed, and based on this, generate a target image with a target area that differs from the target area of the original image. Compared to existing image retouching functions that adopt a unified retouching method regardless of object type, this method can specifically determine the target area to be processed that matches the target object, helping to further ensure the retouching effect.
[0032] Figure 1 is a flow chart of an image processing method provided by an embodiment of the present disclosure. The method can be performed by an image processing device, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. As shown in Figure 1, the method mainly includes the following steps S102 to S108:
[0033] Step S102: Acquire the original image to be processed. Exemplarily, the original image is an image containing a target object, such as a person, animal, vehicle, building, or specific object. The disclosed embodiments do not restrict the target object and can be flexibly set as needed. Furthermore, the disclosed embodiments do not restrict the method for acquiring the original image; for example, the original image may be an image uploaded by the user, an image selected locally by the user, an image downloaded from the network by the user, or an image transmitted from another device.
[0034] Step S104: Obtain the object type to which the target object contained in the original image belongs.
[0035] In practical applications, methods such as object detection algorithms can be used to first determine the location of a target object in the original image, and then analyze the object type of the target object. Alternatively, a user can be provided with an object type option, and the user's selected object type for the target object in the original image can be obtained, without limitation herein.
[0036] Specifically, the object type of the target object can be flexibly divided according to the actual situation. Taking the target object as an example, the object type can be divided based on gender or based on external body shape. Taking the target object as an example, the object type can be divided based on breed. Taking the target object as an example, the object type can be divided based on vehicle structure (such as cars, motorcycles, etc.). Taking the target object as an example, the object type can be divided based on architectural style (Chinese classical style, European style, etc.).
[0037] Step S106 : determining a target area to be processed in the target object based on the object type to which the target object belongs.
[0038] The target area may be, for example, a local area of the target object. For example, if the target object is a person, the target area may be one or more of the person's abdomen, upper body (the area between the neck and waist, which may also include the neck and / or waist), arms, legs, face, etc. The specific area may be flexibly set according to the needs and is not limited here. In the embodiment disclosed herein, different types of objects are taken into consideration, and the features presented to the outside are different, and the focus is also different. Therefore, the requirements for retouching the target area to be processed are different. For example, most objects with a burly body have the need to retouch the upper body as a whole, so as to present an overall effect of well-developed upper body muscles, while most objects with a petite body have the need to retouch the abdomen, so as to present a toned abdominal line. In actual applications, the areas to be processed corresponding to different object types can be pre-set according to actual conditions, so that when the object type to which the target object belongs in the image to be processed is obtained, the target area to be processed in the target object can be efficiently determined.
[0039] Step S108: Generate a target image based on the original image and the target region in the original image; wherein the target region in the target image is different from the target region in the original image. For example, an image processing model may be used to process the target region based on the original image, so that the target region in the generated target image is different from the target region in the original image, for example, the target region in the target image has a better or more impactful visual appearance than the target region in the original image.
[0040] Exemplarily, the difference between the target area in the target image and the target area in the original image includes: a difference in edge contours between the target area in the target image and the target area in the original image, and / or a difference in texture lines within the target area in the target image and the target area in the original image. Taking the target area as an example, there are differences in the abdominal lines of the person in the target image and the original image, and / or there are differences in the muscle lines on the abdomen. For example, the abdominal edge contour of the person in the original image has no obvious curve and no obvious muscle lines, while the abdominal edge contour of the person in the target image has a more obvious curve and more obvious muscle lines.
[0041] In some embodiments, the above step S104, i.e., obtaining the object type of the target object contained in the original image, can be performed with reference to the following steps a to b:
[0042] Step a: Acquire the attribute features of the target object contained in the original image. The attribute features of the target object are the features of the specific attributes of the target object. The specific attributes can be used to distinguish the object type to which the target object belongs, such as external gender characteristics, body characteristics, animal breed characteristics, architectural style characteristics, etc. The specific attributes can be flexibly set according to needs to obtain the corresponding attribute features of the target object. The embodiment of the present disclosure provides a method for acquiring attribute features when the target object is a person or an animal, etc., which can be implemented as follows:
[0043] When a target part of a target object is detected in the original image, features of the target part of the target object are obtained, and attribute features of the target object are derived based on the features of the target part. The target part may be a part that can well represent the attribute features of the target object, such as the face of the target object. In practical applications, the target part can be flexibly set as needed and is not limited here.
[0044] If the target part of the target object contained in the original image is not detected, the target object's body features are obtained to obtain the target object's attribute features based on the body features. If the target part is not detected, the target object's overall body features can be obtained, and the target object's attribute features can also be relatively accurately obtained based on the overall body features of the target object.
[0045] It is understandable that the embodiments of the present disclosure can give priority to obtaining the attribute characteristics of the target object based on the target part characteristics. For example, when the target object is a person or an animal, the target part can be the face, and the target part characteristics are facial features. Facial features are typical representatives of the external characteristics of the target object and can usually present the external situation of the target object to a large extent. Therefore, the embodiments of the present disclosure can give priority to detecting the face of the target object and can use facial features as the attribute characteristics of the target object. Considering that the face of the target object may not be detected in many cases, such as when the target image only shows a body part such as the abdomen of a person, the body characteristics of the target object are then obtained and used as the attribute characteristics of the target object. In the above manner, the attribute characteristics of the target object can be obtained more efficiently and reliably.
[0046] Step b, determining the object type to which the target object belongs based on the attribute characteristics of the target object and a preset first correspondence; wherein the first correspondence is used to indicate the object type to which each of the multiple attribute characteristics corresponds. In practical applications, a statistical method can be used to determine the attribute characteristics corresponding to each object type, and to establish a first correspondence. For example, a large number of pictures containing target objects of different object types can be collected, and the first correspondence between the attribute characteristics and the object type can be established by counting the attribute characteristics corresponding to each of the different object types. In the embodiment of the present disclosure, the first correspondence is preset, so when obtaining the attribute characteristics of the target object, the object type to which the target object belongs can be determined efficiently and reliably based on the first correspondence, further shortening the image processing time.
[0047] In some embodiments, the above-mentioned step S106, i.e., determining the target area to be processed in the target object based on the object type to which the target object belongs, can be specifically implemented by determining the target area to be processed in the target object based on the object type to which the target object belongs and a preset second correspondence relationship; wherein the second correspondence relationship is used to indicate the areas to be processed corresponding to each of the multiple object types. In actual applications, the corresponding areas to be processed can be pre-set according to the object type, thereby establishing the second correspondence relationship. Specifically, the areas to be processed corresponding to different object types can also be determined by statistical means, such as by conducting online or offline surveys, or by obtaining historical image processing records, etc. to count the areas to be processed with a higher proportion of retouching requirements corresponding to various object types, thereby establishing a second correspondence relationship between object type and area to be processed, such as most users with a large build or most men have the need to retouch the entire upper body, and most users with a small build or most women have the need to retouch the abdomen. By establishing the second corresponding relationship as described above, the target area to be processed in the target object can be quickly and accurately determined based on the object type to which the target object belongs, so that subsequent image processing can be carried out in a targeted manner based on the target area, and the image retouching requirements can be met with a higher probability.
[0048] In some embodiments, the above step S108, i.e., generating the target image based on the original image and the target area in the original image, can be performed with reference to the following steps A to C:
[0049] Step A: Obtain an image processing model corresponding to the object type to which the target object belongs. The image processing model is a neural network model. The embodiment of the present disclosure does not limit the structure of the image processing model. Specifically, the image processing model can be a generative model.
[0050] In order to facilitate model processing and better guarantee the image processing effect, in some specific implementation examples, the image processing models corresponding to different object types are different. Specifically, at least one of the model structure, model parameters and training samples of the image processing models corresponding to different object types is different. Exemplarily, the training samples of the image processing models corresponding to different object types are different, such as, the training samples of the image processing models are original images of target objects of the corresponding object types and / or images that meet the requirements, and corresponding prompt information can be set for the training samples, such as using prompts marked with special symbols to guide the model to learn the required sample features. In this way, the image processing model can better learn the characteristics of the target objects of the corresponding object types and the corresponding processing methods, so that it is able to output image processing results that meet the requirements.
[0051] Step B: Obtain an original mask image corresponding to the target area in the original image. In some specific implementation examples, step B can be performed with reference to the following steps B1 to B2:
[0052] Step B1: Generate a region mask based on the target region in the original image. Specifically, the target region in the original image can be segmented to obtain a region mask based on the segmentation results. The region mask has the same size as the original image, and the target region to be processed identified by the region mask is consistent with the target region in the original image. In the region mask, the pixel values of the target region are all a first value (such as 255), and the pixel values of the non-target region are all a second value (such as 0), so that the target region can be clearly and unambiguously identified.
[0053] Step B2: Dilate the target region identified by the region mask to obtain an original mask corresponding to the target region in the original image. In practical applications, a dilation algorithm can be used to process the target region. By appropriately expanding the target region to be processed, the subsequent image processing effect is improved, making the final image more natural and realistic.
[0054] In step C, the target image is generated using the image processing model based on the original image and the original mask image corresponding to the target region. The original mask image corresponding to the target region allows the image processing model to clearly identify the target region in the original image to be processed. Based on the original image, the target region can be beautified and restored, ultimately obtaining the target image.
[0055] In order to further enable the image processing model to better generate the desired target image, in some specific implementation examples, step C can be performed with reference to the following steps C1 to C4:
[0056] In step C1, based on the target object in the original image, an object region to be cropped is determined in the original image; the object region includes at least a portion of the target object, and the portion includes the target region. For example, if the target object is a person, the object region may include the entire person or only the upper half of the person, but must at least include the target region to be processed.
[0057] Step C2: Cropping the original image based on the object area to obtain the object image. It is understandable that the embodiments of the present disclosure fully take into account that the original image may also contain a large background area, and the target object may not account for a large proportion of the original image. In order to make it easier for the image processing model to process the target area, the embodiments of the present disclosure can pre-crop the original image. The target area usually accounts for a large proportion of the object image, and irrelevant background is also reduced in the object image, making it easier for the model to process. In actual applications, the cropping size can be flexibly set according to needs.
[0058] In step C3, the original mask image corresponding to the target area is cropped based on the object image to obtain a target mask image corresponding to the target area. The size of the target mask image matches the size of the object image. It is understood that after the original image is cropped, the original mask image also needs to be cropped accordingly so that the cropped target mask image matches the object image. Specifically, the location of the target area in the target mask image corresponds to the target area to be processed in the object image.
[0059] Step C4: Generate a target image using an image processing model based on the target mask image corresponding to the object image and the target area. For example, the pixel value of the target area to be processed in the target mask image is 255 (white), and the pixel value of the non-target area is 0 (black). The image processing model can perform fusion processing based on the target mask image and the object image to accurately obtain the target area to be processed in the object image. That is, the target mask image can be used to assist the image processing model in locating the target area to be processed. The image processing model can beautify the target area in the object image (such as modifying the outline, adding line texture, etc.) and output the beautified image. Since the object image is part of the original image, the image beautified by the image processing model can also be pasted back to the corresponding area in the original image to obtain the final target image. The final target image is consistent in size with the original image.
[0060] In practical applications, the object image and target mask can be directly input into the image processing model, or the edge pixels of the object image and target mask can be padded to complete the object image and target mask to a square size, which is more convenient for the image processing model to process. It should be noted that if the above-mentioned padded processing is performed in advance, the edges of the output image of the image processing model should also be cropped to crop the originally padded edge areas, so as to ensure that the beautified image output by the image processing model is consistent with the size of the object image.
[0061] In this way, the image processing model can better process the object image and the target mask corresponding to the target area, and can also avoid the interference of irrelevant background as much as possible, thereby obtaining a target image with better effect.
[0062] In some specific implementation examples, step C may also be performed with reference to steps 1 and 2 below:
[0063] Step 1, obtaining image processing parameters; wherein, the image processing parameters include parameters for indicating the degree of difference between the target area in the target image and the target area in the original image, which can also be called intensity parameters, and can characterize different image processing intensities. Taking the processing of the human abdomen as an example, the intensity parameter is used to indicate the strength of the muscle lines added to the human abdomen, or the degree of curve of the outline of the human abdomen. In addition, the image processing parameters can also include parameters such as CFG (Classifier Free Guidance, without classifier guidance), which are used to adjust the degree of guidance of the diffusion process of the model by the text prompt. In actual applications, the image processing parameters can be default values, or the user can be provided with setting options for the image processing parameters, and the image processing parameters set by the user can be obtained.
[0064] Step 2: Generate a target image using the image processing model based on the original image, the original mask corresponding to the target area, and the image processing parameters. This method can produce a target image with the desired level of retouching.
[0065] In practical applications, steps 1 to 2 and steps C1 to C4 may be combined and applied.
[0066] In order to further ensure the image processing effect, the embodiment of the present disclosure can also perform color migration processing on the target image based on the color information of the original image to obtain a target image after color migration processing. Specifically, color migration can be mainly performed on the processed target area in the target image. It is understandable that the color of the target image generated by the image processing model may be different from the color of the original image. Therefore, the target image can be post-processed and color migration can be used to further improve the realism of the processed target image.
[0067] For ease of understanding, the present disclosure further provides a flowchart of an image processing method as shown in FIG2 , which mainly includes the following steps S202 to S210:
[0068] Step S202: obtaining the original image to be processed.
[0069] Step S204: Obtain the object type of the target object contained in the original image. If the object type is the first type, execute step S206a; if the object type is the second type, execute step S206b.
[0070] Step S206a: determining that the target area to be processed in the target object is the abdomen area, and determining that the image processing model corresponding to the original image is the first image processing model.
[0071] Step S206b: determining that the target area to be processed in the target object is the upper body area, and determining that the image processing model corresponding to the original image is the second image processing model.
[0072] Step S208 , obtaining an original mask image corresponding to the target area in the original image, and obtaining image processing parameters.
[0073] Step S210, based on the original mask images corresponding to the original image and the target area, and the image processing parameters, the target image is generated using the image processing model corresponding to the original image. For example, a comparative schematic diagram can be shown in FIG3 , which illustrates the original image, target image 1, and target image 2. The image processing parameters corresponding to target image 1 and target image 2 are different. Specifically, the parameters used to indicate the strong and weak effects are different, and the effect of target image 2 is stronger than that of target image 1. For example, the target images 1 and 2 generated by the image processing model both highlight the muscle lines of the upper body, and the muscle lines in target image 2 are more obvious than those in target image 1. It should be noted that FIG3 is only a simple diagram, and mosaic processing is performed in a local area. As shown in FIG3 , in actual applications, the original image and the target image usually also include a background, and also include other body parts of the target object, which are not limited here.
[0074] In related technologies, a unified image retouching method is often used without considering the object type. Furthermore, for areas like the abdomen and upper body, deformation and other methods are often relied upon, resulting in distorted and unrealistic images. Non-target areas (such as the background) are also deformed accordingly, resulting in poor image processing results. In contrast, the disclosed embodiments can specifically determine the target area to be processed that matches the target object, obtain the corresponding mask image, and use the corresponding image processing model for processing. The resulting image can better meet user needs and effectively ensure the image retouching effect.
[0075] FIG4 is a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, can generally be integrated into an electronic device, and can execute an image processing method. As shown in FIG4 , the image processing device includes: an original image acquisition module 402 for acquiring an original image to be processed; an object type acquisition module 404 for acquiring the object type to which a target object contained in the original image belongs; a target area determination module 406 for determining a target area to be processed in the target object based on the object type to which the target object belongs; and a target image generation module 408 for generating a target image based on the original image and the target area in the original image; wherein the target area in the target image is different from the target area in the original image.
[0076] Compared with the existing photo editing function that adopts a unified photo editing method without considering the object type, the above-mentioned device can specifically determine the target area to be processed that matches the target object, which helps to further ensure the photo editing effect.
[0077] In some embodiments, the object type acquisition module 404 is specifically used to: obtain the attribute characteristics of the target object contained in the original image; determine the object type to which the target object belongs based on the attribute characteristics of the target object and a preset first correspondence relationship; wherein the first correspondence relationship is used to indicate the object type corresponding to each of the multiple attribute characteristics.
[0078] In some embodiments, the object type acquisition module 404 is specifically used to: when the target part of the target object contained in the original image is detected, obtain the target part features of the target object to obtain the attribute features of the target object based on the target part features; when the target part of the target object contained in the original image is not detected, obtain the body features of the target object to obtain the attribute features of the target object based on the body features.
[0079] In some embodiments, the target area determination module 406 is specifically used to: determine the target area to be processed in the target object based on the object type to which the target object belongs and a preset second correspondence; wherein the second correspondence is used to indicate the areas to be processed corresponding to multiple object types.
[0080] In some embodiments, the target image generation module 408 is specifically used to: obtain an image processing model corresponding to the object type to which the target object belongs; obtain an original mask image corresponding to the target area in the original image; and generate a target image using the image processing model based on the original image and the original mask image corresponding to the target area.
[0081] In some embodiments, the target image generation module 408 is specifically used to: determine the object area to be cropped in the original image based on the target object in the original image; wherein the object area includes at least a partial area of the target object, and the partial area includes the target area; crop the original image according to the object area to obtain an object image; crop the original mask image corresponding to the target area according to the object image to obtain a target mask image corresponding to the target area; wherein the size of the target mask image is consistent with the size of the object image; based on the object image and the target mask image corresponding to the target area, generate the target image using the image processing model.
[0082] In some implementations, different object types correspond to different image processing models.
[0083] In some embodiments, the target image generation module 408 is specifically used to: generate a regional mask map based on the target area in the original image; wherein the regional mask map is consistent with the size of the original image, and the target area to be processed identified by the regional mask map is consistent with the target area in the original image; and perform expansion processing on the target area identified by the regional mask map to obtain the original mask map corresponding to the target area in the original image.
[0084] In some embodiments, the target image generation module 408 is specifically used to: obtain image processing parameters; wherein the image processing parameters include parameters for indicating the degree of difference between the target area in the target image and the target area in the original image; based on the original image, the original mask image corresponding to the target area and the image processing parameters, generate the target image using the image processing model.
[0085] In some embodiments, the device further includes a color migration module configured to perform color migration processing on the target image based on color information of the original image to obtain a target image after color migration processing.
[0086] In some embodiments, the difference between the target area in the target image and the target area in the original image includes: the difference in edge contours between the target area in the target image and the target area in the original image, and / or the difference in texture lines within the target area in the target image and the target area in the original image.
[0087] The image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0088] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.
[0089] An embodiment of the present disclosure provides an electronic device, which includes: a storage device storing a computer program; and a processing device configured to execute the computer program in the storage device to implement the steps of any one of the methods in the present disclosure.
[0090] Reference is now made to FIG5 , which illustrates a schematic diagram of the structure of an electronic device 500 suitable for implementing embodiments of the present disclosure. Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device illustrated in FIG5 is merely an example and should not limit the functionality or scope of use of embodiments of the present disclosure.
[0091] As shown in Figure 5, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0092] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although FIG5 shows the electronic device 500 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0093] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0094] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the image processing method provided by the embodiments of the present disclosure. The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present disclosure, the programming languages including object-oriented programming languages such as Java, C++, etc., and also conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0095] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor is enabled to execute the image processing method provided by the embodiment of the present disclosure.
[0096] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0097] The embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which implements the image processing method in the embodiment of the present disclosure when executed by a processor.
[0098] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0099] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0100] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0101] It is understandable that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0102] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0103] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, comprising: Obtain the original image to be processed; Acquire the object type to which the target object contained in the original image belongs; Based on the object type to which the target object belongs, determining a target area to be processed in the target object; A target image is generated according to the original image and the target area in the original image; wherein the target area in the target image is different from the target area in the original image.
2. The method according to claim 1, wherein obtaining the object type to which the target object contained in the original image belongs comprises: Acquire attribute features of the target object contained in the original image; Based on the attribute characteristics of the target object and a preset first corresponding relationship, the object type to which the target object belongs is determined; wherein the first corresponding relationship is used to indicate the object type corresponding to each of the multiple attribute characteristics.
3. The method according to claim 2, wherein the step of obtaining the attribute features of the target object contained in the original image comprises: In the case where a target part of the target object contained in the original image is detected, a target part feature of the target object is acquired to obtain an attribute feature of the target object based on the target part feature; In a case where the target part of the target object included in the original image is not detected, a body feature of the target object is acquired to obtain an attribute feature of the target object based on the body feature.
4. The method according to claim 1, wherein determining the target area to be processed in the target object based on the object type to which the target object belongs comprises: Based on the object type to which the target object belongs and a preset second corresponding relationship, a target area to be processed in the target object is determined; wherein the second corresponding relationship is used to indicate the areas to be processed corresponding to each of multiple object types.
5. The method according to claim 1, wherein generating a target image according to the original image and the target area in the original image comprises: Obtain an image processing model corresponding to the object type to which the target object belongs; Obtaining an original mask image corresponding to the target area in the original image; Based on the original image and the original mask image corresponding to the target area, the target image is generated using the image processing model.
6. The method according to claim 5, wherein the step of generating the target image by using the image processing model based on the original image and the original mask image corresponding to the target area comprises: According to the target object in the original image, determining the object area to be cropped in the original image; wherein, The object area includes at least a partial area of the target object, and the partial area includes the target area; Cropping the original image according to the object area to obtain an object image; According to the object image, the original mask image corresponding to the target area is cropped to obtain a target mask image corresponding to the target area; wherein the size of the target mask image is consistent with the size of the object image; Based on the object image and the target mask image corresponding to the target area, the target image is generated using the image processing model. The method according to claim 5 , wherein different image processing models correspond to different object types.
8. The method according to claim 5, wherein the step of obtaining an original mask image corresponding to the target area in the original image comprises: Generate a regional mask image according to the target area in the original image; wherein the regional mask image has the same size as the original image, and the target area to be processed identified by the regional mask image is consistent with the target area in the original image; The target region identified by the regional mask image is expanded to obtain an original mask image corresponding to the target region in the original image.
9. The method according to claim 5, wherein generating the target image by using the image processing model based on the original image and the original mask image corresponding to the target area comprises: Acquiring image processing parameters; wherein the image processing parameters include parameters for indicating the degree of difference between the target area in the target image and the target area in the original image; Based on the original image, the original mask image corresponding to the target area and the image processing parameters, the target image is generated using the image processing model.
10. The method according to claim 1, further comprising: Based on the color information of the original image, the target image is subjected to color migration processing to obtain a target image after color migration processing.
11. The method according to any one of claims 1 to 10, wherein the difference between the target area in the target image and the target area in the original image comprises: The difference in edge contour between the target area in the target image and the target area in the original image, and / or the difference in texture lines inside the target area in the target image and the target area in the original image.
12. An image processing device, comprising: An original image acquisition module, used to acquire the original image to be processed; An object type acquisition module, used to acquire the object type to which the target object contained in the original image belongs; A target region determination module, configured to determine a target region to be processed in the target object based on the object type to which the target object belongs; The target image generation module is used to generate a target image according to the original image and the target area in the original image; wherein the target area in the target image is different from the target area in the original image.
13. An electronic device, comprising: a storage device having a computer program stored thereon; A processing device, used to execute the computer program in the storage device to implement the steps of the image processing method according to any one of claims 1 to 11.
14. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the image processing method according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the image processing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Image processing method and device, storage medium, and electronic equipment
CN107358241A
Image processing method and device, electronic equipment and storage medium
CN114240738A
Processing method and device for intelligently modifying image and repairing abdominal muscle and computer equipment
CN116777792A
Image processing method and device, electronic equipment and storage medium
CN116993953A
Computer system and computer-readable storage medium
US20200250401A1