Image processing method and device, electronic equipment and computer readable storage medium

By translating the image region along the target extraction direction and its opposite direction on the mobile device, the edge region is automatically determined and rendered, solving the problems of low efficiency and poor effect in the existing technology, and achieving efficient and stable image processing effect.

CN115239852BActive Publication Date: 2026-04-21BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2022-09-01
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

When implementing the effect of scattering and breaking objects at the edges on mobile devices, existing technologies require professional operation and are inefficient. Users manually outlining the edge area is inaccurate, resulting in poor processing effects. Furthermore, AI key point extraction is performance-intensive and difficult to adapt to mobile devices.

Method used

By translating the target region in the image to be processed along the target extraction direction and its opposite direction, the edge region is automatically determined and rendered based on it, avoiding AI key point extraction, reducing performance consumption, and improving efficiency and effect.

Benefits of technology

It enables fast, convenient, and reliable edge region determination on mobile devices, improving image processing efficiency and quality, supporting real-time rendering, and ensuring processing consistency and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239852B_ABST
    Figure CN115239852B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image processing method and device, electronic equipment and computer readable storage medium. The image processing method comprises: obtaining a target region in a to-be-processed image and a target extraction direction; translating the target region by a first distance in a direction opposite to the target extraction direction to obtain a first translation image; translating the target region by a second distance in the target extraction direction to obtain a second translation image; determining an edge region of the target region in the target extraction direction according to the first translation image and the second translation image; and performing rendering processing on the to-be-processed image based on the edge region to obtain a rendered image. By translating the target region in the to-be-processed image in the target extraction direction and the opposite direction respectively, the edge region of the target region in the target extraction direction can be quickly, conveniently, reliably and automatically determined by combining the two images obtained after translation, so as to render the to-be-processed image based on the edge region, which helps to improve the image processing efficiency and image processing effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image technology, and in particular to an image processing method and apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] In games and science fiction movies, the effect of objects scattering and breaking off from one side is often used to simulate the process of an object gradually disappearing. However, such special effects require operators to have professional image processing skills and consume a lot of hardware computing power, making them difficult to implement on mobile devices.

[0003] A few related technologies exist that can achieve this effect on mobile devices. Taking Motionleap, a software that performs relatively well, as an example, this software can create a particle spraying effect within the edge region of an object in an image by constructing a particle system within that edge region. However, this method requires the user to manually outline the edge region in the image to be processed, which is inefficient. Furthermore, the manually outlined edge region may not be suitable for creating the particle spraying effect, resulting in low image processing efficiency and poor processing results. Summary of the Invention

[0004] This disclosure provides an image processing method and apparatus, electronic device, and computer-readable storage medium to at least solve the problems of low image processing efficiency and poor processing effect in the related art, or it may not solve any of the above problems.

[0005] According to a first aspect of this disclosure, an image processing method is provided, the image processing method comprising: acquiring a target region and a target extraction direction in an image to be processed; translating the target region along a direction opposite to the target extraction direction by a first distance to obtain a first translated image; translating the target region along the target extraction direction by a second distance to obtain a second translated image; determining an edge region of the target region in the target extraction direction based on the first translated image and the second translated image; and rendering the image to be processed based on the edge region to obtain a rendered image.

[0006] Optionally, determining the edge region of the target region in the target extraction direction based on the first translation image and the second translation image includes: determining the overlapping portion of the region other than the target region in the first translation image and the target region in the second translation image as the edge region.

[0007] Optionally, determining the overlapping portion of the region other than the target region in the first translated image and the target region in the second translated image as the edge region includes: setting a first preset value for pixels in the region other than the target region in the first translated image and the target region in the second translated image; setting a second preset value for pixels in the target region in the first translated image and the region other than the target region in the second translated image; determining the product of the first preset value and the second preset value for corresponding pixels in the first translated image and the second translated image, and determining the edge region based on the product.

[0008] Optionally, the step of rendering the image to be processed based on the edge region to obtain a rendered image includes: determining multiple spray points from the edge region and obtaining the spray direction; using the multiple spray points as the particle source of the target particle system; and performing particle spray processing on the image to be processed based on the target particle system and the spray direction to obtain an image of image particles at the multiple spray points being sprayed along the spray direction, which is used as the rendered image.

