CN-115239852-B - Image processing method and device, electronic equipment and computer readable storage medium
Abstract
The disclosure relates to an image processing method and device, an electronic device and a computer readable storage medium, wherein the image processing method comprises the steps of obtaining a target area and a target extraction direction in an image to be processed; the method comprises the steps of translating a target area along a direction opposite to a target extraction direction to obtain a first translation image, translating the target area along the target extraction direction to obtain a second translation image, determining an edge area of the target area along the target extraction direction according to the first translation image and the second translation image, and performing rendering processing on an image to be processed based on the edge area to obtain a rendered image. Through respectively translating the target area in the image to be processed along the target extraction direction and the opposite direction, the edge area of the target area in the target extraction direction can be quickly, conveniently, reliably and automatically determined by combining the two images obtained after translation, so that the image to be processed is rendered based on the edge area, and the image processing efficiency and the image processing effect are improved.
Inventors
- LIU YIZHOU
Assignees
- 北京达佳互联信息技术有限公司
- 北京达佳互联信息技术有限公司
Dates
- Publication Date
- 20260421
- Application Date
- 20220901
- Priority Date
- 20220901
Claims (9)
- 1. An image processing method, characterized in that the image processing method comprises: Acquiring a target area and a target extraction direction in an image to be processed; translating the target area along a direction opposite to the target extraction direction by a first distance to obtain a first translation image; Translating the target area along the target extraction direction for a second distance to obtain a second translation image; Determining an overlapping portion of a region other than the target region in the first translation image and the target region in the second translation image as an edge region of the target region in the target extraction direction; And rendering the image to be processed based on the edge area to obtain a rendered image.
- 2. The image processing method according to claim 1, wherein the determining of 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 an edge region of the target region in the target extraction direction includes: Setting a first preset value for a region except the target region in the first translation image and a pixel point in the target region in the second translation image; Setting a second preset value for the target area in the first translation image and pixel points in an area except the target area in the second translation image; And determining the product of the first preset value and the second preset value of corresponding pixel points in the first translation image and the second translation image, and determining the edge area according to the product.
- 3. The image processing method according to claim 1, wherein the rendering the image to be processed based on the edge region to obtain a rendered image includes: determining a plurality of injection points from the edge area, and acquiring injection directions; Taking the plurality of injection points as a particle source of a target particle system; and carrying out particle spraying treatment on the image to be treated based on the target particle system and the spraying direction, and obtaining images of image particles at the spraying points along the spraying direction as the rendering image.
- 4. The image processing method of claim 3, wherein said determining a plurality of ejection points from said edge region comprises: selecting 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; and determining N equally dividing points of the edge area along the reference direction, and determining the plurality of injection points based on the N equally dividing points, wherein N is a preset number.
- 5. The image processing method according to claim 3, wherein, before the image to be processed is subjected to particle ejection processing based on the target particle system and the ejection direction to obtain an image in which image particles at the plurality of ejection points are ejected in the ejection direction, the image to be processed is subjected to rendering processing based on the edge region to obtain a rendered image, further comprising: determining a reference distance based on a distance between two adjacent injection points; and determining the particle size of the target particle system according to 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 comprises: Determining a target area mask according to the image to be processed and the target area; and superposing the target area mask and the rendering image to obtain a processed image.
- 7. An image processing apparatus, characterized in that the image processing apparatus comprises: An acquisition unit configured to perform acquisition of a target region in an image to be processed and a target extraction direction; A translation unit configured to perform translation of the target region by a first distance in a direction opposite to the target extraction direction, resulting in a first translated image; the translation unit is further configured to perform translation of the target region along the target extraction direction by a second distance to obtain a second translation image; a determination unit configured to perform determination of an overlapping portion of a region other than the target region in the first translation image and the target region in the second translation image as an edge region of the target region in the target extraction direction; And the processing unit is configured to perform rendering processing on the image to be processed based on the edge area to obtain a rendered image.
- 8. An 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 the image processing method of any of claims 1 to 6.
- 9. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by at least one processor, cause the at least one processor to perform the image processing method of any of claims 1 to 6.
Description
Image processing method and device, electronic equipment and computer readable storage medium Technical Field The present disclosure relates to the field of image technology, and in particular, to an image processing method and apparatus, an electronic device, and a computer readable storage medium. Background In a game or science fiction movie scene, the effect of drifting and crushing one side edge of an object often appears, and the process of gradually annihilating the object can be simulated. However, such special effects require specialized image processing skills of operators, and consume more hardware computing power, so that implementation is difficult at the mobile terminal. In the related art, there are a small number of schemes capable of realizing the effect at the mobile terminal, taking software Motionleap which performs better as an example, the software can realize the effect of image particle spray drift in an edge area of an object in an image by constructing a particle system. However, in this method, the edge area needs to be manually outlined by the user in the image to be processed, the operation efficiency is low, and the edge area selected by the manual outlining by the user is not necessarily suitable for making the effect of particle spray drift, so there are problems of low image processing efficiency and poor processing effect. Disclosure of Invention The present disclosure provides an image processing method and apparatus, an electronic device, and a computer-readable storage medium to solve at least the problems of low image processing efficiency and poor processing effect in the related art, or to not solve any of the above problems. According to a first aspect of the present disclosure, an image processing method is provided, the image processing method includes obtaining a target area and a target extraction direction in an image to be processed, translating the target area along a direction opposite to the target extraction direction by a first distance to obtain a first translated image, translating the target area along the target extraction direction by a second distance to obtain a second translated image, determining an edge area of the target area in the target extraction direction according to the first translated image and the second translated image, and performing rendering processing on the image to be processed based on the edge area to obtain a rendered image. Optionally, the determining the edge area of the target area in the target extraction direction according to the first translation image and the second translation image comprises determining the overlapping part of the area except the target area in the first translation image and the target area in the second translation image as the edge area. Optionally, the determining the overlapping part of the region except the target region in the first translation image and the target region in the second translation image is used as the edge region, and the method comprises the steps of setting a first preset value for a pixel point in the region except the target region in the first translation image and the target region in the second translation image, setting a second preset value for a pixel point in the region except the target region in the first translation image and the region except the target region in the second translation image, determining the product of the first preset value and the second preset value of corresponding pixel points in the first translation image and the second translation image, and determining the edge region according to the product. Optionally, the rendering processing is performed on the image to be processed based on the edge area to obtain a rendered image, wherein the rendering processing comprises the steps of determining a plurality of injection points from the edge area, acquiring injection directions, taking the injection points as particle sources of a target particle system, and performing particle injection processing on the image to be processed based on the target particle system and the injection directions to obtain an image of image particles at the injection points along the injection directions as the rendered image. Optionally, determining a plurality of injection points from the edge area comprises selecting 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, determining N equally divided points of the edge area along the reference direction, and determining the plurality of injection points based on the N equally divided points, wherein N is a preset number. Optionally, before performing particle spraying processing on the image to be processed based on the target particle system and the spraying direction to obtain images of image particles at the plurality of spraying points sprayed along the spraying direction as the rendered image, performing renderin