Method, device, equipment and storage medium for generating special effect text
By converting the monochrome text image into a color image, and applying edge amplification and noise perturbation technology, combined with splicing coding, special effects text with smoothness and visual effects is generated, which solves the problem of the lack of dynamic effects of text in the existing technology and improves user experience.
Patent Information
- Application Number
- CN202210179409.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-25
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-02-25
AI Technical Summary
It is difficult to generate special effects text with smoothness and visual effects using existing technology. Especially in simple designs, the text lacks dynamic effects, which affects the user experience.
By transforming the original monochrome text image into a color text image, edge amplification and noise disturbance, combined with splicing encoding technology, stretch and flutter special effect text is generated.
The smoothness and display effect of special effects text are improved, making the text dynamic and visually vibrant in a simple design, and improving the user experience.
Smart Images

Figure CN114677461B_ABST
Abstract
Description
Technical Field
[0001] The disclosed embodiments relate to the field of image processing technology, and in particular to a method, device, equipment and storage medium for generating special effect text. Background Art
[0002] Text design, in the past user interface design, often mentioned is the font paradigm, focusing on its shape. Text effects are rarely mentioned, but with the popular trend of minimalist design, if you can make the text "animated", even a single graphic page will immediately "come alive", which will bring a different visual experience to users. Summary of the invention
[0003] The embodiments of the present disclosure provide a method, device, equipment and storage medium for generating special effect text, which can generate text with stretched and floating special effects and improve the smoothness and display effect of the special effect text.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating special effect text, comprising:
[0005] Transform the original monochrome text image into a color text image;
[0006] Enlarging a set edge in the color text image along a first direction to obtain a stretching effect image;
[0007] Acquire a plurality of set noise images, and disturb the pixel points in the set area of the stretching effect image along the second direction according to the plurality of set noise images, so as to obtain a plurality of special effect text images; wherein the set area includes the stretching area;
[0008] The multiple special effect text images are spliced and encoded to obtain dynamic special effect text.
[0009] In a second aspect, the embodiment of the present disclosure further provides a device for generating special effect text, including:
[0010] A color text image acquisition module is used to transform the original monochrome text image into a color text image;
[0011] A stretching effect image acquisition module, used for enlarging a set edge in the color text image along a first direction to obtain a stretching effect image;
[0012] A special effect text image acquisition module, used for acquiring a plurality of set noise images, and disturbing the pixel points in the set area of the stretch effect image along the second direction according to the plurality of set noise images, to obtain a plurality of special effect text images; wherein the set area includes the stretching area;
[0013] The dynamic special effect text acquisition module is used to splice and encode the multiple special effect text images to obtain dynamic special effect text.
[0014] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0015] one or more processing devices;
[0016] A storage device for storing one or more programs;
[0017] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method for generating special effect text as described in the embodiment of the present disclosure.
[0018] In a fourth aspect, the embodiments of the present disclosure further provide a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the method for generating special effect text as described in the embodiments of the present disclosure is implemented.
[0019] The disclosed embodiments disclose a method, device, equipment and storage medium for generating special effect text. The original monochrome text image is transformed into a color text image; the set edge in the color text image is enlarged along the first direction to obtain a stretching effect image; multiple set noise images are obtained, and the pixel points in the set area of the stretching effect image are disturbed along the second direction according to the multiple set noise images to obtain multiple special effect text images; wherein the set area includes the stretching area; the multiple special effect text images are spliced and encoded to obtain dynamic special effect text. The method for generating special effect text provided by the disclosed embodiments can generate text with stretching and floating special effects, and can improve the smoothness and display effect of the special effect text. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of a method for generating special effect text in an embodiment of the present disclosure;
[0021] Figure 2 is a schematic diagram of converting an original monochrome image into a color text image in an embodiment of the present disclosure;
[0022] Figure 3 is an example diagram of edge distortion of colored text in an embodiment of the present disclosure;
[0023] Figure 4 is an example diagram of obtaining a stretching effect diagram in an embodiment of the present disclosure;
[0024] Figure 5 This is an example diagram of mixing and superimposing the original monochrome text image and the stretching effect image in the embodiment of the present disclosure;
[0025] Figure 6 is an example diagram of disturbing a set area along a second direction in an embodiment of the present disclosure;
[0026] Figure 7 It is a structural schematic diagram of a device for generating special effect text in an embodiment of the present disclosure;
[0027] Figure 8 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0034] Figure 1This is a flow chart of a method for generating special effect text provided by an embodiment of the present disclosure. This embodiment is applicable to the case of generating special effect text. The method can be executed by a device for generating special effect text. The device can be composed of hardware and / or software and can generally be integrated in a device with a special effect text generation function. The device can be an electronic device such as a server, a mobile terminal or a server cluster. Figure 1 As shown, the method specifically comprises the following steps:
[0035] S110, transforming the original monochrome text image into a color text image.
[0036] The original monochrome text image may be a static image in which the text is filled with a monochrome color, such as white. The color text image may be understood as a static image in which the text is filled with a color.
[0037] In this embodiment, the method of transforming the original monochrome text image into a color text image may be: obtaining the position information of each pixel constituting the text, obtaining the color information from the set color bar according to the position information, and using the color information as the final color of the pixel. The method of obtaining the color information from the set color bar according to the position information may be: using the horizontal coordinate value or the vertical coordinate value of the pixel as index information, and obtaining the color information from the set color bar according to the index information.
[0038] Optionally, the method of transforming the original monochrome text image into a color text image can be: copying the original monochrome text image multiple times to obtain multiple copied monochrome text images; mapping the text in the multiple copied monochrome text images to different colors to obtain multiple color images; moving the multiple color images along the second direction by at least partially different offsets; filtering and superimposing the multiple offset color images and the original monochrome text image to obtain an overlay image; and using the original monochrome text image to mask the overlay image to obtain a color text image.
[0039] Among them, different colors can be colors from red, orange, yellow, green, cyan, blue, and purple. The second direction is related to the sorting direction of the text in the image. If the sorting direction of the text is vertical, the second direction is vertical. If the sorting direction of the text is horizontal, the second direction is horizontal. The offsets of multiple color images can be partially different or all different, for example, they can be gradually increased. Exemplarily, assuming that three monochrome text images are copied, and the mapped colors are red, green, and yellow, respectively, the red text image is offset by d along the second direction, the green text image is offset by 2d along the second direction, and the yellow text image is offset by 3d along the second direction.
[0040] The process of using the original monochrome text image to mask the overlay image may be: aligning the original monochrome text image with the overlay image, and for each pixel constituting the text in the original monochrome text image, using the color of the corresponding pixel in the overlay image as the color of the pixel to obtain a color text image. Figure 2 Schematic diagram of converting the original monochrome image into a color text image in this embodiment. Figure 2 As shown, the left image is the original monochrome image, the middle image is the overlay image, and the right image is the color text image obtained after masking. In this embodiment, the color text image is obtained by masking the overlay image with the original monochrome text image, which can ensure the smoothness of the generated color text image.
[0041] Optionally, after the original monochrome text image is transformed into a color text image, the method further includes the following step: edge-distorting the color text in the color text image to obtain an edge-distorted color image.
[0042] The edge may be an edge portion that occupies a certain proportion (may be 20%-30%) of the text size, and may be a left edge, a right edge, an upper edge, or a lower edge. The position of the edge is related to the sorting direction of the text. If the sorting direction is vertical, the left edge or the right edge is selected. If the sorting direction is horizontal, the upper edge or the lower edge is selected.
[0043] In this embodiment, the edge distortion of the colored text in the colored text image may be performed by using a custom water ripple function, noise interference, or a stripe noise image.
[0044] Optionally, the edges of the colored text in the color text image are distorted to obtain the edge-distorted color image by: obtaining a stripe noise image; and perturbing the edges of the colored text in the color text image along a first direction according to the grayscale information of the stripe noise image to obtain the edge-distorted color image.
[0045] The stripe noise image may be an image including multiple stripes with gradually changing brightness, wherein the stripes have a certain width and there is a certain interval between adjacent stripes. In this embodiment, the stripe noise image may be custom drawn by a technician. The width of the stripes may control the wave width and the peak spacing of the distortion, and the grayscale information may control the peak height of the distortion.
[0046] The first direction is related to the sorting direction of the text. If the sorting direction is vertical, the first direction is horizontal, and if the sorting direction is horizontal, the first direction is vertical. Perturbing the edge of the colored text in the colored text image along the first direction according to the grayscale information of the stripe noise image can be understood as: changing the first direction coordinate value of the edge pixel of the colored text according to the grayscale information of the stripe noise image, thereby achieving the distortion of the text edge. In this embodiment, the edge distortion of the colored text by the stripe noise image can improve the adaptability of the distortion.
[0047] Optionally, the edge of the colored text in the colored text image is perturbed along the first direction according to the grayscale information of the striped noise image, and the process of obtaining the edge-distorted colored image may be: aligning the striped noise image with the colored text image; for each pixel point in the edge portion of the colored text, obtaining the grayscale information of the pixel point in the striped noise image aligned with the pixel point; accumulating the grayscale information with the coordinate value of the pixel point in the first direction to obtain the first direction coordinate value of the disturbed pixel point, and obtaining the edge-distorted colored image.
[0048] The grayscale information can be represented by the value of any channel in the RGB channel, or by the average value of the three RGB channels. Specifically, for each pixel point on the edge of the colored text, the first direction coordinate value of the pixel point is added to the grayscale value of the corresponding pixel point in the stripe noise map to obtain the first direction coordinate value after disturbance, and the second direction coordinate value remains unchanged. Finally, the pixel point is moved to the position corresponding to the first direction coordinate value and the second direction coordinate value after disturbance, thereby obtaining the edge distortion map. For example, Figure 3 FIG. 1 is an example of edge distortion of colored text in this embodiment. Figure 3 As shown, the left image is a striped noise image, the middle image is a color text image, and the right image is an edge-distorted color image obtained by perturbing the left edge of the text in the color text image with the striped noise image. In this embodiment, the edge of the color text is perturbed along the first direction based on the grayscale information of the noise interference image, so as to increase the efficiency of generating the edge-distorted color image.
[0049] S120, enlarging a set edge in the color text image along a first direction to obtain a stretching effect image.
[0050] Among them, the set edge can be an edge portion that occupies a certain proportion of the text size (can be 20%-30%), and can be a left edge, a right edge, an upper edge or a lower edge. The position of the edge is related to the sorting direction of the text. If the sorting direction is vertical, select the left edge or the right edge. If the sorting direction is horizontal, select the upper edge or the lower edge. Enlarging the set edge in the color text image along the first direction can be understood as: enlarging the set edge along the first direction by a set multiple, keeping the second direction unchanged, and obtaining a stretching effect image. The principle of image magnification can be implemented in any existing way and is not limited here. In this embodiment, the stretching effect image presents a "ribbon" effect.
[0051] Optionally, the method of enlarging the set edge in the color text image along the first direction to obtain the stretch effect image may be: enlarging the distorted edge of the edge-distorted color image along the first direction to obtain the stretch effect image.
[0052] Specifically, the entire area or part of the area of the twisted edge is enlarged by a set multiple along the first direction, and the second direction is kept unchanged to obtain a stretching effect image. Figure 4 This is an example diagram of obtaining a stretching effect diagram in this embodiment. Figure 4 As shown, the left picture is the edge distortion color picture, and the right picture is the stretching effect picture.
[0053] Optionally, after obtaining the stretching effect image, the following step is further included: mixing and superimposing the original monochrome text image and the stretching effect image to obtain the superimposed stretching effect image.
[0054] Among them, mixing and superimposing the original monochrome text image and the stretched effect image can be understood as: superimposing the monochrome text in the original monochrome text image on top of the colored text in the stretched effect image, so that the superimposed stretched effect image presents the effect of "monochrome text floating out of ribbons".
[0055] Specifically, the original monochrome text image and the stretched effect image are mixed and superimposed to obtain the stretched effect image. The process may be: blurring the stretched effect image with a first blurriness to obtain a first blurred stretched image; mixing the first blurred stretched image and the stretched effect image according to a set mixing rule to obtain a first mixed image; aligning the text in the original monochrome text image with the text in the first mixed image, and offsetting the text in the aligned original monochrome text image by a set offset along a second direction to obtain the superimposed stretched effect image.
[0056] Among them, the text of the original monochrome text image in the superimposed stretched effect image is located above the text of the first mixed image. The blurring method can be to perform double-layer Gaussian blurring and downsampling processing on the stretched effect image to obtain the first blurred stretched image. The mixing rule can be the mixing ratio of the pixel values or color values of the first blurred stretched image and the stretched effect image, and the mixing ratio can remain unchanged or change according to certain rules. For example: when two images are mixed, the pixels from one edge to another are mixed according to the same mixing ratio, or, the mixing ratio from one edge to another first gradually changes from a first set value (for example: 1) to a second set value (for example: 0), and then gradually changes from the second set value to the first set value.
[0057] In this embodiment, the text in the aligned original monochrome text image is offset by a set offset along the second direction, so that part of the colored text below can be exposed, thereby improving the display effect. Figure 5 This is an example diagram of mixing and superimposing the original monochrome text image and the stretch effect image in this embodiment. In this embodiment, the stretch effect image is blurred and then mixed and superimposed with the original monochrome text image, which can soften the edge of the ribbon.
[0058] Optionally, the first blurred stretched image and the stretched effect image are mixed according to set mixing rules to obtain the first mixed image by: aligning the first blurred stretched image and the stretched effect image to obtain the first direction coordinate values of the aligned pixels; determining the mixing ratio according to the first direction coordinate values; and mixing the aligned pixels according to the mixing ratio to obtain the first mixed image.
[0059] The mixing ratio is the ratio of the stretching effect image to the first fuzzy stretching image, and the mixing ratio can be a value between 0 and 1. In this embodiment, a corresponding relationship between the first direction coordinate value and the mixing ratio can be pre-established. Figure 4 Taking the obtained stretching effect image as an example, the corresponding relationship establishment rule can be: divide the image into three sub-areas from left to right, and the three sub-areas account for 20%, 10% and 70% respectively. In the first sub-area, the mixing intensity gradually changes from 1 to 0 from left to right, and in the second sub-area, the mixing intensity gradually changes from 1 to 1 from left to right, and in the third sub-area, the mixing intensity remains unchanged at 1. Specifically, the method of mixing the aligned pixels according to the mixing ratio can be: mixing the color values (RGB) of the pixels according to the mixing ratio. For example, Figure 5 As shown, the left image is the first blurred stretched image after blurring, the middle image is the first mixed image after the first blurred stretched image and the stretched effect image are mixed, and the right image is the stretched effect image after the text in the original monochrome text image is mixed and superimposed with the first mixed image. In this embodiment, the mixing ratio is determined according to the first direction coordinate value, which can improve the smoothness of the first mixed image.
[0060] Optionally, the original monochrome text image and the stretched effect image are mixed and superimposed to obtain the stretched effect image. The process may be: blurring the stretched effect image with a second blurriness to obtain a second blurred stretched image; mixing the first blurred stretched image and the second blurred stretched image according to a set mixing rule to obtain a second mixed image; aligning the text in the original monochrome text image with the text in the second mixed image, and offsetting the text in the aligned original monochrome text image by a set offset along a second direction to obtain the superimposed stretched effect image.
[0061] Among them, the second blur is smaller than the first blur. The text of the original monochrome text image in the superimposed stretch effect image is located above the text of the second mixed image. The first fuzzy stretched image and the second fuzzy stretched image are mixed according to the set mixing rules to obtain the second mixed image. The method can be: align the first fuzzy stretched image and the second fuzzy stretched image, and obtain the first direction coordinate value of the aligned pixel point; determine the mixing ratio according to the first direction coordinate value; mix the aligned pixel points according to the mixing ratio to obtain the second mixed image. In this embodiment, the two fuzzy images are mixed according to the set mixing rules to further improve the smoothness of the second mixed image.
[0062] S130, obtaining a plurality of set noise images, and disturbing the pixel points in the set area of the stretching effect image along the second direction according to the plurality of set noise images, to obtain a plurality of special effect text images.
[0063] The set area includes the stretching area, that is, the set area includes the stretching area and a part of the text area. The set noise map may be Thiessen polygon noise or Voronoi noise map. The second direction may be a direction perpendicular to the first direction. The perturbation of the pixel points in the set area of the stretching effect map along the second direction according to the plurality of set noise maps can be understood as: changing the second direction coordinate value of the pixel points in the set area according to the grayscale information of the set noise map, thereby distorting the set area along the second direction.
[0064] Specifically, a plurality of set noise images are obtained, and the pixel points in the set area of the stretching effect image are disturbed along the second direction according to the plurality of set noise images respectively, and a plurality of special effect text images are obtained in the following manner: the set noise image is aligned with the stretching effect image, and for each pixel point in the set area, the grayscale information of the pixel point in the set noise image aligned with the pixel point is obtained; the grayscale information is accumulated with the coordinate value of the pixel point in the second direction to obtain the coordinate value of the pixel point in the second direction after the disturbance, and the special effect text image is obtained.
[0065] The grayscale information can be represented by the value of any channel in the RGB channel, or by the average value of the three RGB channels. Specifically, for each pixel point in the set area, the second direction coordinate value of the pixel point is accumulated with the grayscale value of the corresponding pixel point in the set noise map to obtain the second direction coordinate value after disturbance, and the first direction coordinate value remains unchanged. Finally, the pixel point is moved to the position corresponding to the second direction coordinate value after disturbance and the first direction coordinate value, so as to obtain a special effect text image. For example, Figure 6 is an example diagram of the disturbance of the set area along the second direction in this embodiment. Figure 6 As shown in the figure, the left picture is the set noise picture, the middle picture is the stretching effect picture, and the right picture is the special effect text picture after disturbance. Figure 6 As shown, in the special effect text image, the set area including the stretching area is twisted along the second direction. In this embodiment, the stretching effect image is disturbed along the second direction by using a set noise image to achieve the effect of "twisting ribbons".
[0066] Optionally, the process of accumulating the grayscale information with the coordinate value of the pixel point in the second direction to obtain the coordinate value of the pixel point in the second direction after disturbance can be: determining the accumulation weight according to the distance of the pixel point from the text in the first direction; multiplying the grayscale information by the accumulation weight and then accumulating the result with the coordinate value of the pixel point in the second direction to obtain the coordinate value of the pixel point in the second direction after disturbance.
[0067] Among them, the cumulative weight is inversely proportional to the distance, that is, the farther the pixel point is from the text in the first direction, the greater the cumulative weight. The cumulative weight can be a value between 0 and 1. The distance of the pixel point from the text in the first direction can be understood as the distance between the center line of the pixel point and the text along the second direction. Specifically, after obtaining the cumulative weight, the cumulative weight is multiplied by the grayscale information, and then the multiplied grayscale information is added to the coordinate value of the pixel point in the second direction to obtain the second direction coordinate value of the pixel point after disturbance. In this embodiment, the grayscale information is multiplied by the cumulative weight and then accumulated with the coordinate value of the pixel point in the second direction to obtain the second direction coordinate value of the pixel point after disturbance, which can improve the smoothness of the twisting and reduce the sense of frustration at the critical point.
[0068] S140, splicing and encoding multiple special effect text images to obtain dynamic special effect text.
[0069] The special effect text image may be an image of a set area in the stretch effect image twisted along the second direction. Specifically, after obtaining multiple special effect text images, the multiple special effect text images are spliced and encoded to obtain dynamic special effect text.
[0070] Optionally, after obtaining the plurality of special effect text images, the following step is further included: periodically adjusting the intensity coefficients of the saturation of the plurality of special effect text images.
[0071] Each special effect text image corresponds to a timestamp information, and the intensity coefficients of the saturation of multiple special effect text images are adjusted periodically according to time. In this embodiment, the intensity coefficients of the saturation of multiple special effect text images are adjusted periodically, so that the generated dynamic special effect text can present the effect of periodic intensity changes.
[0072] Optionally, after obtaining multiple special effect text images, the following steps are also included: for each pixel in the set area, determine the index information based on the grayscale information of the pixel and the timestamp information of the current special effect text image; obtain the target color from the set color bar based on the index information; replace the color of the pixel with the target color.
[0073] In this embodiment, the grayscale value and the timestamp information can be accumulated to obtain the index information. That is, the index information can be expressed as Uv = (grayscale value + timestamp, 0.5). Among them, Uv can represent the coordinate information on the set color bar. Specifically, after obtaining the index information of the pixel point, the color corresponding to the index information is obtained from the set color bar, and the color is determined as the target color, and finally the color of the pixel point is replaced with the target color. In this embodiment, the color of the pixel point is replaced with the target color on the set color bar, which can change the color system of the ribbon, thereby improving the display effect of the "ribbon".
[0074] The technical solution of the disclosed embodiment transforms the original monochrome text image into a color text image; enlarges the set edge in the color text image along the first direction to obtain a stretch effect image; obtains multiple set noise images, and disturbs the pixels in the set area of the stretch effect image along the second direction according to the multiple set noise images, to obtain multiple special effect text images; wherein the set area includes the stretch area; splices and encodes the multiple special effect text images to obtain dynamic special effect text. The special effect text generation method provided by the disclosed embodiment can generate text with stretching and floating special effects, and can improve the smoothness and display effect of the special effect text.
[0075] Figure 7 is a structural diagram of a device for generating special effect text provided by an embodiment of the present disclosure, such as Figure 7 As shown, the device comprises:
[0076] A color text image acquisition module 210 is used to transform the original monochrome text image into a color text image;
[0077] A stretching effect image acquisition module 220 is used to enlarge a set edge in the color text image along a first direction to obtain a stretching effect image;
[0078] The special effect text image acquisition module 230 is used to acquire a plurality of set noise images, and disturb the pixel points in the set area of the stretch effect image along the second direction according to the plurality of set noise images, so as to obtain a plurality of special effect text images; wherein the set area includes the stretching area;
[0079] Dynamic special effect text acquisition module 240 is used to splice and encode multiple special effect text images to obtain dynamic special effect text
[0080] Optionally, the color text image acquisition module 210 is further used to:
[0081] The original monochrome text image is copied multiple times to obtain multiple copied monochrome text images;
[0082] Mapping the text in the multiple copied monochrome text images to different colors respectively to obtain multiple color images;
[0083] shifting the plurality of color maps along the second direction by at least partially different offsets;
[0084] Perform color filtering and superposition on the shifted multiple color images and the original monochrome text image to obtain a superimposed image;
[0085] The original monochrome text image is used to mask the overlay image to obtain a color text image.
[0086] Optionally, it further includes: an edge distortion module, used to: distort the edges of the colored text in the colored text image to obtain an edge distorted colored image;
[0087] Optionally, the stretching effect image acquisition module 220 is further used for:
[0088] The distorted edge of the edge-distorted color image is enlarged along the first direction to obtain a stretching effect image.
[0089] Optionally, the edge warping module is also used to:
[0090] Get the stripe noise map;
[0091] The edges of the colored characters in the colored character image are disturbed along a first direction according to the grayscale information of the stripe noise image to obtain an edge-distorted colored image.
[0092] Optionally, the edge warping module is also used to:
[0093] Align the striped noise image with the colored text image;
[0094] For each pixel point at the edge of the colored text, grayscale information of the pixel point in the stripe noise image aligned with the pixel point is obtained;
[0095] The grayscale information and the coordinate value of the pixel point in the first direction are accumulated to obtain the coordinate value of the pixel point in the first direction after disturbance, and to obtain an edge distortion color image.
[0096] Optionally, it further includes: a superposition module, which is used to: mix and superimpose the original monochrome text image with the stretching effect image to obtain a superimposed stretching effect image.
[0097] Optionally, the stacking module is also used to:
[0098] Performing blur processing with a first blur degree on the stretching effect image to obtain a first blurry stretching image;
[0099] The first fuzzy stretching image and the stretching effect image are mixed according to a set mixing rule to obtain a first mixed image;
[0100] Align the text in the original monochrome text image with the text in the first mixed image, and offset the text in the aligned original monochrome text image along the second direction by a set offset amount to obtain a superimposed stretched effect image; wherein, in the superimposed stretched effect image, the text in the original monochrome text image is located above the text in the first mixed image.
[0101] Optionally, the stacking module is also used to:
[0102] Align the first fuzzy stretched image with the stretched effect image, and obtain the first direction coordinate value of the aligned pixel point;
[0103] Determine the mixing ratio according to the first direction coordinate value;
[0104] The aligned pixels are mixed according to a mixing ratio to obtain a first mixed image, wherein the mixing ratio is a ratio of the stretched effect image to the first fuzzy stretched image.
[0105] Optionally, the stacking module is also used to:
[0106] Performing blur processing with a second blur degree on the stretch effect image to obtain a second blur stretch image; wherein the second blur degree is smaller than the first blur degree;
[0107] Mixing the first fuzzy stretched image and the second fuzzy stretched image according to a set mixing rule to obtain a second mixed image;
[0108] Align the text in the original monochrome text image with the text in the second mixed image, and offset the text in the aligned original monochrome text image along the second direction by a set offset amount to obtain a superimposed stretched effect image; wherein, in the superimposed stretched effect image, the text in the original monochrome text image is located above the text in the second mixed image.
[0109] Optionally, the special effect text image acquisition module 230 is further used for:
[0110] Align the noise map with the stretch effect map.
[0111] For each pixel point in the set area, grayscale information of the pixel point in the set noise map aligned with the pixel point is obtained;
[0112] The grayscale information and the coordinate value of the pixel point in the second direction are accumulated to obtain the coordinate value of the pixel point in the second direction after disturbance, and to obtain the special effect text image.
[0113] Optionally, the special effect text image acquisition module 230 is further used for:
[0114] Determine the accumulated weight according to the distance of the pixel point from the text in the first direction; wherein the accumulated weight is in inverse proportion to the distance;
[0115] The grayscale information is multiplied by the accumulated weight and then added to the coordinate value of the pixel point in the second direction to obtain the second direction coordinate value of the pixel point after disturbance.
[0116] Optionally, it also includes: a strength adjustment module, used for:
[0117] Periodically adjust the saturation intensity coefficient of multiple special effect text images.
[0118] Optionally, it also includes: a color replacement module for:
[0119] For each pixel in the set area, determine the index information according to the grayscale information of the pixel and the timestamp information of the current special effect text image;
[0120] Get the target color from the set color bar according to the index information;
[0121] Replace the color of the pixel with the target color.
[0122] The above device can execute the methods provided by all the above embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of executing the above methods. For technical details not fully described in this embodiment, please refer to the methods provided by all the above embodiments of the present disclosure.
[0123] Reference below Figure 8 , which shows a schematic diagram of the structure of an electronic device 300 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc., or various forms of servers, such as independent servers or server clusters. Figure 8The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0124] like Figure 8 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only storage device (ROM) 302 or a program loaded from a storage device 305 to a random access storage device (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0125] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0126] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing a method for recommending words. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 309, or installed from a storage device 305, or installed from a ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0127] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0128] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0129] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0130] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: transforms the original monochrome text image into a color text image; enlarges the set edge in the color text image along the first direction to obtain a stretching effect image; obtains multiple set noise images, and according to the multiple set noise images, disturbs the pixel points in the set area of the stretching effect image along the second direction to obtain multiple special effect text images; wherein the set area includes the stretching area; splices and encodes the multiple special effect text images to obtain dynamic special effect text.
[0131] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0132] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0133] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0134] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0135] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0136] According to one or more embodiments of the present disclosure, the present disclosure discloses a method for generating special effect text, including:
[0137] Transform the original monochrome text image into a color text image;
[0138] Enlarging a set edge in the color text image along a first direction to obtain a stretching effect image;
[0139] Acquire a plurality of set noise images, and disturb the pixel points in the set area of the stretching effect image along the second direction according to the plurality of set noise images, so as to obtain a plurality of special effect text images; wherein the set area includes the stretching area;
[0140] The multiple special effect text images are spliced and encoded to obtain dynamic special effect text.
[0141] Furthermore, the original monochrome text image is transformed into a color text image, including:
[0142] Copying the original monochrome text image multiple times to obtain multiple copied monochrome text images;
[0143] Mapping the characters in the plurality of copied monochrome character images to different colors respectively to obtain a plurality of color images;
[0144] moving the plurality of color maps respectively along the second direction by at least partially different offsets;
[0145] Perform color filtering and superposition on the multiple offset color images and the original monochrome text image to obtain a superimposed image;
[0146] The original monochrome text image is used to perform masking processing on the overlay image to obtain a color text image.
[0147] Furthermore, after the original monochrome text image is transformed into a color text image, the method further includes:
[0148] Performing edge distortion on the colored characters in the colored character image to obtain an edge-distorted colored image;
[0149] Further, the set edge in the color text image is enlarged along the first direction to obtain a stretching effect image, including:
[0150] The distorted edge of the edge-distorted color image is enlarged along the first direction to obtain a stretching effect image.
[0151] Furthermore, edge distortion is performed on the color text in the color text image to obtain an edge-distorted color image, including:
[0152] Get the stripe noise map;
[0153] The edges of the colored characters in the colored character image are disturbed along the first direction according to the grayscale information of the stripe noise image to obtain an edge-distorted colored image.
[0154] Further, the edge of the color text in the color text image is disturbed along the first direction according to the grayscale information of the stripe noise image to obtain an edge-distorted color image, including:
[0155] Aligning the striped noise image with the color text image;
[0156] For each pixel point at the edge of the colored text, obtaining grayscale information of the pixel point in the stripe noise image aligned with the pixel point;
[0157] The grayscale information and the coordinate value of the pixel point in the first direction are accumulated to obtain the first direction coordinate value of the pixel point after disturbance, and to obtain an edge distortion color image.
[0158] Furthermore, after obtaining the stretching effect diagram, the method further includes:
[0159] The original monochrome text image and the stretching effect image are mixed and superimposed to obtain a superimposed stretching effect image.
[0160] Furthermore, the original monochrome text image and the stretching effect image are mixed and superimposed to obtain the superimposed stretching effect image, including:
[0161] Performing fuzzy processing with a first fuzziness degree on the stretching effect image to obtain a first fuzzy stretching image;
[0162] Mixing the first fuzzy stretched image and the stretched effect image according to a set mixing rule to obtain a first mixed image;
[0163] Align the text in the original monochrome text image with the text in the first mixed image, and offset the text in the aligned original monochrome text image along the second direction by a set offset amount to obtain a superimposed stretched effect image; wherein the text in the original monochrome text image in the superimposed stretched effect image is located above the text in the first mixed image.
[0164] Further, the first fuzzy stretching image and the stretching effect image are mixed according to a set mixing rule to obtain a first mixed image, including:
[0165] Aligning the first fuzzy stretched image with the stretched effect image, and obtaining first direction coordinate values of aligned pixel points;
[0166] Determine a mixing ratio according to the first direction coordinate value;
[0167] The aligned pixels are mixed according to the mixing ratio to obtain a first mixed image; wherein the mixing ratio is the ratio of the stretched effect image to the first blurred stretched image.
[0168] Furthermore, the original monochrome text image and the stretching effect image are mixed and superimposed to obtain the superimposed stretching effect image, including:
[0169] Performing blur processing with a second blur degree on the stretching effect image to obtain a second blur stretching image; wherein the second blur degree is smaller than the first blur degree;
[0170] Mixing the first fuzzy stretched image and the second fuzzy stretched image according to a set mixing rule to obtain a second mixed image;
[0171] Align the text in the original monochrome text image with the text in the second mixed image, and offset the text in the aligned original monochrome text image by a set offset along the second direction to obtain a superimposed stretched effect image; wherein, in the stretched effect image, the text in the original monochrome text image is located above the text in the second mixed image.
[0172] Further, a plurality of set noise images are obtained, and according to the plurality of set noise images, the pixel points in the set area of the stretching effect image are disturbed along the second direction respectively to obtain a plurality of special effect text images, including:
[0173] Align the set noise map with the stretch effect map,
[0174] For each pixel point in the set area, obtaining grayscale information of the pixel point in the set noise map aligned with the pixel point;
[0175] The grayscale information and the coordinate value of the pixel point in the second direction are accumulated to obtain the coordinate value of the pixel point in the second direction after disturbance, thereby obtaining a special effect text image.
[0176] Further, the grayscale information is added to the coordinate value of the pixel point in the second direction to obtain the coordinate value of the pixel point in the second direction after disturbance, including:
[0177] Determine the accumulated weight according to the distance of the pixel point from the text in the first direction; wherein the accumulated weight is in inverse proportion to the distance;
[0178] The grayscale information is multiplied by the accumulated weight and then added to the coordinate value of the pixel point in the second direction to obtain the disturbed coordinate value of the pixel point in the second direction.
[0179] Furthermore, after obtaining a plurality of special effect text images, the method further includes:
[0180] Periodically adjust the intensity coefficients of the saturation of the multiple special effect text images.
[0181] Furthermore, after obtaining a plurality of special effect text images, the method further includes:
[0182] For each pixel in the set area, determining index information according to the grayscale information of the pixel and the timestamp information of the current special effect text image;
[0183] Acquire a target color from a set color bar according to the index information;
[0184] Replace the color of the pixel with the target color.
[0185] Note that the above are only preferred embodiments of the present disclosure and the technical principles used. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present disclosure. Therefore, although the present disclosure is described in more detail through the above embodiments, the present disclosure is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present disclosure, and the scope of the present disclosure is determined by the scope of the attached claims.
Claims
1. A method for generating special effect text, characterized in that: include: Transform the original monochrome text image into a color text image; The colored characters in the colored character image are edge-distorted to obtain an edge-distorted colored image; wherein the edge is an edge portion that occupies a set proportion of the character size, and the position of the edge is related to the sorting direction of the characters. If the sorting direction is vertical, the left edge or the right edge is selected; if the sorting direction is horizontal, the upper edge or the lower edge is selected; Enlarging the distorted edge of the edge-distorted color image along a first direction to obtain a stretching effect image; Acquire a plurality of set noise images, and disturb the pixel points in the set area of the stretching effect image along the second direction according to the plurality of set noise images, so as to obtain a plurality of special effect text images; wherein the set area includes the stretching area; The multiple special effect text images are spliced and encoded to obtain dynamic special effect text.
2. The method according to claim 1, characterized in that Convert the original monochrome text image to a color text image, including: Copying the original monochrome text image multiple times to obtain multiple copied monochrome text images; Mapping the characters in the plurality of copied monochrome character images to different colors respectively to obtain a plurality of color images; moving the plurality of color maps respectively along the second direction by at least partially different offsets; Perform color filtering and superposition on the multiple offset color images and the original monochrome text image to obtain a superimposed image; The original monochrome text image is used to perform masking processing on the overlay image to obtain a color text image.
3. The method according to claim 1, characterized in that The colored characters in the colored character image are edge-distorted to obtain an edge-distorted colored image, including: Get the stripe noise map; The edges of the colored characters in the colored character image are disturbed along the first direction according to the grayscale information of the stripe noise image to obtain an edge-distorted colored image.
4. The method according to claim 3, characterized in that The method of perturbing the edge of the color text in the color text image along the first direction according to the grayscale information of the stripe noise image to obtain an edge-distorted color image includes: Aligning the striped noise image with the color text image; For each pixel point at the edge of the colored text, obtaining grayscale information of the pixel point in the stripe noise image aligned with the pixel point; The grayscale information and the coordinate value of the pixel point in the first direction are accumulated to obtain the first direction coordinate value of the pixel point after disturbance, and to obtain an edge distortion color image.
5. The method according to claim 1, characterized in that After obtaining the stretching effect diagram, it also includes: The original monochrome text image and the stretching effect image are mixed and superimposed to obtain a superimposed stretching effect image.
6. The method according to claim 5, characterized in that The original monochrome text image and the stretching effect image are mixed and superimposed to obtain the superimposed stretching effect image, including: Performing fuzzy processing with a first fuzziness degree on the stretching effect image to obtain a first fuzzy stretching image; Mixing the first fuzzy stretched image and the stretched effect image according to a set mixing rule to obtain a first mixed image; Align the text in the original monochrome text image with the text in the first mixed image, and offset the text in the aligned original monochrome text image along the second direction by a set offset amount to obtain a superimposed stretched effect image; wherein the text in the original monochrome text image in the superimposed stretched effect image is located above the text in the first mixed image.
7. The method according to claim 6, characterized in that Mixing the first fuzzy stretching image and the stretching effect image according to a set mixing rule to obtain a first mixed image, including: Aligning the first fuzzy stretched image with the stretched effect image, and obtaining first direction coordinate values of aligned pixel points; Determine a mixing ratio according to the first direction coordinate value; The aligned pixels are mixed according to the mixing ratio to obtain a first mixed image; wherein the mixing ratio is the ratio of the stretched effect image to the first blurred stretched image.
8. The method according to claim 6, characterized in that The original monochrome text image and the stretching effect image are mixed and superimposed to obtain the superimposed stretching effect image, including: Performing blur processing with a second blur degree on the stretching effect image to obtain a second blur stretching image; wherein the second blur degree is smaller than the first blur degree; Mixing the first fuzzy stretched image and the second fuzzy stretched image according to a set mixing rule to obtain a second mixed image; Align the text in the original monochrome text image with the text in the second mixed image, and offset the text in the aligned original monochrome text image along the second direction by a set offset amount to obtain a superimposed stretched effect image; wherein, in the superimposed stretched effect image, the text in the original monochrome text image is located above the text in the second mixed image.
9. The method according to claim 1, characterized in that: Acquire a plurality of set noise images, and disturb the pixel points in the set area of the stretch effect image along the second direction according to the plurality of set noise images, to obtain a plurality of special effect text images, including: Align the set noise map with the stretch effect map, For each pixel point in the set area, obtaining grayscale information of the pixel point in the set noise map aligned with the pixel point; The grayscale information and the coordinate value of the pixel point in the second direction are accumulated to obtain the coordinate value of the pixel point in the second direction after disturbance, thereby obtaining a special effect text image.
10. The method according to claim 9, characterized in that Accumulating the grayscale information and the coordinate value of the pixel point in the second direction to obtain the coordinate value of the pixel point in the second direction after disturbance, including: Determine the accumulated weight according to the distance of the pixel point from the text in the first direction; wherein the accumulated weight is in inverse proportion to the distance; The grayscale information is multiplied by the accumulated weight and then added to the coordinate value of the pixel point in the second direction to obtain the disturbed coordinate value of the pixel point in the second direction.
11. The method according to claim 1, characterized in that: After obtaining multiple special effect text pictures, it also includes: Periodically adjust the intensity coefficients of the saturation of the multiple special effect text images.
12. The method according to claim 1, characterized in that After obtaining multiple special effect text pictures, it also includes: For each pixel in the set area, determining index information according to the grayscale information of the pixel and the timestamp information of the current special effect text image; Acquire a target color from a set color bar according to the index information; Replace the color of the pixel with the target color.
13. A device for generating special effect text, characterized in that: include: A color text image acquisition module is used to transform the original monochrome text image into a color text image; An edge distortion module is used to distort the edges of the colored characters in the colored character image to obtain an edge distorted colored image; wherein the edge is an edge portion that occupies a set proportion of the character size, and the position of the edge is related to the sorting direction of the characters. If the sorting direction is vertical, the left edge or the right edge is selected; if the sorting direction is horizontal, the upper edge or the lower edge is selected; A stretching effect image acquisition module, used for enlarging the distorted edge of the edge-distorted color image along a first direction to obtain a stretching effect image; A special effect text image acquisition module, used for acquiring a plurality of set noise images, and disturbing the pixel points in the set area of the stretch effect image along the second direction according to the plurality of set noise images, to obtain a plurality of special effect text images; wherein the set area includes the stretching area; The dynamic special effect text acquisition module is used to splice and encode the multiple special effect text images to obtain dynamic special effect text.
14. An electronic device, characterized in that: The electronic device comprises: one or more processing devices; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method for generating special effect text as described in any one of claims 1-12.
15. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, a method for generating special effect text as described in any one of claims 1-12 is implemented.