[0009] Optionally, determining multiple injection points from the edge region includes: selecting one from the height direction and width direction of the image to be processed as a reference direction according to the target extraction direction; determining N equal division points of the edge region along the reference direction; and determining the multiple injection points based on the N equal division points, where N is a preset number.

[0010] Optionally, before performing particle jetting processing on the image to be processed based on the target particle system and the jetting direction to obtain an image of image particles jetted along the jetting direction at the plurality of jetting points as the rendered image, the step of rendering the image to be processed based on the edge region to obtain the rendered image further includes: determining a reference distance based on the distance between two adjacent jetting points; and determining the particle size of the target particle system according to the reference distance.

[0011] Optionally, after obtaining the rendered image, the image processing method further includes: determining a target region mask based on the image to be processed and the target region; and superimposing the target region mask and the rendered image to obtain a processed image.

[0012] According to a second aspect of this disclosure, an image processing apparatus is provided, comprising: an acquisition unit configured to acquire a target region and a target extraction direction in an image to be processed; a translation unit configured to translate the target region along a direction opposite to the target extraction direction by a first distance to obtain a first translated image; the translation unit further configured to translate the target region along the target extraction direction by a second distance to obtain a second translated image; a determination unit configured to determine an edge region of the target region in the target extraction direction based on the first translated image and the second translated image; and a processing unit configured to perform rendering processing on the image to be processed based on the edge region to obtain a rendered image.

[0013] Optionally, the determining unit is further configured to determine the overlapping portion of the region in the first translation image other than the target region with the target region in the second translation image as the edge region.

[0014] Optionally, the determining unit is further configured to perform the following: setting a first preset value for pixels in the region other than the target region in the first translation image and in the target region in the second translation image; setting a second preset value for pixels in the target region in the first translation image and in the region other than the target region in the second translation image; determining the product of the first preset value and the second preset value for corresponding pixels in the first translation image and the second translation image; and determining the edge region based on the product.

[0015] Optionally, the processing unit is further configured to perform the following: determine multiple spray points from the edge region and obtain the spray direction; use the multiple spray points as the particle source of the target particle system; and perform particle spray processing on the image to be processed based on the target particle system and the spray direction to obtain an image of image particles at the multiple spray points being sprayed along the spray direction, which is used as the rendered image.

[0016] Optionally, the processing unit is further configured to perform the following: selecting one of the height and width directions of the image to be processed as a reference direction based on the target extraction direction; determining N equal division points of the edge region along the reference direction; and determining the plurality of injection points based on the N equal division points, wherein N is a preset number.

[0017] Optionally, the processing unit is further configured to perform the following: determine a reference distance based on the distance between two adjacent injection points; and determine the particle size of the target particle system based on the reference distance.

[0018] Optionally, the image processing apparatus further includes: a mask unit configured to determine a target region mask based on the image to be processed and the target region; and an overlay unit configured to overlay the target region mask and the rendered image to obtain a processed image.

[0019] According to a third aspect of this disclosure, an electronic device is provided, the electronic device comprising: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform an image processing method according to this disclosure.

[0020] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by at least one processor, causes the at least one processor to perform an image processing method according to this disclosure.

[0021] According to a fifth aspect of this disclosure, a computer program product is provided, including computer instructions that, when executed by at least one processor, implement the image processing method according to this disclosure.

[0022] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0023] According to the image processing method and apparatus of the present disclosure, by translating the target region in the image to be processed along the target extraction direction and its opposite direction, the edge region of the target region in the target extraction direction can be quickly, conveniently, reliably, and automatically determined by combining the two images obtained after translation, so as to render the image to be processed based on this edge region. This automatically and quickly determines suitable edge regions, improving image processing efficiency and contributing to the generation of high-quality rendering effects, thereby enhancing the image processing effect. Furthermore, it enables real-time automated processing, obtaining real-time rendered images, thus allowing the rendered effect to be visually observed during image capture, improving image processing capabilities.

[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0026] Figure 1 This is a flowchart illustrating an image processing method according to an exemplary embodiment of the present disclosure.

[0027] Figure 2 This is a schematic diagram illustrating the process of determining an edge region according to a specific embodiment of the present disclosure.

[0028] Figure 3 This is a schematic diagram illustrating the injection points according to a specific embodiment of the present disclosure.

[0029] Figure 4 This is a block diagram illustrating an image processing apparatus according to an exemplary embodiment of the present disclosure.

