CN114387194A - Image processing method, image processing apparatus, electronic device, medium, and program product - Google Patents
Image processing method, image processing apparatus, electronic device, medium, and program product Download PDFInfo
- Publication number
- CN114387194A CN114387194A CN202111534858.2A CN202111534858A CN114387194A CN 114387194 A CN114387194 A CN 114387194A CN 202111534858 A CN202111534858 A CN 202111534858A CN 114387194 A CN114387194 A CN 114387194A
- Authority
- CN
- China
- Prior art keywords
- sampling
- image
- special effect
- pattern
- pattern elements
- 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
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 20
- 238000005070 sampling Methods 0.000 claims abstract description 247
- 230000000694 effects Effects 0.000 claims abstract description 170
- 238000000034 method Methods 0.000 claims abstract description 25
- 230000002194 synthesizing effect Effects 0.000 claims abstract description 17
- 238000010586 diagram Methods 0.000 claims description 47
- 230000006870 function Effects 0.000 claims description 32
- 230000015572 biosynthetic process Effects 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 6
- 238000003786 synthesis reaction Methods 0.000 claims description 6
- 238000001514 detection method Methods 0.000 abstract description 7
- 238000004891 communication Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 6
- 230000000737 periodic effect Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 5
- 230000005236 sound signal Effects 0.000 description 4
- 238000007726 management method Methods 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The present disclosure relates to an image processing method, apparatus, electronic device, medium, and program product, the method comprising: acquiring a noise image distributed with a plurality of pattern elements; sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped; and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments. According to the method, the pattern element image is obtained by directly sampling the noise image distributed with the plurality of pattern elements, so that the special effect of pattern element motion can be added to the image to be processed by using the pattern element image, and the problems that the special effect of pattern element motion is added to the image to be processed by depending on an angular point detection algorithm and the special effect is easy to lose are solved.
Description
Technical Field
The present disclosure relates to image processing technologies, and in particular, to an image processing method, an image processing apparatus, an electronic device, a medium, and a program product.
Background
In the related art, in order to add a special effect of pattern element motion to an image, an angular point detection algorithm is often used to obtain an angular point of the image, and then the special effect of pattern element motion is drawn in an angular point area of the image.
However, the special effect of the pattern element motion is drawn based on the angular point detection algorithm, and the accuracy dependence on the angular point detection algorithm is high; when an object contained in the image moves, data detected by the corner points can be changed variously, so that the special effect of pattern element movement is lost, and the user experience is influenced; in extreme scenes, the number of corners included in the image is large, so that additional processing needs to be performed on some edge situations, and computing resources are consumed. It is seen that a method of adding a special effect of a pattern element motion to an image in the related art is in need of improvement.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides an image processing method, apparatus, electronic device, medium, and program product. The technical scheme of the disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided an image processing method, including:
acquiring a noise image distributed with a plurality of pattern elements;
sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped;
and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments.
Optionally, sampling a part of pattern elements in the noise image at each sampling instant, including:
acquiring an initial sampling position map;
determining the offset and the offset direction corresponding to each sampling moment according to a preset time function;
adjusting the initial sampling position diagram according to the offset and the offset direction corresponding to each sampling moment to obtain a sampling position diagram corresponding to each sampling moment;
and sampling the noise image according to the sampling position graph corresponding to each sampling moment.
Optionally, synthesizing the pattern element graphs corresponding to the plurality of sampling moments into an element special effect graph including moving pattern elements according to the sequence of the plurality of sampling moments, including:
performing gray scale processing on the pattern element diagrams corresponding to the sampling moments respectively to obtain gray scale pattern element diagrams corresponding to the sampling moments respectively;
respectively carrying out contrast enhancement processing on the gray pattern element diagrams corresponding to the sampling moments to obtain contrast enhanced pattern element diagrams corresponding to the sampling moments;
and synthesizing the contrast-enhanced pattern element graphs corresponding to the sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the sampling moments.
Optionally, acquiring a noise image distributed with a plurality of pattern elements comprises:
acquiring a random image with a plurality of pattern elements distributed randomly;
setting a first degree of flatness of the random image;
and carrying out tiling processing on the random image according to the first tiling degree to obtain the noise image distributed with a plurality of pattern elements.
Optionally, acquiring an initial sampling position map includes:
acquiring a random sampling position map;
setting a second degree of flatness of the randomly sampled position map;
and carrying out tiling processing on the random sampling position diagram according to the second tiling degree to obtain the initial sampling position diagram.
Optionally, the method further comprises:
acquiring a plurality of different noise images distributed with a plurality of pattern elements, a plurality of different initial sampling position images and a plurality of different preset time functions;
obtaining a plurality of different element special effect graphs containing moving pattern elements according to the plurality of different noise images distributed with the plurality of pattern elements, the plurality of different initial sampling position graphs and the plurality of different preset time functions;
and superposing the plurality of different element special effect graphs containing the moving pattern elements to obtain the element special effect graphs containing different pattern element special effect effects.
Optionally, the method further comprises:
acquiring an image to be processed;
and carrying out special effect processing on the image to be processed based on the element special effect image to generate a target special effect image.
Optionally, the method further comprises:
acquiring an image to be processed;
identifying a target area of the image to be processed;
acquiring a mask image of the target area;
superposing the element special effect image and the mask image of the target area to obtain an area special effect image;
and superposing the regional special effect image and the image to be processed to obtain a target special effect image.
According to a second aspect of the embodiments of the present disclosure, there is provided an image processing apparatus including:
an acquisition module configured to acquire a noise image in which a plurality of pattern elements are distributed;
the sampling module is configured to sample part of pattern elements in the noise image at each sampling moment to obtain a pattern element map corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped;
and the synthesis module is configured to synthesize the pattern element graphs corresponding to the sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the sampling moments.
Optionally, the sampling module comprises:
a position acquisition unit configured to acquire an initial sampling position map;
the offset determining unit is configured to determine an offset and an offset direction corresponding to each sampling moment according to a preset time function;
the position adjusting unit is configured to adjust the initial sampling position diagram according to the offset and the offset direction corresponding to each sampling moment to obtain a sampling position diagram corresponding to each sampling moment;
the first sampling unit is configured to sample the noise image according to a sampling position map corresponding to each sampling time.
Optionally, the synthesis module comprises:
the gray processing unit is configured to perform gray processing on the pattern element maps corresponding to the sampling moments respectively to obtain gray pattern element maps corresponding to the sampling moments respectively;
the contrast enhancement unit is configured to perform contrast enhancement processing on the gray pattern element maps corresponding to the sampling moments respectively to obtain contrast enhanced pattern element maps corresponding to the sampling moments respectively;
and the synthesizing unit is configured to synthesize the contrast-enhanced pattern element graphs corresponding to the plurality of sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the plurality of sampling moments.
Optionally, the obtaining module includes:
a random image acquisition unit configured to acquire a random image in which a plurality of pattern elements are randomly distributed;
a first setting unit configured to set a first degree of flatness of the random image;
a first tiling processing unit configured to tile the random image according to the first tiling degree to obtain the noise image with the plurality of pattern elements distributed thereon.
Optionally, the position acquiring unit includes:
a random position acquisition subunit configured to acquire a randomly sampled position map;
a second setting subunit configured to set a second degree of spread of the random sampling position map;
a second tiling processing subunit, configured to tile the random sampling position map according to the second tiling degree, so as to obtain the initial sampling position map.
Optionally, the apparatus further comprises:
the difference acquisition module is configured to acquire a plurality of different noise images distributed with a plurality of pattern elements, a plurality of different initial sampling position images and a plurality of different preset time functions;
a difference special effect module configured to obtain a plurality of different element special effect graphs containing moving pattern elements according to the plurality of different noise images distributed with the plurality of pattern elements, the plurality of different initial sampling position graphs and the plurality of different preset time functions;
and the difference superposition module is configured to superpose the plurality of different element special effect graphs containing the moving pattern elements to obtain the element special effect graphs containing the special effect effects of different pattern elements.
Optionally, the apparatus further comprises:
a first image acquisition module configured to acquire an image to be processed;
and the target special effect image generation module is configured to perform special effect processing on the image to be processed based on the element special effect image to generate a target special effect image.
Optionally, the apparatus further comprises:
the second image acquisition module is configured to acquire an image to be processed;
a target area identification module configured to identify a target area of the image to be processed;
a mask image acquisition module configured to acquire a mask image of the target region;
the mask superposition module is configured to superpose the element special effect image and the mask image of the target area to obtain an area special effect image;
and the image superposition module is configured to superpose the region special effect image and the image to be processed to obtain a target special effect image.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image processing method according to the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the image processing method according to the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program or computer instructions which, when executed by a processor, implement the image processing method according to the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
the method comprises the steps of acquiring a noise image distributed with a plurality of pattern elements; sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped; and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments. Because the pattern elements in the pattern element diagrams sampled at two adjacent sampling moments are not completely overlapped, the element special effect diagram synthesized by the pattern elements can realize the effect of pattern element motion through the on-off states of the pattern elements at different moments; and the special effect of the pattern element motion is realized by sampling the pattern elements without using an angular point detection algorithm, so that the special effect of the pattern element motion is not lost when an object contained in the image moves, and the problem that the number of angular points is too large and extra processing needs to be carried out on the edge condition can be avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating an image processing method according to an exemplary embodiment;
FIG. 2 is an exemplary diagram of noise containing multiple pattern elements in the present disclosure;
FIG. 3 is an exemplary diagram of an initial sampling position map in the present disclosure;
FIG. 4 is an exemplary diagram of a grayscale pattern element map in this disclosure;
FIG. 5 is an exemplary diagram of a contrast enhanced pattern element diagram in the present disclosure;
FIG. 6 is a block diagram illustrating an image processing apparatus according to an exemplary embodiment;
fig. 7 is a block diagram illustrating an image processing apparatus according to an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating an image processing method according to an exemplary embodiment, which may be used in an electronic device such as a computer, a mobile phone, a tablet computer, and the like, as shown in fig. 1, and includes the following steps.
In step S11, a noise image in which a plurality of pattern elements are distributed is acquired.
The plurality of pattern elements may include pattern elements of the same type, pattern elements of the same size, or pattern elements of different types, pattern elements of different sizes. The special effect of the movement of the pattern element may be a special effect of the movement of the pattern element, a special effect of the flicker of the pattern element, or the like.
In order to ensure randomness of the special effect of pattern element motion, the distribution of the plurality of pattern elements in the noise image may also be random. Alternatively, the pattern elements in the noisy image may be brighter relative to the background. The noise map containing a plurality of pattern elements may be an image obtained using various drawing software or other methods.
Referring to fig. 2, a noise image including a plurality of pattern elements is shown, the noise image being a noise map, and a plurality of white noise contained in the noise map being a plurality of pattern elements contained in the noise image.
The noise image may be previously made, and when the image processing method of the present disclosure is used, the previously made noise image may be directly acquired.
In step S12, a part of pattern elements in the noise image is sampled at each sampling time, and a pattern element map corresponding to each sampling time is obtained, where a plurality of pattern elements sampled at two adjacent sampling times do not completely overlap.
The noise image comprises a plurality of pattern elements, and random part of pattern elements in the noise image are sampled at each sampling moment, so that a pattern element map corresponding to each sampling moment is obtained.
At each sampling time, the pattern elements are sampled and then displayed, and the displayed pattern elements are considered to be in the "bright" state at the sampling time, while the pattern elements which are not sampled are not displayed at the sampling time and are in the "off" state. The plurality of pattern elements sampled at two adjacent sampling instants do not completely overlap, i.e. for each element there is a possibility of being sampled or not being sampled. When the state of the pattern element is switched between 'on' and 'off', a special effect of pattern element flickering is visually presented. When two pattern elements with the same shape and size are sampled at different sampling moments, a special effect of pattern element movement is visually presented.
In step S13, the pattern element maps corresponding to the sampling moments are synthesized into the element special effect map including the moving pattern elements according to the sequence of the sampling moments.
Because the pattern elements sampled at two adjacent sampling moments are not completely the same, when a plurality of pattern element graphs are synthesized according to the respective sampled moments, the pattern elements in the obtained element special effect have the effect of movement. The synthesis refers to that each pattern element image is taken as a frame image and is combined into a moving image with pattern element motion and unchanged background.
The sampling time can be periodic, so that the pattern elements in the noise image are sampled in one period, and the element motion effect in the element special effect image is periodic.
The image processing method provided by the present exemplary embodiment is performed by acquiring a noise image in which a plurality of pattern elements are distributed; sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped; and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments. Because the pattern elements in the pattern element diagrams sampled at two adjacent sampling moments are not completely overlapped, the element special effect diagram synthesized by the pattern elements can realize the effect of pattern element motion through the on-off states of the pattern elements at different moments; and the special effect of the pattern element motion is realized by sampling the pattern elements without using an angular point detection algorithm, so that the special effect of the pattern element motion is not lost when an object contained in the image moves, and the problem that the number of angular points is too large and extra processing needs to be carried out on the edge condition can be avoided.
On the basis of the above technical solution, sampling a part of pattern elements in the noise image at each sampling time includes: acquiring an initial sampling position map; determining the offset and the offset direction corresponding to each sampling moment according to a preset time function; adjusting the initial sampling position diagram according to the offset and the offset direction corresponding to each sampling moment to obtain a sampling position diagram corresponding to each sampling moment; and sampling the initial image according to the sampling position graph corresponding to each sampling moment.
The initial sampling position map comprises a plurality of randomly distributed initial sampling positions, and a noise image comprising a plurality of pattern elements can be sampled according to the initial sampling positions in the initial sampling position map, and specifically, the elements in the noise image can be sampled by multiplying each color channel of the noise image by each channel of the initial sampling position map.
Optionally, the initial sampling position map may also be a noise map. Referring to fig. 3, an initial sampling position map is shown, which is a noise map in which noise is represented in white and a plurality of noise included in the noise map are a plurality of randomly distributed initial sampling positions included in the initial sampling position map. The sampled elements resulting from multiplying each color channel of the noise image by each channel of the initial sampling position profile can be understood as pattern elements whose coincident positions are both noise points are sampled when the noise image and the initial sampling position profile are superimposed.
In order to make the sampled pattern elements in the noise image not always overlap with the initial positions, so as to make the pattern elements move, the inventor thinks that the time function is introduced to shift the initial sampling position map, so that the sampled pattern elements are changed.
Different time functions may be preset in order to sample the elements at different positions to obtain different element special effects. According to the preset time function, the offset and the offset direction corresponding to each sampling moment can be determined. The absolute value of the preset time function represents the offset, and the trend of the preset time function represents the offset direction. For example, when the predetermined time function is a cosine function, the corresponding offset effect is an upper and lower period offset.
After the offset and the offset direction corresponding to each sampling time are determined through a preset time function, the initial sampling position diagram is offset according to the offset and the offset direction corresponding to each sampling time, and therefore the sampling position diagram corresponding to each sampling time can be obtained. The sampling position map corresponding to each sampling moment is obtained after the offset, so that different pattern elements can be sampled by sampling the noise image at each sampling moment by using the sampling position map corresponding to each sampling moment.
If the predetermined time function is a periodic function, the sampled pattern elements are also periodic, but because the initial sampling positions in the initial sampling position map are random, the sampled pattern elements at each sampling instant in a period are random. Therefore, in order to realize the periodic sampling of the pattern elements, only the preset time function is required to be the periodic function, and the additional setting of the sampling period is not required.
The pattern elements in the noise image are sampled through the initial sampling position graph and the preset time function, the randomness of sampling is guaranteed through the random distribution of the initial sampling positions, the relevance of the sampling positions between two adjacent moments is guaranteed through the preset time function, the ordered sampling effect in disorder can be achieved, the situation that the positions of the pattern elements sampled at the two adjacent sampling moments are unrelated is avoided, and the special effect of generated element motion is more attractive.
On the basis of the technical scheme, according to the sequence of a plurality of sampling moments, synthesizing pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements, and the method comprises the following steps: performing gray scale processing on the pattern element diagrams corresponding to the sampling moments respectively to obtain gray scale pattern element diagrams corresponding to the sampling moments respectively; respectively carrying out contrast enhancement processing on the gray pattern element diagrams corresponding to the sampling moments to obtain contrast enhanced pattern element diagrams corresponding to the sampling moments; and synthesizing the contrast-enhanced pattern element graphs corresponding to the sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the sampling moments.
The pattern element graphs corresponding to the sampling moments are directly synthesized into the element special effect graph, and the problem that the contained pattern elements are too many or the special effect of element motion is not obvious is possibly caused. Therefore, the pattern element images corresponding to the multiple sampling moments can be subjected to binarization processing respectively, and then subjected to gray scale processing to obtain the gray scale pattern element images corresponding to the multiple sampling moments, so that the regions in the gray scale pattern element images only have two colors, namely black and white, wherein the elements are white, and the background is black. Referring to fig. 4, a gray pattern element diagram is shown, in which white areas are pattern elements.
And then carrying out contrast enhancement processing on the gray pattern element image so as to enable the self white obvious elements in the obtained contrast enhanced pattern element image to be whiter and enable the black background to be blacker. The contrast enhancement processing may be to perform an exponential operation on the gray-scale values in the gray-scale pattern element map, and perform truncation processing on the result values. Referring to fig. 5, a contrast enhanced pattern element map is shown, which is obtained by performing contrast enhancement processing on the gray pattern element map shown in fig. 4.
And according to the sequence of the sampling moments, synthesizing the contrast-enhanced pattern elements corresponding to the sampling moments into an element special effect graph containing moving pattern elements.
The flicker effect of the element special effect image synthesized by the pattern element image after the gray level processing and the contrast enhancement processing is more obvious.
On the basis of the technical scheme, the method for acquiring the noise image distributed with the plurality of pattern elements comprises the following steps: acquiring a random image with a plurality of pattern elements distributed randomly; setting a first degree of flatness of the random image; and carrying out tiling processing on the random image according to the first tiling degree to obtain the noise image distributed with a plurality of pattern elements.
The noise image having the plurality of pattern elements distributed therein may be generated by a random image having the plurality of pattern elements randomly distributed therein. To ensure a random distribution of pattern elements in the noisy image, the random image may be tiled, including tiling the random image across the display screen. Wherein, the first degree of tiling of process can be according to actual demand setting.
On the basis of the technical scheme, the method for acquiring the initial sampling position map comprises the following steps: acquiring a random sampling position map; setting a second degree of flatness of the randomly sampled position map; and carrying out tiling processing on the random sampling position diagram according to the second tiling degree to obtain the initial sampling position diagram.
The initial sampled position map may be generated by a randomly sampled position map in which the sampling positions are random. In order to ensure that the initial sampling position map can sample all areas in the noise image, and in order to ensure the randomness of the sampling positions in the initial sampling position map, the random sampling position map can be subjected to tiling processing, so that the initial sampling position map obtained after tiling can cover the noise image. Wherein, tiling the random sampling position graph comprises: the randomly sampled location map is tiled across the display screen. Wherein, the second degree of tiling of the tiling process can be set according to actual requirements.
The degree of tiling represents the number of images used to tile the display screen. It will be appreciated that as the degree of tiling is greater, the tiled image shrinks accordingly. For example, when the random sampling diagram and the display screen are equal in size, the second tiling degree is set to 4, and the length and the width of the random sampling diagram are respectively reduced by one time, and then the whole display screen can be tiled.
The randomness of each pattern element in the noise image and the randomness of each initial sampling position in the initial sampling position map can be further ensured by utilizing the random image after tiling to obtain the noise image and utilizing the random sampling position map to obtain the initial sampling position map, so that the randomness of the sampled elements can be ensured when the noise image is sampled by utilizing the initial sampling position map.
On the basis of the above technical solution, the image processing method further includes: acquiring a plurality of different noise images distributed with a plurality of pattern elements, a plurality of different initial sampling position images and a plurality of different preset time functions; obtaining a plurality of different element special effect graphs containing moving pattern elements according to the plurality of different noise images distributed with the plurality of pattern elements, the plurality of different initial sampling position graphs and the plurality of different preset time functions; and superposing the plurality of different element special effect graphs containing the moving pattern elements to obtain the element special effect graphs containing different pattern element special effect effects.
An element effect map having pattern elements including motion is obtained from a noise image including a plurality of pattern elements, an initial sampling position map simulating initial positions of the pattern elements, and a predetermined time function simulating offset effects. Therefore, when any of the noise image, the initial sampling position map, and the preset time function is changed, the effect of the pattern element motion of the obtained element effect map is also changed.
In order to make the element special effect graph have the special effect of pattern element motion with a staggered sense, a plurality of different element special effect graphs can be obtained by utilizing a plurality of different noise images containing a plurality of pattern elements, a plurality of different initial sampling position graphs and a plurality of different preset time functions. And superposing a plurality of different element special effect graphs, so that the element special effect graph with the special effect of the pattern element motion with the staggered sense of hierarchy can be obtained. Therefore, the special effect of the movement of the pattern elements can be more agile and more beautiful.
On the basis of the above technical solution, the image processing method further includes: acquiring an image to be processed; and carrying out special effect processing on the image to be processed based on the element special effect image to generate a target special effect image.
After the element special effect image is obtained, the special effect of the element special effect image can be given to the image to be processed.
Specifically, a mask image of an image to be processed is obtained, then the element special effect image and the mask image of the image to be processed are superposed to obtain a mask image containing a moving pattern element effect, and then the mask image containing the pattern element moving special effect and the image to be processed are superposed to obtain a target special effect image with the moving pattern element effect. The target special effect image increases the special effect of the moving pattern elements relative to the image to be processed.
Optionally, the element special effect map superimposed with the mask map of the image to be processed may include only an element special effect map of one pattern element special effect, or may include element special effect maps of a plurality of different pattern element special effects.
On the basis of the above technical solution, the image processing method further includes: acquiring an image to be processed; identifying a target area of the image to be processed; acquiring a mask image of the target area; superposing the element special effect image and the mask image of the target area to obtain an area special effect image; and superposing the regional special effect image and the image to be processed to obtain a target special effect image.
When it is only desired that the target area of the image to be processed has the special effect of the pattern element motion, the target area of the image to be processed can be identified first, then the mask image of the target area is obtained, the element special effect image and the mask image of the target area are overlapped to obtain the area special effect image with the special effect of the pattern element motion, and then the area special effect image and the image to be processed are overlapped to obtain the target special effect image with the special effect of the pattern element motion in the target area. The target special effect image adds the special effect of the moving pattern elements in the target area relative to the image to be processed.
For example, when the image to be processed is an image including a human face and it is only desired to have a special effect of pattern element motion in a human face region, the human face region in the image to be processed may be recognized first, then a mask image of the human face region may be obtained, and the special effect of pattern element motion may be constrained in the human face region by using the mask image of the human face region.
Alternatively, the element special effect map superimposed with the mask map of the target area may include only an element special effect map of one pattern element special effect, or may be an element special effect map including a plurality of different pattern element special effects.
Optionally, the element special effect graph may be used to add a special effect of pattern element motion to the video, specifically, the special effect of pattern element motion may be directly added to the real-time video stream, or the special effect of pattern element motion may be added to each frame of image of the video, and then each frame of image to which the special effect of pattern element motion is added is synthesized into the video in real time.
When the video comprises a target area, only adding a special effect of pattern element motion to the target area in the video, the target area in the video can be identified and framed in real time, then adding the special effect of the pattern element motion to the framed target area, identifying the target area for each frame of image of the video, adding the special effect of the pattern element motion to the target area, and then synthesizing each frame of image added with the special effect of the pattern element motion to the target area into the video in real time. Therefore, the flicker effect can move along with the target area while the computing resources are saved, and the flicker effect is prevented from being lost.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Fig. 6 is a block diagram illustrating an element flicker map generating apparatus according to an exemplary embodiment, and referring to fig. 6, the apparatus includes an acquisition module 61, a sampling module 62, and a synthesis module 63.
An acquisition module 61 configured to acquire a noise image in which a plurality of pattern elements are distributed;
a sampling module 62 configured to sample a part of pattern elements in the noise image at each sampling time to obtain a pattern element map corresponding to each sampling time, wherein a plurality of pattern elements sampled at two adjacent sampling times are not completely overlapped;
and the synthesizing module 63 is configured to synthesize the pattern element graphs corresponding to the plurality of sampling moments into the element special effect graph including the moving pattern elements according to the sequence of the plurality of sampling moments.
Optionally, the sampling module 62 includes:
a position acquisition unit configured to acquire an initial sampling position map;
the offset determining unit is configured to determine an offset and an offset direction corresponding to each sampling moment according to a preset time function;
the position adjusting unit is configured to adjust the initial sampling position diagram according to the offset and the offset direction corresponding to each sampling moment to obtain a sampling position diagram corresponding to each sampling moment;
the first sampling unit is configured to sample the noise image according to a sampling position map corresponding to each sampling time.
Optionally, the synthesis module 63 comprises:
the gray processing unit is configured to perform gray processing on the pattern element maps corresponding to the sampling moments respectively to obtain gray pattern element maps corresponding to the sampling moments respectively;
the contrast enhancement unit is configured to perform contrast enhancement processing on the gray pattern element maps corresponding to the sampling moments respectively to obtain contrast enhanced pattern element maps corresponding to the sampling moments respectively;
and the synthesizing unit is configured to synthesize the contrast-enhanced pattern element graphs corresponding to the plurality of sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the plurality of sampling moments.
Optionally, the obtaining module 61 includes:
a random image acquisition unit configured to acquire a random image in which a plurality of pattern elements are randomly distributed;
a first setting unit configured to set a first degree of flatness of the random image;
a first tiling processing unit configured to tile the random image according to the first tiling degree to obtain the noise image with the plurality of pattern elements distributed thereon.
Optionally, the position acquiring unit includes:
a random position acquisition subunit configured to acquire a randomly sampled position map;
a second setting subunit configured to set a second degree of spread of the random sampling position map;
a second tiling processing subunit, configured to tile the random sampling position map according to the second tiling degree, so as to obtain the initial sampling position map.
Optionally, the apparatus further comprises:
the difference acquisition module is configured to acquire a plurality of different noise images distributed with a plurality of pattern elements, a plurality of different initial sampling position images and a plurality of different preset time functions;
a difference special effect module configured to obtain a plurality of different element special effect graphs containing moving pattern elements according to the plurality of different noise images distributed with the plurality of pattern elements, the plurality of different initial sampling position graphs and the plurality of different preset time functions;
and the difference superposition module is configured to superpose the plurality of different element special effect graphs containing the moving pattern elements to obtain the element special effect graphs containing the special effect effects of different pattern elements.
Optionally, the apparatus further comprises:
a first image acquisition module configured to acquire an image to be processed;
and the target special effect image generation module is configured to perform special effect processing on the image to be processed based on the element special effect image to generate a target special effect image.
Optionally, the apparatus further comprises:
the second image acquisition module is configured to acquire an image to be processed;
a target area identification module configured to identify a target area of the image to be processed;
a mask image acquisition module configured to acquire a mask image of the target region;
the mask superposition module is configured to superpose the element special effect image and the mask image of the target area to obtain an area special effect image;
and the image superposition module is configured to superpose the region special effect image and the image to be processed to obtain a target special effect image.
The image processing apparatus provided by the present exemplary embodiment, by acquiring a noise image in which a plurality of pattern elements are distributed; sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped; and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments. Because the pattern elements in the pattern element diagrams sampled at two adjacent sampling moments are not completely overlapped, the element special effect diagram synthesized by the pattern elements can realize the effect of pattern element motion through the on-off states of the pattern elements at different moments; and the special effect of the pattern element motion is realized by sampling the pattern elements without using an angular point detection algorithm, so that the special effect of the pattern element motion is not lost when an object contained in the image moves, and the problem that the number of angular points is too large and extra processing needs to be carried out on the edge condition can be avoided.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an apparatus 700 for element flashing map generation in accordance with an exemplary embodiment. For example, the apparatus 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 7, electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input/output (I/O) interface 712, a sensor component 714, and a communication component 716.
The processing component 702 generally controls overall operation of the device 700, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 702 may include one or more processors 720 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 702 may include one or more modules that facilitate interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate interaction between the multimedia component 708 and the processing component 702.
The memory 704 is configured to store various types of data to support operation at the device 700. Examples of such data include instructions for any application or method operating on device 700, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 704 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 706 provides power to the various components of the device 700. The power components 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 700.
The multimedia component 708 includes a screen that provides an output interface between the device 700 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 700 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 710 is configured to output and/or input audio signals. For example, audio component 710 includes a Microphone (MIC) configured to receive external audio signals when apparatus 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 704 or transmitted via the communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.
The I/O interface 712 provides an interface between the processing component 702 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 714 includes one or more sensors for providing status assessment of various aspects of the apparatus 700. For example, sensor assembly 714 may detect an open/closed state of device 700, the relative positioning of components, such as a display and keypad of apparatus 700, sensor assembly 714 may also detect a change in position of apparatus 700 or a component of apparatus 700, the presence or absence of user contact with apparatus 700, orientation or acceleration/deceleration of apparatus 700, and a change in temperature of apparatus 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 716 is configured to facilitate wired or wireless communication between the apparatus 700 and other devices. The apparatus 700 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described element flicker pattern generation method.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 704 comprising instructions, executable by the processor 720 of the apparatus 700 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, which comprises readable program code executable by the processor 720 of the electronic device 700 for performing the above-mentioned method of personnel rights management. Alternatively, the program code may be stored in a storage medium of the electronic device 700, which may be a non-transitory computer-readable storage medium, for example, ROM, Random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (10)
1. An image processing method, comprising:
acquiring a noise image distributed with a plurality of pattern elements;
sampling part of pattern elements in the noise image at each sampling moment to obtain a pattern element image corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped;
and synthesizing the pattern element graphs corresponding to the sampling moments into an element special effect graph containing moving pattern elements according to the sequence of the sampling moments.
2. The method of claim 1, wherein sampling a portion of pattern elements in the noise image at each sampling instant comprises:
acquiring an initial sampling position map;
determining the offset and the offset direction corresponding to each sampling moment according to a preset time function;
adjusting the initial sampling position diagram according to the offset and the offset direction corresponding to each sampling moment to obtain a sampling position diagram corresponding to each sampling moment;
and sampling the noise image according to the sampling position graph corresponding to each sampling moment.
3. The method according to claim 1, wherein synthesizing the pattern element graphs corresponding to the plurality of sampling moments into the element special effect graph including the moving pattern elements according to the sequence of the plurality of sampling moments comprises:
performing gray scale processing on the pattern element diagrams corresponding to the sampling moments respectively to obtain gray scale pattern element diagrams corresponding to the sampling moments respectively;
respectively carrying out contrast enhancement processing on the gray pattern element diagrams corresponding to the sampling moments to obtain contrast enhanced pattern element diagrams corresponding to the sampling moments;
and synthesizing the contrast-enhanced pattern element graphs corresponding to the sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the sampling moments.
4. The method of claim 1, wherein obtaining a noise image having a plurality of pattern elements distributed thereon comprises:
acquiring a random image with a plurality of pattern elements distributed randomly;
setting a first degree of flatness of the random image;
and carrying out tiling processing on the random image according to the first tiling degree to obtain the noise image distributed with a plurality of pattern elements.
5. The method of claim 2, further comprising:
acquiring a plurality of different noise images distributed with a plurality of pattern elements, a plurality of different initial sampling position images and a plurality of different preset time functions;
obtaining a plurality of different element special effect graphs containing moving pattern elements according to the plurality of different noise images distributed with the plurality of pattern elements, the plurality of different initial sampling position graphs and the plurality of different preset time functions;
and superposing the plurality of different element special effect graphs containing the moving pattern elements to obtain the element special effect graphs containing different pattern element special effect effects.
6. The method according to any one of claims 1-5, further comprising:
acquiring an image to be processed;
and carrying out special effect processing on the image to be processed based on the element special effect image to generate a target special effect image.
7. An image processing apparatus characterized by comprising:
an acquisition module configured to acquire a noise image in which a plurality of pattern elements are distributed;
the sampling module is configured to sample part of pattern elements in the noise image at each sampling moment to obtain a pattern element map corresponding to each sampling moment, wherein a plurality of pattern elements sampled at two adjacent sampling moments are not completely overlapped;
and the synthesis module is configured to synthesize the pattern element graphs corresponding to the sampling moments into the element special effect graph containing the moving pattern elements according to the sequence of the sampling moments.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image processing method of any one of claims 1 to 6.
9. A computer-readable storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the image processing method of any of claims 1 to 6.
10. A computer program product comprising a computer program or computer instructions, characterized in that the computer program or computer instructions, when executed by a processor, implement the image processing method according to any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111534858.2A CN114387194A (en) | 2021-12-15 | 2021-12-15 | Image processing method, image processing apparatus, electronic device, medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111534858.2A CN114387194A (en) | 2021-12-15 | 2021-12-15 | Image processing method, image processing apparatus, electronic device, medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114387194A true CN114387194A (en) | 2022-04-22 |
Family
ID=81197735
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111534858.2A Pending CN114387194A (en) | 2021-12-15 | 2021-12-15 | Image processing method, image processing apparatus, electronic device, medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114387194A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107944252A (en) * | 2017-12-18 | 2018-04-20 | 乐清咔咔网络科技有限公司 | A kind of method of information seal impression uniqueness characteristic extraction |
CN109068053A (en) * | 2018-07-27 | 2018-12-21 | 乐蜜有限公司 | Image special effect methods of exhibiting, device and electronic equipment |
CN112702531A (en) * | 2020-12-29 | 2021-04-23 | 维沃移动通信有限公司 | Shooting method and device and electronic equipment |
CN113240578A (en) * | 2021-05-13 | 2021-08-10 | 北京达佳互联信息技术有限公司 | Image special effect generation method and device, electronic equipment and storage medium |
CN113658315A (en) * | 2021-08-17 | 2021-11-16 | 广州光锥元信息科技有限公司 | Method and device for manufacturing shadow special effect based on fractal noise |
-
2021
- 2021-12-15 CN CN202111534858.2A patent/CN114387194A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107944252A (en) * | 2017-12-18 | 2018-04-20 | 乐清咔咔网络科技有限公司 | A kind of method of information seal impression uniqueness characteristic extraction |
CN109068053A (en) * | 2018-07-27 | 2018-12-21 | 乐蜜有限公司 | Image special effect methods of exhibiting, device and electronic equipment |
CN112702531A (en) * | 2020-12-29 | 2021-04-23 | 维沃移动通信有限公司 | Shooting method and device and electronic equipment |
CN113240578A (en) * | 2021-05-13 | 2021-08-10 | 北京达佳互联信息技术有限公司 | Image special effect generation method and device, electronic equipment and storage medium |
CN113658315A (en) * | 2021-08-17 | 2021-11-16 | 广州光锥元信息科技有限公司 | Method and device for manufacturing shadow special effect based on fractal noise |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9674395B2 (en) | Methods and apparatuses for generating photograph | |
US10026381B2 (en) | Method and device for adjusting and displaying image | |
EP3125158A2 (en) | Method and device for displaying images | |
EP3121699A1 (en) | Method and device for displaying badge of icon | |
CN107967459B (en) | Convolution processing method, convolution processing device and storage medium | |
CN109285126B (en) | Image processing method and device, electronic equipment and storage medium | |
CN108122195B (en) | Picture processing method and device | |
CN110580688B (en) | Image processing method and device, electronic equipment and storage medium | |
CN112201211B (en) | Ambient light collection method and device, terminal and storage medium | |
CN111078170B (en) | Display control method, display control device, and computer-readable storage medium | |
CN111611034A (en) | Screen display adjusting method and device and storage medium | |
CN106775235B (en) | Screen wallpaper display method and device | |
CN112330570A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN106648650A (en) | Method and device for adjusting terminal display status | |
CN112116670A (en) | Information processing method and device, electronic device and storage medium | |
EP3285474A1 (en) | Colour gamut mapping method and apparatus, computer program and recording medium | |
CN105677352B (en) | Method and device for setting application icon color | |
CN104902318B (en) | Control method for playing back and terminal device | |
CN112331158B (en) | Terminal display adjusting method, device, equipment and storage medium | |
CN108550127A (en) | image processing method, device, terminal and storage medium | |
CN110502993B (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN108874482B (en) | Image processing method and device | |
CN112565625A (en) | Video processing method, apparatus and medium | |
CN105976344A (en) | Whiteboard image processing method and whiteboard image processing device | |
CN115100253A (en) | Image comparison method, device, electronic equipment and storage medium |
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 |