Image processing method and device
By receiving user's painting style and material type information, determining the corresponding texture image and rendering, the problem of difficult to achieve realistic texture effects in painting works in the prior art is solved, and a more realistic painting effect is achieved.
Patent Information
- Application Number
- CN202411755974.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-03
- Publication Date
- 2025-04-29
AI Technical Summary
Existing image processing applications have difficulty achieving realistic texture effects in painting works, especially when simulating painting styles such as watercolor, ink and oil painting.
By receiving information about the user's painting style and material type, determine the corresponding texture image, and render the image in texture, combining the user's painting operations to render the texture effect in real time.
The texture effect processing of images is realized, which improves the authenticity of painting effects, so that paintings produced through image processing applications have more realistic material textures.
Smart Images

Figure CN119904538A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202410405293.5, and the original application date is April 3, 2024. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of image processing technology, and in particular to an image processing method and device. Background Art
[0003] Image processing applications are widely used in business (such as graphic advertising), art creation (such as illustration design), and personal entertainment. As users' requirements for painting styles and painting effects become higher and higher, the requirements for image processing functions of image processing applications are also getting higher and higher.
[0004] Currently, in a scenario where a user uses an electronic device (such as a tablet computer, a personal computer, etc.) to paint, an image processing application program overlays and mixes the pictures painted by the user on different layers with the background color to achieve the final painting effect.
[0005] The painting effects of watercolor, ink and oil painting are closely related to the texture of the painting material. How to make the paintings produced by image processing applications have realistic painting effects is a problem that needs to be solved. Summary of the invention
[0006] The embodiments of the present application provide an image processing method and device for implementing texture effect processing on an image, thereby improving the realism of a painting effect.
[0007] The embodiments of the present application can be applied to electronic devices. The electronic devices can be terminal devices, such as portable terminal devices (e.g., mobile phones, tablet computers, laptop computers, personal computers, ultra-mobile personal computers (UMPCs), netbooks, etc.), wearable devices (e.g., watches, etc.), vehicle-mounted terminal devices, augmented reality (AR) / virtual reality (VR) devices, personal digital assistants (PDAs), smart home devices (e.g., smart TVs, etc.), etc.
[0008] In a first aspect, an image processing method is provided, which is applied to an electronic device, and the method includes: receiving first information, the first information indicating a painting style and / or a material type of a painting carrier; determining one or more corresponding texture images based on the first information, wherein the one or more texture images are obtained based on a texture of a same painting carrier, and the one or more texture images are used to present the texture of the same painting carrier; performing texture rendering on the first image according to the one or more texture images to obtain a second image; and displaying the second image, or sending the second image to a terminal device connected to the electronic device.
[0009] In the above implementation, multiple texture images can be obtained based on the texture of the same painting carrier to present the characteristics of the texture from different aspects or angles. In this way, by making different combinations of the multiple texture images for texture rendering of the image, images with different painting effects can be obtained. Based on the above principle, a correspondence between the painting style and the texture image can be established in advance, so that the user's image can be texture rendered using the corresponding texture image according to the painting style selected by the user, so that an image of the corresponding painting style can be obtained, thereby improving the authenticity of the painting effect.
[0010] In a possible implementation, the receiving of the first information includes: receiving a first user operation, obtaining the first information according to the first user operation, the first user operation being used to request texture rendering of a currently drawn image according to the first information during image drawing; or, receiving a second user operation, obtaining the first information according to the second user operation, the second user operation being used to request texture rendering of the first image according to the first information, the first image being an image to be edited; or, receiving a third user operation, obtaining the first information according to the third user operation, the third user operation being used to pause image drawing and request texture rendering of the currently paused image according to the first information.
[0011] In one possible implementation, the receiving a first user operation and obtaining the first information based on the first user operation includes: receiving a user operation that triggers a function option for creating a painting, or receiving a user operation that triggers a function option for setting a texture; in response to the received user operation, displaying option information of a painting style and / or a material type of a painting carrier; and obtaining the first information based on the received user operation for selecting the option information.
[0012] In one possible implementation, the receiving a second user operation and obtaining the first information according to the second user operation includes: receiving a user operation that triggers a function option for editing the first image; displaying option information of a painting style and / or a material type of a painting carrier in response to the received user operation; and obtaining the first information according to the received user operation for selecting the option information.
[0013] In a possible implementation, receiving a third user operation and obtaining the first information according to the third user operation includes: receiving a user operation for triggering a function option for previewing a current image; in response to the received user operation, pausing response to a user operation for drawing the current image, and displaying option information of a painting style and / or a material type of a painting carrier; and obtaining the first information according to the received user operation for selecting the option information.
[0014] In a possible implementation, after texture rendering is performed on the currently suspended image, the method further includes: receiving a fourth user operation, wherein the fourth user operation is used to cancel texture rendering of the texture-rendered image and resume image drawing.
[0015] A possible implementation method also includes: receiving a fifth user operation, obtaining texture feature information set by the user according to the fifth user operation, and the texture feature information indicating the texture granularity density and / or the texture granularity size; if the texture feature information set by the user is not equal to the texture feature information of the one or more texture images corresponding to the first information, adjusting the size of the one or more texture images corresponding to the first information according to the texture feature information set by the user.
[0016] Through the above implementation, the texture image can be adaptively adjusted according to the texture feature information set by the user, so that the texture feature information of the texture image meets the user's requirements, so that the image after texture rendering based on the texture image can obtain the visual effect required by the user.
[0017] In a possible implementation, receiving a fifth user operation and obtaining texture feature information set by a user based on the fifth user operation includes: receiving a user operation acting on a slider on a slider control; and determining the texture feature information set by the user based on a position of the slider on the slider control.
[0018] In one possible implementation, different texture images obtained based on the texture of the same painting carrier are used to present different texture features of the same painting carrier, and the texture features include one or more of texture shape, texture size, texture depth, dark contour features, bright contour features, light color contour features, and effects presented based on pigment adsorption capacity.
[0019] In a possible implementation manner, different texture images obtained based on the texture of the same painting carrier are obtained by mixing an image based on the texture of the same painting carrier and a background image.
[0020] In a possible implementation, the texture image of the same painting carrier and the background image are mixed based on one of the following blending modes: dark mode, screen mode, light mode, color darkening blending mode, and multiply blending mode.
[0021] In one possible implementation, the one or more texture images include one or more of the following: a texture layer image, used to present the texture shape, texture size and texture depth under diffuse light conditions; a gloss layer image, used to present the texture outline under light conditions in a specific direction, wherein the dark outline of the texture outline is eliminated and the bright outline of the texture outline is highlighted; a gloss absorption layer image, used to present the texture outline under light conditions in a specific direction, wherein the dark part of the texture outline is eliminated and the light part of the texture outline is highlighted; a color deposition layer image, used to present an effect based on the adsorption capacity of the pigment; and a shadow layer image, used to present the texture outline under light conditions in a specific direction, wherein the bright outline of the texture outline is eliminated and the dark outline of the texture outline is highlighted.
[0022] In a possible implementation, the texture layer image is obtained by performing a first blending mode on the third image and the background image; or, the gloss layer image is obtained by performing a second blending mode on the fourth image and the background image; or, the gloss absorption layer image is obtained by performing a third blending mode on the fourth image and the background image; or, the color deposition layer image is obtained by performing a fourth blending mode on the fifth image and the background image; or, the shadow layer image is obtained by performing a fifth blending mode on the fourth image and the background image; wherein the third image is an image of the texture of the same painting carrier under diffuse light conditions, the fourth image is an image of the texture of the same painting carrier under light conditions in a specific direction, and the fifth image is an image of the texture of the same painting carrier after being dyed.
[0023] In a possible implementation, the first blending mode is a dark color mode, or the second blending mode is a color filter mode, or the third blending mode is a light color mode, or the fourth blending mode is a color darkening blending mode, or the fifth blending mode is a multiply blending mode.
[0024] In a possible implementation, determining the corresponding one or more texture images based on the first information includes: determining one or more texture images corresponding to the painting style based on the painting style indicated by the first information and a first correspondence relationship; or, determining all texture images corresponding to the material type based on the material type indicated by the first information and a second correspondence relationship; or, determining one or more texture images corresponding to the painting style and the material type based on the painting style indicated by the first information and the material type and a third correspondence relationship; wherein the first correspondence relationship includes a correspondence between a painting style type and a texture image, the second correspondence relationship includes a correspondence between a material type and a texture image, and the third correspondence relationship includes a correspondence between a painting style type and a material type and a texture image.
[0025] In a possible implementation, the first information also indicates texture feature information, and the texture feature information indicates texture granularity density and / or texture granularity size; determining the corresponding one or more texture images based on the first information includes: based on the first information, determining one or more texture images that match the texture feature information from one or more texture images corresponding to the painting style and / or the material type.
[0026] In a possible implementation, before texture rendering the first image according to the one or more texture images, it also includes: if the size of the one or more texture images is smaller than the size of the first image, performing the following processing operation for each of the one or more texture images: copying the texture image, splicing the multiple copied texture images, and cropping the spliced texture image to be equal to the size of the first image; or, if the size of the one or more texture images is larger than the size of the first image, performing the following processing operation for each of the one or more texture images: cropping the texture image to be equal to the size of the first image.
[0027] In one possible implementation, texture rendering of the first image according to the one or more texture images to obtain the second image includes: processing the values of pixels at the same position in the one or more texture images and the first image according to a set blending mode to obtain the values of pixels at the same position in the second image.
[0028] In a possible implementation manner, the blending mode is associated with a painting style indicated by the first information, or the blending mode is associated with a material type indicated by the first information.
[0029] Optionally, the blending mode includes one of the following: darkening mode (Darken), multiply (Multiply), color burn mode (Color Burn), linear burn mode (Linear Burn), darker color mode (Darker Color), add mode (Add), lighten mode (Lighten), screen mode (Screen), color dodge mode (Color Dodge), linear dodge mode (Linear Dodge), lighter color mode (Lighter Color), overlay mode (Overlay), soft light mode (Soft Light), hard light mode (Hard Light), bright light mode (Vivid Light), linear light mode (LinearLight), pin light mode (Pin Light), hard mix mode (Hard Mix), difference mode (Difference), exclusion mode (Exclusion), subtract mode (Subtract), and divide mode (Divide).
[0030] In a possible implementation, the first information also indicates texture feature information, and the texture feature information indicates texture granularity density and / or texture granularity size; the method further includes: determining brush parameters corresponding to the texture feature information based on the texture feature information indicated by the first information and a fourth correspondence; wherein the fourth correspondence includes a correspondence between the texture feature information and the brush parameters; and setting the brush based on the brush parameters.
[0031] In a possible implementation, the brush parameters include one or more of a brush shape and a brush material, and the particle fineness of the brush material is associated with the texture particle fineness corresponding to the texture feature information indicated by the first information.
[0032] In a possible implementation, the painting style includes one or more of ink painting style, watercolor painting style, oil painting style, and printmaking style.
[0033] In a possible implementation, the material type of the painting carrier includes one or more of paper, canvas, and drawing board.
[0034] According to a second aspect, a device is provided, comprising a unit or a module for executing the method as described in any one of the first aspects.
[0035] According to a third aspect, a device is provided, comprising: one or more processors, wherein the one or more processors are configured to execute the method as described in any one of the first aspects.
[0036] According to a fourth aspect, a readable storage medium is provided, wherein the readable storage medium includes a program, and when the program is executed on a device, the device executes any method described in the first aspect.
[0037] In a fifth aspect, a chip system is provided, comprising: the chip system comprises at least one chip and a memory, the at least one chip is used to read and execute a program stored in the memory to implement a method as described in any one of the first aspects.
[0038] According to a sixth aspect, a computer program product is provided, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method as described in any one of the first aspects is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1a , Figure 1b and Figure 1c They are schematic diagrams of an application scenario of an embodiment of the present application;
[0040] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0042] Figure 4 is a schematic diagram of a texture image in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of the principle of the image processing method provided in the embodiment of the present application;
[0044] Figure 6 A schematic diagram of the system architecture of an image processing application provided in an embodiment of the present application;
[0045] Figure 7 A flowchart of an image processing method provided in an embodiment of the present application;
[0046] Figure 8 A schematic diagram of an image processing application program interface provided in an embodiment of the present application;
[0047] Fig. 9 A flowchart of another image processing method provided in an embodiment of the present application;
[0048] Fig.10 A schematic diagram of another image processing process provided in an embodiment of the present application;
[0049] Fig.11This is a comparison chart of the image before and after texture rendering in the embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0051] In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0052] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0053] The image processing method provided in the embodiment of the present application can be applied to the scene where the electronic device is used for drawing or editing the image. Figure 1a , Figure 1b and Figure 1c An application scenario of an embodiment of the present application is described.
[0054] See also Figure 1a , which is a schematic diagram of an application scenario provided in an embodiment of the present application. The electronic device 100 has a display screen and a sensor with a touch function or a pressure sensing function, which can respond to the user's touch operation or the touch operation of an electronic stylus (or electronic painting pen). An image processing application is installed on the electronic device 100, and the image processing application has the image processing function provided in an embodiment of the present application. After the user opens the image processing application on the electronic device 100, the user can use an electronic painting pen or a finger to paint on the user interface of the image processing application to obtain a painting with a material texture effect. The user can also edit the painting to obtain an image with a material texture effect.
[0055] See also Figure 1b, which is a schematic diagram of another application scenario provided by an embodiment of the present application. The electronic device 100 has a display screen, and the electronic device 100 is connected to an electronic handwriting board (or electronic drawing board) via a wired or wireless method. After the user starts the image processing application, he can use an electronic handwriting pen to draw on the electronic handwriting board, and the corresponding picture will be displayed on the display screen of the electronic device 100, thereby obtaining a painting with a material texture effect.
[0056] In another possible scenario, the electronic device 100 (such as a personal computer or a laptop) is connected to a mouse via a wired or wireless method. After the user starts the image processing application, he can use the mouse to draw, and the corresponding picture will be displayed on the display screen of the electronic device 100, thereby obtaining a painting with a material texture effect.
[0057] See also Figure 1c , which is a schematic diagram of another application scenario provided by an embodiment of the present application. The electronic device 100 can be connected to multiple terminal devices. Multiple users can create the same painting or edit the same painting on the multiple terminal devices (such as terminal devices 200a, 200b and 200c in the figure), respectively. The electronic device 100 can respond to the user's operation on these terminal devices, perform corresponding image processing operations, and send the processed image data to these terminal devices, so that the processed pictures can be displayed synchronously on these terminal devices, thereby realizing distributed image processing. Among them, the electronic device 100 can use the method provided in the embodiment of the present application to generate an image with a material texture effect.
[0058] Optionally, the Figure 1c The terminal devices may be portable terminal devices (such as mobile phones, tablet computers, laptops, personal computers (PCs), UMPCs, netbooks, etc.), wearable devices (such as watches, etc.), vehicle-mounted terminal devices, AR / VR devices, PDAs, smart home devices (such as smart TVs, etc.), etc.
[0059] Optional, in Figure 1c In the illustrated scenario, the electronic device 100 and the terminal devices (eg, the terminal devices 200a, 200b, and 200c in the figure) may be connected via a network 300. Optionally, the network 300 may be a local area network or the Internet, which is not limited in the present application.
[0060] The above are only some possible application scenarios and are not limited in this application.
[0061] In some embodiments of the present application, the electronic device 100 may be a terminal device, such as a portable terminal device (e.g., a mobile phone, a tablet computer, a laptop computer, a personal computer, a UMPC, a netbook, etc.), a wearable device (e.g., a watch, etc.), a vehicle-mounted terminal device, an AR / VR device, a PDA, a smart home device (e.g., a smart TV, etc.), etc.
[0062] Among them, exemplary embodiments of the terminal device include but are not limited to Harmony Or terminal devices of other operating systems.
[0063] See below Figure 2 , the hardware structure of the electronic device to which the method provided in the embodiments of the present application is applicable is introduced.
[0064] like Figure 2 As shown in , the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identity module (SIM) interface 195, etc.
[0065] The sensor module 180 may include a gyroscope sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.
[0066] Understandably, Figure 2 The electronic device 100 shown is merely an example and does not constitute a limitation on the electronic device, and the electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have a different component configuration. Figure 2 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0067] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0068] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0069] The execution of the image processing method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in a third-party device through the external memory interface 120, to control the wireless communication module 160 to communicate data with other devices, improve the intelligence and convenience of the electronic device 100, and enhance the user experience. The processor 110 may include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the image processing method provided in the embodiment of the present application. For example, part of the algorithm in the image processing method is executed by the CPU, and another part of the algorithm (for example, an algorithm for processing an image into a material texture effect) is executed by the GPU to obtain faster processing efficiency.
[0070] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1. The display screen 194 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUIs). For example, the display screen 194 can display photos, videos, web pages, or files.
[0071] In the embodiment of the present application, the display screen 194 may be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
[0072] The camera 193 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 193 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal.
[0073] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store the code of the operating system, application program (such as the function corresponding to the present application scheme, etc.). The data storage area can store data created during the use of the electronic device 100, etc.
[0074] The internal memory 121 may also store one or more computer programs corresponding to the algorithm of the present application. The one or more computer programs are stored in the internal memory 121 and configured to be executed by one or more processors 110. The one or more computer programs include instructions, which may be used to execute the various steps in the following embodiments.
[0075] In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0076] Of course, the code of the algorithm of the embodiment of the present application can also be stored in an external memory. In this case, the processor 110 can run the code of the algorithm of the embodiment of the present application stored in the external memory through the external memory interface 120.
[0077] The touch sensor is also called a "touch panel". The touch sensor can be arranged on the display screen 194, and the touch sensor and the display screen 194 form a touch display screen, also called a "touch screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0078] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0079] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0080] The mobile communication module 150 can provide solutions for wireless communication including the second generation (2G) / the 3G / the 4G / the 5G / the 6G) applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110. In the embodiment of the present application, the mobile communication module 150 can also be used to exchange information with other devices.
[0081] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0082] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In the embodiment of the present application, the wireless communication module 160 can be used to establish a connection with other electronic devices and exchange data. Or the wireless communication module 160 can be used to access the access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.
[0083] In addition, the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc. The electronic device 100 can receive input from the key 190 and generate key signal input related to the user settings and function control of the electronic device 100. The electronic device 100 can use the motor 191 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 192 in the electronic device 100 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 in the electronic device 100 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195, to achieve contact and separation with the electronic device 100.
[0084] It should be understood that in practical applications, the electronic device 100 may include Figure 2The embodiments of the present application are not limited to the more or fewer components shown. The illustrated electronic device 100 is only an example, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0085] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. For example, Figure 3 As shown, the software architecture can be divided into four layers, from top to bottom, namely the application layer, the application framework layer (framework, FWK), the runtime and system library, and the (Linux) kernel layer.
[0086] The application layer is the top layer of the operating system, including native applications of the operating system, such as camera, gallery, calendar, Bluetooth, music, video, information, etc., and may also include third-party applications. The application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can implement one or more specific functions. Typically, multiple applications can be installed in an electronic device, such as a camera application, a mailbox application, etc. The application mentioned below may be a system application installed when the electronic device leaves the factory, or it may be a third-party application downloaded from the Internet or obtained from other electronic devices by the user while using the electronic device.
[0087] Of course, for developers, developers can write applications and install them in this layer. In a possible implementation, applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can interact with the bottom layer of the operating system (such as the kernel layer) through the application framework to develop their own applications.
[0088] The application framework layer is the API and programming framework of the application layer. The application framework layer may include some predefined functions. The application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
[0089] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the display screen (or screen), capture the display screen, etc.
[0090] Content providers are used to store and retrieve data and make these data accessible to applications. The data may include files (such as documents, videos, images, audio), text and other information.
[0091] The view system includes visual controls, such as controls for displaying text, images, documents, etc. The view system can be used to build applications. The interface in the display window can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.
[0092] The phone manager is used to provide communication functions for electronic devices. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction.
[0093] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.
[0094] The core library of the system consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the system. The application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0095] The system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), image processing library, etc. The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications. The media library supports a variety of commonly used audio and video format playback and recording, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0096] The kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack and driver model, which are all implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to electronic devices, the main drivers are: display driver; keyboard driver as input device; Flash driver based on memory technology device; camera driver; audio driver; Bluetooth driver; WiFi driver, etc.
[0097] It should be understood that the functional services described above are only examples, and in actual applications, electronic devices may also be divided into more or fewer functional services according to other factors, or the functions of each service may be divided in other ways, or the functional services may not be divided but work as a whole.
[0098] The image processing method provided in the embodiment of the present application can be applied to Figure 2 or Figure 3 Based on the architecture shown, the image processing method provided in the embodiment of the present application can be used to implement texture rendering of the image and generate an image with material texture effects, thereby improving the realism of the painting effect.
[0099] First, some terms involved in the embodiments of the present application are explained below.
[0100] (1) Painting carrier and material type of painting carrier
[0101] In real scenes, paintings are usually carried on physical media, and the painting carrier is the physical medium used to carry the painting. For example, the painting carrier may include: paper, cloth, board, etc. In general, any physical medium on which painting can be done can be called a painting carrier.
[0102] The material type of the painting carrier refers to the material type of the physical medium that can carry the painting. From a larger classification perspective, the material types of the painting carrier may include: paper, canvas, drawing board, etc. From a more fine-grained classification perspective, the material types of the painting carrier may include: rice paper, watercolor paper, oil painting paper, oil canvas, wooden drawing board, etc. This application does not limit this.
[0103] (2) Texture of the painting medium
[0104] In real scenes, the painting carrier will have texture on its surface due to different material types or production methods. For example, the surface of a wooden painting carrier will show the unique wood grain, and the surface of an oil canvas will show fiber weaving texture. Similarly, paper will also show different textures on its surface due to different materials and production methods. For example, the texture of rice paper is more delicate than that of optimized paper.
[0105] Taking paper as an example, the texture of paper can usually be described as grain, which refers to the natural fiber texture distribution characteristics inside the paper. Texture usually refers to the natural patterns or textures on the surface of paper, which are formed by fibers or other materials during the paper manufacturing process. Grain usually refers to the lines or stripes on the paper, which are usually caused by molds or other processing equipment during paper manufacturing. Therefore, the texture and grain of paper can be used to describe the appearance, texture and quality of paper.
[0106] The texture of paper has the characteristic of random distribution. The texture of paper of different textures is different in one or more aspects such as texture brightness, texture glossiness, texture depth, texture size (such as texture width), texture shape, texture direction, density of texture particles, and fineness of texture particles. The texture brightness, texture glossiness, texture depth, texture size (such as texture width), texture shape, texture direction, density of texture particles, and fineness of texture particles can be called texture features.
[0107] Paper texture may also be called paper pattern or PaperPrint.
[0108] (3) Painting style
[0109] The painting styles in the embodiments of the present application are divided based on the painting effect presented by the painting, or based on the visual effect of the painting. The painting effect presented by the painting is related to the material type of the painting carrier and the texture of the material type. For example, if a painting is created on an oil canvas, the painting can present the texture of the oil canvas, so that the painting presents the visual effect of an oil painting.
[0110] Based on this, in an embodiment of the present application, the painting style may include: one or more of: ink painting style, watercolor painting style, oil painting style, printmaking style, etc.
[0111] It should be understood that in actual scenarios, the painting styles may include more. The embodiments of the present application only exemplarily list several possible painting styles, and the present application does not limit this.
[0112] In some embodiments of the present application, one or more texture images can be obtained in advance, and the texture images can be included in the installation package of the image processing application. When the image processing application is installed on an electronic device, the installation package of the image processing application is run on the electronic device, and the texture images in the installation package are stored in the electronic device. When the electronic device starts the image processing application, the texture images stored in the electronic device can be selected by the user to add texture effects to the painting.
[0113] In some other embodiments of the present application, an image processing application capable of implementing the method provided in the embodiments of the present application may be pre-installed in the electronic device. In this case, the texture image required by the image processing application may be pre-stored in the electronic device.
[0114] Optionally, the texture image in the embodiment of the present application may be a binary image. A binary image means that each pixel on the image has only two possible values or grayscale states, for example, a black and white or monochrome image is commonly used to represent a binary image.
[0115] The storage format of the texture image in the embodiment of the present application may be BMP, JPEG, PNG or TIFF, etc. The present application does not limit the storage format of the texture image.
[0116] The types of texture images involved in the embodiments of the present application are described below.
[0117] In the embodiment of the present application, one or more texture images corresponding to the same painting carrier (eg, the same paper) may be set, and each texture image may be used to present the texture of the painting carrier.
[0118] Optionally, different texture images corresponding to the same painting carrier are used to present different texture features of the painting carrier, and the texture features may include one or more of the following: texture shape, texture size, texture depth, dark contour features, bright contour features, light contour features, effects presented based on pigment adsorption capacity, and other texture features.
[0119] Among them, the effect presented based on the color absorption capacity is related to the depression of the texture. Taking paper as an example, after the paper is soaked with liquid (such as water or liquid pigment), some areas may appear depressed. The depression phenomenon means that after the paper is soaked with liquid, due to differences in texture or material thickness, some areas are more likely to absorb water or water-based pigments than other areas, resulting in higher color deposition (or color depth) in this area than in other areas.
[0120] In a possible implementation, the texture image and the background image of the same painting carrier can be mixed based on one of the following mixing modes: dark mode, filter mode, light mode, color darkening mixing mode, and multiply mixing mode. This application does not limit this.
[0121] It can be seen that multiple texture images can present the texture of the same painting carrier, which can be understood as: presenting the texture of the same painting carrier from multiple different aspects, wherein each texture image can highlight the characteristics of the texture of the painting carrier in one or more aspects, such as some texture images are used to highlight the texture shape, texture size and texture depth, some texture images are used to highlight the dark contour features, some texture images are used to highlight the bright contour features, and some texture images are used to highlight the effects presented based on the pigment adsorption capacity.
[0122] Exemplarily, the texture images corresponding to the same painting carrier may include: one or more of a texture layer image, a gloss layer image, a gloss absorption layer image, a color deposition layer image, and a shadow layer image. These texture images are described below.
[0123] (1) Texture layer image
[0124] The texture layer image is used to present the texture shape, texture size and texture depth characteristics of the texture of the painting carrier.
[0125] The texture features presented by the texture layer image are independent of the direction of light. In other words, the texture layer image can present the texture shape, texture size and texture depth features of the texture under diffuse light conditions (or under light conditions without a specific direction).
[0126] An example of a texture layer image can be found in Figure 4 (a) in .
[0127] (2) Glossy layer image
[0128] The gloss layer image is used to present the texture outline of the painting carrier under the condition of light from a specific direction, and in the presented texture outline, the dark part outline is eliminated and the bright part outline is highlighted. In other words, the gloss layer image can highlight the bright part of the texture outline. The texture features presented by the gloss layer image are related to the direction of light.
[0129] That is to say, the gloss layer image can present the characteristics of the texture of the painting carrier in terms of texture brightness, texture glossiness, texture depth, etc. under the lighting conditions of a specific direction. Using the gloss layer image to render the user image texture can reflect the texture effect in the place where the user paints, and the dark place can show the effect of the user's painting.
[0130] An example of a glossy layer image can be found in Figure 4 (b) in .
[0131] (3) Glossy absorption layer image
[0132] The gloss absorption layer image is used to present the outline of the texture of the painting carrier, and in the presented texture outline, the dark part is eliminated and the light part is highlighted. The texture characteristics presented by the gloss layer image are related to the direction of light.
[0133] Compared with the gloss layer image, the gloss absorption layer image has more bright areas. In other words, the gloss absorption layer image can present the texture brightness, texture gloss, texture depth and other characteristics of the texture of the painting carrier under the lighting conditions of a specific direction. Using the gloss absorption layer to render the user's image texture can present the texture effect where the user paints, and also present the effect of color absorption.
[0134] (4) Color deposition layer image
[0135] The color deposition layer image is used to present the depressions in the texture of the painting carrier, or to present the characteristics of the texture (or also the material) in terms of color deposition, or to present the effect based on the color adsorption capacity.
[0136] Taking paper as an example, when using pigment to paint on paper, if the color deposition degree of the paper is higher, the color deposition effect on the paper is better, and the color presented on the paper is closer to the color of the actual pigment; conversely, if the color deposition degree of the paper is lower, the color deposition effect on the paper is worse, and the color presented on the paper is lighter than the color of the actual pigment.
[0137] For example, for the same paper, different regions of the texture may have different texture characteristics (such as the degree of texture depression, etc.), and further, different regions may have slight differences in paper thickness or material, which will affect the color deposition effect. For example, the greater the degree of texture depression, the more obvious the color deposition effect.
[0138] An example of a color deposition layer image can be found in Figure 4 (c) in .
[0139] (5) Shadow layer image
[0140] The shadow layer image is used to present the outline of the texture of the painting carrier, and in the presented texture outline, the dark part of the outline is highlighted and the bright part of the outline is eliminated. In other words, the shadow layer image can highlight the dark part of the texture outline. The texture features presented by the shadow layer image are related to the direction of light.
[0141] It should be understood that the above only exemplifies several possible types of texture images, and the present application does not limit this. In actual applications, other types of texture images may be used to present other aspects of paper texture features.
[0142] The following uses the above-mentioned types of texture images as an example to illustrate the method of obtaining texture images.
[0143] In one possible implementation, a painting carrier, such as a paper (for example, a piece of white paper), can be photographed under different lighting conditions, and then different image processing is performed on the obtained images to obtain one or more of a texture layer image, a gloss layer image, a gloss absorption layer image, a color deposition layer image, and a shadow layer image corresponding to the painting carrier.
[0144] Optionally, for multiple painting carriers of the same material but different texture features (such as different texture sizes, or different texture depths, or different texture densities), one or more of the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images and shadow layer images corresponding to the different painting carriers can be obtained in the above manner.
[0145] Optionally, for painting carriers of different materials, one or more of the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images corresponding to the painting carriers of different materials can be obtained in the above manner. For example, for a piece of rice paper, photograph it under different light, and process the images obtained by photographing differently to obtain the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image corresponding to the piece of rice paper; for a piece of oil painting paper, photograph it under different light, and process the images obtained by photographing differently to obtain the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image corresponding to the oil painting paper.
[0146] Taking paper as an example, the following describes the methods for obtaining the texture layer image, the gloss layer image, the gloss absorption layer image, the color deposition layer image, and the shadow layer image.
[0147] (1) How to obtain texture layer images
[0148] Under diffuse light conditions, take a picture of the paper. A higher pixel can be used to take pictures to show the inherent texture of the paper fiber. Furthermore, the image obtained by taking pictures can also be processed, such as removing information such as dust spots on the paper. Then, the image obtained by taking pictures and the background image are processed in a first mixing mode to obtain a texture layer image corresponding to the paper. Exemplarily, the first mixing mode can be a darker mode (Darker Color), for example, the image is mixed with the background image in a "dark" color. Optionally, the background image can be an image of a single color. Optionally, the color of the background image is lighter, such as the background image can be a white background image, or an off-white background image. For example, the background image can be a background image of the same size as the captured or processed image, and the values of all pixels in the background image are (255,255,255). The background image can be generated by an electronic device. This application does not limit the background image.
[0149] For example, under cloudy light conditions outdoors (ie, diffuse light conditions), a piece of paper is photographed, and the photographed image is mixed with a white background image in a "dark" manner to obtain a paper texture layer image corresponding to the paper.
[0150] Taking the RGB three-channel image as an example, one implementation of the dark mode may be: for the same pixel position in the paper image (i.e., the image obtained by photographing and processing in the above manner) and the background image of the same size, the sum of the values of the three channels R, G, and B of the pixel at that position in the paper image (referred to as the value of the mixed color B), and the sum of the values of the three channels R, G, and B of the pixel at that position in the background image (referred to as the value of the base color A) are calculated. If the value of the mixed color B is less than the value of the base color A, the value of the pixel at that position in the paper image is used as the pixel value at the same position in the paper texture layer image, or in other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the paper image. If the value of the mixed color B is greater than the value of the base color A, the value of the pixel at that position in the background image is used as the pixel value at the same position in the paper texture layer image, or in other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the background image. If the value of the mixed color B is equal to the value of the base color A, the value of the pixel at that position in the paper image or the background image is used as the pixel value at the same position in the paper texture layer image. In other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the paper image or the background image.
[0151] The value range of R, G, and B channels is 0 to 255. For a pixel, if the value of the R, G, and B channels of the pixel is (0, 0, 0), the pixel is displayed as black, and if the value of the R, G, and B channels of the pixel is (255, 255, 255), the pixel is displayed as white.
[0152] By processing the paper image and the background image in dark mode, the texture in the paper image can be presented in the texture layer image. Since the paper image is photographed under diffuse light conditions, the texture layer image can present the characteristics of the texture shape, texture size and texture depth of the paper texture under diffuse light conditions.
[0153] (2) Method for obtaining gloss layer image
[0154] Under the condition of light from a specific direction, the paper is photographed. A higher pixel can be used to take pictures to show the inherent texture of the paper fibers. Furthermore, the image obtained by taking pictures can be processed, such as removing information such as dust spots on the paper. Then, the image obtained by taking pictures and the background image are processed in a second mixing mode to obtain a glossy layer image corresponding to the paper. Exemplarily, the second mixing mode can be a color filter mode (Screen), for example, the image is mixed with the background image by "color filter". Optionally, the background image is the same as the background image used to obtain the texture layer image. For example, under the condition of light source from a specific direction, the paper is photographed, and the image obtained by taking pictures and the background image are processed by "color filter" to eliminate very dark parts and reflect the outline of the bright part, so as to obtain the glossy layer image corresponding to the paper.
[0155] Optionally, the contrast of the captured image may be increased before the color filter mode processing is performed.
[0156] Taking an RGB three-channel image as an example, one implementation of the color filter mode may be:
[0157] For the same pixel position in the paper image (i.e., the image obtained by photographing and processing in the above manner) and the background image of the same size, the value of each channel of the pixel at the same position in the gloss layer image is calculated according to the following formula:
[0158]
[0159] Among them, C represents the value of one channel of the pixel in the gloss layer image, A represents the value of one channel of the pixel in the background image, and B represents the value of one channel of the pixel in the paper image.
[0160] According to the above method, the three channels of a pixel are calculated respectively to obtain the values of the three channels of the pixel. According to the above method, the value of each pixel in the gloss layer image can be obtained by calculating each pixel, thereby obtaining the gloss layer image.
[0161] By applying the filter mode to the paper image and the background image, the complementary color of the color of the pixel in the paper image and the complementary color of the color of the pixel in the background image can be multiplied, and then divided by 255 to obtain the mixed pixel value. Usually, the color after the filter mode is applied is lighter, such as any color and white are filtered to obtain white. For example, applying the filter mode to the paper image and the white background image can enhance the bright part of the texture, thereby obtaining a texture outline with a very bright bright part.
[0162] (3) Method for obtaining the gloss absorption layer image
[0163] Under the lighting conditions of a specific direction, the paper is photographed. A higher pixel can be used to take the photo to show the inherent texture of the paper fiber. Furthermore, the image obtained by taking the photo can be processed, such as removing information such as dust spots on the paper. Optionally, the image obtained by taking the gloss layer image can be used. In other words, different processing can be performed on the same photographed paper image to obtain a gloss layer image and a gloss absorption layer image.
[0164] Then, the image obtained by photographing and the background image are processed in a third mixing mode to obtain the gloss absorption layer image corresponding to the paper. Exemplarily, the third mixing mode can be a light color mode (Lighter Color), for example, the image is mixed with the background image in a "lighter color". Optionally, the background image can be an image of a single color. Optionally, the background image is the same as the background image used to obtain the texture layer image or the gloss layer image.
[0165] For example, under cloudy light conditions outdoors (ie, diffusely scattered light conditions), a piece of paper is photographed, and the photographed image is "lightly" mixed with a white background image to obtain a glossy absorption layer image corresponding to the paper.
[0166] Taking the RGB three-channel image as an example, one implementation of the light color mode may be: for the same pixel position in the paper image (i.e., the image obtained by photographing and processing in the above manner) and the background image of the same size, the sum of the values of the three channels R, G, and B of the pixel at that position in the paper image (referred to as the value of the mixed color B), and the sum of the values of the three channels R, G, and B of the pixel at that position in the background image (referred to as the value of the base color A) are calculated. If the value of the mixed color B is greater than the value of the base color A, the value of the pixel at that position in the paper image is used as the pixel value at the same position in the paper texture layer image, or in other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the paper image. If the value of the mixed color B is less than the value of the base color A, the value of the pixel at that position in the background image is used as the pixel value at the same position in the paper texture layer image, or in other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the background image. If the value of the mixed color B is equal to the value of the base color A, the value of the pixel at that position in the paper image or the background image is used as the pixel value at the same position in the paper texture layer image. In other words, the value of the pixel at that position in the texture layer image is equal to the value of the pixel at the same position in the paper image or the background image.
[0167] By processing the paper image and the background image in light color mode, the light part of the texture in the paper image can be highlighted and the dark part can be erased, thereby presenting the characteristics of the paper texture in terms of texture brightness, texture gloss, texture depth, etc. under lighting conditions in a specific direction.
[0168] (4) Method for obtaining color deposition layer images
[0169] The paper is impregnated with water, ink or other liquid pigments once or multiple times, and then the paper is photographed. A higher pixel can be used for taking pictures to show the inherent texture of the paper fiber. Furthermore, the image obtained by taking pictures can be processed, such as removing information such as spots on the paper. Then, the image obtained by taking pictures and the background image are processed in a fourth mixing mode to obtain a texture layer image corresponding to the paper. Exemplarily, the fourth mixing mode can be a color burning mode (Color Burn), for example, the image is mixed with the background image by "color burning". Optionally, the background image can be a single color image. Optionally, the background image is the same as the background image used to obtain the texture layer image, the gloss layer image or the gloss absorption layer image.
[0170] For example, under cloudy light conditions outdoors (ie, diffuse light conditions), the dyed paper is photographed, and the photographed image is mixed with a white background image by "darkening" to obtain a paper texture layer image corresponding to the paper.
[0171] Taking an RGB three-channel image as an example, one implementation of the color deepening mode may be:
[0172] For the same pixel position in the paper image (i.e., the image obtained by photographing and processing in the above manner) and the background image of the same size, the value of each channel of the pixel at the same position in the color deposition layer image is calculated according to the following formula:
[0173]
[0174] Among them, C represents the value of one channel of the pixel in the gloss layer image, A represents the value of one channel of the pixel in the background image, and B represents the value of one channel of the pixel in the paper image.
[0175] According to the above method, the three channels of a pixel are calculated respectively to obtain the values of the three channels of the pixel. According to the above method, the value of each pixel in the color deposition layer image can be obtained, and then the gloss layer image can be obtained.
[0176] Using the color darkening mode to render the user image texture can make only the texture appear in the unpainted areas of the user image. The darker the color of the area painted by the user, the heavier the deposition effect.
[0177] After the paper is dyed, different areas have different effects on color deposition. Some areas may be darker in color, indicating that more color is deposited in this area, while other areas may be lighter in color, indicating that less color is deposited in this area. This can present the color deposition characteristics of the texture of different areas of the paper.
[0178] By performing dark mode processing on the paper image and the background image, the color deposition features of different areas in the paper image can be presented in the color deposition layer image.
[0179] (5) How to obtain the shadow layer image
[0180] Under the condition of light from a specific direction, a photograph of the paper is taken. A higher pixel can be used to take the photograph to show the inherent texture of the paper fiber. Furthermore, the photographed image can be processed, such as removing information such as dust spots on the paper. Then, the photographed image and the background image are processed in the fifth blending mode to obtain a shadow layer image corresponding to the paper. Exemplarily, the fifth blending mode can be a multiply blending mode (Multiply), for example, the image is mixed with the background image by "multiplying". Optionally, the background image is the same as the background image used to obtain the texture layer image. For example, under the condition of light source from a specific direction, the paper is photographed, and the photographed image and the background image are processed by "multiplying" to strengthen the outline of the dark part, so as to obtain the gloss layer image corresponding to the paper.
[0181] Optionally, before performing the multiply blending mode processing, the light and dark of the captured image can be highlighted, and the distribution ratio of the light and dark can be adjusted.
[0182] Taking an RGB three-channel image as an example, one implementation of the multiply mode may be:
[0183] For the same pixel position in the paper image (i.e., the image obtained by taking photos and processing in the above manner) and the background image of the same size, the value of each channel of the pixel at the same position in the shadow layer image is calculated according to the following formula:
[0184]
[0185] Among them, C represents the value of one channel of the pixel in the shadow layer image, A represents the value of one channel of the pixel in the background image, and B represents the value of one channel of the pixel in the paper image.
[0186] According to the above method, the three channels of a pixel are calculated respectively to obtain the values of the three channels of the pixel. According to the above method, the value of each pixel in the shadow layer image can be obtained by calculating each pixel, thereby obtaining the shadow layer image.
[0187] Usually the color after executing the Multiply mode is darker than the original two colors. Any color multiplied with black will still be black, any color multiplied with white will keep the original color unchanged, and executing this mode with other colors will produce the effect of lighting with this color in a dark room.
[0188] In another possible implementation, a paper image under diffuse light can be obtained from an existing paper texture image library, and then a texture layer image can be obtained based on the paper image according to the above-mentioned method for obtaining the texture layer image. By performing image processing or AI processing on the paper image, an image of the paper under light conditions in a specific direction is obtained, and then a gloss layer image is obtained according to the above-mentioned method for obtaining the gloss layer image, and a gloss absorption layer image is obtained according to the above-mentioned method for obtaining the gloss absorption layer image. Similarly, a shadow layer image can also be obtained. The embodiment of the present application does not limit the method for obtaining the paper image in the paper texture image library, for example, it can be obtained by actual shooting, or it can be generated by AI.
[0189] After obtaining one or more of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image corresponding to the same paper, a database or data table corresponding to the paper can be established to store one or more related parameters of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image. For example, the related parameters may include material type, type and identification of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image, image size, etc. Exemplarily, Table 1 shows an example of a data table corresponding to a paper.
[0190] Table 1: Contents of the data table corresponding to the paper
[0191]
[0192]
[0193] "ID 1" and "aa" in Table 1 are used to represent specific values, and this application does not limit the value of the specific values. The texture image identifier can uniquely identify the texture image.
[0194] After obtaining one or more of the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images corresponding to the papers of the same material but different texture features (such as texture granularity size and / or texture granularity density, etc.), a database or data table corresponding to the paper of the material can be established to store relevant parameters of one or more of the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images. For example, Table 2 shows an example of a data table corresponding to a paper of a material.
[0195] Table 2: Contents of the data table corresponding to a type of paper
[0196]
[0197] It should be understood that the "texture feature level" shown in Table 2 is used to represent the texture size (i.e., the texture granularity size) and the texture density (used to indicate the number of texture granularities present per unit area). There may be a negative correlation between the texture size and the texture density, for example, the larger the texture granularity size, the smaller the density. It is also possible that there is no negative correlation between the texture granularity size and the texture density, for example, when the texture granularity size is large, the texture density may also be small. In other words, the texture feature level can be used to indicate one or more of the size of the texture granularity, the density of the texture granularity, and other features (such as the depth of the texture). The texture feature level described in Table 2 is only a possible example, and the embodiments of the present application are not limited to this.
[0198] After obtaining one or more of the corresponding texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images for different materials, a database or data table corresponding to the painting carriers of different materials can be established to store the relevant parameters of one or more of the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images. For example, Table 3 shows an example of a data table corresponding to paper of various materials.
[0199] Table 3: Data table contents corresponding to various paper materials
[0200]
[0201]
[0202] "ID 1" and the like in Table 3 are used to indicate specific numerical values, and this application does not impose any restrictions on the values of the specific numerical values.
[0203] It should be understood that the above Table 1, Table 2 and Table 3 are merely examples of several possible data structures, and the present application does not limit the data structure.
[0204] It should also be understood that the above Tables 1, 2 and 3 only show some parameters. In actual scenarios, more parameters may be included, and this application does not limit this.
[0205] In the embodiment of the present application, different texture images can be combined, and each combination can include one texture image, or include multiple different texture images. When different texture image combinations are used to render the same painting, different painting effects or visual effects, or different painting styles, can be presented.
[0206] According to the various texture images shown above, the embodiments of the present application can combine the above texture images to obtain the following types of combinations:
[0207] Combination 1 includes: texture layer image, shadow layer image, gloss layer image, color deposition layer image;
[0208] Combination 2 includes: texture layer image, color deposition layer image;
[0209] Combination 3 includes: texture layer image, shadow layer image, gloss layer image;
[0210] Combination 4 includes: texture layer image, shadow layer image, gloss absorption layer image;
[0211] Combination 5 includes: texture layer image, gloss layer image;
[0212] Combination 6 includes: texture layer image, gloss absorption layer image;
[0213] Combination 7 includes: texture layer image, gloss absorption layer image, color deposition layer image;
[0214] Combination 8 includes: a texture layer image, a gloss layer image, and a color deposition layer image.
[0215] The arrangement order of the images included in the above various combinations is only a possible example, and the present application does not limit the arrangement order of the images in each combination.
[0216] It should be understood that the above only illustrates several possible combinations by way of example and the present application is not limited thereto.
[0217] In the embodiment of the present application, a texture image combination identifier may be set for each texture image combination to uniquely identify a texture image combination.
[0218] In some embodiments of the present application, a correspondence relationship between different texture images and painting styles can be set. In this way, when a user selects a painting style, the image processing application can determine which texture image or images to use to process the user's painting according to the correspondence relationship to obtain a painting of the corresponding style.
[0219] According to the characteristics of different painting styles, texture images or combinations of texture images can be set to achieve different painting styles. For example, paintings in the style of ink painting need to present the texture effect where the user paints, and also present the effect of color absorption. Therefore, the gloss layer image can be used to render the texture of the painting to achieve the style of ink painting. For another example, paintings in the style of oil painting need to present the rough texture characteristics unique to oil canvas, and the deposition effect of oil paint on the canvas is obvious. The oil paint is affected by the texture on the canvas, and the texture outline it presents is more obvious. Therefore, the texture layer image and color deposition layer image corresponding to the oil canvas can be used to render the texture of the painting to achieve the style of oil painting.
[0220] Table 4 exemplarily shows the correspondence between painting styles and texture images.
[0221] Table 4: Correspondence between painting styles and texture images corresponding to the same painting carrier
[0222]
[0223]
[0224] Optionally, in Table 4, "texture layer image" may specifically refer to an identifier of a texture layer image, or other information that can uniquely identify the texture layer image. Similarly, other types of texture images in Table 4 may also be understood in the same way.
[0225] Optionally, in Table 4, the set of texture images corresponding to the ink painting style can also be replaced by the identifier of the texture image combination, for example, "texture layer image, gloss absorption layer image" can specifically be the identifier of the texture image combination. Similarly, the set of texture images corresponding to other painting styles in Table 4 can also be understood in this way.
[0226] Table 5 shows the correspondence between the material type of the painting carrier and the texture image.
[0227] Table 5: Correspondence between painting styles and texture images corresponding to the same painting carrier
[0228]
[0229] Optionally, in Table 5, "texture layer image" may specifically refer to an identifier of a texture layer image, or other information that can uniquely identify the texture layer image. Similarly, other types of texture images in Table 5 may also be understood in the same way.
[0230] Optionally, in Table 5, the set of texture images corresponding to "rice paper" can also be replaced by the identifier of the texture image combination, for example, "texture layer image, gloss absorption layer image" can specifically be the identifier of the texture image combination. Similarly, the set of texture images corresponding to other material types in Table 5 can also be understood in this way.
[0231] Table 6 shows the correspondence between the painting styles and the material types of the painting carriers and the texture images.
[0232] Table 6: Correspondence between painting styles and material types and texture images corresponding to different painting carriers
[0233]
[0234] Optionally, in Table 6, "texture layer image 1" may specifically refer to an identifier of a texture layer image, or other information that can uniquely identify a texture layer image. Similarly, other types of texture images in Table 6 may also be understood in the same manner.
[0235] Optionally, in Table 6, a group of texture images corresponding to "texture layer image 1, gloss layer image 1, and color deposition layer image 1" may also be replaced by the identifier of the texture image combination. Similarly, "texture layer image 2, gloss layer image 2, and color deposition layer image 2" may also be replaced by the identifier of the corresponding texture image combination.
[0236] It should be understood that the above Tables 4, 5 and 6 only provide several possible corresponding relationships by way of example, and the embodiments of the present application are not limited thereto.
[0237] In some embodiments of the present application, a correspondence between texture features (such as the density of texture granularity and / or the size of texture granularity) and brush parameters can be set. Based on the correspondence, the image processing application can set the brush using the corresponding brush parameters according to the texture feature parameters (such as the density of texture granularity) set by the user (or required by the user). In other words, the default parameters of the brush can be set according to the texture feature parameters set by the user. It should be understood that the user can adjust the default parameters of the brush according to his or her needs, and the present application does not limit this.
[0238] In a possible implementation, the brush parameters may include one or more of the hardness of the brush stroke, the size of the brush stroke, the flow rate of the brush stroke, and the viscosity of the brush. Among them, hard brush strokes are generally suitable for drawing some clear, outline lines. Soft brush strokes are generally suitable for scenes such as smearing and coating. The size of the brush stroke is related to the fineness of the painting. The flow rate of the brush stroke refers to the outflow speed of the paint during the painting process, that is, the "concentration" of the brush smear. For scenes that require the picture to present rich colors and delicate scenes, a smaller brush stroke flow rate can be set to achieve it. On the contrary, if the main feature of the painting is to emphasize the vividness of the color, a relatively large brush stroke flow rate can be set. The viscosity of the brush is generally used to adjust the degree of restriction of a specific part of the brush. The intuitiveness and deformation degree of the brush can be controlled by adjusting the viscosity of the brush. Generally, the higher the viscosity of the brush, the softer the painting result will be, and the more obvious the transformation characteristics will be.
[0239] Based on the influence of the above brush parameters on the painting style, for example, in some embodiments of the present application, if the density of the texture granularity is relatively large, such as greater than a set threshold, or at a density level corresponding to a larger density value, a harder brushstroke can be set to achieve a clearer painting effect; conversely, if the density of the texture granularity is relatively small, a softer brushstroke can be set to achieve a smoother painting effect. The present application does not impose any limitation on this.
[0240] In another possible implementation, the brush parameters may include one or more of the brush shape and brush material. The brush material may also be referred to as brush granularity, and the edge contours of lines drawn by different brush materials have different granularity. Exemplarily, by setting the corresponding relationship between the density of texture granularity and the brush material, the relationship between the granularity of the paper texture (the granularity of the texture is related to the granularity density of the texture) and the granularity of the brush material can be established.
[0241] Based on the above-mentioned texture images, when processing images in the embodiments of the present application, the user's image (e.g., the user's painting) can be mixed with one or more texture images corresponding to the painting style and / or material type according to the painting style and / or the material type of the selected painting carrier, so that the user's image presents a texture effect corresponding to the painting style, thereby achieving a realistic painting effect in a painting style such as watercolor, ink painting, or oil painting.
[0242] Combine the following Figures 5 to 10 , the image processing method provided in the embodiment of the present application is described.
[0243] See also Figure 5 , is a schematic diagram of the principle of the image processing method provided in the embodiment of the present application. Figure 5 As shown, when processing the user's image, the background layer, the layer where the user's image is located, and the layer where the texture image is located can be mixed. After the mixing process, these layers will be merged into one layer, and the image on this layer is the image with a certain painting style after texture rendering.
[0244] Optionally, the background layer is an optional layer. The image processing application provided in the embodiment of the present application may provide a default background layer, such as a white background layer.
[0245] It should be understood that the layer where the user's image is located may be one or more layers, and the figure only takes one layer as an example for description.
[0246] Since the texture image used to achieve a certain painting style may include one or more, correspondingly, Figure 5 The texture image may be located on one or more layers, and there is only one texture image on one layer.
[0247] These layers can be Figure 5 The order shown in (a) can also be arranged in Figure 5 Arranged in the order shown in (b).
[0248] When blending these layers, the pixels in each layer at the same position are blended separately. Figure 5Taking the pixel position shown in (b) as an example, when performing blending, the pixel values of pixel 2 in the layer where the top texture image is located, pixel 3 in the layer where the middle texture image is located, pixel x in the layer where the bottom texture image is located (not shown in the figure), pixel 1 in the layer where the user's image is located, and pixel 4 in the background layer are calculated to obtain the pixel value after blending. The pixel value is the pixel value of the pixel at that position on the merged layer, and the image carried by the layer is the image after texture rendering.
[0249] Depending on the painting style, the blending mode used when blending these layers may be different. The blending modes used include but are not limited to the following types: Darken, Multiply, Color Burn, Linear Burn, Darker Color, Add, Lighten, Screen, Color Dodge, Linear Dodge, Lighter Color, Overlay, SoftLight, Hard Light, Vivid Light, Linear Light, Pin Light, Hard Mix, Difference, Exclusion, Subtract, Divide, etc. This application does not limit the blending mode used.
[0250] Based on the above principle, the embodiments of the present application are Figure 3 Based on the system architecture shown, Figure 6 The system architecture of the image processing application is shown.
[0251] See also Figure 6 , which is a schematic diagram of the system architecture of the image processing application provided in the embodiment of the present application. The architecture may include a texture image management module 11 and an image processing module 21. Optionally, a texture parameter management module 12 may also be included. Optionally, a brush parameter management module 13 may also be included. The texture image management module 11, the texture parameter management module 12 and the brush parameter management module 13 may be located in the CPU 10, and the image processing module 21 may be located in the GPU 20. The image processed by the image processing module 21 may be displayed by the display module 30.
[0252] The texture image management module 11 is used to manage texture images. For example, the texture image management function of the texture image management module 11 can be embodied in one or more of the following aspects:
[0253] Aspect 1: Storage management of texture images. The texture image management module 11 can maintain the storage location of the texture image, so that the corresponding texture image can be obtained according to the material type or painting style selected by the user to provide it to the image processing module 21. The texture image management module 11 can also maintain relevant parameters of the texture image, such as the texture image identifier, image size, texture feature level and other parameters, such as establishing and maintaining the data structure shown in Table 1, Table 2 or Table 3.
[0254] Aspect 2: Managing the correspondence between texture images and painting styles. For example, the data structure shown in Table 4 or Table 5 may be stored and maintained.
[0255] Aspect 3: In response to the user's selected painting style, material type and / or texture features (for example, including the density of texture granularity and / or the size of texture granularity, etc.), the corresponding texture image is obtained and the texture image is provided to the image processing module 21 (or the corresponding texture image is loaded into the image processing module 21).
[0256] Aspect 4: Based on the size of the user's image and / or the user's requirements for texture parameters (such as the density of texture granularity and / or the size of texture granularity, etc.), instruct the texture parameter management module 12 to modify the texture image and provide the modified texture image to the image processing module 21.
[0257] Aspect 5: According to the determined texture features of the texture image (eg, density of texture granularity and / or size of texture granularity, etc.), and based on the correspondence between the texture features and the brush parameters, instruct the brush parameter management module 13 to set the brush.
[0258] It should be understood that the above only exemplifies the management functions that the texture image management module 11 may have, and the embodiments of the present application do not limit this.
[0259] The texture parameter management module 12 may modify the texture image according to the instruction of the texture image management module 11, and provide the modified texture image to the texture image management module 11. Optionally, the texture image management module 11 may send an instruction to modify the texture image to the texture parameter management module 12, and the instruction may indicate which texture image the texture parameter management module 12 is to modify.
[0260] For example, if the size of the user's image does not match the size of the texture image, the texture parameter management module 12 may modify the size of the specified texture image to be the same as the size of the user's image by:
[0261] Method 1: If the difference between the size of the user image and the size of the texture image is within a tolerable range, such as the difference in the horizontal direction and the difference in the vertical direction are both within the range of plus or minus 10%, the texture image can be scaled to adjust the size of the texture image to the same size as the user image. Since the size difference between the texture image and the user image is not large, stretching the texture image will not have a significant impact on the texture features presented by the texture image, and the presentation of the corresponding painting style can be guaranteed.
[0262] Method 2: If the size of the user image is larger than the size of the texture image and has exceeded the above-mentioned tolerable range, multiple copies of the texture image can be copied and the multiple identical texture images can be spliced so that the spliced texture image matches the size of the user image. It can be understood that if the size of the spliced texture image is too large, the spliced texture image can be cropped to match the size of the user image.
[0263] In this way, the texture features in the texture image can be kept unchanged, thereby ensuring the presentation of the corresponding painting style.
[0264] Mode 3: If the size of the user image is smaller than the size of the texture image and exceeds the above-mentioned tolerable range, the texture image may be cropped so that the cropped texture image matches the size of the user image.
[0265] In this way, the texture features in the texture image can be kept unchanged, thereby ensuring the presentation of the corresponding painting style.
[0266] For another example, if the texture features required by the user are different from the texture features of the texture image, the texture parameter management module 12 may use the following method to adjust the texture features of the specified texture image to meet the user's requirements:
[0267] Method 1: If the texture granularity density required by the user is greater than the texture granularity density of the texture image, the size of the texture image can be reduced to increase the density of the texture granularity. The texture image with increased texture granularity density is then copied and spliced to obtain a texture image whose texture granularity density meets the requirements and whose size matches the user image size.
[0268] Method 2: If the texture granularity density required by the user is smaller than the texture granularity density of the texture image, the size of the texture image can be stretched to reduce the density of the texture granularity, and then the texture image with the reduced texture granularity density can be cropped to obtain a texture image whose texture granularity density meets the requirements and whose size matches the user image size.
[0269] Similarly, if the size of the texture granularity required by the user is different from the size of the texture granularity in the texture image, the texture image can be adjusted accordingly based on the same principle to meet the user's requirements.
[0270] It should be understood that the above merely exemplifies the functions that may be implemented by the texture parameter management module 12, and the embodiments of the present application do not limit this.
[0271] The brush parameter management module 13 can set the brush according to the instruction of the texture image management module 11. For example, after determining the texture image, the texture image management module 11 can determine the corresponding brush parameters according to the texture features of the texture image (for example, the density of the texture granularity and / or the size of the texture granularity, etc.), and send an instruction to set the brush parameters to the brush parameter management module 13, and indicate the specific brush parameters to the brush parameter management module 13 through the instruction; the brush parameter management module 13 can set the brush according to the instruction.
[0272] The image processing module 21 can perform mixed processing on the user's image and the loaded texture image. For specific implementation methods, please refer to Figure 5 The principle shown.
[0273] The display module 30 can display the processed image.
[0274] It should be understood that Figure 6 The information flow indicated by the arrows shown in is only a possible example, and the present application does not limit it. For example, after the texture parameter management module 12 modifies the texture image, it is not necessary to send the modified texture image to the texture image management module 11, but the storage location of the modified texture image is notified to the texture image management module 11. For another example, the image processing module 21 can store the texture rendered image in a cache unit, and the display module 30 can obtain the image data to be displayed from the cache unit and display it.
[0275] In some embodiments of the present application, during the user's painting process, the painting effect matching the painting style and / or material type selected by the user can be displayed in real time following the user's painting operation, that is, a what-you-see-is-what-you-get display effect can be achieved. Figure 7 This implementation method is described.
[0276] based on Figure 6 The system architecture shown in the figure, when the image processing application is started, Figure 7 The process shown may include the following steps:
[0277] Step 701: the electronic device receives first information, where the first information indicates a painting style requested by a user and / or a material type of a painting carrier.
[0278] In a possible implementation, the user can perform a first user operation through a user interface provided by the image processing application to submit relevant information required by the user, such as the painting style requested by the user and / or the material type of the painting carrier, to the image processing application. The first user operation is used to enable the image processing application to perform texture rendering on the currently drawn image according to the first information during the process of the user drawing the image.
[0279] Optionally, the first user operation may include one or more operation steps, or one or more operation gestures, or one or more operation actions. For example, the electronic device may receive a user operation for triggering a function option of creating a painting (e.g., the user clicks the function key of "Create Painting" or selects the menu command of "Create Painting"), or receives a user operation for triggering a function option of setting a texture (e.g., the user clicks the function key of "Set Texture"), and the electronic device responds to the received user operation by displaying option information of the painting style and / or the material type of the painting carrier, so that the user can select from the painting styles provided by the application, or select from the material types of the painting carrier provided by the application; when the user completes the selection, the electronic device obtains the first information according to the received user operation for selecting the option information.
[0280] Combine the following Figure 8 The user interface shown is described in the figure. Figure 8 As shown, the user interface 800 includes an image editing area 801, a setting area 802 and a layer operation area 803. The setting area 802 may include a menu, a plurality of setting function keys, and the like, such as a "texture setting" function key. When the user triggers the "texture setting" function key, a painting style setting window 804 pops up. The painting style window 804 includes a painting style option and a slide bar for setting the density of texture granularity. The user can select a painting style through the window, and further, can use the slide bar to set the density of texture granularity. Optionally, the density of texture granularity can be set by default.
[0281] In another possible implementation, the application may provide an input box in the user interface, and the user may input a density value of the texture granularity in the input box.
[0282] In another possible implementation, similarly, the image processing application may provide a material type selection function, allowing the user to select a material type from a plurality of material types provided by the application.
[0283] In another possible implementation, similarly, the image processing application provides a painting style selection function and a material type selection function, and allows the user to select the painting style and the material type.
[0284] It can be understood that the above only exemplifies an implementation method of obtaining the first information based on a user interaction method. In actual scenarios, the first information can also be obtained through other methods, and this application does not limit this.
[0285] This step can be implemented by the texture image management module 11 .
[0286] Step 702: The electronic device determines a texture image corresponding to the requested painting style and / or material type according to the first information.
[0287] In one possible implementation, the electronic device may determine one or more texture images corresponding to the requested painting style based on the requested painting style and the correspondence between the painting style and the texture image (which may be referred to as a first correspondence, an example of which may be shown in Table 4).
[0288] In another possible implementation, the electronic device may determine one or more texture images corresponding to the requested material based on the requested material type and the correspondence between the material type and the texture image (which may be referred to as a second correspondence, an example of which may be shown in Table 5). Optionally, the texture image corresponding to the requested material may include all texture images corresponding to the material.
[0289] In another possible implementation, the electronic device may determine the texture image corresponding to the requested painting style and material type based on the correspondence between the painting style and material type and the texture image (which may be referred to as a third correspondence, an example of which may be shown in Table 6).
[0290] In another possible implementation, the electronic device may modify the texture image according to the texture feature requirement requested by the user to obtain a texture image that meets the texture feature requirement. For specific implementations, reference may be made to the functions of the texture parameter management module.
[0291] Exemplarily, the user may perform a fifth user operation based on a user interface provided by the application, and the electronic device may obtain the texture feature information set by the user according to the fifth user operation. For example, after the electronic device receives the user operation of a slider on a slider control, the texture feature information set by the user may be determined according to the position of the slider on the slider control. If the texture feature information set by the user is not equal to the texture feature information of the texture image corresponding to the first information, the electronic device may adjust the size of the texture image according to the texture feature information set by the user, so that the density of the texture granularity in the adjusted texture image matches the density of the texture granularity set by the user.
[0292] This step can be implemented by the texture image management module 11, or by the texture image management module 11 and the texture parameter management module 12 cooperating with each other.
[0293] Step 703: After the electronic device obtains the user's drawing operation, it draws on the layer where the user's image is located, and mixes the layer where the user's image is located with the layer where the texture image is located.
[0294] The layer where the user's image is located may include one layer or multiple layers.
[0295] According to the number of texture images determined in step 702, the layer where the texture image is located may include one layer or may include multiple layers.
[0296] Optional, the order of the layers where the texture image is located and the layers where the user image is located, you can refer to Figure 5 .
[0297] Optionally, the layer containing the texture image is not visible to the user.
[0298] Optionally, the layer where the texture image is located is visible to the user. Optionally, the layer where the texture image is located does not allow the user to edit it, or only provides limited editing functions to the user, such as only allowing transparency to be set.
[0299] The specific implementation method of this step can be found in Figure 5 The principle shown.
[0300] This step can be implemented by the image processing module 21. The image processing module 21 can store the processed image data in a cache unit.
[0301] Step 704: The electronic device displays the mixed image.
[0302] In a possible implementation, the display module 30 may obtain the rendered image data from the cache unit according to a set period, and display the image.
[0303] This step can be implemented by the display module 30 .
[0304] For ease of distinction, the image before texture rendering may be referred to as a first image, and the image after texture rendering may be referred to as a second image.
[0305] In a possible implementation, when the first information also indicates texture feature information, the electronic device may also determine brush parameters corresponding to the texture feature information based on the texture feature information indicated by the first information and a fourth corresponding relationship, and set the brush based on the brush parameters. The fourth corresponding relationship includes a corresponding relationship between texture feature information and brush parameters.
[0306] In a possible implementation, when the user needs to modify the painting style or material type or texture feature information, a new painting style or material type can be selected or new texture feature information can be set based on the user interface provided by the application program in a human-computer interaction manner, so that the application program can perform texture rendering on the user's image based on the new painting style or material type or the new texture feature information. The human-computer interaction manner is similar to the first user operation described above, such as selecting a new session style by triggering a "texture setting" function key.
[0307] Based on the above process, whenever the user draws on the layer where the user image is located, the electronic device can respond to the user's current painting operation in the above manner and mix the layer where the user image is located and the layer where the image texture is located, thereby realizing real-time display of a painting effect that matches the painting style or material type selected by the user.
[0308] In some other embodiments of the present application, during the user's painting process, the painting effect matching the painting style or material type selected by the user can be displayed according to the user's "preview" or similar instructions. If the user cancels the "preview", the normal display can be restored. Fig. 9 This implementation method is described.
[0309] based on Figure 6 The system architecture shown in the figure, when the image processing application is started, Fig. 9 The process shown may include the following steps:
[0310] Step 901: The electronic device displays an image of a user (which may be referred to as a first image).
[0311] In this step, when the user uses the image processing application to draw, the electronic device can display the user's current drawing picture. The drawing picture is a picture that has not been rendered by the texture image.
[0312] Step 902: The electronic device receives a user's request for "painting effect preview", where the request is used to request that the current screen be displayed with a display effect that matches the painting style or material type requested by the user.
[0313] In this step, when the user performs a user operation to trigger a function option to preview the current image, the electronic device, after receiving the user operation, responds to the user operation, pauses responding to the user operation of drawing the current image, and displays option information of the painting style and / or material type of the painting carrier; after the user completes the selection operation based on the option information, the electronic device can obtain the first information according to the received user operation for selecting the option information.
[0314] Exemplarily, the third user operation here may include, for example, the user triggering a "painting effect preview" key on the user interface and selecting a painting style in a pop-up window for setting a painting style. The user may submit the "painting effect preview" request by selecting a function option provided by the image processing application.
[0315] This step can be implemented by the texture image management module 11 .
[0316] Step 903: The electronic device determines a texture image corresponding to the painting style or material requested by the user according to the “painting effect preview” request.
[0317] In one possible implementation, the painting style or material type can be selected or set before painting begins. For specific implementation methods, please refer to Figure 7 Step 701 in . Figure 7 The difference between the process shown is that Fig. 9 In the process shown, when the electronic device obtains the painting style requested by the user or the material type selected by the user, the function of processing the user's drawing based on the texture image can be disabled by default during the user's drawing process. Alternatively, when the user selects the painting style or material type, a user interface can be provided to allow the user to choose whether to enable the function of rendering based on the texture image. If the user chooses to enable the function of rendering based on the texture image, the function of rendering based on the texture image is enabled. Figure 7 If the user chooses to turn off the function of rendering based on texture images, the following steps are followed Fig. 9 The process shown is executed.
[0318] In another possible implementation, after the electronic device obtains the user's "painting effect preview" request, it can display a user interface for setting or selecting a painting style and / or material type, such as a function option for the user to select a painting style from a plurality of painting styles provided by the application, or a function option for the user to select a material type from a plurality of material types provided by the application. After the electronic device obtains the painting style and / or material type set or selected by the user, step 904 can be executed.
[0319] This step can be implemented by the texture image management module 11 .
[0320] Step 904: The electronic device mixes the layer where the user's image is located with the layer where the texture image is located.
[0321] Optionally, after the electronic device obtains the “painting effect preview” request submitted by the user, it may enter an image editing mode, in which the electronic device does not respond to the user's painting operation.
[0322] The specific implementation method of this step can be found in Figure 5 The principle shown.
[0323] This step can be implemented by the image processing module 21. The image processing module 21 can store the processed image data in a cache unit.
[0324] Step 905: The electronic device displays the mixed image.
[0325] The implementation method of this step may refer to step 704.
[0326] Step 906: the electronic device receives a user's request to cancel the "painting effect preview", which is used to request to cancel the display of the current screen as a display effect matching the painting style or material type requested by the user, or to restore to a normal display effect.
[0327] Optionally, after the electronic device obtains the user's request to cancel the “painting effect preview”, it can exit the image editing mode and continue to respond to the user's painting operation.
[0328] The specific implementation of this step can be achieved by the cooperation between the texture image management module 11 and the image processing module 21. For example, the texture image management module 11 can instruct the image processing module 21 to restore the current image to the effect without texture image processing.
[0329] It should be understood that the above Fig. 9 In the process shown, more specific implementation methods can refer to the aforementioned embodiments and will not be repeated here.
[0330] Compared to Figure 7 The image processing method shown uses Fig. 9 The image processing method shown can process and display the image in a conventional manner during the user's painting process. Only when the user needs to view the texture display effect, the electronic device will use the texture image to edit the user's image based on the user's "painting effect preview" request, thereby reducing resource overhead.
[0331] In some other embodiments of the present application, the loaded user image can be edited, and the user image can be processed according to the painting style or material type selected by the user so that the user image presents the corresponding painting style. Fig.10 The image processing method shown can process existing or completed images. Fig.10 This method will be described.
[0332] based on Figure 6 The system architecture shown in the figure, when the image processing application is started, Fig.10 The process shown may include the following steps:
[0333] Step 1001: The electronic device obtains an image (which may be referred to as a first image) that a user requests to process.
[0334] In this step, the user submits the image to be edited to the image processing application through a function provided by the image processing application, such as a function of opening an image or a function of importing an image.
[0335] Step 1002: The electronic device receives a second user operation, and acquires first information according to the second user operation, wherein the first information indicates a painting style and / or a material type of a painting carrier. The second user operation is used to request texture rendering of a requested first image according to the first information.
[0336] In this step, the user can trigger the function option of editing the first image (i.e., the image to be processed) based on the user interface provided by the application. After receiving the user operation, the electronic device displays option information of the painting style and / or the material type of the painting carrier in response to the user operation; when the user completes the selection operation of the painting style and / or the material type of the painting carrier based on the option information, the electronic device can obtain the first information according to the received user operation for selecting the option information.
[0337] For the specific implementation of this step, please refer to step 701.
[0338] Step 1003: The electronic device determines a texture image corresponding to the requested painting style and / or material type.
[0339] For the specific implementation of this step, please refer to step 702.
[0340] Step 1004: The electronic device performs a blending process on the layer where the first image requested for processing is located and the layer where the texture image is located.
[0341] Optionally, after determining the texture image corresponding to the painting style or material type selected by the user, the electronic device directly proceeds to step 1004, that is, immediately performs a blending operation.
[0342] The specific implementation method of this step can be found in Figure 5 The principle shown.
[0343] Based on the image processing method provided in the above-mentioned embodiment of the present application, texture effect processing can be performed on the image, thereby improving the realism of the painting effect.
[0344] For example, Fig.11 A comparison diagram is shown before and after texture rendering of an image using the method provided in an embodiment of the present application. It can be seen that after texture rendering of a user image using the image processing method provided in an embodiment of the present application, the user image is closer to the effect obtained by drawing on a real paper with a specific texture than before texture rendering.
[0345] On the other hand, since the image processing method provided in the embodiment of the present application uses a texture image to achieve the texture effect of the image, there is no need to model the texture, thereby reducing the resource overhead of image processing.
[0346] On the other hand, the texture image in the embodiment of the present application can be obtained by photographing the painting material and performing image processing on the photographed image, which can reduce costs compared to using professional extraction equipment (such as a fingerprint sensor) to extract paper texture.
[0347] On the other hand, based on the uniqueness or uniqueness of the paper texture, by obtaining a texture image using the method provided in the embodiment of the present application, a texture image with a unique texture can be obtained. After processing the user image based on the texture image, the user image also has the unique texture feature, thereby achieving the purpose of anti-counterfeiting.
[0348] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program. When the computer program is executed by a computer, the computer can implement the method provided in the above method embodiment.
[0349] An embodiment of the present application further provides a computer program product, which is used to store a computer program. When the computer program is executed by a computer, the computer can implement the method provided in the above method embodiment.
[0350] An embodiment of the present application also provides a chip, including a processor, wherein the processor is coupled to a memory and is used to call a program in the memory so that the chip implements the method provided by the above method embodiment.
[0351] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0352] The present application is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0353] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0354] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0355] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An image processing method, characterized in that: Applied to electronic equipment, the method comprises: Starting an application, wherein the application is a painting application or an image editing application; Displaying a first editing control on the interface of the application, wherein the first editing control allows a user to select painting information, wherein the painting information includes information on a painting style and / or a material type of a painting carrier; Receiving a first operation of the user on the first editing control; The first image is texture rendered to display a second image with texture, wherein the second image with texture is presented by mixing the first image with a texture image, and the texture image corresponds to the painting information selected by the user.
2. The image processing method according to claim 1, characterized in that: The texture image includes one or more texture images, and the one or more texture images are generated based on the texture corresponding to the material type of the painting style and / or the painting carrier, and the one or more texture images are used to mix and present the texture corresponding to the material type of the painting style and / or the painting carrier.
3. The method according to claim 2, characterized in that The one or more texture images include one or more of the following: Texture layer images, used to present texture shape, texture size, and texture depth under diffuse light conditions; A gloss layer image, used to present a texture outline under a lighting condition in a specific direction, wherein a dark outline of the texture outline is eliminated and a bright outline is highlighted; A gloss absorption layer image, used to present a texture profile under a lighting condition in a specific direction, wherein a dark portion of the texture profile is eliminated and a light portion is highlighted; Color deposition layer images, used to present effects based on pigment adsorption capacity; The shadow layer image is used to present the texture contour under the lighting conditions of a specific direction, in which the bright contour of the texture contour is eliminated and the dark contour is highlighted.
4. The method according to any one of claims 1 to 3, characterized in that The painting information also includes information of texture features, and the information of texture features includes texture granularity density and / or texture granularity size of the corresponding texture image.
5. The method according to claim 4, characterized in that The method further comprises: The pattern size of the one or more texture images corresponding to the first information is adjusted according to the texture feature information set by the user.
6. The method according to any one of claims 1 to 5, characterized in that The information of the texture feature includes one or more of the following information: texture shape, texture size, texture depth, dark part contour feature, bright part contour feature, light color contour feature, and effect presented based on pigment adsorption capacity.
7. The method according to claim 6, characterized in that The texture layer image is obtained by performing a first mixing mode on the third image and the background image; or, the gloss layer image is obtained by performing a second mixing mode on the fourth image and the background image; or, the gloss absorption layer image is obtained by performing a third mixing mode on the fourth image and the background image; or, the color deposition layer image is obtained by performing a fourth mixing mode on the fifth image and the background image; or, the shadow layer image is obtained by performing a fifth mixing mode on the fourth image and the background image; Among them, the third image is an image of the texture corresponding to the painting information under diffuse light conditions, the fourth image is an image of the texture corresponding to the painting information under specific direction light conditions, and the fifth image is an image of the texture of the same painting carrier after being dyed.
8. The method according to claim 7, characterized in that The first blending mode is a dark color mode, or the second blending mode is a screen mode, or the third blending mode is a light color mode, or the fourth blending mode is a color darkening blending mode, or the fifth blending mode is a multiply blending mode.
9. The image processing method according to any one of claims 2 to 8, characterized in that: The method further comprises: According to the first operation, a corresponding painting carrier is generated, wherein the corresponding painting carrier is mixed and presented by the corresponding one or more texture images.
10. The image processing method according to claim 9, characterized in that: The method further comprises: A background image corresponding to the painting carrier is displayed on the interface of the first application.
11. The image processing method according to any one of claims 1 to 10, characterized in that: The first image comprises: An image drawn by a user on the drawing interface of the application; or The image currently presented on the interface of the application; or The background image presented on the interface of the application.
12. The method according to any one of claims 1 to 11, characterized in that The method further comprises: Displaying the first edit control in the interface for creating a painting, or Display the first editing control in the function option interface of setting texture, or The first editing control is displayed on the function option interface of previewing the current image.
13. The method according to any one of claims 1 to 12, characterized in that The method further comprises: A second operation of the user on the first editing control is received, texture rendering processing of the first image is canceled, and image drawing is resumed.
14. The method according to any one of claims 1 to 13, characterized in that The method further comprises: The first image and the texture image are mixed, wherein the mixing processing mode includes: one or more of a dark mode, a color filter mode, a light mode, a color darkening mixing mode, and a positive film overlay mixing mode.
15. The method according to any one of claims 2 to 14, characterized in that The step of performing texture rendering processing on the first image comprises: The values of the pixels at the same position in the one or more texture images and the first image are processed according to a set blending mode to obtain the values of the pixels at the same position in the second image.
16. The method according to claim 15, characterized in that The blending mode is associated with a painting style indicated by the first information, or the blending mode is associated with a material type indicated by the first information.
17. The method according to any one of claims 1 to 16, characterized in that The first information further indicates texture feature information, wherein the texture feature information indicates texture granularity density and / or texture granularity size; The method further comprises: Determining a brush parameter corresponding to the texture feature information according to the texture feature information indicated by the first information and a fourth corresponding relationship; wherein the fourth corresponding relationship includes a corresponding relationship between the texture feature information and the brush parameter; Sets the brush according to the brush parameters.
18. The method according to claim 17, characterized in that The brush parameters include one or more of a brush shape and a brush material, and the particle fineness of the brush material is associated with the texture particle fineness corresponding to the texture feature information indicated by the first information.
19. The method according to any one of claims 1 to 18, characterized in that The painting styles include: one or more of ink painting style, watercolor painting style, oil painting style, paper style, silk style, cloth grain style, leather grain style, printmaking style, rock color style, and metal style.
20. The method according to any one of claims 1 to 19, characterized in that The material type of the painting carrier includes one or more of paper, canvas, and drawing board.
21. A device, characterized in that: The method comprises a unit or a module for executing the method according to any one of claims 1 to 20.
22. A device, characterized in that: include: One or more processors, the one or more processors configured to execute the method according to any one of claims 1-20.
23. A readable storage medium, characterized in that: The readable storage medium includes a program, and when the program is executed on a device, the device is caused to perform the method according to any one of claims 1 to 20.
24. A chip system, characterized in that: include: The chip system includes at least one chip and a memory, and the at least one chip is used to read and execute a program stored in the memory to implement the method as described in any one of claims 1-20.
25. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 20 is implemented.
Citation Information
Patent Citations
Painting rendering method based on stroke texture analysis
CN102663782A
Image processing method and device and storage medium
CN112017257A
Special effect processing method and device, electronic equipment and storage medium
CN117608736A
Image generation method and device, nonvolatile storage medium and computer equipment
CN117689798A