Brush recommendation method, electronic device, computer program product, and storage medium
By using artificial intelligence to identify the brush features of paintings and compare them with a brush library or create similar brushes, the problem of users spending a lot of time and effort adjusting brushes in painting software is solved, and the effect of quickly acquiring and adjusting brushes is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2022-09-26
- Publication Date
- 2026-05-15
AI Technical Summary
In existing painting software, the process of adjusting the brush used to obtain a certain painting is time-consuming and laborious, and requires a high level of painting skill.
Artificial intelligence image recognition technology is used to extract brush features from paintings and compare them with the brush library of painting applications or create similar brushes to recommend or adjust brushes to match the effect of the paintings.
It improves the usability and convenience of drawing software, allowing users to quickly obtain the brushes they need for learning or copying, reducing the complexity and time cost of adjustments.
Smart Images

Figure CN115527218B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminals, and more particularly to a brush recommendation method, electronic devices, computer program products, and computer-readable storage media. Background Technology
[0002] With the enhancement of display capabilities of terminal devices (such as portable or desktop terminals) and the improvement of writing accuracy of accompanying styluses, more and more drawing software has emerged, enabling users to complete various types of drawing works.
[0003] In drawing software, a variety of practical brushes are one of the core competitive advantages. Brushes, with their textures or outlines, can quickly help users complete their artwork and achieve good drawing results. For example, a special brush can be used to draw the red and yellow texture of a peach. Drawing software generally has a brush library, which can include brushes that come with the software, brushes downloaded from third parties, and brushes that users design themselves within the software.
[0004] Painting software offers a vast number of brush adjustment options, typically comprising multiple main categories, each further divided into several subcategories. This makes brush adjustments extremely complex. For non-art creators seeking to acquire the brushes used in a painting for study or imitation, the only recourse is to adjust multiple brush options based on their own understanding and observation to achieve a brush style similar to the artwork. This process is difficult, time-consuming, and challenging. Summary of the Invention
[0005] In view of this, it is necessary to provide a brush recommendation method to solve the problem that existing technologies require a lot of manpower and time to obtain the brushes used in a painting.
[0006] The first aspect of this application discloses a brush recommendation method, comprising: in response to an identification operation of a painting, obtaining a first brush used to draw the painting; extracting brush features of the first brush, wherein the brush features correspond to at least one parameter sub-item used to set brush parameters in a painting application; comparing the brush features of the first brush with each brush in a brush library of the painting application; recommending a second brush in the brush library corresponding to the first brush based on the comparison result, or creating a third brush in the brush library corresponding to the first brush based on the comparison result.
[0007] By employing the above technical solution, intelligent recognition of paintings, such as artificial intelligence image recognition, is performed to extract the brushes and brush features used in creating the paintings. These brush features correspond to one or more parameter sub-items used to set brush parameters in the painting application. Furthermore, the extracted brush features can be compared and recommended with brushes in the painting application's brush library, or new brushes can be created within the painting application based on the extracted brush features. For non-painting creators, this allows them to quickly obtain the brushes used in a painting for painting learning or imitation, enriching the usability and convenience of the painting application. Users can even attempt brush recognition on any image to create brushes with unique brush effects, increasing the fun of the painting application.
[0008] In some embodiments, the first brush includes multiple brush features. Obtaining the first brush used to draw the painting includes: obtaining the first brush used to draw the painting based on a pre-trained brush recognition model; extracting the brush features of the first brush includes: inputting the first brush into multiple pre-trained feature recognizers respectively, and extracting multiple brush features of the first brush, wherein each feature recognizer is used to extract one type of brush feature.
[0009] Using the above technical solution, a pre-trained brush recognition model is used to extract the brushes used in creating the artwork, and multiple pre-trained feature recognizers are used to extract multiple brush features of the brush. Each feature recognizer is used to extract one brush feature of the brush. For example, a brush can be generally represented by six brush features. After the brush used in creating the artwork is obtained using the brush recognition model, the extracted brushes can be input into the six feature recognizers to attempt to extract the six brush features of the brush. The output of the feature recognizer can be empty, indicating that the brush does not have the corresponding brush features.
[0010] In some embodiments, comparing the brush features of the first brush with each brush in the brush library of the painting application includes: calculating the similarity between the first brush and each brush in the brush library of the painting application based on the brush features of the first brush and the parameters of the target parameter sub-items of each brush in the brush library of the painting application, wherein the target parameter sub-items are the parameter sub-items corresponding to the brush features of the first brush.
[0011] By adopting the above technical solution, the brush features of the first brush are compared with the parameters of the target parameter sub-items of each brush in the brush library. The target parameter sub-items are the parameter sub-items corresponding to the brush features of the first brush. This allows for the calculation of the similarity between the first brush and each brush in the brush library, which facilitates subsequent brush recommendation based on the similarity with each brush in the brush library, or the creation of new brushes in the brush library.
[0012] In some embodiments, recommending a second brush corresponding to the first brush in the brush library based on the comparison result includes: if there is a brush in the brush library with a similarity greater than a preset value to the first brush, recommending the brush with the highest similarity to the first brush in the brush library as the second brush.
[0013] Using the above technical solution, if the brush library contains brushes with a similarity greater than a preset value to the first brush, the brush with the highest similarity to the first brush can be selected from one or more brushes with a similarity greater than the preset value and recommended as the second brush. This makes it easier for users to accurately learn or imitate related artworks based on the recommended second brush.
[0014] In some embodiments, creating a third brush corresponding to the first brush in the brush library based on the comparison result includes: if there is no brush in the brush library with a similarity greater than a preset value to the first brush, creating a third brush corresponding to the first brush in the brush library based on the brush features of the first brush.
[0015] Using the above technical solution, if there is no brush in the brush library with a similarity greater than a preset value to the first brush, it indicates that there is no brush in the current brush library that is similar to the first brush. A third brush corresponding to the first brush can be created in the brush library based on the brush features of the first brush. This makes it easier for users to accurately learn or imitate related artworks based on the created third brush. For example, the parameters of a certain brush in the brush library can be adjusted based on the brush features of the first brush to obtain a third brush corresponding to the first brush.
[0016] In some embodiments, creating a third brush corresponding to the first brush in a brush library based on the brush features of the first brush includes: selecting the brush with the highest similarity to the first brush from the brush library as the brush to be adjusted; and adjusting the parameters of the target parameter sub-item of the brush to be adjusted based on the brush features of the first brush to obtain the third brush.
[0017] Using the above technical solution, when creating a brush, the brush with the highest similarity to the first brush can be selected from the brush library as the brush to be adjusted. By adjusting the parameters of the target parameter sub-item of the brush to be adjusted, which is the parameter sub-item corresponding to the brush features of the first brush, a third brush corresponding to the first brush can be quickly obtained, thus improving the efficiency of brush creation.
[0018] In some embodiments, creating a third brush corresponding to the first brush in the brush library based on the brush features of the first brush includes: creating a corresponding brush copy based on the brush in the brush library that has the highest similarity to the first brush; and adjusting the parameters of the target parameter sub-item of the brush copy based on the brush features of the first brush to obtain the third brush.
[0019] Using the above technical solution, when creating a brush, the brush with the highest similarity to the first brush can be selected from the brush library as the brush to be adjusted. By creating a copy of the brush to be adjusted and adjusting the parameters of the target parameter sub-item of the brush copy, which is the parameter sub-item corresponding to the brush features of the first brush, a third brush corresponding to the first brush can be quickly obtained, improving the efficiency of brush creation, and also ensuring that the brush to be adjusted is retained in the brush library.
[0020] In some embodiments, the similarity between the first brush and each brush in the brush library of a painting application is calculated based on the brush features of the first brush and the parameters of the target parameter sub-items of each brush in the brush library, including: if the first brush includes multiple brush features, calculating the feature similarity between each brush feature and each brush in the brush library based on each brush feature of the first brush and the parameters of the target parameter sub-items of each brush in the brush library; and calculating the similarity between the first brush and each brush in the brush library based on the feature similarity of each brush feature and the corresponding weight coefficient, wherein each brush feature corresponds to a weight coefficient.
[0021] Using the above technical solution, based on each brush feature of the first brush and the parameters of the target parameter sub-items of each brush in the brush library, the feature similarity between each brush feature of the first brush and each brush in the brush library can be calculated. Then, based on the multiple feature similarities between the first brush and any brush in the brush library and the corresponding weight coefficients, the similarity between the first brush and any brush in the brush library can be calculated. This facilitates subsequent brush recommendation based on the similarity with each brush in the brush library, or the creation of new brushes in the brush library.
[0022] In some embodiments, brush features include one or more of line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features.
[0023] Using the above technical solution, brush features include, but are not limited to, one or more of the following: line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features. For example, the brush features of a certain brush may include line edge contour features, texture features, stroke trajectory features, line thickness features, and color depth features.
[0024] In some embodiments, the parameter sub-item corresponding to the line edge contour feature includes a first parameter sub-item. Extracting the brush feature of the first brush includes: extracting the painting line corresponding to the first brush from the painting; extracting the edge contour feature of each painting line, and synthesizing the single-point basic shape of the first brush based on the edge contour feature of each painting line; comparing the brush feature of the first brush with each brush in the brush library, including: comparing the single-point basic shape of the first brush with the parameter of the first parameter sub-item of each brush in the brush library.
[0025] Using the above technical solution, taking the brush parameter sub-item corresponding to the dimension of line edge contour as an example, after recognizing the painting lines drawn using the first brush in the painting, the single-point basic shape of the first brush can be synthesized based on the edge contour features of the painting lines. The single-point basic shape of the first brush is compared with the single-point basic shape of each brush in the brush library to obtain the comparison result between the first brush and each brush in the brush library. The more painting lines of the brushes extracted, the more edge contour features can be collected, and the closer the single-point basic shape of the synthesized brush is to the single-point basic shape of the original brush in the painting.
[0026] In some embodiments, the parameter sub-item corresponding to the line edge contour feature further includes multiple second parameter sub-items. Extracting the brush features of the first brush further includes: extracting the density information, rotation information, and discrete distribution information of the single-point basic shape of the first brush from the drawing lines corresponding to the first brush, wherein the density information, rotation information, and discrete distribution information of the single-point basic shape correspond to a second parameter sub-item respectively; comparing the brush features of the first brush with each brush in the brush library, including: comparing the density information, rotation information, and discrete distribution information of the single-point basic shape of the first brush with the parameters of the second parameter sub-item of each brush in the brush library respectively.
[0027] Using the above technical solution, taking the brush parameter sub-item corresponding to the dimension of line edge contour as an example, after recognizing the painting lines drawn using the first brush in the painting, the density, rotation, and discrete distribution information of the single-point basic shape of the first brush can be extracted from the painting lines. The density, rotation, and discrete distribution information of the single-point basic shape are each compared with a parameter sub-item. Furthermore, the density, rotation, and discrete distribution information of the single-point basic shape of the first brush are compared with the density, rotation, and discrete distribution information of each brush in the brush library to obtain the comparison result between the first brush and each brush in the brush library.
[0028] In some embodiments, a painting includes an electronic painting or an electronic image of a physical painting.
[0029] Using the above technical solution, a painting can be an electronic painting or an electronic image of a physical painting. A physical painting can refer to a painting created by the creator using painting tools such as pens, brushes, and knives, and powdered materials such as pigments, inks, and varnishes on a two-dimensional plane such as paper, textiles, wood panels, or walls.
[0030] Secondly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the brush recommendation method as described in the first aspect.
[0031] Thirdly, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory is used to store instructions, and the processor is used to call the instructions in the memory, causing the electronic device to execute the brush recommendation method as described in the first aspect.
[0032] Fourthly, embodiments of this application provide a computer program product that, when run on an electronic device (such as a computer), causes the electronic device to execute the brush recommendation method as described in the first aspect.
[0033] Fifthly, an apparatus is provided that has the function of implementing the behavior of the electronic device in the method provided in the first aspect. The function can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0034] It is understood that the computer-readable storage medium described in the second aspect, the electronic device described in the third aspect, the computer program product described in the fourth aspect, and the device described in the fifth aspect all correspond to the method described in the first aspect. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application;
[0036] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;
[0037] Figure 3 This is a schematic diagram illustrating an application scenario of the brush recommendation method provided in an embodiment of this application.
[0038] Figure 4 A schematic diagram of the architecture for recommending or creating brushes in an electronic device according to an embodiment of this application;
[0039] Figure 5A schematic diagram illustrating a brush based on multiple brush features, provided as an embodiment of this application;
[0040] Figure 6 This is a schematic diagram of multiple brushes extracted from a painting by a brush recognition model provided in an embodiment of this application;
[0041] Figures 7a-7f This is a schematic diagram illustrating the extraction of line edge contour feature information based on brush-based drawing lines according to an embodiment of this application;
[0042] Figure 8 This is a schematic diagram illustrating the extraction of brush texture feature information based on brush-based drawing lines, provided in an embodiment of this application.
[0043] Figure 9 This is a flowchart illustrating a brush recommendation method provided in an embodiment of this application. Detailed Implementation
[0044] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0045] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0046] In existing technologies, if a user wants to learn to draw by copying a painting using drawing software, the user usually adjusts the brush settings in the drawing software based on their observation and understanding of the painting to obtain the brush used to create the painting. This method of creating brushes is time-consuming and laborious, and requires a high level of drawing skill from the user.
[0047] Based on this, this application provides a brush recommendation method that combines artificial intelligence (AI) image recognition technology to identify and extract brush features from paintings, and uses the extracted information to create or recommend brushes, thereby improving the usability and convenience of painting software and eliminating the need for users to manually adjust the brush settings in the painting software to obtain the adjusted brushes.
[0048] The brush recommendation method provided in this application can be applied to electronic devices. The electronic devices covered by this application may include, but are not limited to, mobile phones, foldable electronic devices, tablets, personal computers (PCs), laptops, handheld computers, ultra-mobile personal computers (UMPCs), netbooks, cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, smart home devices, in-vehicle systems, and smart city devices. This application does not impose any special limitations on the specific type of electronic device.
[0049] In some embodiments, electronic devices can communicate with other electronic devices or servers via a communication network. The communication network can be a wired network or a wireless network. For example, the communication network can be a local area network (LAN) or a wide area network (WAN), such as the Internet. When the communication network is a LAN, for example, it can be a short-range communication network such as a Wi-Fi hotspot network, a Wi-Fi P2P network, a Bluetooth network, a Zigbee network, or a near field communication (NFC) network. When the communication network is a WAN, for example, it can be a 3rd generation wireless telephone technology (3G) network, a 4th generation mobile communication technology (4G) network, a 5th generation mobile communication technology (5G) network, a future public land mobile network (PLMN), or the Internet.
[0050] In some embodiments, an electronic device may install one or more applications (APPs). An APP, often shortened to application, is a software program capable of performing one or more specific functions. Examples include instant messaging applications, video applications, audio applications, image capture applications, cloud desktop applications, drawing applications, and so on. Instant messaging applications, for example, may include... Image capture applications, such as camera apps (system camera or third-party camera apps). Video applications, such as Huawei Video, etc. Audio applications, such as Huawei Music, The applications mentioned in the following embodiments may be system applications that are installed when the electronic device leaves the factory, or third-party applications that the user downloads from the network or obtains from other electronic devices during the use of the electronic device.
[0051] Electronic devices including but not limited to those equipped with Windows Or other operating systems.
[0052] Figure 1This diagram illustrates the structure of an electronic device 10.
[0053] Electronic device 10 may include processor 110, external memory interface 120, internal memory 121, antenna 1, antenna 2, mobile communication module 130, wireless communication module 140, audio module 150, sensor module 160, camera module 170, display screen 180, etc.
[0054] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0055] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0056] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. The memory can store instructions or data that the processor 110 has used or that are used frequently. If the processor 110 needs to use the instructions or data, it can directly retrieve them from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves system efficiency.
[0057] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 can connect to modules such as an audio module, a wireless communication module, a display, and a camera through at least one of these interfaces.
[0058] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0059] The wireless communication function of electronic device 10 can be implemented through antenna 1, antenna 2, mobile communication module 130, wireless communication module 140, modem processor, and baseband processor.
[0060] The mobile communication module 130 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 10. The mobile communication module 130 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. In some embodiments, at least some functional modules of the mobile communication module 130 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 130 and at least some modules of the processor 110 may be housed in the same device.
[0061] The wireless communication module 140 can provide solutions for wireless communication applications on the electronic device 10, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Bluetooth Low Energy (BLE), ultra-wideband (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 140 can be one or more devices integrating at least one communication processing module.
[0062] In some embodiments, electronic device 10 can communicate with networks and other electronic devices via wireless communication technologies. These wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).
[0063] Electronic device 10 can implement display functions through a GPU, a display screen 180, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 180 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0064] The camera module 170 includes a camera. The display screen 180 is used to display images, videos, etc. The display screen 180 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 10 may include one or more displays 180.
[0065] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external memory card communicates with the processor 110 through the external memory interface 120 to perform data storage functions.
[0066] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 10, etc. Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional methods or data processing of electronic device 10 by running instructions stored in internal memory 121 and / or instructions stored in memory disposed in the processor.
[0067] The audio module 150 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal. The audio module 150 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 150 may be located in the processor 110, or some functional modules of the audio module 150 may be located in the processor 110.
[0068] The software system of electronic device 10 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 10.
[0069] Figure 2 This is a software structure block diagram of an electronic device 10 according to an embodiment of this application.
[0070] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and native C / C++ libraries, the Hardware Abstraction Layer (HAL), and the kernel layer.
[0071] The application layer can include a series of application packages.
[0072] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0073] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0074] like Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, resource manager, notification manager, activity manager, input manager, etc.
[0075] The window manager provides Window Manager Service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.
[0076] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0077] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0078] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0079] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0080] The Activity Manager Service (AMS) can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.
[0081] The Input Manager Service (IMS) provides input management services, which can be used to manage system inputs such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS (Windows Management System), distributes these events to appropriate windows.
[0082] The Android runtime consists of the core libraries and the Android runtime itself. The Android runtime is responsible for converting source code into machine code. The Android runtime primarily employs ahead-of-time (AOT) compilation and just-in-time (JIT) compilation techniques.
[0083] The core library primarily provides basic Java class library functionalities, such as libraries for fundamental data structures, mathematics, I / O, tools, databases, and networking. It also provides APIs for users to develop Android applications.
[0084] Native C / C++ libraries can include multiple functional modules. Examples include: surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.
[0085] The Surface Manager manages the display subsystem and provides 2D and 3D layer blending for multiple applications. The Media Framework supports playback and recording of various common audio and video formats, as well as still image files. The Media Library supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. OpenGL ES provides drawing and manipulation of 2D and 3D graphics in applications. SQLite provides a lightweight relational database for applications on the electronic device 10.
[0086] The Hardware Abstraction Layer (HAL) runs in user space, encapsulates kernel-level drivers, and provides calling interfaces to the upper layers.
[0087] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0088] The following is combined Figure 3 The following is an exemplary application scenario diagram illustrating the brush recommendation method provided in the embodiments of this application.
[0089] For ease of description, such as Figure 3 As shown, the electronic device 10 is illustrated using a tablet computer as an example. In this embodiment, the electronic device 10 may have one or more apps installed. After a user clicks on an app, the electronic device 10 can create a corresponding application process, which can then perform the various functions of the app. For example, if the electronic device 10 has a drawing app installed, after the app is opened, the user can draw on it.
[0090] In some embodiments, the electronic device 10 includes a touchscreen, allowing users to input commands on the touchscreen of the electronic device 10 via a touch input device 20 to perform related operations. For example, users can select files or draw by tapping the touchscreen using the touch input device 20. Besides inputting commands on the touchscreen, the touch input device 20 can also communicate with the electronic device 10 to transmit information. In some application scenarios provided in this application embodiment, users can also draw without using the touch input device 20. For example, users can input commands on the touchscreen of the electronic device 10 using their fingers, or input trigger commands through external interface devices such as a mouse, keyboard, or buttons to draw.
[0091] like Figure 4 The diagram shown is an architectural schematic of an electronic device provided in this application that recommends or creates brushes based on paintings.
[0092] In one embodiment of this application, to illustrate the recommendation or creation of brushes, the operating system installed on the electronic device 10 is an example of a system developed based on the Linux kernel. The electronic device 10 may have a painting app installed. This painting app can be an app pre-installed at the factory or a third-party painting app downloaded from the network or obtained by the user during use of the electronic device 10. The painting app includes a brush library, which may include multiple brushes. Users can paint using the brushes in the brush library. Each brush may include multiple adjustable parameter items (e.g., brush tip, line, texture, rendering, etc.). Each adjustable parameter item may further include multiple adjustable sub-parameters. For example, lines may include sub-parameters such as spacing and scattering. Users can adjust the parameters of the sub-parameters under each parameter item to adjust the painting effect of the brush. The sources of brushes in the brush library can include the following: a1. Brushes that come with the drawing app; a2. Brushes obtained by downloading brush installation packages from the internet or receiving them from other electronic devices and loading them into the drawing app (the drawing app must be compatible with the format of the brush installation package); a3. Users can adjust the parameters of a brush in the drawing app according to their drawing needs to obtain the adjusted brush, or by creating a brush copy of a brush and adjusting the parameters of the brush copy to obtain the adjusted brush. One or more adjusted brushes can be stored as custom brushes.
[0093] In some embodiments, the electronic device 10 can recommend and create brushes through the following modules: the electronic device 10 may include an identification module 101, a comparison module 102, a recommendation module 103, and a creation module 104. The modules referred to in this application embodiment can be a series of computer program instruction segments capable of performing specific functions, or functional modules formed by the cooperation of computer program instruction segments and hardware. The division of modules is a logical functional division, and there may be other division methods in actual implementation; this application does not limit this. The identification module 101 is used to identify the brushes used in the painting and extract the brush features of each brush. The painting can be an electronic painting (e.g., a painting created by a creator using painting software), or an electronic image of a physical painting (e.g., a painting created by a creator using painting tools such as pens, brushes, and knives, and powdered materials such as pigments, inks, and varnishes on a two-dimensional plane such as paper, textiles, wood panels, or walls). The comparison module 102 compares the brush features of each extracted brush with the brush parameters of brushes in the brush library to determine the similarity between the extracted brush and each brush in the brush library. The recommendation module 103 filters brushes from the brush library that have brush features consistent with those used in the artwork, or brushes whose brush features are inconsistent but whose similarity is greater than a preset value, and recommends these brushes to the user so that the user can use the recommended brushes to copy artworks or create artworks. The creation module 104 adjusts the parameters of a specified brush in the brush library based on the extracted brush features when there are no brushes with similar brush features in the brush library (similarity less than a preset value). For example, to retain the specified brush in the brush library, a copy of the specified brush can be created, and the parameters of the brush copy can be adjusted to obtain a brush with a similarity greater than a preset value to the extracted brush features, and then recommended to the user so that the user can use the created brush to copy artworks. The specified brush can be the brush in the brush library with the highest brush feature similarity to the extracted brush, which can improve the brush creation efficiency. Alternatively, it can be a brush randomly selected or a specified brush in the brush library that is then adjusted. In other embodiments, the creation module 104 can also create a blank brush, which can be a brush without parameter settings. Setting parameters for the blank brush results in a brush with a brush feature similarity to the extracted brush that is greater than a preset value.
[0094] In some embodiments, the recognition module 101 can identify the brushes used in the painting and extract the brush features of each brush based on an image recognition model. The image recognition model can be created based on the following principles: a1. Constructing training samples, which may include multiple images of paintings, which may be collected from the network or photographed from multiple physical paintings; a2. Performing image processing on each painting image, which may include one or more of the following: binarization, denoising, smoothing, transformation (transforming the image from one space to another), image enhancement, and image filtering; a3. Extracting and selecting image features from the painting images, for example, separating image features from the painting images in a certain way. The obtained image features may not all be useful for this image recognition, and useful image features need to be selected from the extracted image features as training samples to train the classifier; a4. Constructing a classifier for sample training, which may refer to a classifier built based on a neural network. By training the classifier, recognition rules are determined, and brush extraction and brush feature recognition are achieved based on the recognition rules.
[0095] In some embodiments, a brush can be generally characterized by the following six brush features: line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features. Each brush feature can correspond to one or more parameter sub-items used for brush parameter settings in a painting app. The parameter sub-items corresponding to each brush feature can be set according to actual needs, and this application does not limit this. These six brush features characterize the more important parameter sub-items for brush parameter settings in the painting app, facilitating subsequent selection of brushes from the brush library based on the extracted brush features, where the brush feature similarity to the brush used in the painting is greater than a preset value, or the creation of brushes with brush feature similarity greater than a preset value to the brush used in the painting. This application does not limit the number of brush features included in a brush; the brush features included in a brush can be defined according to actual needs. Figure 5 As shown, the brush is illustrated using the following examples: brush edge contour features, texture features, brush stroke features, line thickness features, color blending features, and color depth features.
[0096] Each brush feature can include one or more feature information. For example, line edge contour features can include contour shape information, contour randomness information, information on the appearance of wisps in the middle of the contour, contour density information, contour roughness / smoothness information, contour clarity / blurriness information, etc. Texture features can include texture effect information, texture randomness information, etc. Handwriting trajectory features can include whether the line is continuous, whether the line has random handwriting gaps (random breakpoints in the line); if there are no handwriting gaps, the line handwriting can be considered continuous. Line thickness features can include line thickness ranges, such as identifying the thickest and thinnest values of the line and obtaining the line thickness range based on the thickest and thinnest values. Color blending features can include the wet blending effect of different colored brushes at the boundary of the handwriting; specifically, this can be achieved by magnifying the image at the boundary of the handwriting and obtaining the difference in hue, brightness, and saturation of adjacent pixels to obtain the degree of color blending. Color depth features can include color depth ranges; this can be achieved by obtaining the darkest and lightest values of the line color and obtaining the color depth range based on the darkest and lightest values.
[0097] In some embodiments, the image recognition model may include a brush recognition model and a classifier for extracting brush features. The image recognition model may include six feature recognizers (first to sixth feature recognizers) for extracting six brush features respectively. For example, the first feature recognizer is used to extract edge contour features, the second feature recognizer is used to extract texture features, the third feature recognizer is used to extract stroke trajectory features, the fourth feature recognizer is used to extract line thickness features, the fifth feature recognizer is used to extract color blending features, and the sixth feature recognizer is used to extract color depth features.
[0098] For example, different brushes create different lines, and the brush used to create a painting can be determined based on the lines of the artwork. Brush recognition models are used to identify the brushes used in a painting, such as... Figure 6 As stated above, assuming the brush recognition model recognizes a certain painting I1 ( Figure 6(The specific painting content of painting I1 is omitted) is identified, and it is found that painting I1 includes six brushes br1 to br6. Brush br1 can be input into the first to sixth feature recognizers to extract the six brush features of brush br1. Similarly, brushes br2 to br6 can be input into the first to sixth feature recognizers to extract the six brush features of brushes br2 to br6 respectively. In different embodiments, brushes br1 to br6 may only include one or a few of the six brush features. In this case, not all six feature recognizers may have output results. The output result of a certain feature recognizer may be empty, indicating that there is no brush feature corresponding to that feature recognizer. For example, if the extracted brush br1 is monochrome and does not have a color blending feature, inputting brush br1 into the fifth feature recognizer will result in an empty output result for the fifth feature recognizer.
[0099] In some embodiments, if the six brush feature information of two brushes are all the same, the painting effect of the two brushes can be considered consistent. Alternatively, the similarity between the brush features of two brushes can be calculated, for example, based on histogram distance algorithms, hash algorithms, cosine similarity algorithms, etc., and the similarity between the two brushes can be obtained based on the similarity of the six brush features. For example, the average of the similarity of the six brush features can be used as the similarity between the two brushes, or weight coefficients can be assigned to each of the six brush features, and the similarity between the two brushes can be calculated based on the weight coefficients and the similarity of the six brush features. For example, the weight coefficients of line edge contour features and texture features can be set relatively high, while the weight coefficients of stroke trajectory features, line thickness features, color blending features, and color depth features can be set relatively low.
[0100] Taking brush br1 as an example, after obtaining the six brush features of brush br1, all feature information included in the six brush features can be summarized and compared with the brush parameters of each brush in the brush library of the painting app to recommend brushes similar to brush br1. For example, if the brush library includes multiple brushes with a similarity greater than a preset value to brush br1, the brush with the highest similarity can be recommended.
[0101] If the drawing app's brush library does not contain a brush with a similarity greater than the preset value to brush br1, it can adjust the subtype of a brush in the brush library based on the feature information of brush br1 to obtain a brush with a similarity greater than the preset value to brush br1. For example, a copy of the brush with the closest similarity to the preset value can be provided as the basis for adjustment.
[0102] Suppose a painting is identified that includes two brushes, br11 and br12. In a painting app, the parameters include single-point basic shape, spacing, rotation, random flipping, and scattering. Taking the setting or comparison of corresponding brush parameter sub-items based on the brush's line edge contour features as an example, the brush parameter sub-items corresponding to the line edge contour features can include single-point basic shape, spacing, rotation, random flipping, and scattering. After identifying the painting lines of a brush (e.g., brush br11), the corresponding parameter sub-items can be compared or created based on the line edge contour features. Suppose the user drew multiple lines with brush br11 in the painting; these multiple lines can be extracted from the painting, and the single-point basic shape of brush br11 can be obtained by combining the edge contour features of these multiple lines.
[0103] Suppose we extract brushes br11 and br12 from a painting. For example... Figure 7a As shown, the single-point basic shape of brush br11 is synthesized based on the edge contour features of the three painting lines L1 to L3 extracted from the painting artwork.
[0104] Assuming that the painting lines L1 to L3 in image I11 are the original lines extracted from the painting to brush br11, the single-point basic shape of brush br11 can be synthesized based on the edge contour features of painting lines L1 to L3 as follows: Image I11 is processed to improve the clarity of painting lines L1 to L3, resulting in image I12; the edge contour features M1 to M3 of painting lines L1 to L3 are extracted from image I12; the single-point basic shape M11 of brush br11 is synthesized based on the edge contour features M1 to M3 of painting lines L1 to L3. Drawing lines using brush br11 involves extending the single-point basic shape M11 of brush br11 in a certain direction to obtain the line.
[0105] Once the basic shape M11 of brush br11 is synthesized, it can be compared with the basic shape of each brush in the brush library. This facilitates the subsequent selection of similar brushes, or the basic shape of a brush in the brush library can be adjusted to obtain a basic shape similar to the basic shape M11 of brush br11, which facilitates the subsequent creation of similar brushes.
[0106] It is understandable that the more times the same brush is used in a painting, the more painting lines can be collected, the more edge contour features can be extracted, and the closer the final synthesized single-point basic shape M11 of the brush is to the single-point basic shape of the original brush in the painting.
[0107] like Figure 7b , 7c As shown, it is also possible to obtain the density information of the basic shape of a single point of the brush within a unit distance based on the drawing lines of a certain brush extracted from the painting artwork. The unit distance can be set according to actual needs, and this application does not limit it. The density information of the basic shape of a single point of the brush within a unit distance corresponds to the parameter sub-item "spacing". That is, in the painting app, the density information of the basic shape of a single point of the brush is adjusted by adjusting the value of the parameter sub-item "spacing". Figure 7b The image shows the density information of the basic shape of a single point in brush br11. For example... Figure 7c The image shows the density information of the single-dot basic shape of brush br12. In the direction of stroke movement, the density of the single-dot basic shape of brush br11 is denser than that of brush br12.
[0108] Once the density information of the single-point basic shape of brush br11 is obtained, the density of the single-point basic shape of brush br11 can be compared with the density of the single-point basic shape of each brush in the brush library. This facilitates the subsequent filtering of similar brushes, or the density of the single-point basic shape of a certain brush in the brush library can be adjusted to obtain a density similar to that of brush br11, which facilitates the subsequent creation of similar brushes.
[0109] like Figure 7d As shown, it is also possible to obtain whether the basic shape of a single point of a brush rotates along the direction of the brush stroke based on the drawing lines of a certain brush extracted from the painting, and if so, the specific rotation angle value. The rotation angle value can be a specific angle value or an angle range value. Figure 7d This illustrates the cases where rotation occurs along the direction of the handwriting trace and the cases where rotation does not occur along the direction of the handwriting trace. For ease of understanding... Figure 7d The diagram clearly illustrates whether the basic shapes of the brush strokes rotate along the direction of the brushstroke. The basic shapes are set to be sparsely distributed within a unit distance in the diagram; the actual distribution of the basic shapes might be as follows. Figure 7b , 7c The distribution shown is as follows.
[0110] Assuming that the basic shape of brush br11 is not rotated along the stroke path (e.g., rotation angle is 0), and the basic shape of brush br12 is rotated along the stroke path (e.g., rotation angle is within the angle range ar1), if you need to filter brushes similar to brush br11 from the brush library, the parameter setting for the "rotation" sub-item of the filtered brushes indicates that they are not rotated along the stroke path. If you need to filter brushes similar to brush br12 from the brush library, the parameter setting for the "rotation" sub-item of the filtered brushes indicates that they are rotated along the stroke path, with the rotation angle being the same as the rotation angle of brush br12, or the difference being within a preset range. The preset range can be set according to actual needs.
[0111] like Figure 7e As shown, it is also possible to determine whether the basic shape of a single point of a brush is randomly flipped based on the drawing lines of a brush extracted from a painting. Figure 7e This illustrates the cases where the characters are randomly flipped along the direction of the handwriting trajectory and the cases where they are not randomly flipped along the direction of the handwriting trajectory. For ease of understanding... Figure 7e The image clearly illustrates whether the basic shapes of individual brush points are randomly flipped along the direction of the brush stroke. The basic shapes of individual brush points are set to be sparsely distributed within a unit distance in the image; the actual distribution of these basic shapes might be as follows: Figure 7b , 7c The distribution shown is as follows.
[0112] Suppose that the basic shape of a single point of a brush in a painting is randomly flipped along the direction of the brushstroke. If it is necessary to select brushes similar to this brush from the brush library, the parameter setting of the selected brush's sub-item "Flip Random" indicates that it is randomly flipped along the direction of the brushstroke.
[0113] like Figure 7f As shown, it is also possible to obtain whether the basic shape of a single point of a brush is discretely distributed on both sides of the brushstroke trajectory based on the drawing lines of a certain brush extracted from the painting artwork, and if so, the specific degree of discrete distribution. The degree of discrete distribution can be a specific distribution degree value or a distribution degree interval value. Figure 7f This illustrates the cases where the basic shape of a single point is discretely distributed on both sides of the stroke trajectory along the stroke trajectory direction, and the cases where the basic shape of a single point is not discretely distributed on both sides of the stroke trajectory along the stroke trajectory direction. To facilitate... Figure 7f The diagram clearly illustrates whether the basic shapes of individual brush points are discretely distributed on both sides of the brushstroke path. The diagram shows a sparse distribution of these basic shapes within a unit distance; the actual distribution of these basic shapes might be as follows: Figure 7b , 7c The distribution shown is as follows.
[0114] Assuming that the basic shape of brush br11 is not discretely distributed along the stroke trajectory, if we need to select brushes similar to brush br11 from the brush library, the parameter setting of the "Dispersion" sub-item of the selected brushes should indicate that they are not discretely distributed along the stroke trajectory. Assuming that the basic shape of brush br12 is discretely distributed along the stroke trajectory, if we need to select brushes similar to brush br12 from the brush library, the parameter setting of the "Dispersion" sub-item of the selected brushes should indicate that they are discretely distributed along the stroke trajectory, and the degree of dispersion is the same as that of brush br12, or the difference is within a preset range. The preset range can be set according to actual needs.
[0115] For texture features, stroke trajectory features, line thickness features, color blending features, and color depth features, the comparison or creation method for line edge contour features can be similarly referenced. Parameters for corresponding sub-items can be compared or created based on the texture features of the painted lines, the line thickness features, the color blending features, and the color depth features. If a brush extracted from a painting lacks a certain dimension feature, such as color blending, then when creating brushes similar to that brush, the parameter creation for the color blending feature's corresponding sub-item can be omitted. Alternatively, during brush selection, it can be compared with brushes in the brush library whose color blending feature's corresponding parameter sub-item parameter is empty.
[0116] like Figure 8 As shown, assuming three drawing lines L1 to L3 of brush br11 are extracted from a painting, the texture map I13 of brush br11 can be obtained based on the drawing lines L1 to L3. Based on the texture map I13, the texture effect and texture change information of brush br11 can be analyzed. The texture effect of brush br11 can be compared with the corresponding parameter sub-items to select brushes with similar texture effects from the brush library, or the parameters of the parameter sub-items can be set to create brushes with similar texture effects to brush br11. Similarly, the texture change information of brush br11 can be compared with the corresponding parameter sub-items to select brushes with similar texture changes from the brush library, or the parameters of the parameter sub-items can be set to create brushes with similar texture changes to brush br11.
[0117] Reference Figure 9As shown, one embodiment of this application provides a brush recommendation method applied to an electronic device 10. The electronic device 10 may have a drawing app installed. The drawing app may be a drawing app pre-installed at the factory, or a third-party drawing app downloaded from the network or obtained from other electronic devices by the user during use of the electronic device 10. The brush recommendation method may include:
[0118] S11, in response to the recognition operation of the painting, obtains the first brush used to create the painting.
[0119] In some embodiments, the artwork can be an electronic artwork, such as one created by an artist using drawing software, or a physical artwork, such as an electronic image of an artwork created by an artist using drawing tools such as pens, brushes, and knives, and powdered materials such as paints, inks, and pigments on a two-dimensional surface such as paper, textiles, wood panels, or walls. The artwork recognition operation can be triggered by the user; for example, the electronic device 10 can respond to a user's operation to recognize the artwork and obtain one or more brushes used to create it. For example, a drawing app may have a scan function; the app can respond to a user's operation to activate the scan function and perform image recognition on the artwork; alternatively, it can upload an artwork and invoke the recognition function to recognize the uploaded artwork.
[0120] Electronic device 10 can store a pre-trained brush recognition model, which is used to acquire one or more brushes used in creating a painting. The first brush can refer to a specific brush used in creating the painting. For example, the brush recognition model can be integrated into a painting app as a plugin.
[0121] S12, extract the brush features of the first brush, the brush features corresponding to at least one parameter sub-item used in the painting application to set brush parameters.
[0122] In some embodiments, a brush can be characterized by one or more brush features. For example, a brush can be characterized by the following six brush features: line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features. In other embodiments, a brush may also include only one or more of the above six brush features.
[0123] Each brush feature can correspond to one or more parameter sub-items used for brush parameter settings in a painting app. The parameter sub-items corresponding to each brush feature can be set according to actual needs. This application does not limit this. Six brush features are used to characterize the more important parameter sub-items for brush parameter settings in the painting app. This makes it easier to select brushes with brush feature similarity greater than a preset value from the brush library based on the extracted brush features, or to create brushes with brush feature similarity greater than a preset value to the brushes used in the painting.
[0124] Each brush feature can include one or more feature information. The feature information included in each brush feature can be set according to actual needs, and this application does not limit this. For example, line edge contour features can include contour shape information, contour randomness information, information on the appearance of white streaks in the middle of the contour, contour density information, contour roughness / smoothness information, contour clarity / blurriness information, etc. Texture features can include texture effect information, texture randomness information, etc. Handwriting trajectory features can include whether the lines are continuous and whether there are random handwriting gaps (random breakpoints in the lines). If there are no handwriting gaps, the handwriting is considered continuous. Line thickness features can include line thickness ranges, such as identifying the thickest and thinnest values of the lines and obtaining the line thickness range based on the thickest and thinnest values. Color blending features can include the wet blending effect of different colored brushes at the boundary of handwriting. Specifically, the color blending degree can be obtained by magnifying the image at the boundary of handwriting and obtaining the difference in hue, brightness, and saturation between adjacent pixels. Color depth features can include color depth ranges. By obtaining the darkest and lightest color values of the line, the color depth range can be obtained based on the darkest and lightest color values.
[0125] In some embodiments, brush features can be extracted using pre-trained feature recognizers, with one feature recognizer used to extract one type of brush feature. If the brush includes line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features, brush features can be extracted using six feature recognizers respectively. For example, the first feature recognizer is used to extract edge contour features, the second feature recognizer is used to extract texture features, the third feature recognizer is used to extract stroke trajectory features, the fourth feature recognizer is used to extract line thickness features, the fifth feature recognizer is used to extract color blending features, and the sixth feature recognizer is used to extract color depth features. After the brush of the painting is extracted using the pre-trained brush recognition model, the brush can be input into the first to sixth feature recognizers respectively to extract line edge contour features, texture features, stroke trajectory features, line thickness features, color blending features, and color depth features.
[0126] S13, compare the brush features of the first brush with each brush in the brush library.
[0127] In some embodiments, the brush features of the first brush can be compared with the parameters of the target parameter sub-items of each brush in the brush library. The target parameter sub-items are the parameter sub-items corresponding to the brush features of the first brush. This allows the calculation of the similarity between the first brush and each brush in the brush library, which facilitates the subsequent selection of recommended brushes based on the similarity with each brush in the brush library, or the creation of new brushes in the brush library.
[0128] In some embodiments, based on each brush feature of the first brush and the parameters of the target parameter sub-item of each brush in the brush library, the feature similarity between each brush feature of the first brush and each brush in the brush library can be calculated. Then, based on multiple feature similarities between the first brush and any brush in the brush library and the corresponding weight coefficients, the similarity between the first brush and any brush in the brush library can be calculated. In this way, the similarity between the first brush and the brushes in the brush library can be calculated, and subsequently, brush recommendations can be made based on the similarity with each brush in the brush library, or new brushes can be created in the brush library.
[0129] In some embodiments, taking the brush parameter sub-items corresponding to the line edge contour dimension as an example, including single-point basic shape, spacing, rotation, scattering, etc., after recognizing the painting lines drawn using the first brush in the painting, the single-point basic shape of the first brush can be synthesized based on the edge contour features of the painting lines. The single-point basic shape of the first brush is compared with the single-point basic shape of each brush in the brush library to obtain the comparison result of the single-point basic shape of the first brush with the single-point basic shape of each brush in the brush library. The more painting lines of the brushes extracted, the more edge contour features can be collected, and the closer the single-point basic shape of the synthesized brush is to the single-point basic shape of the original brush in the painting. After identifying the painting lines drawn using the first brush in the artwork, the density, rotation, and discrete distribution information of the single-point basic shape of the first brush can be extracted from the painting lines. Furthermore, the density, rotation, and discrete distribution information of the single-point basic shape of the first brush are compared with the density, rotation, and discrete distribution information of each brush in the brush library to obtain the comparison results of the density, rotation, and discrete distribution information of the first brush with each brush in the brush library.
[0130] S14. Based on the comparison results, recommend a second brush from the brush library that corresponds to the first brush, or create a third brush from the brush library that corresponds to the first brush based on the comparison results.
[0131] In some embodiments, if the brush library contains a brush with a similarity greater than a preset value to the first brush, the brush with the highest similarity to the first brush can be selected from one or more brushes with a similarity greater than the preset value and recommended as the second brush. This allows users to accurately learn or imitate related artworks based on the recommended second brush. If the brush library does not contain a brush with a similarity greater than the preset value to the first brush, it indicates that the current brush library does not contain a brush that is similar to the first brush. In this case, a third brush corresponding to the first brush can be created in the brush library based on the brush features of the first brush. This allows users to accurately learn or imitate related artworks based on the created third brush. For example, the parameters of a certain brush in the brush library can be adjusted based on the brush features of the first brush to obtain a third brush corresponding to the first brush.
[0132] In some embodiments, when creating a brush, the brush with the highest similarity to the first brush can be selected from the brush library as the brush to be adjusted. By adjusting the parameters of the target parameter sub-item of the brush to be adjusted, where the target parameter sub-item is the parameter sub-item corresponding to the brush features of the first brush, a third brush corresponding to the first brush can be quickly obtained, improving the efficiency of brush creation. Alternatively, a copy of the brush to be adjusted can be created, and the parameters of the target parameter sub-item of the brush copy can be adjusted so that the brush library retains the brush to be adjusted.
[0133] The electronic device 10 provided in this application embodiment has an internal memory 121 for storing instructions, and a processor 110 for calling the instructions in the internal memory 121, causing the electronic device 10 to execute the aforementioned method steps to implement the brush recommendation method in the above embodiment. The internal memory 121 may also store a state freeze module 101, a metadata writing module 102, and a data writing module 103, which are executed by the processor 110 to implement the function of the brush recommendation device 100.
[0134] This application embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on the electronic device 10, the electronic device 10 performs the above-mentioned related method steps to implement the brush recommendation method in the above embodiment.
[0135] This application also provides a computer program product that, when run on an electronic device, causes the electronic device to perform the aforementioned steps to implement the brush recommendation method described in the above embodiments.
[0136] In addition, this application also provides an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the brush recommendation method in the above method embodiments.
[0137] In this application, the computer storage medium, computer program product, or chip provided in the embodiments are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0138] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0139] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are illustrative. For instance, the division of modules or units is a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0140] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0141] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0142] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0143] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. A brush recommendation method, characterized in that, include: In response to the recognition operation of the painting, the first brush used to create the painting is obtained; Extract the brush features of the first brush, the brush features corresponding to at least one parameter sub-item used to set brush parameters in a painting application; The brush features of the first brush are compared with each brush in the brush library of the painting application; Based on the comparison results, a second brush corresponding to the first brush in the brush library can be recommended, or a third brush corresponding to the first brush can be created in the brush library based on the comparison results. The brush features include line edge contour features, and the parameter sub-item corresponding to the line edge contour features includes a first parameter sub-item. Extracting the brush features of the first brush includes: Extract the painting lines corresponding to the first brush from the painting artwork; Extract the edge contour features of each drawing line, and synthesize the single-point basic shape of the first brush based on the edge contour features of each drawing line; The step of comparing the brush features of the first brush with each brush in the brush library includes: The basic shape of the first point of the brush is compared with the parameters of the first parameter sub-item of each brush in the brush library.
2. The brush recommendation method as described in claim 1, characterized in that, The first brush includes multiple brush features, and obtaining the first brush used to draw the painting includes: The first brush used to create the painting is obtained based on a pre-trained brush recognition model. The extraction of brush features from the first brush includes: The first brush is input into multiple pre-trained feature recognizers to extract multiple brush features of the first brush. Each feature recognizer is used to extract one type of brush feature.
3. The brush recommendation method as described in claim 1, characterized in that, The step of comparing the brush features of the first brush with each brush in the brush library of the painting application includes: Based on the brush features of the first brush and the parameters of the target parameter sub-items of each brush in the brush library of the painting application, the similarity between the first brush and each brush in the brush library of the painting application is calculated, wherein the target parameter sub-items are the parameter sub-items corresponding to the brush features of the first brush.
4. The brush recommendation method as described in claim 3, characterized in that, The step of recommending a second brush from the brush library corresponding to the first brush based on the comparison results includes: If the brush library contains a brush with a similarity greater than a preset value to the first brush, the brush with the highest similarity to the first brush in the brush library will be recommended as the second brush.
5. The brush recommendation method as described in claim 4, characterized in that, The step of creating a third brush corresponding to the first brush in the brush library based on the comparison result includes: If the brush library does not contain a brush with a similarity greater than the preset value to the first brush, a third brush corresponding to the first brush is created in the brush library based on the brush features of the first brush.
6. The brush recommendation method as described in claim 5, characterized in that, The step of creating a third brush corresponding to the first brush in the brush library based on the brush features of the first brush includes: Select the brush with the highest similarity to the first brush from the brush library as the brush to be adjusted; The parameters of the target parameter sub-item of the brush to be adjusted are adjusted based on the brush features of the first brush to obtain the third brush.
7. The brush recommendation method as described in claim 5, characterized in that, The step of creating a third brush corresponding to the first brush in the brush library based on the brush features of the first brush includes: Create a corresponding brush copy based on the brush in the brush library that has the highest similarity to the first brush; The parameters of the target parameter sub-item of the brush copy are adjusted based on the brush features of the first brush to obtain the third brush.
8. The brush recommendation method as described in claim 3, characterized in that, The step of calculating the similarity between the first brush and each brush in the brush library of the painting application, based on the brush features of the first brush and the parameters of the target parameter sub-items of each brush in the brush library, includes: If the first brush includes multiple brush features, the feature similarity between each brush feature and each brush in the brush library is calculated based on each brush feature of the first brush and the parameters of the target parameter sub-item of each brush in the brush library. Based on the feature similarity of each brush feature and its corresponding weight coefficient, the similarity between the first brush and each brush in the brush library is calculated, where each brush feature corresponds to a weight coefficient.
9. The brush recommendation method as described in any one of claims 1 to 8, characterized in that, The brush features also include one or more of the following: texture features, stroke trajectory features, line thickness features, color blending features, and color depth features.
10. The brush recommendation method as described in claim 1, characterized in that, The parameter sub-item corresponding to the line edge contour feature further includes multiple second parameter sub-items, and the extraction of the brush feature of the first brush further includes: Extract the density, rotation, and discrete distribution information of the single-point basic shape of the first brush from the drawing lines corresponding to the first brush. The density, rotation, and discrete distribution information of the single-point basic shape correspond to a second parameter item. The step of comparing the brush features of the first brush with each brush in the brush library includes: The density, rotation, and discrete distribution information of the single-point basic shape of the first brush are compared with the parameters of the second parameter sub-item of each brush in the brush library.
11. The brush recommendation method as described in any one of claims 1 to 8, characterized in that, The artworks mentioned include digital artworks or digital images of physical artworks.
12. A computer-readable storage medium, characterized in that, Includes computer instructions that, when executed on a processor, cause an electronic device to perform the brush recommendation method as described in any one of claims 1 to 11.
13. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store instructions, and the processor being used to invoke the instructions in the memory, causing the electronic device to execute the brush recommendation method according to any one of claims 1 to 11.
14. A computer program product, characterized in that, Includes computer instructions that, when executed on a processor, cause an electronic device to perform the brush recommendation method as described in any one of claims 1 to 11.