[0030] Figure 5 This is a block diagram illustrating an electronic device according to exemplary embodiments of the present disclosure. Detailed Implementation

[0031] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0032] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0033] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. As another example, "performing at least one of step one and step two" indicates the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.

[0034] In games and science fiction movies, the effect of objects scattering and breaking off from one side is often used to simulate the process of an object gradually disappearing. However, such special effects require operators to have professional image processing skills and consume a lot of hardware computing power, making them difficult to implement on mobile devices.

[0035] A few related technologies exist that can achieve this effect on mobile devices. Taking Motionleap, a software that performs well, as an example, this software can create a particle spraying effect within the edge region of an object in an image by constructing a particle system within that edge region. Taking the simulation of a human annihilation process as an example, the specific operation method is as follows: after importing the image to be processed, the user manually outlines one edge region of the human figure in the image. Then, the pixels within the edge region are used as particle sources to construct a particle system. The particle shape and the magnitude of the particle dispersion force are adjusted to create the effect of particles spraying out from the edge of the human figure's body. Since the particle source is the pixels within the edge region, the pixel values ​​of these sprayed particles originate from the pixel values ​​of the pixels within the edge region. While this method, combining edge regions and particle systems, can produce a decent edge spraying effect, the edge region needs to be manually outlined by the user in the image to be processed, resulting in low operational efficiency. Furthermore, the manually outlined edge region may not be suitable for creating the particle spraying effect, thus leading to problems of low image processing efficiency and poor processing results.

[0036] To address this issue, an automatic edge region extraction solution is needed. The conventional approach is to first extract objects (e.g., portraits) from the image using image segmentation techniques, and then leverage AI (Artificial Intelligence) capabilities to identify key points of the extracted objects, such as the skeletal structure of the human torso (including but not limited to the top of the head, shoulders, elbows, knees, and ankles). Key points on one side of the object are then selected as the particle source for a particle system, effectively defining the areas corresponding to these key points as edge regions. However, this approach is very performance-intensive due to the need to extract AI key points, making it difficult to adapt well to mobile devices. Furthermore, while this solution uses the areas corresponding to AI key points as edge regions, the position and angle of objects change during framing. For portrait photography, the subject often moves during the shooting process, further complicating the process. The number of detectable AI key points may suddenly increase or decrease, causing abrupt changes in the identified edge regions and affecting the consistency and stability of image processing results. Furthermore, when an object is not facing the camera directly but is at an angle to the camera, the extracted AI key points may be located inside the area where the object is located, rather than actual edge points. Therefore, particle ejection may occur inside the object, and the greater the angle at which the object is at an angle to the camera, the more obvious this phenomenon of internal particle ejection becomes, leading to abnormal processing results.

[0037] According to the exemplary embodiments of the present disclosure, the image processing method and apparatus can quickly, conveniently, reliably, and automatically determine the edge region of the target region in the target extraction direction by translating the target region in the image to be processed along the target extraction direction and its opposite direction, respectively, and then render the image to be processed based on this edge region in the target extraction direction. Since a pure image processing method is used, without involving AI keypoint extraction, it does not require a large amount of computational power, thus accelerating the determination of edge regions, significantly improving image processing efficiency, and reducing the risk of misclassifying internal areas of objects as edge regions, thereby contributing to a comprehensive improvement in image processing effects. Furthermore, the present disclosure enables real-time automated processing to obtain real-time rendered images, allowing for a direct view of the rendered effect during image capture, thus enhancing image processing capabilities. Simultaneously, during the capture process, the image to be processed and the target region within it are continuously changing, ensuring that the edge regions obtained by the present disclosure based on the translation of the target region also continuously change, guaranteeing the consistency and stability of the image processing effect.

[0038] Below, we will refer to Figures 1 to 4 A detailed description of an image processing method and an image processing apparatus according to exemplary embodiments of the present disclosure.

[0039] Figure 1 This is a flowchart illustrating an image processing method according to an exemplary embodiment of the present disclosure. It should be understood that the image processing method according to an exemplary embodiment of the present disclosure can be implemented in terminal devices such as smartphones, tablets, and personal computers (PCs), or in devices such as servers.

[0040] Reference Figure 1 In step 101, the target region and target extraction direction in the image to be processed are obtained.

