Image processing method and apparatus, electronic device, and storage medium
By obtaining the target mask and generating the target image through the generative model, the problems of natural fusion and color consistency after the objects in the image are eliminated are solved, and high-quality image processing effects are achieved.
Patent Information
- Application Number
- PCT/CN2025/088235
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-15
- Filing Date
- 2025-04-10
- Publication Date
- 2025-10-23
AI Technical Summary
It is difficult for existing technologies to effectively remove specified objects from images and ensure the natural fusion and color consistency of the image content after removal.
By obtaining the target mask to limit the image elimination area, the target image is generated using the generative adversarial model and the image diffusion generative model, and synthesized with the original image to ensure that the target area is related to the original image content and does not contain any specified objects.
It can intelligently remove specified objects from images and generate new content that blends naturally with the original image and has consistent colors, meeting users' diverse image processing needs.
Smart Images

Figure CN2025088235_23102025_PF_FP_ABST
Abstract
Description
Image processing method and device, electronic device, and storage medium
[0001] Cross-reference to Related Applications
[0002] The present application claims priority to the Chinese patent application No. 202410452390.X, filed on April 15, 2024, and entitled "Image processing method and device, electronic device, and storage medium", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0003] The present disclosure relates to the technical field of computer vision, and in particular, to an image processing method and device, an electronic device, and a storage medium. BACKGROUND
[0004] In the current digital era, image processing has penetrated into all aspects of our lives. Whether for work or personal interest, people generally use image processing software to modify and beautify images. SUMMARY
[0005] To solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method and device, an electronic device, and a storage medium.
[0006] In a first aspect, the present disclosure provides an image processing method, comprising:
[0007] obtaining an original image;
[0008] obtaining a target mask corresponding to the original image; the target mask is used to define an image elimination area of the original image; in the original image, the image elimination area includes a target object;
[0009] generating a target image based on the original image and the target mask; the target image includes a target area, the target area is a mapping area of the image elimination area in the target image, and the target area does not include the target object;
[0010] combining the target image and the original image to obtain a processed image.
[0011] a first obtaining module configured to obtain an original image;
[0012] a second obtaining module configured to obtain a target mask corresponding to the original image; the target mask is used to define an image elimination area of the original image; in the original image, the image elimination area includes a target object;
[0013] generating a target image based on the original image and the target mask; the target image comprises a target region, the target region is a mapping region of the image elimination region in the target image, and the target region does not comprise the target object;
[0014] synthesizing the target image and the original image to obtain a processed image.
[0015] In a third aspect, the present disclosure provides an electronic device, which comprises:
[0016] one or more processors;
[0017] a storage device configured to store one or more programs;
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described above.
[0019] In a fourth aspect, the present disclosure provides a computer-readable storage medium, which stores a computer program, and the program is executed by a processor to implement the image processing method as described above.
[0020] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0021] The technical solution provided by the embodiments of the present disclosure comprises the following steps: obtaining a target mask corresponding to an original image; the target mask is used to define an image elimination region of the original image; in the original image, the image elimination region comprises a target object; generating a target image based on the original image and the target mask; the target image comprises a target region, the target region is a mapping region of the image elimination region in the target image, and the target region does not comprise the target object; synthesizing the target image and the original image to obtain a processed image. BRIEF DESCRIPTION OF DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the specification.
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the accompanying drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0024] FIG. 1 is a flowchart of an image processing method provided by an embodiment of the present disclosure;
[0025] FIG. 2 is a schematic diagram of an original image according to an embodiment of the present disclosure;
[0026] FIG. 3 is a schematic diagram of a target image according to an embodiment of the present disclosure;
[0027] FIG. 4 is a structural block diagram of an image processing apparatus according to an embodiment of the present disclosure;
[0028] FIG. 5 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to more clearly understand the above-mentioned purposes, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0030] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present disclosure, but the present disclosure can also be implemented in other different manners from those described herein; obviously, the embodiments described in the specification are only a part of the embodiments of the present disclosure, and not all the embodiments.
[0031] With the progress of technology, the demand of users for image processing is also growing, and one of the most urgent needs is to eliminate certain things in the existing image.
[0032] FIG. 1 is a flowchart of an image processing method according to an embodiment of the present disclosure. The embodiment can be applicable to the case of image processing in a client. The method can be executed by an image processing apparatus. The apparatus can be implemented in software and / or hardware. The apparatus can be configured in an electronic device, such as a terminal, for example, a smart phone, a palm computer, a tablet computer, a wearable device with a display screen, a desktop computer, a notebook computer, an all-in-one machine, a smart home device, etc. Alternatively, the embodiment can be applicable to the case of image processing in a server. The method can be executed by an image processing apparatus. The apparatus can be implemented in software and / or hardware. The apparatus can be configured in an electronic device, such as a server.
[0033] As shown in FIG. 1, the method can specifically include the following steps.
[0034] S110, obtaining an original image.
[0035] The original image can be, for example, an image that needs to be processed for object elimination. The original image can be specified by a user. Specifically, it can be an image taken by a user, or an image downloaded from a network.
[0036] Optionally, the original image can be, for example, a static image, a dynamic image, or an image frame in a video.
[0037] The original image includes a target object, which is an object in the original image that needs to be eliminated, and can be a person, an animal, a plant, a building, an object, or the like.
[0038] The number of target objects is not limited in the present application. For example, the number of target objects can be one, two, three, or the like.
[0039] It should be further noted that the original image can include multiple objects, and the target object is only part of the objects.
[0040] S120, obtaining a target mask corresponding to the original image; the target mask is used to define an image elimination area of the original image; in the original image, the image elimination area includes the target object.
[0041] The image elimination area can be, for example, an area that can frame the target object. For example, the image elimination area completely coincides with the area occupied by the target object in the original image, or the image elimination area is larger than the area occupied by the target object in the original image, and the area occupied by the target object in the original image is located in the image elimination area. In the original image, the area other than the image elimination area is a non-image elimination area.
[0042] The target mask can be, for example, a binary image or a grayscale image, which is used to identify the distinction between the image elimination area and the non-image elimination area in the original image. Alternatively, the pixels corresponding to the image elimination area in the target mask are usually assigned a non-zero value (such as white or a specified value), and the pixels corresponding to the non-image elimination area are assigned a zero value (such as black or other specified value).
[0043] There are various implementation methods for this step, which are not limited in the present application. For example, one implementation method of this step can include: in response to a user's designation operation on an object in the original image, designating the object as the target object; determining the image elimination area based on the position of the target object in the original image; and obtaining the target mask based on the image elimination area.
[0044] Another implementation method of this step can include: in response to a user's designation operation on the image elimination area, determining the target mask based on the image elimination area indicated by the user, and designating the object located in the image elimination area as the target object.
[0045] S130, generating a target image based on the original image and the target mask; the target image includes a target area, which is a mapping area of the image elimination area in the target image, and the target area does not include the target object.
[0046] The target region is a region in the target image, and the image-elimination region is a region in the original image. The target region and the image-elimination region have a mapping relationship, and are essentially corresponding expressions of the same region in different images. If the target image and the original image are overlapped, the target region will coincide with the image-elimination region.
[0047] Exemplarily, the implementation method of the step can include: inputting the original image and the target mask into a first image generation model to obtain an intermediate image; the intermediate image includes a reference region, the reference region is a mapped region of the image-elimination region in the intermediate image, the intermediate image is associated with image content of the non-image-elimination region of the original image, and the reference region does not include the target object; and inputting the intermediate image and the target mask into a second image generation model to obtain the target image; the target image is an optimization result of the intermediate image.
[0048] The reference region is a region in the target image, and the image-elimination region is a region in the original image. The reference region and the image-elimination region have a mapping relationship, and are essentially corresponding expressions of the same region in different images. If the intermediate image and the original image are overlapped, the reference region will coincide with the image-elimination region.
[0049] Optionally, the first image generation model is a generative adversarial model, and the second image generation model is an image diffusion generation model. The generative adversarial model has strong control ability on image theme or content, while the image diffusion generation model generates images with high quality, and is more flexible in processing noise and randomness.
[0050] By setting to input the original image and the target mask into the first image generation model to obtain an intermediate image, and input the intermediate image and the target mask into the second image generation model to obtain the target image, the essence is to ensure that the generated intermediate image is associated with image content of the non-image-elimination region of the original image by means of the first image generation model, but the reference region does not include the target object, instead of an image with little relevance to the content of the original image, so as to ensure that the subsequently obtained target image is associated in content with the original image, and the target image and the original image can be fused in content. By using the second image generation model, the intermediate image is optimized to further improve the quality of the extended image.
[0051] S140, synthesizing the target image and the original image to obtain a processed image.
[0052] There are various implementation methods of the step, and the present application does not limit this. Exemplarily, the implementation method of the step can include: intercepting the target region in the target image to obtain an intercepted image; and synthesizing the intercepted image and the original image to obtain a processed image.
[0053] Alternatively, the implementation method of the step can include: replacing the pixel value of the image elimination region in the original image with the pixel value of the target region in the target image to obtain the processed image.
[0054] For example, the image in FIG. 2 is an original image, which includes a road, trees on both sides of the road, and three people standing in the middle of the road. The image elimination region is indicated by a box in FIG. 2. The people in the image elimination region are target objects. Based on the image elimination region, a target mask is determined. Based on the original image in FIG. 2 and the target mask, a target image is generated. The generated target image is shown in FIG. 3. The box in FIG. 3 represents a target region, which has the same position in the target image as the image elimination region in the original image. The target region does not include human images. The target image is subsequently synthesized with the original image to obtain a processed image.
[0055] The technical solution described above includes: obtaining a target mask corresponding to an original image; the target mask is used to define an image elimination region of the original image; in the original image, the image elimination region includes target objects; based on the original image and the target mask, a target image is generated; the target image includes a target region, which is a mapping region of the image elimination region in the target image, and the target region does not include the target objects; and the target image is synthesized with the original image to obtain a processed image. In essence, the technical solution described above provides a method for eliminating target objects in an original image, which can effectively eliminate specified target objects from the original image and ensure that new image content is intelligently generated to fill the blank left after the target objects are eliminated, so that the new image content can seamlessly connect with and naturally blend with the image in the non-image generation region of the original image, rather than simply and roughly filling in blurred images, so that the target objects are almost imperceptible to the naked eye. The technical solution described above can meet the diversified image processing needs of users.
[0056] On the basis of the technical solution described above, the method further includes: determining whether the target region in the target image includes a preset object; and if the target region in the target image includes the preset object, performing S130 again.
[0057] The preset object is a pre-specified object that is not expected to exist in the target region of the target image. The present application does not limit what the preset object refers to. For example, the preset object can be a person, an animal, or an object. What the preset object refers to can be set by the user or determined based on the target object. In some embodiments, the preset object and the target object can be the same type of object. For example, if the target object is a person, the preset object is a person, and if the target object is a table, the preset object is a table.
[0058] Optionally, the preset object is determined according to the target object in the original image, so that the determined preset object has certain relevance with the target object.
[0059] For example, if the target object in the original image is a person, that is, the user wants to eliminate the person in the original image, the preset object is determined as a face. After S130, it is determined whether the target region in the target image includes a face. If the target region in the target image includes a face, it means that a new person is generated in the target region in the image generation process of S130. Therefore, the target image is abandoned, and S130 is re-executed to generate a new image.
[0060] Therefore, by setting that if the target region in the target image includes the preset object, the step of generating the target image based on the original image and the target mask is executed again. In essence, if the target region of the generated target image includes an object that is not expected to appear, the target image is abandoned, and a new target image is generated. In this way, it can be ensured that the final processed image does not include an object that is not expected to appear.
[0061] On the basis of the above technical solutions, the method can further include: performing color correction on the target image based on the original image; and S140 can include: synthesizing the color-corrected target image and the original image to obtain a processed image.
[0062] When the image generation model is used to generate a new image for replacing the image in the image elimination region of the original image, color distortion problems can occur. By setting to perform color correction on the target image based on the original image, in essence, the color correction on the target image is based on the overall color features of the original image. In this way, the target image after color correction can more closely match the color style of the original image, thereby ensuring that the newly generated image and the original image have high consistency and coordination in color, effectively avoiding the phenomenon that the newly generated image and the image in the non-image elimination region of the original image are not naturally fused due to color differences, and ensuring that the overall visual effect of the final image is more real and harmonious.
[0063] On the basis of the above technical solutions, the method can further include: performing down-sampling on the original image to obtain a first image; performing down-sampling processing on the target mask to obtain a first mask; and S130 can include: generating the target image based on the first image and the first mask. The purpose of this setting is to compress the first image and the first mask through down-sampling processing to improve the rate of generating the target image.
[0064] Further, after the target mask is down-sampled to obtain the first mask, the method can further include: performing blur processing on the first mask to obtain a second mask; and generating the target image based on the first image and the first mask, including: generating the target image based on the first image and the second mask. In practice, in the target mask, the boundary between the image elimination area and the non-image elimination area is too clear and sharp. Even after the down-sampling process, this sharp boundary feature remains. This sharp boundary can cause the newly generated image to not be naturally connected to the image of the non-image elimination area in the original image.
[0065] By performing blur processing on the first mask, the boundary between the image elimination area and the non-image elimination area indicated in the second mask can be softened, so that it is no longer rigid. This can enable the newly generated image to be naturally connected to the image of the non-image elimination area in the original image.
[0066] Optionally, in an embodiment, the method further includes: down-sampling the original image to obtain a first image; down-sampling the target mask to obtain a first mask; performing blur processing on the first mask to obtain a second mask; S130 can include: inputting the first image and the first mask into a first image generation model to obtain an intermediate image; and inputting the intermediate image and the second mask into a second image generation model to obtain the target image. Since the first image generation model focuses on associating the content of the intermediate image with the image of the non-image elimination area in the original image, it can not use the second mask. The second image generation model focuses on optimizing the intermediate image, and therefore uses the second mask.
[0067] Further, S140 can include: performing super-resolution processing on the target image based on the original image; and synthesizing the super-resolution processed target image and the original image to obtain a processed image.
[0068] Super-resolution processing refers to processing a low-resolution, blurred image into a high-resolution, clear image. In practice, a trained super-resolution model can be used to perform super-resolution processing on the target image. In practice, the super-resolution model can be, for example, a convolutional neural network.
[0069] In practice, the resolution of the target image can be different from the resolution of the original image. By setting the super-resolution processing on the target image based on the original image, the essence is to adjust the resolution of the target image with reference to the original image, so that the resolution of the target image is consistent with the resolution of the original image, so that the newly generated image for the image elimination area can be naturally fused with the image of the non-image elimination area in the original image.
[0070] Further, in the case where color correction and super-resolution processing of the target image are both needed, the super-resolution processing of the target image can be performed, including: performing first color correction on the target image based on the original image; performing super-resolution processing on the target image after the first color correction; performing second color correction on the target image after the super-resolution processing based on the original image; and S140 can include: synthesizing the target image after the second color correction and the original image to obtain the processed image.
[0071] This process involves two color corrections, where the first color correction occurs before the super-resolution processing, and the second color correction occurs after the super-resolution processing. Such a setting is mainly because the super-resolution processing algorithm itself may introduce a certain degree of color deviation, so it is necessary to perform a color correction after the super-resolution processing. However, it is difficult to fully ensure that the target image can be fully restored and matched with the color features of the original image by only one color correction. In order to maximize the consistency of the color style of the target image with the original image, a preliminary color correction is performed before the super-resolution processing. Through the complementary color correction operations before and after, the image color can be effectively coordinated and adjusted, and finally the high consistency of the target image with the original image in color style is ensured.
[0072] Optionally, the super-resolution processing on the target image after the first color correction can include: performing super-resolution processing on the target image after the first color correction based on the original image and the target mask. Specifically, the target mask can be operated to obtain a third mask, and the target image after the first color correction can be processed based on the original image and the third mask. The reason for such a setting is that when the target image is synthesized with the original image, the focus is on whether the newly generated image in the image elimination area and the original image in the non-image elimination area are fused naturally. Such a setting can make the fusion more natural.
[0073] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0074] For example, in response to receiving the user's active request, the user is sent prompt information to explicitly prompt the user that the operation requested to be executed will need to obtain and use the user's personal information. Thus, the user can voluntarily choose whether to provide personal information to the electronic device, application program, server or storage medium, etc. software or hardware that performs the operation of the technical solutions of the present disclosure.
[0075] As an optional but non-limiting implementation, in response to receiving the active request of the user, the sending of the prompt information to the user can be in the form of a pop-up window, in which the prompt information can be presented in the form of text. In addition, the pop-up window can also carry a selection control for the user to select "agree" or "disagree" to provide the personal information to the electronic device.
[0076] It can be understood that the above notification and user authorization obtaining process is only illustrative and does not limit the implementation of the present disclosure, and other methods meeting the relevant laws and regulations can also be applied to the implementation of the present disclosure.
[0077] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily necessary for the present application.
[0078] FIG. 4 is a structural schematic diagram of an image processing apparatus in an embodiment of the present disclosure. The image processing apparatus provided by the embodiment of the present disclosure can be configured in a client or in a server. Referring to FIG. 4, the image processing apparatus specifically includes:
[0079] The first obtaining module 310 is configured to obtain an original image.
[0080] The second obtaining module 320 is configured to obtain a target mask corresponding to the original image; the target mask is used to define an image elimination area of the original image; in the original image, the image elimination area includes a target object.
[0081] The generating module 330 is configured to generate a target image based on the original image and the target mask; the target image includes a target area, the target area is a mapping area of the image elimination area in the target image, and the target area does not include the target object.
[0082] The synthesizing module 340 is configured to synthesize the target image and the original image to obtain a processed image.
[0083] Further, the generating module 330 is configured to:
[0084] inputting the original image and the target mask into a first image generation model to obtain an intermediate image; the intermediate image comprises a reference region, the reference region is a mapping region of the image elimination region in the intermediate image, the intermediate image is associated with image content of a non-image elimination region of the original image, and the reference region does not include the target object;
[0085] inputting the intermediate image and the target mask into a second image generation model to obtain a target image; the target image is an optimization result of the intermediate image.
[0086] Further, the device further comprises a judgment module for:
[0087] After generating the target image based on the original image and the target mask, judging whether the target region in the target image includes a preset object;
[0088] If the target region in the target image includes a preset object, executing again the step of generating a target image based on the original image and the target mask.
[0089] Further, the device comprises a color correction module for performing color correction on the target image;
[0090] The synthesis module 340 is configured to synthesize the target image after color correction and the original image to obtain a processed image.
[0091] Further, the generation module 330 is configured to:
[0092] down-sampling the original image to obtain a first image;
[0093] down-sampling the target mask to obtain a first mask;
[0094] generating a target image based on the first image and the first mask.
[0095] Further, the generation module 330 is configured to:
[0096] After down-sampling the target mask to obtain a first mask, performing blur processing on the first mask to obtain a second mask;
[0097] The generation module 330 is configured to:
[0098] generating a target image based on the first image and the second mask.
[0099] Further, the synthesis module 340 is configured to:
[0100] performing super-resolution processing on the target image based on the original image;
[0101] Synthesize the target image after the super-resolution processing with the original image to obtain a processed image.
[0102] Further, the synthesizing module 340 is configured to:
[0103] perform first color correction on the target image based on the original image;
[0104] perform super-resolution processing on the target image after the first color correction;
[0105] perform second color correction on the target image after the super-resolution processing based on the original image;
[0106] synthesize the target image after the second color correction with the original image to obtain a processed image.
[0107] The image processing apparatus provided by the embodiments of the present disclosure can perform the steps performed by the client or the server in the image processing method provided by the embodiments of the present disclosure, and has the execution steps and advantages, which will not be repeated here.
[0108] FIG. 5 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. Referring to FIG. 5, a structural schematic diagram of an electronic device 1000 suitable for implementing the electronic device according to an embodiment of the present disclosure is shown. The electronic device 1000 according to an embodiment of the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a vehicle terminal (e.g., a car navigation terminal), a wearable electronic device, and the like, and a fixed terminal such as a digital TV, a desktop computer, a smart home device, and the like. The electronic device shown in FIG. 5 is only an example, and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0109] As shown in FIG. 5, the electronic device 1000 can include a processing apparatus (e.g., a central processing unit, a graphic processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage apparatus 1008 to a random access memory (RAM) 1003 to implement the image processing method according to the embodiments of the present disclosure. In the RAM 1003, various programs and information required for the operation of the electronic device 1000 are also stored. The processing apparatus 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0110] In general, the following devices can be connected to the I / O interface 1005: input devices 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; storage devices 1008 including, for example, a tape, a hard disk, and the like; and communication devices 1009. The communication devices 1009 can allow the electronic device 1000 to communicate wirelessly or wiredly with other devices to exchange information. While FIG. 5 illustrates the electronic device 1000 with various devices, it is understood that all of the illustrated devices are not required to be implemented or possessed. More or less devices can be alternatively implemented or possessed.
[0111] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts, thereby implementing the image processing method as described above. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 1009, or installed from the storage devices 1008, or installed from the ROM 1002. When the computer program is executed by the processing devices 1001, the above-described functions defined in the methods of the embodiments of the present disclosure are performed.
[0112] It should be noted that the computer-readable medium in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer-readable signal medium can include an information signal in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (radio frequency) or the like, or any suitable combination thereof.
[0113] In some embodiments, the client, server can communicate using any known or future developed network protocols, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital information communication (e.g., communication networks). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any known or future developed networks.
[0114] The computer-readable medium described above can be included in the electronic device described above; or can exist separately, without being assembled into the electronic device.
[0115] The computer-readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device:
[0116] Obtain an original image;
[0117] obtaining a target mask corresponding to the original image; the target mask is used to define an image elimination region of the original image; in the original image, the image elimination region includes a target object;
[0118] generating a target image based on the original image and the target mask; the target image includes a target region, the target region is a mapping region of the image elimination region in the target image, and the target region does not include the target object;
[0119] combining the target image and the original image to obtain a processed image. Optionally, when the one or more programs are executed by the electronic device, the electronic device can further perform other steps described in the embodiments.
[0120] Computer program code for carrying out operations of the present disclosure can be written in one or more programming languages or combinations of languages including object oriented programming languages such as Java, Smalltalk, C++ as well as conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0121] The flow diagrams and the block diagrams in the drawings are illustrations of possible architectures, functions, and operations for systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0122] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware. In some cases, the names of the units do not constitute a limitation on the units themselves.
[0123] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0124] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0125] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, comprising:
[0126] one or more processors;
[0127] a memory for storing one or more programs;
[0128] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method according to any one of the embodiments of the present disclosure.
[0129] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the image processing method according to any one of the embodiments of the present disclosure.
[0130] The embodiments of the present disclosure also provide a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the image processing method described above is implemented.
[0131] 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.
[0132] 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: obtaining an original image; obtaining a target mask corresponding to the original image; the target mask is used to define an image elimination region of the original image; in the original image, the image elimination region includes a target object; generating a target image based on the original image and the target mask; the target image includes a target region, the target region is a mapping region of the image elimination region in the target image, and the target region does not include the target object; synthesizing the target image and the original image to obtain a processed image.
2. The method of claim 1, wherein the generating a target image based on the original image and the target mask comprises: inputting the original image and the target mask into a first image generation model to obtain an intermediate image; the intermediate image includes a reference region, the reference region is a mapping region of the image elimination region in the intermediate image, the intermediate image is associated with non-image elimination region image content of the original image, and the reference region does not include the target object; inputting the intermediate image and the target mask into a second image generation model to obtain a target image; the target image is an optimization result of the intermediate image.
3. The method of claim 1, wherein after the generating a target image based on the original image and the target mask, further comprising: determining whether the target region in the target image includes a preset object; if the target region in the target image includes a preset object, executing again the step of generating a target image based on the original image and the target mask.
4. The method of claim 2, further comprising: performing color correction on the target image based on the original image; the synthesizing the target image and the original image to obtain a processed image comprises: synthesizing the target image after color correction and the original image to obtain a processed image.
5. The method of claim 1, further comprising: performing down-sampling on the original image to obtain a first image; performing down-sampling processing on the target mask to obtain a first mask; the generating a target image based on the original image and the target mask comprises: generating a target image based on the first image and the first mask.
6. The method of claim 5, wherein after the performing down-sampling processing on the target mask to obtain a first mask, further comprising: performing blur processing on the first mask to obtain a second mask; the generating a target image based on the first image and the first mask comprises: generating a target image based on the first image and the second mask.
7. The method of claim 5, wherein the synthesizing the target image and the original image to obtain a processed image comprises: performing super-resolution processing on the target image based on the original image; synthesizing the target image after super-resolution processing and the original image to obtain a processed image.
8. The method of claim 7, wherein the super-resolution processing of the target image comprises: performing first color correction on the target image based on the original image; performing super-resolution processing on the target image after the first color correction; performing second color correction on the target image after the super-resolution processing based on the original image; the synthesizing of the target image and the original image to obtain a processed image comprises: synthesizing the target image after the second color correction and the original image to obtain a processed image.
9. An image processing apparatus comprising: a first obtaining module configured to obtain an original image; a second obtaining module configured to obtain a target mask corresponding to the original image; the target mask is configured to define an image elimination area of the original image; in the original image, the image elimination area includes a target object; a generating module configured to generate a target image based on the original image and the target mask; the target image includes a target area, the target area is a mapping area of the image elimination area in the target image, and the target area does not include the target object; a synthesizing module configured to synthesize the target image and the original image to obtain a processed image.
10. An electronic device, the electronic device comprising: one or more processors; a storage device configured to store one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-8.
11. A computer-readable storage medium having stored thereon a computer program, the program being executed by a processor to implement the method of any one of claims 1-8.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and computer readable medium
CN113112422A
Image generation method and device, equipment and storage medium
CN115131464A
Image processing method and device, equipment and storage medium
CN116051366A
Spherical bearing for bridge
KR102726195B1
Cited By
Processing control method, device, and medium for positioning marker-based machining of printed matter
US12670684B2