Image processing method and apparatus, electronic device, and storage medium
By separating the background layer and the main scanning layer, the scanning object is fused to form special effects during the movement of the scan object, solving the problem of limited types of special effects in the existing technology and achieving a richer visual experience.
Patent Information
- Application Number
- PCT/CN2025/079360
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-29
- Filing Date
- 2025-02-26
- Publication Date
- 2025-09-04
AI Technical Summary
In the prior art, there are limited types of image addition effects, which are difficult to meet the diverse needs of users and cannot provide a rich visual experience.
By obtaining the original image, the background layer and the main scanning layer are separated, the scan object moves in the preset direction over time, and the main object is gradually displayed from scratch, and the background layer and the main scanning layer are fused to form a new special effect.
It realizes the visual effect of "printing" the subject object in the background image, meets users' diverse needs for special effects, and provides a richer visual experience.
Smart Images

Figure CN2025079360_04092025_PF_FP_ABST
Abstract
Description
Image processing method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application No. 202410232633.9, filed on February 29, 2024, entitled “Image processing method, device, electronic device and storage medium”. The entire contents of that application are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device, and storage medium. Background Art
[0004] With the rapid development of digital imaging technology, people are placing higher demands on the visual quality of images. Adding special effects to images has become an important technical tool to enhance their visual appeal and artistic quality. Special effects can enrich the visual quality of images, making them more attractive and valuable. 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, electronic device and storage medium.
[0006] In a first aspect, the present disclosure provides an image processing method, comprising:
[0007] Acquire an original image; the original image includes a subject object;
[0008] Based on the original image, a background layer and a main body scanning layer are obtained; the background layer includes a background area; the main body scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main body object is gradually revealed from nothing to something;
[0009] The background layer and the subject scan layer are fused to obtain a processed image.
[0010] In a second aspect, the present disclosure further provides an image processing device, comprising:
[0011] An acquisition module, configured to acquire an original image; the original image includes a subject object;
[0012] Processing module for
[0013] Based on the original image, a background layer and a main body scanning layer are obtained; the background layer includes a background area; the main body scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main body object is gradually revealed from nothing to something;
[0014] The fusion module is used to fuse the background layer and the subject scan layer to obtain a processed image.
[0015] In a third aspect, the present disclosure further provides an electronic device, comprising:
[0016] one or more processors;
[0017] a storage device for storing 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 described above.
[0019] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the image processing method described above when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] 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.
[0021] 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.
[0022] FIG1 is a flow chart of an image processing method provided by an embodiment of the present disclosure;
[0023] FIG2 is a schematic diagram of an original image provided by an embodiment of the present disclosure;
[0024] FIG3 is a schematic diagram of a background layer obtained based on the original image provided in FIG2 ;
[0025] 4 to 6 are schematic diagrams of the main scanning layer obtained at different times based on the original image provided in FIG2 ;
[0026] 7 to 9 are schematic diagrams of processed images obtained at different times based on the original image provided in FIG. 2 ;
[0027] FIG10 is a flowchart of a specific implementation method for obtaining a subject scanning layer based on an original image provided by an embodiment of the present disclosure;
[0028] FIG11 is a schematic diagram of a first layer obtained based on the original image provided in FIG2 ;
[0029] FIG12 is a schematic diagram of a frame image of a second layer provided by an embodiment of the present disclosure;
[0030] 13-15 are schematic diagrams of a third layer at different times provided by an embodiment of the present disclosure;
[0031] FIG16 is a schematic diagram showing a method for obtaining a fourth layer according to an embodiment of the present disclosure;
[0032] 17 to 19 are schematic diagrams of the fourth layer at different times provided by an embodiment of the present disclosure;
[0033] FIG20 is a schematic structural diagram of an image processing device according to an embodiment of the present disclosure;
[0034] FIG21 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] 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.
[0036] 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.
[0037] In order to enhance the aesthetic and artistic quality of images, adding special effects to images has become an important technical means. However, although some software or applications on the market currently provide the function of adding special effects, the types of special effects they provide are limited and cannot meet the diverse needs of users.
[0038] The technical solution provided by the disclosed embodiments is based on an original image, creating a background layer and a subject scan layer. The background layer includes a background area, while the subject scan layer includes a scanned object, which moves in a preset direction over time. As the scanned object moves, the subject is gradually revealed from nothing. The background layer and the subject scan layer are then merged to produce a processed image. Essentially, this method provides a method for automatically adding a new special effect to a target image. This special effect creates the visual effect of "printing" the subject object within the background image, meeting users' diverse needs for special effects and providing a richer visual experience.
[0039] FIG1 is a flowchart of an image processing method provided by an embodiment of the present disclosure. This embodiment is applicable to situations where image processing is performed on a client. The method can be executed by an image processing device, which can be implemented using software and / or hardware. The device can be configured in an electronic device, such as a terminal, including but not limited to smartphones, PDAs, tablet computers, wearable devices with displays, desktop computers, laptop computers, all-in-one computers, smart home devices, etc. Alternatively, this embodiment is applicable to situations where image processing is performed on a server. The method can be executed by an image processing device, which can be implemented using software and / or hardware. The device can be configured in an electronic device, such as a server.
[0040] As shown in FIG1 , the method may specifically include:
[0041] S110: Acquire an original image; the original image includes a main object.
[0042] The original image may be, for example, an image to which special effects are to be added. The original image may be specified by the user. Specifically, it may be an image captured by the user or an image downloaded from the Internet.
[0043] The object is the thing in the image, which can be a person, animal, plant, building or object.
[0044] The subject object may be, for example, an object in the original image that requires special attention or that is desired to be highlighted. This application does not limit the specific object to which the subject object refers. In some scenarios, the subject object may be the subject of the original image. For example, the subject object may be a person, an animal, a plant, a building, or an object. Furthermore, this application does not limit the number of subject objects. For example, the number of subject objects may be one, two, or three.
[0045] In the original image, the area occupied by the main object is the main area. The remaining area in the original image except the main area is the background area. The background area may or may not include the object.
[0046] Optionally, the original image may be, for example, a static image, a dynamic image, or an image frame in a video.
[0047] S120. Based on the original image, a background layer and a main scanning layer are obtained; the background layer includes a background area; the main scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main object is gradually revealed from nothing to something.
[0048] For example, the background layer can be a layer that only includes the background area image of the original image but does not include the main object. Figure 2 is a schematic diagram of an original image provided by an embodiment of the present disclosure. Figure 3 is a schematic diagram of the background layer obtained based on the original image provided in Figure 2. Referring to Figure 2, the original image includes a road and trees on both sides of the road, and a person is standing in the middle of the road. If the person is the main object, the road, trees on both sides of the road, and the sky constitute the image in the background area. Referring to Figure 3, the background layer obtained based on Figure 2 includes the background area image but does not include the main object.
[0049] The scanning object is used to characterize the position of the scan at the current moment. For example, it can be expressed in the form of a line, a shape, or the position of a combination of lines and / or shapes. The preset direction refers to a pre-specified direction. For example, the preset direction can be the direction from left to right, the direction from right to left, the direction from top to bottom, the direction from bottom to top, the direction from the middle to both sides, and the direction from both sides to the middle. In some original images, the depth information of each part of the main object is different. The depth information reflects the distance between the part represented by the pixel points that constitute the object and the camera. For this case, optionally, the preset direction can also be the direction of depth information from large to small, or the direction of depth information from small to large. In some scenarios, the preset direction can be specified by the user.
[0050] Figures 4-6 illustrate the subject scan layers at different times, based on the original image provided in Figure 2. Figure 4 corresponds to time T1, Figure 5 to time T2, and Figure 6 to time T3, with T1 occurring earlier than T2, which in turn occurs earlier than T3. Viewing Figures 4-6 sequentially creates the illusion that the target subject is gradually "printed" as the scanned object moves.
[0051] S130: Fusing the background layer and the subject scan layer to obtain a processed image.
[0052] Optionally, the subject scan layer is overlaid on the background layer to obtain a processed image.
[0053] For example, Figure 7 shows the effect of fusing the image in Figure 4 with the image in Figure 3, Figure 8 shows the effect of fusing the image in Figure 4 with the image in Figure 5, and Figure 9 shows the effect of fusing the image in Figure 4 with the image in Figure 6. Viewing Figures 7-9 sequentially, the background image is always displayed, but as the scanned object moves, the target subject is gradually "printed" into the background image.
[0054] The above technical solution creates a background layer and a subject scan layer based on the original image; the background layer includes the background area; the subject scan layer includes the scanned object, which moves in a preset direction over time. As the scanned object moves, the subject is gradually revealed from nothing. The background layer and the subject scan layer are then merged to produce a processed image. Essentially, this method provides a method for automatically adding a new special effect to a target image. This effect creates the visual effect of "printing" the subject object into the background layer, meeting users' diverse needs for special effects and providing a richer visual experience.
[0055] Based on the above technical solution, there are various methods for obtaining a background layer based on the original image, which are not limited in this application. For example, obtaining a background layer based on the original image may include: determining a subject area in the original image; the subject area is the area occupied by the subject object; removing the image in the subject area of the original image; and filling the subject area in the original image with an image to obtain the background layer.
[0056] “Performing image filling on the subject area in the original image to obtain a background layer” may, for example, include: performing image filling on the subject area in the original image based on the image in the background area in the original image to obtain a background layer.
[0057] In some embodiments, based on the image in the background area of the original image, the subject area in the original image is filled with an image, which can specifically include: using an image generation model to generate an image for the subject area in the original image based on the image in the background area. Optionally, the image generation model can be a generative adversarial model or an image diffusion generation model. In this way, the generated image for filling the subject area is related in content to the image in the background area of the original image. Alternatively, an image restoration model can be used to restore the subject area in the original image based on the image in the background area. Optionally, the image restoration model can be a generative adversarial model or an image diffusion generation model. In this way, the restored image for filling the subject area is related in content to the image in the background area of the original image, or there is no obvious color jump between the restored image for filling the subject area and the image in the background area of the original image, and a natural transition can be achieved.
[0058] For example, comparing Figure 2 and Figure 3, in Figure 3, the area within the human wireframe is the subject area, and the area outside the human wireframe is the background area. The image in the subject area in Figure 3 is generated based on the image in the background area.
[0059] Based on the above technical solution, there are various specific implementation methods for "obtaining the main body scanning layer based on the original image", which are not limited by this application. For example, referring to FIG10 , the specific implementation method for obtaining the main body scanning layer based on the original image may include:
[0060] S210: Perform cutout processing on the main object in the original image to obtain a first layer.
[0061] Optionally, the first layer only includes the subject object and does not include the background area image. For example, FIG11 shows a schematic diagram of a first layer, which is obtained based on the original image provided in FIG2 .
[0062] S220. Determine a second layer, where the second layer includes a scanning object, and the scanning object moves along a preset direction over time; at any moment, the scanning object divides the second layer into a transparent area and a non-transparent area; during the movement of the scanning object, the range of the transparent area gradually changes, and the range of the non-transparent area gradually changes.
[0063] The second layer can be, for example, a preset layer that presents the effect of the scanned object moving over time. Specifically, the second layer is composed of multiple frames of images. The position of the scanned object is different in each frame of image. In each frame of image, the scanned object divides the entire area into a transparent area and a non-transparent area. If the frames of image are viewed continuously, the effect of the scanned object moving along a preset direction is presented, and the area and / or size of the transparent area and the non-transparent area change accordingly. Exemplarily, during the movement of the scanned object, the transparent area gradually increases and the non-transparent area gradually decreases; or, during the movement of the scanned object, the transparent area gradually decreases and the non-transparent area gradually increases.
[0064] The second layer is not associated with the main object in the original image. In other words, the position and size of the transparent area, as well as the position and size of the non-transparent area, are independent of the position and size of the main object in the original image.
[0065] For example, Figure 12 shows a schematic diagram of a frame image of the second layer. Referring to Figure 12 , the left side of the second layer is a non-transparent area, and the right side is a transparent area. The scanned object is located at the junction of the non-transparent and transparent areas. If the frames comprising the second image are viewed continuously, as the scanned object moves in the direction of the arrow over time, the non-transparent area gradually increases while the transparent area gradually decreases.
[0066] There are various methods for implementing S220, which are not limited in this application. For example, one method for implementing S220 may include: creating a transparent layer, creating an animation effect of an opaque color block scaling along a preset direction in the transparent layer; and modifying the edge of the opaque color block to obtain a second layer.
[0067] The animation effect of the opaque color block scaling along the preset direction may specifically be that the edge of the opaque color block gradually moves along the preset direction, and the opaque color block presents a visual effect of gradually expanding along the preset direction.
[0068] The edge of the opaque color block is modified to obtain a second layer. Specifically, at least one of the following operations may be performed on the opaque color block, and the resulting layer is used as the second layer: adding a rough edge effect to the edge of the opaque color block; displacing the opaque color block using a preset first noise image to distort the opaque color block; or adding a mosaic effect to the edge of the opaque color block. The purpose of modifying the edge of the opaque color block is to increase the sense of irregularity in the scan.
[0069] The first noise image may be, for example, a pre-specified noise image. The present application does not impose any limitation on the specific type of image the first noise image may be.
[0070] S230 . Based on the first layer, adjust the range of the transparent area and the non-transparent area in the second layer during the movement of the scanned object to obtain a third layer, so that the non-transparent area in the third layer is associated with the main object.
[0071] “The non-transparent area is associated with the main object” may, for example, mean that if the first layer and the third layer are overlapped, the non-transparent area overlaps with at least a portion of the main object.
[0072] There are many specific implementation methods for S230, which are not limited in this application. For example, the implementation method of this step may include: overlaying the second layer as a transparent mask on the first layer; for pixels that are opaque in the second layer and opaque in the first layer, setting their transparency channels to opaque; for pixels that are opaque in the second layer but transparent in the first layer, and pixels that are transparent in the second layer but opaque in the first layer, setting their transparency channels to transparent, thereby obtaining a third layer. This allows the non-transparent areas in the third layer to be associated with the main object.
[0073] Figures 13-15 are schematic diagrams of a third layer provided by an embodiment of the present disclosure at different times. Figure 13 corresponds to time T1, Figure 14 corresponds to time T2, and Figure 15 corresponds to time T3, with T1 occurring earlier than T2, and T2 occurring earlier than T3. When viewing Figures 13-15 sequentially, the entire third layer initially appears transparent. As the scanned object moves, the area occupied by the subject (i.e., the non-transparent area) gradually changes to a non-transparent area along a predetermined direction.
[0074] S240: Merge the first layer and the third layer to obtain a main scanning layer.
[0075] Optionally, a third layer can be overlaid on the first layer to create a main scan layer. The main scan layer includes transparent and non-transparent areas. The transparent areas allow the background image to show through after the main scan layer is fused with the background layer. The non-transparent areas create the visual effect of the main object gradually being printed out after the main scan layer is fused with the background layer.
[0076] Based on the above technical solution, optionally, after S230, the process further includes: creating a fourth layer based on the third layer, the fourth layer including a modification object for modifying the scanned object; the modification object moving in a preset direction over time; and the movement speed of the modification object being consistent with the movement speed of the scanned object; and S240 including: fusing the first layer, the third layer, and the fourth layer to obtain the main scan layer. The modification object is used to depict and render the scanned object, and can present a specific visual effect, making the final processed image more interesting and artistic. For example, the modification object is used to add a colorful luminous effect to the scanned object.
[0077] In practice, the specific production method of the fourth layer varies depending on the desired visual effect. For example, if the third layer includes N frames of images, producing the fourth layer based on the third layer includes: duplicating the third layer to obtain a fifth layer; setting t = 1, repeatedly performing the following modification object production steps until t = Na, obtaining a modification object image corresponding to the image in the third layer; processing the modification object image corresponding to the image in the third layer into the fourth layer; the modification object production steps include: determining the modification object image corresponding to the tth frame image of the third layer based on the t+ath frame image of the fifth layer and the tth frame image of the third layer; updating the value of t so that the difference between the updated value of t and the value of t before the update is 1; wherein t and a are both positive integers, and a≤N-1.
[0078] Furthermore, a t+a-th frame image based on the fifth layer and the t-th frame image of the third layer can be set to determine the modified object image corresponding to the t-th frame image of the third layer, including: subtracting the t+a-th frame image of the fifth layer and the t-th frame image of the third layer to obtain the modified object image corresponding to the t-th frame image of the third layer.
[0079] For example, referring to FIG16 , the fifth layer is a copy of the third layer, so the first frame image of the fifth layer is identical to the first frame image of the third layer. The second frame image of the fifth layer is identical to the second frame image of the third layer, and so on. If a = 2, the modified image corresponding to the first frame image of the third layer is the difference between the third frame image of the fifth layer (i.e., the third frame image of the third layer) and the first frame image of the third layer; the modified image corresponding to the second frame image of the third layer is the difference between the fourth frame image of the fifth layer (i.e., the fourth frame image of the third layer) and the second frame image of the third layer; the modified image corresponding to the third frame image is the difference between the fifth frame image of the fifth layer (i.e., the fifth frame image of the third layer) and the third frame image of the third layer, and so on. Using the above method, the modified image corresponding to FIG13 is shown in FIG17 , the modified image corresponding to FIG14 is shown in FIG18 , and the modified image corresponding to FIG15 is shown in FIG19 .
[0080] Optionally, fusing the first layer, the third layer, and the fourth layer to obtain the main scanning layer includes: fusing the first layer, the third layer, and the fourth layer in the order of the fourth layer, the third layer, and the first layer to obtain the main scanning layer.
[0081] Furthermore, after processing the modified object image corresponding to the image in the third layer into the fourth layer, the method includes: adjusting the modified object in the fourth layer so that the modified object presents a colorful luminous effect.
[0082] Specifically, adjusting the modified object in the fourth layer may include, for example, performing at least one of the following steps: multiplying the fourth layer with the second preset noise image to increase the brightness difference of the pixels in the fourth layer; adding sharpening and / or chromatic aberration effects to the modified object in the fourth layer so that the modified object has the visual effect of a grid edge; adjusting the color of the modified object based on a preset color mapping relationship so that the modified object appears in color; and adding a luminous effect to the modified object.
[0083] The second preset noise image is a pre-specified noise image, and the present application does not limit what kind of noise image the second preset noise image specifically refers to. The second preset noise image can be the same as or different from the first preset noise image.
[0084] For example, the fourth layer can be multiplied with the second preset noise image; then, sharpening and chromatic aberration effects can be added to the modified object in the resulting image; then, based on a preset color mapping relationship, the color of the modified object with sharpening and chromatic aberration effects can be adjusted; and finally, a glowing effect can be added to the modified object. This can make the modified object appear to be shining with colorful light, creating a magical atmosphere of flowing light objects.
[0085] 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.
[0086] 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.
[0087] 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.
[0088] It is understandable that the above notification and user authorization process are merely illustrative and do not limit 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.
[0089] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0090] FIG20 is a schematic diagram of the structure of an image processing device in an embodiment of the present disclosure. The image processing device provided by the embodiment of the present disclosure can be configured in a client or a server. Referring to FIG20 , the image processing device specifically includes:
[0091] The acquisition module 510 is used to acquire an original image; the original image includes a subject object;
[0092] Processing module 520 is configured to obtain a background layer and a subject scanning layer based on the original image; the background layer includes a background area; the subject scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the subject object is gradually revealed from nothing to something;
[0093] The fusion module 530 is used to fuse the background layer and the subject scan layer to obtain a processed image.
[0094] Furthermore, the processing module is used to:
[0095] Determine a subject area in the original image; the subject area is the area occupied by the subject object;
[0096] removing the image in the subject area of the original image;
[0097] Perform image filling on the main area in the original image to obtain a background layer.
[0098] Furthermore, the processing module is used to:
[0099] Based on the image in the background area in the original image, the main body area in the original image is filled with an image to obtain a background layer.
[0100] Furthermore, the processing module is used to:
[0101] Performing cutout processing on the main object in the original image to obtain a first layer;
[0102] Determining a second layer, the second layer including a scanned object, the scanned object moving along the preset direction over time; at any moment, the scanned object divides the second layer into a transparent area and a non-transparent area; during the movement of the scanned object, the range of the transparent area gradually changes, and the range of the non-transparent area gradually changes;
[0103] Based on the first layer, adjusting the ranges of the transparent area and the non-transparent area in the second layer during the movement of the scanned object to obtain a third layer, so that the non-transparent area in the third layer is associated with the main object;
[0104] The first layer and the third layer are merged to obtain a main scanning layer.
[0105] Furthermore, the processing module is used to:
[0106] Based on the first layer, adjusting the ranges of the transparent area and the non-transparent area during the movement of the scanned object to obtain a third layer, and then creating a fourth layer based on the third layer, the fourth layer including a modification object for modifying the scanned object; the modification object moves along the preset direction over time; and the movement speed of the modification object is consistent with the movement speed of the scanned object;
[0107] The first layer, the third layer, and the fourth layer are fused to obtain a main scanning layer.
[0108] Furthermore, if the third layer includes N frames of images, the processing module is configured to:
[0109] The step of producing a fourth layer based on the third layer includes:
[0110] Duplicate the third layer to obtain a fifth layer;
[0111] Let t = 1, and repeat the following modification object creation steps until t = Na, to obtain a modification object image corresponding to the image in the third layer;
[0112] Processing the modified object image corresponding to the image in the third layer into a fourth layer;
[0113] The modified object making step comprises:
[0114] determining, based on the t+a-th frame image of the fifth layer and the t-th frame image of the third layer, a modification target image corresponding to the t-th frame image of the third layer;
[0115] Update the value of t so that the difference between the updated value of t and the value of t before the update is 1;
[0116] Wherein, t and a are both positive integers, and a≤N-1.
[0117] Furthermore, the processing module is used to:
[0118] A difference is made between the t+a-th frame image of the fifth layer and the t-th frame image of the third layer to obtain a modification object image corresponding to the t-th frame image of the third layer.
[0119] Furthermore, the processing module is used to: process the modified object image corresponding to the image in the third layer into a fourth layer, and then adjust the modified object in the fourth layer so that the modified object presents a colorful luminous effect.
[0120] The image processing device provided in the embodiment of the present disclosure can execute the steps executed by the client or server in the image processing method provided in the embodiment of the method of the present disclosure, and has the execution steps and beneficial effects, which will not be repeated here.
[0121] Figure 21 is a schematic diagram of the structure of an electronic device in an embodiment of the present disclosure. With specific reference to Figure 21 below, it shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. The electronic device shown in Figure 21 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0122] As shown in FIG21 , the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes to implement the image processing method of the embodiment described in the present disclosure according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. Various programs and information required for the operation of the electronic device 1000 are also stored in the RAM 1003. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0123] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange information. Although FIG. 21 shows an electronic device 1000 having various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0124] 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, thereby implementing the image processing method described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0125] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include an information signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated information signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0126] In some embodiments, the client and server can communicate using any known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital information communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any known or future developed network.
[0127] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0128] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0129] Acquire an original image; the original image includes a subject object;
[0130] Based on the original image, a background layer and a main body scanning layer are obtained; the background layer includes a background area; the main body scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main body object is gradually revealed from nothing to something;
[0131] The background layer and the subject scan layer are fused to obtain a processed image.
[0132] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0133] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may 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 may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0134] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0136] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0137] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A 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, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer 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 of the foregoing.
[0138] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0139] one or more processors;
[0140] a memory for storing one or more programs;
[0141] When the one or more programs are executed by the one or more processors, the one or more processors implement any image processing method provided in the present disclosure.
[0142] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any image processing method provided by the present disclosure.
[0143] An embodiment of the present disclosure further provides 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.
[0144] 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.
[0145] 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: Acquire an original image; the original image includes a subject object; Based on the original image, a background layer and a main body scanning layer are obtained; the background layer includes a background area; the main body scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main body object is gradually revealed from nothing to something; The background layer and the subject scan layer are fused to obtain a processed image.
2. The method according to claim 1, wherein The step of obtaining a background layer based on the original image includes: Determine a subject area in the original image; the subject area is the area occupied by the subject object; removing the image in the subject area of the original image; Perform image filling on the main area in the original image to obtain a background layer.
3. The method according to claim 2, wherein: The step of performing image filling on the main area in the original image to obtain a background layer includes: Based on the image in the background area in the original image, the main body area in the original image is filled with an image to obtain a background layer.
4. The method according to claim 1, wherein Based on the original image, a main body scanning layer is obtained; comprising: Performing cutout processing on the main object in the original image to obtain a first layer; Determining a second layer, the second layer including a scanned object, the scanned object moving along the preset direction over time; at any moment, the scanned object divides the second layer into a transparent area and a non-transparent area; during the movement of the scanned object, the range of the transparent area gradually changes, and the range of the non-transparent area gradually changes; Based on the first layer, adjusting the ranges of the transparent area and the non-transparent area in the second layer during the movement of the scanned object to obtain a third layer, so that the non-transparent area in the third layer is associated with the main object; The first layer and the third layer are merged to obtain a main scanning layer.
5. The method according to claim 4, wherein After adjusting the ranges of the transparent area and the non-transparent area during the movement of the scanned object based on the first layer to obtain the third layer, the method further includes: Based on the third layer, a fourth layer is generated, wherein the fourth layer includes a modification object for modifying the scanned object; the modification object moves along the preset direction over time; and the movement speed of the modification object is consistent with the movement speed of the scanned object; The step of fusing the first layer and the third layer to obtain a main body scan layer includes: The first layer, the third layer, and the fourth layer are fused to obtain a main scanning layer.
6. The method according to claim 5, wherein: If the third layer includes N frames of images, generating the fourth layer based on the third layer includes: Duplicate the third layer to obtain a fifth layer; Let t = 1, and repeat the following modification object creation steps until t = Na, to obtain a modification object image corresponding to the image in the third layer; Processing the modified object image corresponding to the image in the third layer into a fourth layer; The modified object making step comprises: determining, based on the t+a-th frame image of the fifth layer and the t-th frame image of the third layer, a modification target image corresponding to the t-th frame image of the third layer; Update the value of t so that the difference between the updated value of t and the value of t before the update is 1; Wherein, t and a are both positive integers, and a≤N-1.
7. The method according to claim 6, wherein: The determining, based on the t+ath frame image of the fifth layer and the tth frame image of the third layer, the modification target image corresponding to the tth frame image of the third layer comprises: A difference is made between the t+a-th frame image of the fifth layer and the t-th frame image of the third layer to obtain a modification object image corresponding to the t-th frame image of the third layer.
8. The method according to claim 6, wherein: After processing the modified object image corresponding to the image in the third layer into a fourth layer, the method includes: The modified object in the fourth layer is adjusted so that the modified object presents a colorful glowing effect.
9. An image processing device comprising: An acquisition module, configured to acquire an original image; the original image includes a subject object; Processing module for Based on the original image, a background layer and a main body scanning layer are obtained; the background layer includes a background area; the main body scanning layer includes a scanning object, and the scanning object moves along a preset direction over time; during the movement of the scanning object, the main body object is gradually revealed from nothing to something; The fusion module is used to fuse the background layer and the subject scan layer to obtain a processed image.
10. An electronic device comprising: one or more processors; a storage device for storing 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 according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Continuous animation effect realization method and device for mobile terminal
CN101789133A
Image data processing method and device
CN107154032A
Image processing method and related device
CN111563908A
Image processing method and device, electronic equipment and storage medium
CN118096936A