[0041] The image to be processed can be a pre-captured image, allowing for post-processing of the captured image using this disclosure. Alternatively, the image to be processed can be an image captured in real-time during the shooting of a photo or video, enabling real-time processing so that the captured photo or video has the effect of subsequent rendering. It should be understood that the captured photo is the rendered image described later, and the captured video consists of multiple rendered images corresponding to the images to be processed, with each rendered image serving as a frame of the video. This disclosure does not limit the images to be processed.

[0042] The target region can be extracted using image segmentation techniques, eliminating the need for manual user intervention. For example, the target region can be a human image, an image of another animal, or an image of an object—any region that can be extracted using image segmentation techniques.

[0043] The target extraction direction refers to the direction in which the edge region to be determined from the target area is located. It can be a default direction or a user-defined direction to meet different user needs. For custom directions, several preset directions can be provided for the user to choose from, such as, but not limited to, up, down, left, and right; alternatively, the user can input a custom direction, for example, but not limited to, by performing a swipe input on the touchscreen, with the direction defined by the user's swipe path serving as the target extraction direction. This disclosure does not impose restrictions on the determination of the target extraction direction.

[0044] In step 102, the target region is translated a first distance in the opposite direction to the target extraction direction to obtain a first translated image. By translating the target region in the opposite direction to the target extraction direction, it can be superimposed and compared with the original target region in the image to be processed to determine the difference between the two. This allows for the rapid and convenient identification of edge parts without the need for AI technology to extract key points, greatly reducing performance consumption and enabling the identification of reliable edge parts, thus reducing the risk of misjudgment.

[0045] In step 103, the target region is translated a second distance along the target extraction direction to obtain a second translated image. The translation direction in this step is opposite to that in step 102.

[0046] In step 104, the edge region of the target region in the target extraction direction is determined based on the first translation image and the second translation image.

[0047] In step 105, the image to be processed is rendered based on the edge region to obtain a rendered image. The rendering process here can be the process described above for creating particle spraying effects at the object's edge, or other processes based on the edge region; this disclosure does not limit this.

[0048] Building upon step 102, compared to directly comparing the original target region in the image to be processed with the target region of the first translated image, step 103 further translates the target region along the target extraction direction. In step 104, a second translated image is used to compare with the first translated image. This extends the edge regions determined when applying the original target region further towards the target extraction direction, serving as edge regions. This reduces the impact of insufficient extraction accuracy on the rendering effect in step 105, thereby improving the image processing effect. Even if regions outside the target region are extracted, since these regions belong to the background of the image to be processed, they can blend into the background and will not have a significant negative impact on the processing effect after rendering.

[0049] Taking the rendering of particle spraying effects at the object's edge as an example, if the region corresponding to the object's outline is not sufficiently extracted as the target region, and the original target region in the image to be processed is directly compared with the target region of the first translation image, the part of the object that was not extracted will not be identified as the edge region, thus causing this part of the region not to be sprayed as a particle source. If the target region in the second translation image is compared with the target region in the first translation image, the part of the region outside the extracted target region in the target extraction direction will also be included in the edge region. This solves the problem of insufficient determination of the edge region. On the other hand, it may cause some background regions to be included in the edge region and sprayed as particle sources. However, since this part of the particles is sprayed into the background region, there will be no obvious abnormality and no obvious negative impact. The benefits outweigh the drawbacks.

[0050] It should be understood that the first distance in step 102 is a positive value to achieve translation, and the second distance in step 103 can also be a positive value, and be on the same order of magnitude as the first distance, or it can be 0. When the second distance is 0, it is equivalent to directly comparing the original target region in the image to be processed with the target region of the first translated image when determining the edge region. This is also an implementation method of this disclosure and falls within the protection scope of this disclosure. In addition, since only a narrow edge region needs to be extracted, the value of the first distance is much smaller than the size of the image to be processed in the target extraction direction, and can be at the pixel level, for example, between 1 pixel and 10 pixels. The first distance and the second distance are on the same order of magnitude, and their values ​​can be equal or unequal. They can be fixed by default or determined according to the size of the image to be processed. This disclosure does not impose any restrictions on this.

[0051] The next step is to explain how to determine the edge region.

