CN118052900A - Image generation method, device, nonvolatile storage medium and computer equipment - Google Patents

Image generation method, device, nonvolatile storage medium and computer equipment Download PDF

Info

Publication number
CN118052900A
CN118052900A CN202410274691.8A CN202410274691A CN118052900A CN 118052900 A CN118052900 A CN 118052900A CN 202410274691 A CN202410274691 A CN 202410274691A CN 118052900 A CN118052900 A CN 118052900A
Authority
CN
China
Prior art keywords
pixel points
image
target
colors
positions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410274691.8A
Other languages
Chinese (zh)
Inventor
金尧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Electronic Commerce Co Ltd
Original Assignee
Tianyi Electronic Commerce Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Electronic Commerce Co Ltd filed Critical Tianyi Electronic Commerce Co Ltd
Priority to CN202410274691.8A priority Critical patent/CN118052900A/en
Publication of CN118052900A publication Critical patent/CN118052900A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses an image generation method, an image generation device, a nonvolatile storage medium and computer equipment. Wherein the method comprises the following steps: acquiring an initial image; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect graph of the initial image. The invention solves the technical problem of lower generation efficiency caused by the fact that a large amount of computing resources are required for generating the distortion effect in the related technology.

Description

Image generation method, device, nonvolatile storage medium and computer equipment
Technical Field
The present invention relates to the field of image processing, and in particular, to an image generating method, an image generating device, a nonvolatile storage medium, and a computer device.
Background
Currently, the distortion effect is widely used in digital art, website design, and visual media. This is achieved primarily through the use of JavaScript, CSS or animation libraries. These methods typically involve animation effects such as gradual changes in transparency, dimensional changes, displacements, and rotations of the image or element to achieve gradual appearance or disappearance of the image. However, there are problems in achieving the warp effect, such as the need to introduce complex velocity field simulations in order to simulate the irregular effects of the warp, which increases computational complexity and cost, resulting in less efficient image generation. And the generated distortion effect is usually fixed, and is difficult to customize in a personalized way according to the requirements of users, so that the flexibility of the application is limited, and the experience of the users is not high.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides an image generation method, an image generation device, a nonvolatile storage medium and computer equipment, which at least solve the technical problem that the generation efficiency is low due to the fact that a large amount of computing resources are required for generating a distortion effect in the related technology.
According to an aspect of an embodiment of the present invention, there is provided an image generation method including: acquiring an initial image; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect graph of the initial image.
Optionally, randomly generating a movement path for each of a plurality of pixels in the initial image includes: acquiring a moving distance input based on a target account; randomly generating movement angles corresponding to the pixel points respectively; and determining a moving path corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Optionally, determining the positions of the plurality of pixel points as the target positions after the plurality of pixel points move according to the corresponding movement paths includes: respectively taking a plurality of pixel points as original points, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are positioned on an initial image, and coordinate axes of the polar coordinate systems are parallel to each other; based on the plurality of polar coordinate systems, the target position is determined according to the movement distance and the movement angle of each of the plurality of pixel points.
Optionally, generating the target image according to the color of the target position corresponding to the color adjustment of the plurality of pixel points includes: and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-overlapping positions to the colors of the corresponding pixel points to obtain the target image.
Optionally, adjusting the colors of the pixels at the corresponding target positions according to the colors of the plurality of pixels to generate the target image, and further includes: according to the colors of the plurality of pixel points, the colors of the pixel points at the corresponding target positions are adjusted, and an intermediate image is obtained; acquiring the set iteration times based on the target account input; and carrying out iterative processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iterative times to obtain a target image.
Optionally, the color of the pixel point at the corresponding target position is adjusted according to the colors of the plurality of pixel points by using a Web graphic library, and a target image is generated.
According to another aspect of the embodiment of the present invention, there is also provided an image generating apparatus including: the acquisition module is used for acquiring an initial image; the first generation module is used for randomly generating a moving path for each of a plurality of pixel points in the initial image; the determining module is used for determining the positions of the pixel points after moving according to the corresponding moving paths as target positions; and the second generation module is used for generating a target image according to the colors of the pixel points at the corresponding target positions, wherein the target image is a distortion effect diagram of the initial image.
According to still another aspect of the embodiments of the present invention, there is also provided a nonvolatile storage medium including a stored program, wherein a device in which the nonvolatile storage medium is controlled to execute any one of the image generating methods described above when the program runs.
According to still another aspect of the embodiments of the present invention, there is further provided a computer device, including a processor for executing a program, where the program executes any one of the image generating methods described above.
According to still another aspect of the embodiments of the present invention, there is also provided a computer program product including a computer program which, when executed by a processor, implements any one of the above image generation methods.
In the embodiment of the invention, an image generation method is adopted, and an initial image is acquired; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and generating a target image according to the colors of the pixel points at the corresponding target positions of the color adjustment of the plurality of pixel points, wherein the target image is a distortion effect diagram of the initial image, so that the aim of generating the image without a large amount of computer resources is fulfilled, the technical effect of improving the image generation efficiency is realized, and the technical problem that the generation efficiency is lower due to the fact that a large amount of computing resources are required for generating the distortion effect in the related technology is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 shows a hardware block diagram of a computer terminal for implementing an image generation method;
fig. 2 is a flowchart of an image generating method according to an embodiment of the present invention;
FIG. 3 is a flowchart of an implementation of an image generation method provided in accordance with an alternative embodiment of the present invention;
FIG. 4 is an implementation effect diagram of an image generation method provided according to an alternative embodiment of the present invention;
Fig. 5 is a block diagram of an image generating apparatus according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an embodiment of the present invention, there is provided a method embodiment of an image generation method, it being noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in an order different from that herein.
The method according to the first embodiment of the present application may be implemented in a mobile terminal, a computer terminal or a similar computing device. Fig. 1 shows a block diagram of a hardware structure of a computer terminal for implementing an image generation method. As shown in fig. 1, the computer terminal 10 may include one or more (shown as 102a, 102b, … …,102 n) processors (which may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. In addition, the method may further include: a display, an input/output interface (I/O interface), a Universal Serial BUS (USB) port (which may be included as one of the ports of the BUS), a network interface, a power supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors and/or other data processing circuits described above may be referred to herein generally as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Furthermore, the data processing circuitry may be a single stand-alone processing module or incorporated, in whole or in part, into any of the other elements in the computer terminal 10. As referred to in embodiments of the application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the image generation method in the embodiments of the present invention, and the processor executes the software programs and modules stored in the memory 104, thereby executing various functional applications and data processing, that is, implementing the image generation method of the application program described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10.
Currently, distortion-effect images are widely used in digital art, website design, and visual media. The distortion effect image can be used for simulating smoke effect, combustion effect and the like, and has wide application. However, there are some problems in the related art in generating a distortion effect image, for example, in order to achieve a better distortion effect, it is necessary to introduce a complicated velocity field simulation to simulate irregularities in the distortion effect. This requires a lot of computational resources and complex algorithms, and many of the generated warping effects are fixed and difficult to customize according to the user's needs, which limits the flexibility and customizable of the generated images. In view of the above problems, the present invention proposes an image generation method. Fig. 2 is a flowchart of an image generating method according to an embodiment of the present invention, as shown in fig. 2, the method includes the following steps:
step S202, an initial image is acquired.
In this step, the initial image obtained is an image to be generated with a distortion effect, and various patterns may be provided thereon. Specifically, the corresponding initial image can be selected according to different requirements of users, so that the final image can be generated in a personalized way, and the requirements of the users are better met.
Step S204, randomly generating a moving path for each of a plurality of pixels in the initial image.
In this step, a moving path is randomly generated for the pixel points. All pixels in the initial image can be randomly generated into a moving path, or only a part of pixels can be selected to generate the moving path. Therefore, different parts of the image can be distorted to different degrees according to the needs of the user, so that the final effect is richer, and the needs of the user are better met. There are various methods of randomly generating the movement path, in which a random walk algorithm may be selected for determination. The algorithm randomly selects one direction and moves a fixed distance, then randomly selects one direction and moves, and thus reciprocates, generating a moving path. The method can simulate the irregularity in the distortion effect, so that the effect generated finally is more real. Coordinate points may also be randomly generated. For example, a two-dimensional coordinate system is established on the initial image, then coordinate points of the target position are randomly generated, and movement is performed according to the distance and direction between the position of the pixel point and the target position. The method can control the moving track of each pixel point more flexibly, thereby realizing finer distortion effect.
In step S206, it is determined that the positions of the plurality of pixel points after moving according to the corresponding moving paths are target positions.
In this step, the position of the pixel point after moving according to the corresponding moving path is determined as the target position, and the coordinates of each of the plurality of pixel points and the vector corresponding to the moving path can be determined by establishing a coordinate system in the initial image, so that the coordinates of the pixel point at the target position after moving through the moving path can be determined. In the process of establishing the coordinate system, the origin position of the image needs to be determined first, for example, a certain point of the edge of the image may be taken as the origin, and then the direction and unit length of the coordinate axis may be determined. Then, by marking each pixel point, their respective coordinate values can be obtained. And then determining a vector corresponding to the moving path, and determining the target position of each pixel point after moving through the coordinates of the pixel point and the vector of the corresponding moving path. Because in the actual image processing process, fine adjustment or transformation of the color of the pixel point is needed in many cases, so as to achieve better visual effect or actual requirement. The two-dimensional coordinate system is established, so that the positions of the pixel points can be well determined, and further, the image can be modified and optimized more accurately.
Step S208, the colors of the corresponding pixel points at the target positions are adjusted according to the colors of the plurality of pixel points, and a target image is generated, wherein the target image is a distortion effect diagram of the initial image.
In this step, the color of the pixel point at the corresponding target position is adjusted according to the colors of the plurality of pixel points, and a target image, that is, a distortion effect map of the initial image is generated. The color of each pixel point is adjusted, so that the purpose of the twisting effect is achieved. In practical applications, the distortion effect map may be used as a simulated smoke effect map or a combustion effect map. In the related art, a common method is to generate a target image by setting a speed and a moving direction for a pixel point and then capturing an image at a certain time. However, this method requires a large amount of computational resources because each pixel needs to be subjected to analog motion, which results in inefficient image generation. The target image is determined by directly adjusting the color of the pixel point at the target position, so that the method can reduce required computing resources and further improve the efficiency of image generation.
Through the steps, the aim of generating images without a large amount of computer resources is achieved, so that the technical effect of improving the image generation efficiency is achieved, and the technical problem that the generation efficiency is low due to the fact that a large amount of computing resources are needed for generating the distortion effect in the related technology is solved.
As an alternative embodiment, the method for randomly generating the moving paths for the plurality of pixels in the initial image includes: acquiring a moving distance input based on a target account; randomly generating movement angles corresponding to the pixel points respectively; and determining a moving path corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Alternatively, the movement path may be randomly generated, and the movement distance input based on the target account may be acquired first, and then the movement angles corresponding to the plurality of pixels may be randomly generated. And combining the movement angle and the movement distance to determine the movement path corresponding to the pixel point. The moving distance may also be randomly generated, and may be randomly generated under the limitation of the size and resolution of the image. The random generation under the limitation of the size and the resolution can lead the obtained moving distance to be in a proper range without influencing the distortion effect of the finally generated target image due to excessive or insufficient size. Specifically, the number of the moving pixels may be set by the target user, and whether all the pixels are moved or part of the pixels are moved. The random generation angle may be generated by a pseudo-random number generation function. The pseudorandom number generation function is an algorithm or function that generates pseudorandom numbers. It generates a series of seemingly random digital sequences, which have randomness to a certain extent, according to a seed value through a certain mathematical calculation method. Specifically, a seed value may be input by the target user, a random number between 0 and 360 degrees may be generated by a pseudo-random number generation function, and then used as the angle value. The moving angle can determine the moving direction, and then the moving distance is combined, so that the moving path can be obtained.
As an optional embodiment, determining, as the target position, a position where the plurality of pixel points are moved according to the corresponding movement paths, includes: respectively taking a plurality of pixel points as original points, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are positioned on an initial image, and coordinate axes of the polar coordinate systems are parallel to each other; based on the plurality of polar coordinate systems, the target position is determined according to the movement distance and the movement angle of each of the plurality of pixel points.
Optionally, determining the target position after the plurality of pixel points move may first use the plurality of pixel points as the origin, and establish a plurality of polar coordinate systems on the initial image. The coordinate axes of the polar coordinate systems are parallel to each other, and then the target positions corresponding to the pixel points are determined through the movement distances and the movement angles corresponding to the pixel points. The method can improve the accuracy and the reliability of the target position, because the method considers the movement condition of a plurality of pixel points and avoids errors possibly occurring when determining the position by a single coordinate system. Similarly, a two-dimensional coordinate system can be established by taking a plurality of pixel points as an origin, wherein x axes of the two-dimensional coordinate systems are parallel to each other and have the same direction. Then, a position with respect to the x-axis or the y-axis, for example, with respect to the positive x-axis direction, which is a movement direction corresponding to the rotation, and which is a movement distance from the pixel point along the movement direction, may be selected as the target position. This method can provide accurate target positions when dealing with pixel movement. By establishing a plurality of polar coordinate systems or two-dimensional coordinate systems to determine the target position, the accuracy and reliability of the target position can be improved.
As an alternative embodiment, generating a target image according to color adjustment of a plurality of pixel points, includes: and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-overlapping positions to the colors of the corresponding pixel points to obtain the target image.
Alternatively, since the movement paths are randomly generated, the target positions corresponding to the plurality of pixels may be the same position, in which case the colors of the pixels corresponding to the overlapping positions may be retained, and then the colors of the pixels at other non-overlapping positions may be adjusted to the colors of the corresponding pixels, so as to obtain the target image. By the method, the problems of image blurring and distortion caused by overlapping pixel points can be solved, and the definition and accuracy of a final image are ensured. In the image processing, the processing of overlapping pixels is very critical. Overlapping pixels may result in reduced image quality or even unrecognizable if not properly processed. Therefore, by retaining the color of the corresponding pixel at the overlapping position and adjusting the color of the other pixels at the non-overlapping position, this problem can be effectively avoided. In addition, in the case of random generation of the moving path, the probability of occurrence of the overlapping position can be reduced by adjusting the random generation process of the moving path, and the efficiency and quality of image processing can be further improved. Through the comprehensive application of the methods, the final image can be ensured to be clear and accurate, and the expected processing effect can be achieved.
As an alternative embodiment, the generating the target image according to the colors of the pixel points at the target positions corresponding to the color adjustment of the plurality of pixel points further includes: according to the colors of the plurality of pixel points, the colors of the pixel points at the corresponding target positions are adjusted, and an intermediate image is obtained; acquiring the set iteration times based on the target account input; and carrying out iterative processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iterative times to obtain a target image.
Alternatively, the intermediate image may be obtained by adjusting the colors of the pixel points at the corresponding target positions according to the colors of the plurality of pixel points. And carrying out iterative processing on the intermediate image according to the iteration times set by the user, and adjusting the image each time, so as to gradually approximate to the effect of the target image. Through multiple iterations, the target image wanted by the user can be finally obtained, and the iteration times are set by the user, so that the user requirement can be better met, and the generation effect of the final target image can be flexibly adjusted. The distortion effect of the final image can be influenced by the setting of the iteration times, and the more the iteration times are, the smoother and more real the distortion effect in the generated target image can be. Because the pixel points in the image are adjusted for more times with the increase of the iteration times, the final image is finer. Therefore, when generating the target image, the number of iterations can be set according to the actual need to obtain a satisfactory effect. In a word, the generated target image can be more vivid through multiple iterations, and the method is more in line with the expectations of users.
As an alternative embodiment, a Web graphic library is adopted to realize the generation of a target image according to the colors of the pixel points at the target positions corresponding to the color adjustment of the pixel points.
Alternatively, a Web image library may be used to implement adjustment of the colors of the pixels at the corresponding target locations according to the colors of the plurality of pixels, to generate the target image. Wherein a Web graphic library is a collection of tools for creating and processing graphics in Web page development. It includes various graphic processing functions such as drawing graphics, adding animation effects, processing images, etc., which can help developers quickly create attractive and interactive web page graphics. Through the Web graphics library, developers can directly access the GPU of a computer or mobile device to render various visual effects with high performance. Here, by utilizing WebGL technology and the parallel computing capability of GPU, a plurality of pixels can be processed simultaneously, so that the computing efficiency is greatly improved, the image generating efficiency is further improved, and the time is saved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
From the above description of the embodiments, it will be clear to a person skilled in the art that the image generation method according to the above embodiments may be implemented by means of software plus a necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The distortion effect image in the related art is mainly realized by using JavaScript, CSS or an animation library. These methods typically involve animation effects such as gradual changes in transparency, dimensional changes, displacements, and rotations of the image or element to achieve gradual appearance or disappearance of the image. However, these methods have some technical problems and challenges, for example, in order to simulate the irregular effect of the distortion, it is generally necessary to introduce a complex velocity field simulation, and intercept the image at a certain moment as a distortion effect image, which requires a large amount of computing resources, increasing the complexity and cost of computation. And the distortion effect generated in the related art is generally fixed, and is difficult to be personalized according to the user's needs. This limits the flexibility and user experience of the application. Accordingly, the following is a specific implementation, and fig. 3 is a flowchart illustrating an implementation of an image generating method according to an alternative embodiment of the present invention, as shown in fig. 3:
S1, preparing materials: an initial image based on the target account setting is acquired.
S2, initializing parameters: defining parameters and setting the parameters based on the target account, wherein the parameters comprise the moving number, the moving angle parameters, the moving distance and the iteration times. The moving number refers to the number of pixel points to be moved in the initial image, and can be set as all pixel points or part of pixel points; the movement angle parameter is a seed value as a function of the pseudo-random number generation for generating the random angle.
S3, determining a moving pixel point: and randomly selecting the pixel points with the number matched with the moving number from the pixel points of the initial image as moving pixel points.
S4, generating an intermediate image: and randomly generating a moving angle for the moving pixel point through a pseudo-random number generating function, and determining a moving path of each moving pixel point by combining the moving distance. And determining the position of the moving pixel point after moving according to the moving path as a target position. And adjusting the color of the pixel point at the target position to the color of the corresponding moving pixel point to obtain an intermediate image.
S5, generating a target image: and carrying out iteration processing on the intermediate image by adopting the method for obtaining the intermediate image based on the set iteration times, so as to generate a target image. The moving distance in each iteration can be changed, and the moving distance can be gradually reduced or gradually increased, so that images can show different distortion effects, and fig. 4 is an implementation effect diagram of the image generating method provided according to an alternative embodiment of the present invention, as shown in fig. 4, where a first image is an initial image, and other three images are target images with different distortion effects, and the generated distortion effects are more natural and smoother as the number of iterations is increased.
In the embodiment of the invention, an image generation method is adopted, and an initial image is acquired; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and generating a target image according to the colors of the pixel points at the corresponding target positions of the color adjustment of the plurality of pixel points, wherein the target image is a distortion effect diagram of the initial image, so that the aim of generating the image without a large amount of computer resources is fulfilled, the technical effect of improving the image generation efficiency is realized, and the technical problem that the generation efficiency is lower due to the fact that a large amount of computing resources are required for generating the distortion effect in the related technology is solved.
According to an embodiment of the present invention, there is also provided an image generating apparatus for implementing the above-described image generating method, and fig. 5 is a block diagram of the structure of the image generating apparatus provided according to the embodiment of the present invention, as shown in fig. 5, the image generating apparatus includes: the acquisition module 52, the first generation module 54, the determination module 56, and the second generation module 58 are described below.
An acquisition module 52 for acquiring an initial image.
The first generation module 54 is connected to the acquisition module 52, and is configured to randomly generate a movement path for each of the plurality of pixels in the initial image.
The determining module 56 is connected to the generating module 54, and is configured to determine a position where the plurality of pixel points are moved according to the corresponding movement paths as a target position.
The second generating module 58 is connected to the determining module 56, and is configured to adjust the colors of the pixels at the corresponding target positions according to the colors of the plurality of pixels, and generate a target image, where the target image is a distortion effect map of the initial image.
Optionally, the image generating apparatus includes: the first generation module is configured to randomly generate a movement path for each of a plurality of pixels in an initial image, including: the first acquisition unit is used for acquiring the moving distance input based on the target account; the generating unit is used for randomly generating movement angles respectively corresponding to the plurality of pixel points; the first determining unit is used for determining moving paths corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Optionally, the image generating apparatus includes: the determining module is used for determining the positions of the plurality of pixel points as target positions after the plurality of pixel points move according to the corresponding moving paths, and comprises the following steps: the establishing unit is used for establishing a plurality of polar coordinate systems by taking a plurality of pixel points as original points respectively, wherein the polar coordinate systems are positioned on the initial image, and coordinate axes of the polar coordinate systems are parallel to each other; the second determining unit is used for determining the target position according to the moving distance and the moving angle of each of the plurality of pixel points based on the plurality of polar coordinate systems.
Optionally, the image generating apparatus includes: the second generating module is configured to adjust colors of corresponding target positions according to colors of a plurality of pixel points, and generate a target image, including: the first adjusting unit is used for reserving the colors of the pixels at the overlapping positions and adjusting the colors of the pixels at the non-overlapping positions to the colors of the corresponding pixels under the condition that the overlapping positions exist at the target positions corresponding to the plurality of pixels respectively, so that a target image is obtained.
Optionally, the image generating apparatus includes: the second generating module is configured to adjust colors of the pixel points at the corresponding target positions according to the colors of the plurality of pixel points, generate a target image, and further includes: the second adjusting unit is used for adjusting the colors of the corresponding pixel points at the target positions according to the colors of the plurality of pixel points to obtain an intermediate image; the second acquisition unit is used for acquiring the set iteration times input based on the target account; the iteration unit is used for carrying out iteration processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iteration times to obtain the target image.
Optionally, the image generating apparatus includes: the second generation module is also used for realizing the color adjustment of the pixel points at the corresponding target positions according to the colors of the plurality of pixel points by adopting the Web graphic library to generate a target image.
It should be noted that, the above-mentioned obtaining module 52, the first generating module 54, the determining module 56 and the second generating module 58 correspond to steps S202 to S208 in the embodiment, and the plurality of modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above-mentioned embodiment. It should be noted that the above-described module may be operated as a part of the apparatus in the computer terminal 10 provided in the embodiment.
Embodiments of the present invention may provide a computer device, optionally in this embodiment, the computer device may be located in at least one network device of a plurality of network devices of a computer network. The computer device includes a memory and a processor.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the image generating method and apparatus in the embodiments of the present invention, and the processor executes the software programs and modules stored in the memory, thereby executing various functional applications and data processing, that is, implementing the image generating method described above. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located relative to the processor, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor may call the information and the application program stored in the memory through the transmission device to perform the following steps: acquiring an initial image; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect graph of the initial image.
Optionally, the above processor may further execute program code for: randomly generating a moving path for each of a plurality of pixel points in an initial image, comprising: acquiring a moving distance input based on a target account; randomly generating movement angles corresponding to the pixel points respectively; and determining a moving path corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Optionally, the above processor may further execute program code for: determining the position of each pixel point as the target position after moving according to the corresponding moving path comprises the following steps: respectively taking a plurality of pixel points as original points, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are positioned on an initial image, and coordinate axes of the polar coordinate systems are parallel to each other; based on the plurality of polar coordinate systems, the target position is determined according to the movement distance and the movement angle of each of the plurality of pixel points.
Optionally, the above processor may further execute program code for: adjusting the colors of the corresponding target positions according to the colors of the plurality of pixel points to generate a target image, wherein the method comprises the following steps: and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-overlapping positions to the colors of the corresponding pixel points to obtain the target image.
Optionally, the above processor may further execute program code for: according to the color of the pixel points at the corresponding target position, generating a target image, and further comprising: according to the colors of the plurality of pixel points, the colors of the pixel points at the corresponding target positions are adjusted, and an intermediate image is obtained; acquiring the set iteration times based on the target account input; and carrying out iterative processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iterative times to obtain a target image.
Optionally, the above processor may further execute program code for: and (3) realizing the color adjustment of the corresponding pixel points at the target positions according to the colors of the plurality of pixel points by using a Web graphic library, and generating a target image.
By adopting the embodiment of the invention, an image generation method is provided, and an initial image is acquired; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and generating a target image according to the colors of the pixel points at the corresponding target positions of the color adjustment of the plurality of pixel points, wherein the target image is a distortion effect diagram of the initial image, so that the aim of generating the image without a large amount of computer resources is fulfilled, the technical effect of improving the image generation efficiency is realized, and the technical problem that the generation efficiency is lower due to the fact that a large amount of computing resources are required for generating the distortion effect in the related technology is solved.
Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute on associated hardware, the program may be stored in a non-volatile storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
Embodiments of the present invention also provide a nonvolatile storage medium. Alternatively, in the present embodiment, the above-described nonvolatile storage medium may be used to store the program code executed by the image generation method provided in the above-described embodiment.
Alternatively, in this embodiment, the above-mentioned nonvolatile storage medium may be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: acquiring an initial image; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect graph of the initial image.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: randomly generating a moving path for each of a plurality of pixel points in an initial image, comprising: acquiring a moving distance input based on a target account; randomly generating movement angles corresponding to the pixel points respectively; and determining a moving path corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: determining the position of each pixel point as the target position after moving according to the corresponding moving path comprises the following steps: respectively taking a plurality of pixel points as original points, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are positioned on an initial image, and coordinate axes of the polar coordinate systems are parallel to each other; based on the plurality of polar coordinate systems, the target position is determined according to the movement distance and the movement angle of each of the plurality of pixel points.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: adjusting the colors of the corresponding target positions according to the colors of the plurality of pixel points to generate a target image, wherein the method comprises the following steps: and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-overlapping positions to the colors of the corresponding pixel points to obtain the target image.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: according to the color of the pixel points at the corresponding target position, generating a target image, and further comprising: according to the colors of the plurality of pixel points, the colors of the pixel points at the corresponding target positions are adjusted, and an intermediate image is obtained; acquiring the set iteration times based on the target account input; and carrying out iterative processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iterative times to obtain a target image.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: and (3) realizing the color adjustment of the corresponding pixel points at the target positions according to the colors of the plurality of pixel points by using a Web graphic library, and generating a target image.
Embodiments of the present invention also provide a computer program product comprising a computer program, optionally in this embodiment, the computer program when executed by a processor may implement: acquiring an initial image; randomly generating a moving path for each of a plurality of pixel points in an initial image; determining the positions of the pixel points as target positions after the pixel points move according to the corresponding moving paths; and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect graph of the initial image.
Optionally, the above computer program may be further implemented when executed by a processor: randomly generating a moving path for each of a plurality of pixel points in an initial image, comprising: acquiring a moving distance input based on a target account; randomly generating movement angles corresponding to the pixel points respectively; and determining a moving path corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
Optionally, the above computer program may be further implemented when executed by a processor: determining the position of each pixel point as the target position after moving according to the corresponding moving path comprises the following steps: respectively taking a plurality of pixel points as original points, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are positioned on an initial image, and coordinate axes of the polar coordinate systems are parallel to each other; based on the plurality of polar coordinate systems, the target position is determined according to the movement distance and the movement angle of each of the plurality of pixel points.
Optionally, the above computer program may be further implemented when executed by a processor: adjusting the colors of the corresponding target positions according to the colors of the plurality of pixel points to generate a target image, wherein the method comprises the following steps: and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-overlapping positions to the colors of the corresponding pixel points to obtain the target image.
Optionally, the above computer program may be further implemented when executed by a processor: according to the color of the pixel points at the corresponding target position, generating a target image, and further comprising: according to the colors of the plurality of pixel points, the colors of the pixel points at the corresponding target positions are adjusted, and an intermediate image is obtained; acquiring the set iteration times based on the target account input; and carrying out iterative processing on the intermediate image by adopting a mode of obtaining the intermediate image based on the iterative times to obtain a target image.
Optionally, the above computer program may be further implemented when executed by a processor: and (3) realizing the color adjustment of the corresponding pixel points at the target positions according to the colors of the plurality of pixel points by using a Web graphic library, and generating a target image.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a non-volatile storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. An image generation method, comprising:
Acquiring an initial image;
randomly generating a moving path for each of a plurality of pixel points in the initial image;
determining the positions of the pixel points after moving according to the corresponding moving paths as target positions;
and adjusting the colors of the pixel points at the corresponding target positions according to the colors of the pixel points, and generating a target image, wherein the target image is a distortion effect diagram of the initial image.
2. The method of claim 1, wherein randomly generating a movement path for each of the plurality of pixels in the initial image comprises:
acquiring a moving distance input based on a target account;
Randomly generating movement angles respectively corresponding to the plurality of pixel points;
and determining the moving paths corresponding to the plurality of pixel points based on the moving distance and the moving angles corresponding to the plurality of pixel points respectively.
3. The method according to claim 2, wherein determining the positions of the plurality of pixel points as the target positions after the plurality of pixel points move according to the corresponding movement paths, respectively, includes:
Respectively taking the pixel points as the origins, and establishing a plurality of polar coordinate systems, wherein the polar coordinate systems are all positioned on the initial image, and coordinate axes of the polar coordinate systems are parallel to each other;
And determining the target position according to the respective moving distance and moving angle of the plurality of pixel points based on the plurality of polar coordinate systems.
4. The method of claim 1, wherein the generating a target image by adjusting the color of the corresponding target location according to the colors of the plurality of pixels comprises:
and under the condition that the target positions corresponding to the pixel points respectively have overlapping positions, reserving the colors of the pixel points at the overlapping positions, and adjusting the colors of the pixel points at the non-repeated positions to the colors of the corresponding pixel points to obtain the target image.
5. The method of claim 1, wherein the adjusting the colors of the pixels at the corresponding target locations according to the colors of the plurality of pixels generates a target image, further comprising:
According to the colors of the pixel points, the colors of the pixel points at the corresponding target positions are adjusted to obtain an intermediate image;
Acquiring the set iteration times based on the target account input;
And based on the iteration times, carrying out iteration processing on the intermediate image by adopting a mode of obtaining the intermediate image to obtain the target image.
6. The method according to any one of claims 1 to 5, wherein the target image is generated by using a Web graphic library to realize color adjustment of the pixel points at the corresponding target positions according to the colors of the plurality of pixel points.
7. An image generating apparatus, comprising:
the acquisition module is used for acquiring an initial image;
the first generation module is used for randomly generating a moving path for each of a plurality of pixel points in the initial image;
the determining module is used for determining the positions of the pixel points after moving according to the corresponding moving paths as target positions;
and the second generation module is used for generating a target image according to the colors of the pixel points at the corresponding target positions, wherein the target image is a distortion effect graph of the initial image.
8. A non-volatile storage medium, characterized in that the non-volatile storage medium comprises a stored program, wherein the program, when run, controls a device in which the non-volatile storage medium is located to perform the image generation method of any one of claims 1 to 6.
9. A computer device, comprising: a memory and a processor, wherein the memory is configured to store,
The memory stores a computer program;
The processor configured to execute a computer program stored in the memory, the computer program when executed causing the processor to perform the image generation method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the image generation method of any of claims 1 to 6.
CN202410274691.8A 2024-03-11 2024-03-11 Image generation method, device, nonvolatile storage medium and computer equipment Pending CN118052900A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410274691.8A CN118052900A (en) 2024-03-11 2024-03-11 Image generation method, device, nonvolatile storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410274691.8A CN118052900A (en) 2024-03-11 2024-03-11 Image generation method, device, nonvolatile storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN118052900A true CN118052900A (en) 2024-05-17

Family

ID=91046363

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410274691.8A Pending CN118052900A (en) 2024-03-11 2024-03-11 Image generation method, device, nonvolatile storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN118052900A (en)

Similar Documents

Publication Publication Date Title
CN109242961A (en) A kind of face modeling method, apparatus, electronic equipment and computer-readable medium
CN110246209B (en) Image processing method and device
US10909744B1 (en) Simulating garment with wrinkles based on physics based cloth simulator and machine learning model
CN109979013B (en) Three-dimensional face mapping method and terminal equipment
CN108765520B (en) Text information rendering method and device, storage medium and electronic device
CN110458924B (en) Three-dimensional face model establishing method and device and electronic equipment
CN111773688B (en) Flexible object rendering method and device, storage medium and electronic device
CN114529657A (en) Rendering image generation method and device, computer equipment and storage medium
CN109145688A (en) The processing method and processing device of video image
KR102108244B1 (en) Image processing method and device
KR20190048507A (en) Apparatus and method for simplification of 3d mesh data
CN118052900A (en) Image generation method, device, nonvolatile storage medium and computer equipment
US20230326137A1 (en) Garment rendering techniques
CN113126944B (en) Depth map display method, display device, electronic device, and storage medium
CN111292234A (en) Panoramic image generation method and device
CN114820980A (en) Three-dimensional reconstruction method and device, electronic equipment and readable storage medium
CN108846897B (en) Three-dimensional model surface material simulation method and device, storage medium and electronic equipment
CN116977535B (en) Real-time ray tracing method and device, storage medium and electronic equipment
CN117953118A (en) Image generation method, device, nonvolatile storage medium and computer equipment
CN117689786A (en) Image generation method, device, nonvolatile storage medium and computer equipment
KR20160010780A (en) 3D image providing system and providing method thereof
CN117689756A (en) Image processing method, device, nonvolatile storage medium and computer equipment
CN112835453B (en) Method, apparatus and storage medium for simulating interface effect when focusing human eyes
CN117765109A (en) Image generation method, device, nonvolatile storage medium and computer equipment
CN117651125A (en) Video generation method, device, nonvolatile storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination