CN114119812A - Method and device for generating brush pattern and electronic equipment - Google Patents

Method and device for generating brush pattern and electronic equipment Download PDF

Info

Publication number
CN114119812A
CN114119812A CN202111403651.1A CN202111403651A CN114119812A CN 114119812 A CN114119812 A CN 114119812A CN 202111403651 A CN202111403651 A CN 202111403651A CN 114119812 A CN114119812 A CN 114119812A
Authority
CN
China
Prior art keywords
color
target
shape
point
input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111403651.1A
Other languages
Chinese (zh)
Inventor
樊婧
赵宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202111403651.1A priority Critical patent/CN114119812A/en
Publication of CN114119812A publication Critical patent/CN114119812A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/80Creating or modifying a manually drawn or painted image using a manual input device, e.g. mouse, light pen, direction keys on keyboard

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application discloses a method and a device for generating a brush pattern and electronic equipment, and belongs to the field of image processing. The method for generating the brush pattern comprises the following steps: acquiring the color and the shape of a target object in a target picture as the target color and the target shape of the brush; receiving a first input of a user; in response to the first input, displaying a pattern of target shapes and target colors according to an input trajectory of the first input.

Description

Method and device for generating brush pattern and electronic equipment
Technical Field
The application belongs to the field of image processing, and particularly relates to a method and a device for generating a brush pattern and electronic equipment.
Background
With the rapid development of science and technology and the arrival of the internet era, more and more intelligent devices appear in daily life of people and play an indispensable role, and meanwhile, internet products rise rapidly to fill in the life of people. In the present age, everyone wants to have his own unique imprinted and personalized articles, and electronic products are no exception. The wallpaper has personalized functions, and when everyone uses an electronic device, no matter a mobile phone, a tablet or a desktop computer, the wallpaper belonging to the personality of the person can be changed, and can be a photo of the person or family, or a landscape depending on emotion, and can be set as desktop wallpaper. At present, the wallpaper can be drawn by using the brush, but the brush pattern cannot be customized by a user in a personalized manner, and the drawn wallpaper cannot meet the interesting requirement of the user on the wallpaper.
Disclosure of Invention
The embodiment of the application aims to provide a method for generating a brush pattern, which can solve the problem that the existing brush pattern cannot be customized by a user.
In a first aspect, an embodiment of the present application provides a method for generating a brush pattern, where the method includes:
acquiring the color and the shape of a target object in a target picture as the target color and the target shape of the brush;
receiving a first input of a user;
in response to the first input, displaying a pattern of target shapes and target colors according to an input trajectory of the first input.
In a second aspect, an embodiment of the present application provides an apparatus for generating a brush pattern, where the apparatus includes:
the acquisition module is used for acquiring the color and the shape of a target object in the target picture as the target color and the target shape of the brush;
the receiving module is used for receiving a first input of a user;
and the display module is used for responding to the first input and displaying a pattern of a target shape and a target color according to the input track of the first input.
In a third aspect, embodiments of the present application provide an electronic device, which includes a processor and a memory, where the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product, stored on a storage medium, for execution by at least one processor to implement the method according to the first aspect.
In the embodiment of the application, the color and the shape of the target object in the target picture are obtained to serve as the target color and the target shape of the brush, the first input of a user is received, the first input is responded, and the patterns of the target shape and the target color are displayed according to the input track of the first input, so that a convenient and easy-to-use method for generating the self-defined brush pattern can be provided for the user, the brush pattern is displayed along the input track to form the dynamic wallpaper, the personalized customization of the user on the dynamic wallpaper can be realized, the interesting requirements of the user on the wallpaper are met, and the use experience degree of electronic equipment of the user is improved.
Drawings
Fig. 1 is a schematic flowchart of a method for generating a brush pattern according to an embodiment of the present application.
Fig. 2A and 2B are schematic diagrams of color acquisition according to an embodiment of the present application.
Fig. 3 is a schematic diagram of shape acquisition according to an embodiment of the present application.
Fig. 4 is a schematic diagram of pattern generation of a target shape and a target color according to an embodiment of the present application.
FIG. 5 is a schematic diagram of brush generation according to an embodiment of the present application.
FIG. 6 is a schematic diagram of generation of a brush pattern according to an embodiment of the present disclosure.
FIG. 7 is a schematic diagram of a brush pattern generation according to another embodiment of the present application.
FIG. 8 is a schematic diagram illustrating a brush pattern according to an embodiment of the present disclosure.
Fig. 9 is a block diagram showing a configuration of a brush pattern generation device according to an embodiment of the present application.
Fig. 10 is a block diagram showing a configuration of an electronic device according to an embodiment of the present application.
Fig. 11 is a hardware structure diagram of an electronic device implementing an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The method for generating the brush pattern according to the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
Fig. 1 is a schematic flowchart of a method for generating a brush pattern according to an embodiment of the present application. As shown in fig. 1, the method for generating a brush pattern according to the embodiment of the present application includes the following steps 102 to 106.
And 102, acquiring the color and the shape of the target object in the target picture as the target color and the target shape of the brush.
The target picture can be any picture selected by the user based on the requirement of the user, for example, an image of a landscape, a person or an article on the picture, wherein the landscape, the person or the article is mapped or supported by the emotion of the user. The target object may be a certain area or the whole area on the picture, e.g. a corresponding person or item.
Multiple colors may be included on the picture, and the color of the target object may be one or more, some or all of the multiple colors on the picture, as determined based on the user's color selection. Likewise, a plurality of closed-shape regions may be included on the picture, and the shape of the target object may be one or more corresponding shapes, partially or wholly, of the plurality of closed-shape regions on the picture, determined based on the region selection by the user.
Optionally, in one embodiment, the color of the target object includes a first color and a second color. Acquiring the color of a target object in a target picture as the target color of the brush, wherein the acquiring comprises the following steps: acquiring the color with the largest target object area in the target picture as the first color; and acquiring the color with an included angle smaller than or equal to a preset angle with the first color in the color ring as the second color.
The first color and the second color are different colors, and the second color may be one or more.
Referring to fig. 2A, as shown in (a) of fig. 2A, a target picture P is any one picture selected by a user, and then, the target picture P is uniformly divided into a plurality of pixel blocks of a predetermined size, as shown in (b) of fig. 2A. The colors in each pixel block are extracted and sorted according to the area ratio, for example, as shown in (C) in fig. 2A, the color with the largest specific area is a, followed by color B, color C, and the like. The color a with the largest specific area in the target picture P is extracted as the first color.
The preset angle may be in a range of 100 degrees to 120 degrees when the second color is extracted. The second color and the first color extracted in the way are adjacent colors, the hue of the colors cannot be greatly different from each other, and the color matching color is more attractive.
Referring to fig. 2B, colors included at an angle less than or equal to a preset angle θ with respect to the first color a in the color wheel include a color C and a color B, where the extracted color C and color B are the second color.
Optionally, obtaining the shape of the target object in the target picture includes: converting the target picture into a black and white mode; determining a plurality of closed shape areas in a target picture in a black and white mode; and acquiring the maximum closed shape area in the plurality of closed shape areas to obtain the shape of the target object in the target picture.
Referring to fig. 3, for the target picture P selected by the user, the black-and-white mode is converted to obtain a black-and-white picture P'. Only black and white colors, and no gray-scale color, exist in the black-and-white picture P'. At least one closed shape region can be obtained from the black-and-white picture P', and if a plurality of closed shape regions exist, the largest closed shape region is extracted, that is, the shape of the closed shape region in the target picture, for example, the shape corresponding to the region S shown in fig. 3, is obtained.
Selecting the one of the closed shape regions having the largest specific area as the target region can make it easier for the user to imagine the picture he or she selects.
In other embodiments, the target closed shape region may also have a user-customized shape, such as a closed region in the shape of a flower, love, or the like.
And after the color and the shape of the target object in the target picture are obtained, taking the obtained color and the obtained shape of the target object in the target picture as the target color and the target shape of the brush.
Optionally, the obtaining the color and the shape of the target object in the target picture as the target color and the target shape of the brush includes: determining a first point and a second point with the largest distance in the shape of the target object; setting the first color to correspond to the first point, and setting the second color to correspond to the second point; generating a gradient color based on the first color and the second color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
If the target closed shape region is an irregular figure, two points corresponding to the maximum vertical distance in the region are determined, such as the point a and the point b in the region S of fig. 4. Then, the color a with the largest area ratio is extracted and associated with the point a, and one of the extracted second colors is associated with the point b.
As described above, the extracted second colors may be one or more, and when there are a plurality of second colors, one of the second colors may be selected to be set corresponding to the point b according to a user's requirement for generating a gradient color. For example, when the user wishes to generate a two-color gradation color, a third color having the largest area ratio may be selected from the plurality of second colors to generate a two-color gradation with the first color. When the user wishes to generate a three-color gradation color, a fourth color whose area ratio is the largest and a second largest third color may be selected from the plurality of second colors to generate a three-color gradation with the first color.
Accordingly, when one of the extracted second colors corresponds to the point b, a color having the smallest area ratio among the second colors may be set to correspond to the point b.
In the embodiment of fig. 4, a bicolor gradient color D is generated based on color a and color B, where color a and color B are linearly gradient. By setting the color a corresponding to the point a in the area S and the color B corresponding to the point B in the area S, the bicolor gradation color D can be overlaid in the closed-shape area S, resulting in the target image M. The color of the target image M is a two-color gradation color D, and the shape of the target image M is the outer closed contour shape of the closed shape region S.
In this way, the generated gradient color can be arranged in the corresponding closed shape area as far as possible, and a better visual effect can be displayed for a user.
Optionally, generating a gradient color based on the first color and the second color includes: determining a third color with the largest specific area in the second colors; generating a bi-color gradient color based on the first color and the third color.
Or determining a fourth color with the largest specific area and a third color with the second largest specific area in the second colors; generating a tri-color gradient color based on the first color, the fourth color, and the third color. The three-color gradient color may be generated according to the order of the three colors in terms of the area ratio, for example, the three-color gradient color may be generated according to the order of the first color, the fourth color, and the third color.
In other embodiments, the target color may also be presented in other varying ways.
In the above-described embodiment, the acquisition of the color and the acquisition of the shape of the target object within the target picture may be performed separately, respectively.
In another embodiment, optionally, acquiring the color and shape of the target object in the target picture includes: acquiring a target picture containing a first number of color types; determining a plurality of regions of the target picture containing colors of a second number of color categories; acquiring a target area with the largest adjacent color contrast in the plurality of areas, wherein the second number is smaller than the first number; forming a shape of a target object in the target area in a preset closed shape.
For example, a target picture obtained by a user at least includes pictures of 5 colors, a region including 3 colors in the target picture is identified, and 3 adjacent color contrasts in each region are calculated. And extracting the area with the maximum contrast, and performing area division on the maximum area in any closed shape desired by the user to obtain a target closed shape area containing the 3 colors.
That is, in this embodiment, the shape of the target object is determined on the region containing the target color based on the target color and the preset closed shape.
Accordingly, in step 102, acquiring the color and shape of the target object in the target picture as the target color and target shape of the brush comprises: determining the color proportion of each color in the shape of the target object according to the main tone of the target picture; determining a first point and a second point with the largest distance in the shape of the target object; setting a first color with the largest color ratio in the colors to correspond to the first point, and setting a second color with the smallest color ratio in the colors to correspond to the second point; carrying out gradient processing on each color according to the color proportion to generate a gradient color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
The target color and the target shape of the brush obtained according to the steps of the above embodiment may be used to generate a brush pattern, for example, a software module recognizable by a computer may be used to generate a corresponding brush pattern by a user operating the brush.
Step 104, receiving a first input of a user.
Here, the first input of the user may be an operation in which the user moves on the target screen using a brush having the above-described color and shape.
And 106, responding to the first input, and displaying a pattern of a target shape and a target color according to an input track of the first input. From the brush pattern, a dynamic wallpaper may be generated that includes a plurality of brush patterns.
The user can draw out any input track on the screen of the electronic equipment and display the input track based on the input operation of moving the brush by clicking the brush software module.
Optionally, step 106 displays a pattern of the target shape and the target color according to the input trajectory of the first input, including: determining a target position according to the length of the first input track and a preset interval value; displaying a pattern of the target shape and target color at the target location.
As shown in fig. 6, when the user moves the brush on the screen to form a target input track T, the position of the pattern with the shape and color corresponding to the brush is determined according to the length of the current input track and the preset interval, that is, one brush M is set at each preset distance until the user stops moving the brush, and the input track is ended. And continuously and repeatedly setting a brush pattern M by the brush along the input track to obtain the dynamic wallpaper W corresponding to the continuous brush pattern.
The preset interval value may be determined by setting one brush pattern per predetermined length of movement of the brush, for example, setting the brush pattern 1 time per 2 pixels of movement, and if the input trajectory is 300 pixels, sequentially setting 150 times the target image according to the corresponding position.
Optionally, step 106 displays a pattern of the target shape and the target color according to the input trajectory of the first input, including: determining the number of the displayed target shapes and target color patterns according to the length of the first input track and the length of the screen corresponding to the input track; the number of patterns is displayed uniformly along the input trajectory.
In this embodiment, the number of brush patterns displayed is determined in conjunction with the input track length of the user with the screen length as a reference. Assuming that the screen length is X, the input track length drawn by the user using the brush is Y, Y is divided by X, and multiplied by a preset value n, for example, 100-. The number of brush patterns displayed on the screen is obtained.
For example, when Y is 2800 and X is 2400, the number of times the brush is repeatedly displayed is about 163, and a dynamic wallpaper corresponding to a continuous brush pattern is obtained.
And after the plurality of brush patterns are generated and the corresponding dynamic wallpaper is obtained, the background color of the dynamic wallpaper comprising the plurality of brush patterns can be set based on the color selected by the user.
Optionally, the method further includes: and setting the background of the dynamic wallpaper corresponding to the screen in the area except the brush pattern in the dynamic wallpaper.
The set background can be filled according to a recommended color customized by a system or one color freely selected by a user, and the filled area is the part except the dynamic wallpaper in the area displayed on the screen.
As shown in fig. 7, the user may select a favorite color in the color ring of the system to match with the generated dynamic wallpaper W, so as to obtain a dynamic wallpaper W' with a background.
Optionally, the method further includes: storing the dynamic wallpaper in a target gallery; and based on preset operation, the dynamic wallpaper is derived from the target gallery and is reproduced on the screen along the target input track.
After the above-mentioned dynamic wallpaper generation step is completed, the dynamic wallpaper generation result may be automatically stored in the gallery of the electronic device, as shown in (a) of fig. 8. And (c) setting the generated dynamic wallpaper as the desktop standby wallpaper or the main screen wallpaper of the electronic equipment according to the selection of the user, deriving the target dynamic wallpaper from the target gallery and displaying the target dynamic wallpaper correspondingly, wherein the target dynamic wallpaper is set as the desktop standby wallpaper as shown in (b) of fig. 8.
Therefore, a user can extract the brush color and the shape from any picture on an operating system of the electronic equipment, so that the customization of the brush pattern is realized, and the personalized dynamic wallpaper of any lighting path is generated by utilizing the customized brush pattern.
In the embodiment of the application, the color and the shape of the target object in the target picture are obtained to serve as the target color and the target shape of the brush, the first input of a user is received, the first input is responded, and the patterns of the target shape and the target color are displayed according to the input track of the first input, so that a convenient and easy-to-use method for generating the self-defined brush pattern can be provided for the user, the brush pattern is displayed along the input track to form the dynamic wallpaper, the personalized customization of the user on the dynamic wallpaper can be realized, the interesting requirements of the user on the wallpaper are met, and the use experience degree of electronic equipment of the user is improved.
In the method for generating a brush pattern provided by the embodiment of the application, the execution main body may be a device for generating a brush pattern. In the embodiment of the present application, a method for generating a brush pattern by using a brush pattern generation device as an example is described.
As shown in fig. 9, a device 800 for generating a brush pattern according to an embodiment of the present application includes:
an obtaining module 820, configured to obtain a color and a shape of a target object in a target picture as a target color and a target shape of a brush;
a receiving module 840, configured to receive a first input of a user;
a display module 860 for displaying a pattern of a target shape and a target color according to an input trajectory of the first input in response to the first input.
Optionally, the colors of the target object include a first color and a second color, and the obtaining module is specifically configured to: acquiring the color with the largest target object area in the target picture as the first color; and acquiring the color with an included angle smaller than or equal to a preset angle with the first color in the color ring as the second color.
Optionally, the obtaining module is specifically configured to: converting the target picture into a black and white mode; determining a plurality of closed shape areas in a target picture in a black and white mode; and acquiring the maximum closed shape area in the plurality of closed shape areas to obtain the shape of the target object in the target picture.
Optionally, the obtaining module is specifically configured to: determining a first point and a second point with the largest distance in the shape of the target object; setting the first color to correspond to the first point, and setting the second color to correspond to the second point; generating a gradient color based on the first color and the second color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
Optionally, the obtaining module is specifically configured to: determining a third color with the largest specific area in the second colors; generating a bi-chromatic gradient color based on the first color and the third color; or determining a fourth color with the largest specific area and a third color with the second largest specific area in the second colors; generating a tri-color gradient color based on the first color, the fourth color, and the third color.
Optionally, the obtaining module is specifically configured to: acquiring a target picture containing a first number of color types; determining a plurality of regions of the target picture containing colors of a second number of color categories; acquiring a target area with the largest adjacent color contrast in the plurality of areas, wherein the second number is smaller than the first number; forming a shape of a target object in the target area in a preset closed shape.
Optionally, the obtaining module is specifically configured to: determining the color proportion of each color in the shape of the target object according to the main tone of the target picture; determining a first point and a second point with the largest distance in the shape of the target object; setting a first color with the largest color ratio in the colors to correspond to the first point, and setting a second color with the smallest color ratio in the colors to correspond to the second point; carrying out gradient processing on each color according to the color proportion to generate a gradient color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
Optionally, the display module is specifically configured to: determining a target position according to the input track length of the first input and a preset interval value; displaying a pattern of the target shape and target color at the target location.
Optionally, the display module is specifically configured to: determining the number of the displayed target shapes and target color patterns according to the length of the first input track and the length of the screen corresponding to the input track; the number of patterns is displayed uniformly along the input trajectory.
Optionally, the apparatus further comprises: and the background setting module is used for setting the background of the dynamic wallpaper corresponding to the screen in an area except for the brush pattern of the dynamic wallpaper.
Optionally, the apparatus further comprises: the storage module stores the dynamic wallpaper in a target gallery; and the derivation module is used for deriving the dynamic wallpaper from the target gallery and reproducing the dynamic wallpaper on a screen along a target input track based on preset operation.
In the embodiment of the application, the color and the shape of the target object in the target picture are obtained to serve as the target color and the target shape of the brush, the first input of a user is received, the first input is responded, and the patterns of the target shape and the target color are displayed according to the input track of the first input, so that a convenient and easy-to-use method for generating the self-defined brush pattern can be provided for the user, the brush pattern is displayed along the input track to form the dynamic wallpaper, the personalized customization of the user on the dynamic wallpaper can be realized, the interesting requirements of the user on the wallpaper are met, and the use experience degree of electronic equipment of the user is improved.
The device for generating the brush pattern in the embodiment of the present application may be an electronic device, or may be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be a device other than a terminal. The electronic Device may be, for example, a Mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic Device, a Mobile Internet Device (MID), an Augmented Reality (AR)/Virtual Reality (VR) Device, a robot, a wearable Device, an ultra-Mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and may also be a personal computer (personal computer, PC), a Television (TV), a teller machine, a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The device for generating the brush pattern in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The device for generating a brush pattern provided in the embodiment of the present application can implement each process implemented by the method embodiments of fig. 1 to 8, and is not described herein again to avoid repetition.
Optionally, as shown in fig. 10, an electronic device 900 is further provided in this embodiment of the present application, and includes a processor 940 and a memory 920, where the memory 920 stores a program or an instruction that can be executed on the processor 940, and when the program or the instruction is executed by the processor 940, the steps of the embodiment of the method for generating a brush pattern are implemented, and the same technical effects can be achieved, and are not described again to avoid repetition.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 11 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.
Those skilled in the art will appreciate that the electronic device 1000 may further comprise a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 1010 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 11 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is not repeated here.
The processor 1010 is configured to obtain a color and a shape of a target object in a target picture as a target color and a target shape of the brush; the input unit 1004 is used for receiving a first input of a user; the display unit 1006 displays a pattern of a target shape and a target color according to an input trajectory of the first input in response to the first input.
Optionally, the colors of the target object include a first color and a second color, and the processor 1010 is specifically configured to: acquiring the color with the largest target object area in the target picture as the first color; and acquiring the color with an included angle smaller than or equal to a preset angle with the first color in the color ring as the second color.
Optionally, the processor 1010 is specifically configured to: converting the target picture into a black and white mode; determining a plurality of closed shape areas in a target picture in a black and white mode; and acquiring the maximum closed shape area in the plurality of closed shape areas to obtain the shape of the target object in the target picture.
Optionally, the processor 1010 is specifically configured to: determining a first point and a second point with the largest distance in the shape of the target object; setting the first color to correspond to the first point, and setting the second color to correspond to the second point; generating a gradient color based on the first color and the second color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
Optionally, the processor 1010 is specifically configured to: acquiring a target picture containing a first number of color types; determining a plurality of regions of the target picture containing colors of a second number of color categories; acquiring a target area with the largest adjacent color contrast in the plurality of areas, wherein the second number is smaller than the first number; forming a shape of a target object in the target area in a preset closed shape.
Optionally, the processor 1010 is specifically configured to: determining the color proportion of each color in the shape of the target object according to the main tone of the target picture; determining a first point and a second point with the largest distance in the shape of the target object; setting a first color with the largest color ratio in the colors to correspond to the first point, and setting a second color with the smallest color ratio in the colors to correspond to the second point; carrying out gradient processing on each color according to the color proportion to generate a gradient color; and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
Optionally, the display unit 1006 is specifically configured to: determining a target position according to the length of the first input track and a preset interval value; displaying a pattern of the target shape and target color at the target location.
Optionally, the display unit 1006 is specifically configured to: determining the number of the displayed target shapes and target color patterns according to the length of the first input track and the length of the screen corresponding to the input track; the number of patterns is displayed uniformly along the input trajectory.
In the embodiment of the application, the color and the shape of the target object in the target picture are obtained to serve as the target color and the target shape of the brush, the first input of a user is received, the first input is responded, and the patterns of the target shape and the target color are displayed according to the input track of the first input, so that a convenient and easy-to-use method for generating the self-defined brush pattern can be provided for the user, the brush pattern is displayed along the input track to form the dynamic wallpaper, the personalized customization of the user on the dynamic wallpaper can be realized, the interesting requirements of the user on the wallpaper are met, and the use experience degree of electronic equipment of the user is improved.
It should be understood that in the embodiment of the present application, the input Unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042, and the Graphics Processing Unit 10041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts, a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.
The memory 1009 may be used to store software programs as well as various data. The memory 1009 may mainly include a first storage area storing a program or an instruction and a second storage area storing data, wherein the first storage area may store an operating system, an application program or an instruction (such as a sound playing function, an image playing function, and the like) required for at least one function, and the like. Further, the memory 1009 may include volatile memory or nonvolatile memory, or the memory 1009 may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. The volatile Memory may be a Random Access Memory (RAM), a Static Random Access Memory (Static RAM, SRAM), a Dynamic Random Access Memory (Dynamic RAM, DRAM), a Synchronous Dynamic Random Access Memory (Synchronous DRAM, SDRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (Double Data Rate SDRAM, ddr SDRAM), an Enhanced Synchronous SDRAM (ESDRAM), a Synchronous Link DRAM (SLDRAM), and a Direct Memory bus RAM (DRRAM). The memory 1009 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
Processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor, which primarily handles operations related to the operating system, user interface, and applications, and a modem processor, which primarily handles wireless communication signals, such as a baseband processor. It will be appreciated that the modem processor described above may not be integrated into processor 1010. .
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the embodiment of the method for generating a brush pattern, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read only memory ROM, a random access memory RAM, a magnetic or optical disk, and the like.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the embodiment of the method for generating a brush pattern, and the same technical effect can be achieved, and in order to avoid repetition, details are not repeated here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
The present application provides a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the processes of the above embodiment of the method for generating a brush pattern, and can achieve the same technical effects, and in order to avoid repetition, details are not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (18)

1. A method for generating a brush pattern, comprising:
acquiring the color and the shape of a target object in a target picture as the target color and the target shape of the brush;
receiving a first input of a user;
in response to the first input, displaying a pattern of target shapes and target colors according to an input trajectory of the first input.
2. The method of claim 1, wherein the color of the target object comprises a first color and a second color, and wherein obtaining the color of the target object within the target picture as the target color of the brush comprises:
acquiring the color with the largest target object area in the target picture as the first color;
and acquiring the color with an included angle smaller than or equal to a preset angle with the first color in the color ring as the second color.
3. The method of claim 2, wherein obtaining the shape of the target object within the target picture comprises:
converting the target picture into a black and white mode;
determining a plurality of closed shape areas in a target picture in a black and white mode;
and acquiring the maximum closed shape area in the plurality of closed shape areas to obtain the shape of the target object in the target picture.
4. The method of claim 3, wherein obtaining the color and shape of the target object within the target picture as the target color and target shape of the brush comprises:
determining a first point and a second point with the largest distance in the shape of the target object;
setting the first color to correspond to the first point, and setting the second color to correspond to the second point;
generating a gradient color based on the first color and the second color;
and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
5. The method of claim 1, wherein obtaining the color and shape of the target object within the target picture comprises:
acquiring a target picture containing a first number of color types;
determining a plurality of regions of the target picture containing colors of a second number of color categories;
acquiring a target area with the largest adjacent color contrast in the plurality of areas, wherein the second number is smaller than the first number;
forming a shape of a target object in the target area in a preset closed shape.
6. The method of claim 5, wherein obtaining the color and shape of the target object within the target picture as the target color and target shape of the brush comprises:
determining the color proportion of each color in the shape of the target object according to the main tone of the target picture;
determining a first point and a second point with the largest distance in the shape of the target object;
setting a first color with the largest color ratio in the colors to correspond to the first point, and setting a second color with the smallest color ratio in the colors to correspond to the second point;
carrying out gradient processing on each color according to the color proportion to generate a gradient color;
and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
7. The method of claim 1, wherein displaying a pattern of target shapes and target colors according to the input trajectory of the first input comprises:
determining a target position according to the length of the first input track and a preset interval value;
displaying a pattern of the target shape and target color at the target location.
8. The method of claim 1, wherein displaying a pattern of target shapes and target colors according to the input trajectory of the first input comprises:
determining the number of the displayed target shapes and target color patterns according to the length of the first input track and the length of the screen corresponding to the input track;
the number of patterns is displayed uniformly along the input trajectory.
9. A device for generating a brush pattern, comprising:
the acquisition module is used for acquiring the color and the shape of a target object in the target picture as the target color and the target shape of the brush;
the receiving module is used for receiving a first input of a user;
and the display module is used for responding to the first input and displaying a pattern of a target shape and a target color according to the input track of the first input.
10. The apparatus of claim 9, wherein the colors of the target object comprise a first color and a second color, and wherein the obtaining module is specifically configured to:
acquiring the color with the largest target object area in the target picture as the first color;
and acquiring the color with an included angle smaller than or equal to a preset angle with the first color in the color ring as the second color.
11. The apparatus of claim 10, wherein the obtaining module is specifically configured to:
converting the target picture into a black and white mode;
determining a plurality of closed shape areas in a target picture in a black and white mode;
and acquiring the maximum closed shape area in the plurality of closed shape areas to obtain the shape of the target object in the target picture.
12. The apparatus of claim 11, wherein the obtaining module is specifically configured to:
determining a first point and a second point with the largest distance in the shape of the target object;
setting the first color to correspond to the first point, and setting the second color to correspond to the second point;
generating a gradient color based on the first color and the second color;
and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
13. The apparatus of claim 9, wherein the obtaining module is specifically configured to:
acquiring a target picture containing a first number of color types;
determining a plurality of regions of the target picture containing colors of a second number of color categories;
acquiring a target area with the largest adjacent color contrast in the plurality of areas, wherein the second number is smaller than the first number;
forming a shape of a target object in the target area in a preset closed shape.
14. The apparatus of claim 13, wherein the obtaining module is specifically configured to:
determining the color proportion of each color in the shape of the target object according to the main tone of the target picture;
determining a first point and a second point with the largest distance in the shape of the target object;
setting a first color with the largest color ratio in the colors to correspond to the first point, and setting a second color with the smallest color ratio in the colors to correspond to the second point;
carrying out gradient processing on each color according to the color proportion to generate a gradient color;
and covering the gradient color into the shape of the target object based on the first point and the second point to obtain the target color and the target shape of the brush.
15. The apparatus of claim 9, wherein the display module is specifically configured to:
determining a target position according to the input track length of the first input and a preset interval value;
displaying a pattern of the target shape and target color at the target location.
16. The apparatus of claim 9, wherein the display module is specifically configured to:
determining the number of the displayed target shapes and target color patterns according to the length of the first input track and the length of the screen corresponding to the input track;
the number of patterns is displayed uniformly along the input trajectory.
17. An electronic device, comprising a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions when executed by the processor implementing the steps of the method of generating a brush pattern according to any one of claims 1-8.
18. A readable storage medium, on which a program or instructions are stored, which when executed by a processor, carry out the steps of the method of generating a brush pattern according to any one of claims 1-8.
CN202111403651.1A 2021-11-22 2021-11-22 Method and device for generating brush pattern and electronic equipment Pending CN114119812A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111403651.1A CN114119812A (en) 2021-11-22 2021-11-22 Method and device for generating brush pattern and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111403651.1A CN114119812A (en) 2021-11-22 2021-11-22 Method and device for generating brush pattern and electronic equipment

Publications (1)

Publication Number Publication Date
CN114119812A true CN114119812A (en) 2022-03-01

Family

ID=80371805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111403651.1A Pending CN114119812A (en) 2021-11-22 2021-11-22 Method and device for generating brush pattern and electronic equipment

Country Status (1)

Country Link
CN (1) CN114119812A (en)

Similar Documents

Publication Publication Date Title
CN111541907B (en) Article display method, apparatus, device and storage medium
CN103971391A (en) Animation method and device
CN104866755B (en) Setting method and device for background picture of application program unlocking interface and electronic equipment
WO2023045857A1 (en) Image processing method and apparatus, electronic device and storage medium
WO2016197469A1 (en) Method and apparatus for generating unlocking interface, and electronic device
CN106843505A (en) A kind of digital video interactive and method based on preschool education
CN111047511A (en) Image processing method and electronic equipment
WO2023066294A1 (en) Icon display method and apparatus, and electronic device
WO2023197780A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN108038916B (en) Augmented reality display method
CN110347459A (en) Window minimization method and device, storage medium and interactive intelligent panel
CN113986407A (en) Cover generation method and device and computer storage medium
CN107870703A (en) Method, system and the terminal device of full-screen picture displaying
CN114020394A (en) Image display method and device and electronic equipment
CN110599601A (en) Method and device for generating painting image, terminal and storage medium
CN114040248A (en) Video processing method and device and electronic equipment
CN112083863A (en) Image processing method and device, electronic equipment and readable storage medium
CN112541955A (en) Image processing method, device and equipment
CN114119812A (en) Method and device for generating brush pattern and electronic equipment
CN113935891B (en) Pixel-style scene rendering method, device and storage medium
CN114518859A (en) Display control method, display control device, electronic equipment and storage medium
CN114786062A (en) Information recommendation method and device and electronic equipment
CN113794799A (en) Video processing method and device
CN114245193A (en) Display control method and device and electronic equipment
CN114095611A (en) Incoming call display interface processing method and device and electronic equipment

Legal Events

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