[0052] Optionally, step 104 includes: determining the overlapping portion of the region other than the target region in the first translation image and the target region in the second translation image, as the edge region. By determining the region that belongs to the target region in the second translation image but not to the target region in the first translation image, the edge portion of the original target region located in the target extraction direction, and the portion of the edge portion slightly extended towards the target extraction direction, can be obtained as the edge region used for rendering processing. By taking specific regions in the first and second translation images respectively to determine their overlapping portion, the edge region can be determined clearly and concisely, improving the efficiency of edge region determination.

[0053] This step specifically includes: setting a first preset value for pixels in the region other than the target region in the first translation image and pixels in the target region in the second translation image; setting a second preset value for pixels in the target region in the first translation image and pixels in the region other than the target region in the second translation image; determining the product of the first preset value and the second preset value for corresponding pixels in the first translation image and the second translation image, and determining the edge region based on the product. By using numerical product calculation to determine the overlapping part, the computability of the edge region determination scheme can be further improved, and the processing efficiency can be increased. It should be understood that if the first preset value and the second preset value are not equal, and the first preset value is not 0, pixels whose corresponding product is equal to the square of the first preset value can be classified as edge regions.

[0054] Figure 2 This is a schematic diagram illustrating the process of determining an edge region according to a specific embodiment of the present disclosure.

[0055] As an example, the target extraction direction is to the right. (Refer to...) Figure 2 The extracted target region is shifted to the left to obtain the first shifted image, where the black area represents the target region. The extracted target region is then shifted to the right to obtain the second shifted image, where the white area represents the target region. A first preset value (1) is set for the pixels in the white areas of both the first and second shifted images, and a second preset value (0) is set for the pixels in the black areas of both images, indicating transparency. After determining the product of the values ​​corresponding to each pixel, pixels with a product equal to 1 are assigned to the edge region, which is the white area in the image after the arrow. The gray area in this image represents the region formed by pixels with a product of 0.

[0056] As an example, for steps 102 to 104, the operations of translating the target region and determining the edge region can be performed first in the GPU (Graphics Processing Unit), and then UV mapping technology can be used to perform readPixel processing, that is, converting GPU data into CPU (central processing unit) screen pixel data, which can reduce the CPU's operating load. Of course, the above operations can also be performed directly in the CPU, and this disclosure does not limit this.

[0057] The rendering process will be introduced next.

[0058] Optionally, step 105 includes: determining multiple spray points from the edge region and obtaining the spray direction; using the multiple spray points as particle sources for the target particle system; and performing particle spraying processing on the image to be processed based on the target particle system and the spray direction to obtain an image of image particles sprayed along the spray direction at the multiple spray points, which is then used as the rendered image. By determining the spray points from the edge region as particle sources for the target particle system and combining the target particle system and the spray direction for particle spraying processing, the effect of particle spraying at the edge of an object can be easily created on mobile devices, meeting the rendering requirements of mobile devices.

[0059] It should be understood that the spray direction can be consistent with or inconsistent with the target extraction direction. When inconsistent, at least the horizontal and vertical orientations must not be opposite. For example, if the spray direction is right, the target extraction direction can be upper right or lower right, or up or down, as long as it is not left, upper left, or lower left. When the spray direction and target extraction direction are consistent, they can be treated as the same concept and determined only once. For example, but not limited to, the default spray direction and target extraction direction are both right. Of course, the user can choose whether to make them consistent, and if the user chooses to make them inconsistent, the spray direction is determined using the aforementioned method for determining the target extraction direction. This disclosure does not impose any restrictions on this. Furthermore, when the two directions are inconsistent and both require user determination, this disclosure does not restrict the order of determining the spray direction and target extraction direction. One can be determined first, followed by the other. Furthermore, if the user-determined direction does not meet the aforementioned directional relationship requirements with the previous direction, a prompt message can be issued to alert the user that the direction may affect the rendering effect. All of the above are implementation methods of this disclosure and fall within the protection scope of this disclosure.

[0060] It should also be understood that the main settings parameters of the particle system include particle source, particle quantity (how many particles are emitted per frame), particle size, particle shape, wind force, turbulence force, etc. The target particle system is a particle system whose particle source is not yet determined, and it can be constructed at any time point before particle jet processing; this disclosure does not impose any restrictions on this. After multiple jet points are determined from the edge region, these multiple jet points are used as the particle source of the target particle system. Other parameters in the target particle system that are unrelated to the particle source can use default values ​​(as will be described below, the particle size can be determined based on multiple jet points, i.e., the particle size does not use default values), which means that users do not need to set them themselves, which simplifies user operation. Furthermore, a value range can be configured for each default parameter, and different target particle systems can be constructed by randomly selecting values ​​from the value range to enrich the forms of particle jet effects. Of course, editing functions can also be configured for these parameters for users to set themselves, thereby improving the flexibility of constructing the target particle system and meeting the image processing needs of users with different skill levels.

[0061] Optionally, the step of determining multiple injection points from the edge region may include: selecting one from the height and width directions of the image to be processed as a reference direction based on the target extraction direction; determining N equal division points of the edge region along the reference direction; and determining multiple injection points based on the N equal division points, where N is a preset number. Obtaining injection points by using N equal division points determined along the reference direction for the edge region not only simplifies and ensures reliable injection point determination and reduces performance consumption, but also ensures a uniform distribution of the obtained injection points, thus helping to guarantee the processing effect. It should be noted that the N equal division points typically do not include the endpoints at both ends, and the number is N-1. This disclosure can directly use these N-1 N equal division points as injection points, or it can further select at least one endpoint from the N equal division points and use it together with the N equal division points as injection points. These are all implementation methods of this disclosure and fall within the protection scope of this disclosure. The preset number N can be a fixed value or determined according to the size of the image to be processed. The larger the image size, the larger N is, to adapt to different sizes of images to be processed. Regarding the reference direction, as mentioned earlier, to extract a narrow edge region, the reference direction is the direction that aligns with the extension direction of the edge region. Since edge regions are often irregularly shaped and change significantly with variations in the first and second distances, accurately calculating the edge line length along its extension direction and then determining the N division points would result in a large computational burden. By selecting the direction between the height and width of the image to be processed—which better aligns with the extension direction of the edge region—as the reference direction, the edge region can be divided into N equal parts along either a straight height or width direction. This significantly simplifies the calculation, reduces the computational burden, and has a negligible impact on the final edge spraying effect. Specifically, the extension direction of the edge region is often approximately perpendicular to the feature extraction direction. Therefore, the reference direction can be determined based on the feature extraction direction, using the direction between the height and width of the image to be processed that deviates relatively from the feature extraction direction. For example, when the feature extraction direction is left or right, the height direction can be used as the reference direction; when the feature extraction direction is up or down, the width direction can be used. In particular, when the feature extraction direction is a 45° tilt, the height direction can be selected first, the width direction can be selected first, or the selection can be random, or the user can specify the selection. This disclosure does not impose any restrictions on this. Figure 3 This is a schematic diagram illustrating the injection points according to a specific embodiment of the present disclosure.

[0062] Reference Figure 3 ,continue Figure 2 In the specific embodiment shown, N=11, and the boundary line of the determined edge region in the target extraction direction is used. The 10 eleven-part points of this boundary line in the height direction and the lower end point are used as the spray points to obtain a total of 11 spray points.

[0063] Optionally, before performing particle spraying processing on the image to be processed based on the target particle system and the spraying direction to obtain an image of image particles sprayed along the spraying direction at multiple spraying points, and using this as the rendered image, step 105 further includes: determining a reference distance based on the distance between two adjacent spraying points; and determining the particle size of the target particle system based on the reference distance. The distance between two adjacent spraying points can basically reflect the size of the target area, especially when the spraying points are determined based on N equally divided points. By determining the reference distance accordingly and determining the particle size based on the reference distance, it is possible to determine an appropriate particle size based on the size of the target area, which helps to improve the coordination of the edge particle spraying effect and improve the processing effect. As an example, two adjacent spraying points can be arbitrarily selected, and the distance between them can be used as the reference distance. Alternatively, multiple pairs of adjacent spraying points can be selected, and multiple distances can be obtained accordingly. The statistical values ​​of these distances, such as, but not limited to, the mean, median, and mode, can be used as the reference distance. This disclosure does not impose any limitations on this.

[0064] In some embodiments, after step 105, the image processing method according to an exemplary embodiment of the present disclosure further includes: determining a target region mask based on the image to be processed and the target region; and superimposing the target region mask and a rendered image to obtain a processed image. The image in the image to be processed corresponding to the target region is the original image of the extracted object before rendering. The target region mask can be the original image, or it can be an image obtained by adjusting the original image, for example, but not limited to, shrinking the original image inward by a certain amount. By superimposing the target region mask on the rendered image, when there are defects inside the region corresponding to the target region mask in the rendered image, the corresponding original image can be used to cover the defects, thereby compensating for and optimizing the rendered image, which helps to improve the image processing effect.

[0065] Figure 4 This is a block diagram illustrating an image processing apparatus according to exemplary embodiments of the present disclosure. It should be understood that the image processing apparatus according to exemplary embodiments of the present disclosure can be implemented in terminal devices such as smartphones, tablets, and personal computers (PCs) in a software, hardware, or software-hardware combination manner, or in devices such as servers.

[0066] Reference Figure 4 The image processing apparatus 400 includes an acquisition unit 401, a translation unit 402, a determination unit 403, and a processing unit 404.

[0067] The acquisition unit 401 can acquire the target region and the target extraction direction in the image to be processed.

[0068] The translation unit 402 can translate the target region by a first distance in a direction opposite to the target extraction direction to obtain a first translated image.

[0069] The translation unit 402 can also translate the target region along the target extraction direction by a second distance to obtain a second translated image.

[0070] The determining unit 403 can determine the edge region of the target region in the target extraction direction based on the first translation image and the second translation image.

[0071] Optionally, the determining unit 403 may also determine the overlapping portion of the region other than the target region in the first translation image and the target region in the second translation image as the edge region.

[0072] Optionally, the determining unit 403 may also set a first preset value for the region other than the target region in the first translation image and the pixel in the target region in the second translation image; set a second preset value for the pixel in the target region in the first translation image and the region other than the target region in the second translation image; determine the product of the first preset value and the second preset value for the corresponding pixel in the first translation image and the second translation image, and determine the edge region based on the product.

[0073] The processing unit 404 can perform rendering processing on the image to be processed based on the edge region to obtain a rendered image.

[0074] Optionally, the processing unit 404 may also determine multiple spray points from the edge region and obtain the spray direction; use the multiple spray points as the particle source of the target particle system; and perform particle spray processing on the image to be processed based on the target particle system and the spray direction to obtain an image of image particles sprayed along the spray direction at the multiple spray points, which is used as a rendering image.

[0075] Optionally, the processing unit 404 may also select one of the height direction and the width direction of the image to be processed as a reference direction according to the target extraction direction; determine N equal division points of the edge region along the reference direction; and determine multiple injection points based on the N equal division points, where N is a preset number.

[0076] Optionally, the processing unit 404 may also determine a reference distance based on the distance between two adjacent injection points; and determine the particle size of the target particle system based on the reference distance.

[0077] Optionally, the image processing apparatus 400 further includes a mask unit (not shown) and an overlay unit (not shown). The mask unit can determine a target region mask based on the image to be processed and the target region; the overlay unit can overlay the target region mask and the rendered image to obtain the processed image.

[0078] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0079] Figure 5 This is a block diagram of an electronic device according to exemplary embodiments of the present disclosure.

[0080] Reference Figure 5 The electronic device 500 includes at least one memory 501 and at least one processor 502. The at least one memory 501 stores a set of computer-executable instructions. When the set of computer-executable instructions is executed by the at least one processor 502, an image processing method according to an exemplary embodiment of the present disclosure is performed.

[0081] As an example, electronic device 500 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned set of instructions. Here, electronic device 500 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 500 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.

[0082] In electronic device 500, processor 502 may include CPU, GPU, programmable logic device, dedicated processor system, microcontroller, or microprocessor. By way of example and not limitation, processor may also include analog processor, digital processor, microprocessor, multi-core processor, processor array, network processor, etc.

[0083] The processor 502 can execute instructions or code stored in the memory 501, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.

[0084] The memory 501 may be integrated with the processor 502, for example, by arranging RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 501 may include a separate device, such as an external disk drive, a storage array, or other storage device usable by any database system. The memory 501 and the processor 502 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 502 to read files stored in the memory.

[0085] In addition, electronic device 500 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of electronic device 500 can be interconnected via a bus and / or network.

[0086] According to exemplary embodiments of the present disclosure, a computer-readable storage medium may also be provided, which, when executed by at least one processor, causes at least one processor to perform an image processing method according to exemplary embodiments of the present disclosure. Examples of computer-readable storage media herein include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.

[0087] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, the computer program product including computer instructions that, when executed by at least one processor, cause at least one processor to perform an image processing method according to exemplary embodiments of the present disclosure.

[0088] According to the exemplary embodiments of the present disclosure, the image processing method, apparatus, electronic device, and computer-readable storage medium can quickly, conveniently, reliably, and automatically determine the edge region of the target region in the target extraction direction by translating the target region in the image to be processed along the target extraction direction and its opposite direction, respectively, so as to render the image to be processed based on this. This simplifies user operation, and because it adopts a pure image processing method without involving AI key point extraction, it does not require a large amount of computing power, which can accelerate the determination of edge regions and reduce the risk of misjudging the internal regions of objects as edge regions, thus contributing to a comprehensive improvement in image processing effects. In addition, the present disclosure can achieve real-time automated processing to obtain real-time rendered images, so the rendered effect can be seen intuitively during the image capture process, improving image processing capabilities. At the same time, during the capture process, the image to be processed and the target region itself are continuously changing, so the edge region obtained by the present disclosure based on the translation of the target region also changes continuously, which can ensure the consistency and stability of the image processing effect.

[0089] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0090] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An image processing method, characterized in that, The image processing method includes: Obtain the target region and target extraction direction in the image to be processed; The target region is translated by a first distance in a direction opposite to the target extraction direction to obtain a first translated image; The target region is translated by a second distance along the target extraction direction to obtain a second translated image; The overlapping portion of the region other than the target region in the first translation image and the target region in the second translation image is determined as the edge region of the target region in the target extraction direction; Based on the edge region, the image to be processed is rendered to obtain a rendered image.

2. The image processing method as described in claim 1, characterized in that, The step of determining the overlapping portion between the region in the first translation image (excluding the target region) and the target region in the second translation image, as the edge region of the target region in the target extraction direction, includes: Set a first preset value for the pixels in the region other than the target region in the first translation image and the target region in the second translation image; Set a second preset value for the pixels in the target region in the first translation image and the region other than the target region in the second translation image; The product of the first preset value and the second preset value of corresponding pixels in the first translation image and the second translation image is determined, and the edge region is determined based on the product.

3. The image processing method as described in claim 1, characterized in that, The rendering process based on the edge region to obtain a rendered image includes: Multiple injection points are determined from the edge region, and the injection direction is obtained; The plurality of injection points are used as the particle source of the target particle system; Based on the target particle system and the jetting direction, the image to be processed is subjected to particle jetting processing to obtain an image of the image particles at the multiple jetting points being jetted along the jetting direction, which is used as the rendered image.

4. The image processing method as described in claim 3, characterized in that, Determining multiple injection points from the edge region includes: Based on the target extraction direction, select one from the height direction and the width direction of the image to be processed as a reference direction; The edge region is divided into N equal parts along the reference direction, and the plurality of injection points are determined based on the N equal parts, where N is a preset number.

5. The image processing method as described in claim 3, characterized in that, Before performing particle jet processing on the image to be processed based on the target particle system and the jet direction to obtain an image of image particles ejected along the jet direction at the plurality of jet points, and using this image as the rendered image, the step of rendering the image to be processed based on the edge region to obtain the rendered image further includes: Determine the reference distance based on the distance between two adjacent spray points; The particle size of the target particle system is determined based on the reference distance.

6. The image processing method according to any one of claims 1 to 5, characterized in that, After obtaining the rendered image, the image processing method further includes: Determine the target region mask based on the image to be processed and the target region; The target region mask and the rendered image are superimposed to obtain the processed image.

7. An image processing apparatus, characterized in that, The image processing device includes: The acquisition unit is configured to acquire the target region and target extraction direction in the image to be processed. The translation unit is configured to translate the target region along a direction opposite to the target extraction direction by a first distance to obtain a first translated image; The translation unit is further configured to translate the target region along the target extraction direction by a second distance to obtain a second translated image; The determining unit is configured to determine the overlapping portion of a region in the first translation image other than the target region and the target region in the second translation image, as the edge region of the target region in the target extraction direction; The processing unit is configured to perform rendering processing on the image to be processed based on the edge region to obtain a rendered image.

8. An electronic device, characterized in that, include: At least one processor; At least one memory that stores computer-executable instructions. The computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform the image processing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor causes the at least one processor to perform the image processing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Vertex animation processing method and device and electronic equipment

    CN114627214A

  • Anti-aliasing for distance field graphics rendering

    WO2022035627A1