Image processing method and apparatus
By receiving user operations to obtain painting style and material type information, and using multiple texture images for texture rendering, the problem of unrealistic painting effects in the existing technology is solved, and a painting effect with more material texture characteristics is achieved.
Patent Information
- Application Number
- PCT/CN2024/138247
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-03
- Filing Date
- 2024-12-10
- Publication Date
- 2025-10-09
AI Technical Summary
Existing image processing applications have difficulty effectively simulating the textures of painting materials in styles such as watercolor, ink painting, and oil painting when painting, resulting in unrealistic painting effects.
By receiving user operations to obtain painting style and material type information, multiple texture images are used for texture rendering, a correspondence between painting style and texture images is established, and different blending modes and brush parameters are combined to generate images with material texture effects.
The realism of the painting effect is improved, making the generated image more like the material texture characteristics of watercolor, ink or oil painting, and enhancing the visual effect of the painting.
Smart Images

Figure CN2024138247_09102025_PF_FP_ABST
Abstract
Description
Image processing method and device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on April 3, 2024, with application number 202410405293.5 and invention name "A Method and Device for Image Processing", the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of image processing technology, and in particular to an image processing method and device. Background Art
[0004] Image processing applications are widely used in business (such as print advertising), artistic creation (such as illustration design), and personal entertainment. As users' requirements for painting styles and effects become increasingly sophisticated, the requirements for image processing functions in image processing applications are also increasing.
[0005] Currently, when a user uses an electronic device (such as a tablet computer, a personal computer, etc.) to draw, an image processing application overlays and mixes the user's drawn pictures on different layers with the background color to achieve the final drawing effect.
[0006] The quality of paintings in styles like watercolor, ink painting, and oil painting is highly influenced by the texture of the painting material. Making paintings created using image processing applications appear realistic is a challenge currently being addressed. Summary of the Invention
[0007] The embodiments of the present application provide an image processing method and apparatus for performing texture effect processing on an image, thereby improving the realism of a painting effect.
[0008] 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.
[0009] 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 the texture of the same painting carrier, and the one or more texture images are used to present the texture of the same painting carrier; texture rendering 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.
[0010] 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 combining these multiple texture images in different ways and using them to render the image, images with different painting effects can be obtained. Based on the above principles, a correspondence between painting styles and texture images can be pre-established. Therefore, according to the painting style selected by the user, the corresponding texture image can be used to render the user's image, thereby obtaining an image with the corresponding painting style, thereby improving the realism of the painting effect.
[0011] In one 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 the currently drawn image according to the first information during the image drawing process; 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 the 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 requesting texture rendering of the currently paused image according to the first information.
[0012] In one possible implementation, 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; 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 based on the received user operation for selecting the option information.
[0013] In one possible implementation, receiving a second user operation and obtaining the first information based on the second user operation includes: receiving a user operation that triggers a functional option to edit 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 based on the received user operation for selecting the option information.
[0014] In one possible implementation, receiving a third user operation and obtaining the first information based on the third user operation includes: receiving a user operation that triggers a function option for previewing the current image; in response to the received user operation, pausing response to a user operation for drawing the current image, and displaying option information for 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.
[0015] In a possible implementation, after texture rendering is performed on the currently paused 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.
[0016] A possible implementation method also includes: receiving a fifth user operation, obtaining texture feature information set by the user based on the fifth user operation, and the texture feature information indicating the texture granularity density and / or 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.
[0017] Through the above implementation method, 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.
[0018] In one possible implementation, receiving a fifth user operation and obtaining texture feature information set by the 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 the position of the slider on the slider control.
[0019] 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 contour features, and effects presented based on pigment adsorption capacity.
[0020] In a possible implementation, 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.
[0021] 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 burn blending mode, and multiply blending mode.
[0022] 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 in the texture outline is eliminated and the bright 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 in the texture outline is eliminated and the light part 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 in the texture outline is eliminated and the dark outline is highlighted.
[0023] In one 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.
[0024] In one possible implementation, the first blending mode is a dark mode, or the second blending mode is a color filter mode, or the third blending mode is a light mode, or the fourth blending mode is a color darkening blending mode, or the fifth blending mode is a multiply blending mode.
[0025] In one 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; or, determining all texture images corresponding to the material type based on the material type indicated by the first information and a second correspondence; 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; wherein the first correspondence includes the correspondence between the painting style type and the texture image, the second correspondence includes the correspondence between the material type and the texture image, and the third correspondence includes the correspondence between the painting style type and the material type and the texture image.
[0026] In one 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.
[0027] In one possible implementation, before texture rendering the first image according to the one or more texture images, the method further 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 on 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 a size equal to that 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 on each of the one or more texture images: cropping the texture image to a size equal to that of the first image.
[0028] In one possible implementation, texture rendering of the first image based on the one or more texture images to obtain the second image includes: processing the values of the 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 the pixels at the same position in the second image.
[0029] In a possible implementation, 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.
[0030] Optionally, the blending mode includes one of the following: Darken mode, Multiply mode, Color Burn mode, Linear Burn mode, Darker Color mode, Add mode, Lighten mode, Screen mode, Color Dodge mode, Linear Dodge mode, Lighter Color mode, Overlay mode, Soft Light mode, Hard Light mode, Vivid Light mode, Linear Light mode, Pin Light mode, Hard Mix mode, Difference mode, Exclusion mode, Subtract mode, and Divide mode.
[0031] In one 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 the 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 texture feature information and brush parameters; and setting the brush according to the brush parameters.
[0032] In a possible implementation, the brush parameters include one or more of a brush shape and a brush material, and the grain fineness of the brush material is associated with the texture grain fineness corresponding to the texture feature information indicated by the first information.
[0033] In a possible implementation, the painting style includes one or more of ink painting style, watercolor painting style, oil painting style, and printmaking style.
[0034] In a possible implementation, the material type of the painting carrier includes one or more of paper, canvas, and drawing board.
[0035] In a second aspect, a device is provided, comprising a unit or module for executing the method as described in any one of the first aspects.
[0036] 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.
[0037] In a fourth aspect, a readable storage medium is provided, wherein the readable storage medium includes a program, and when the program is run on a device, the device executes any method as described in the first aspect.
[0038] 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 being used to read and execute a program stored in the memory to implement a method as described in any one of the first aspects.
[0039] In a sixth aspect, a computer program product is provided, comprising a computer program, wherein 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
[0040] FIG1a, FIG1b and FIG1c are schematic diagrams of an application scenario of an embodiment of the present application respectively;
[0041] FIG2 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0042] FIG3 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0043] FIG4 is a schematic diagram of a texture image in an embodiment of the present application;
[0044] FIG5 is a schematic diagram showing the principle of an image processing method provided in an embodiment of the present application;
[0045] FIG6 is a schematic diagram of the system architecture of an image processing application provided in an embodiment of the present application;
[0046] FIG7 is a schematic diagram of a flow chart of an image processing method provided in an embodiment of the present application;
[0047] FIG8 is a schematic diagram of an image processing application program interface provided in an embodiment of the present application;
[0048] FIG9 is a flow chart of another image processing method provided in an embodiment of the present application;
[0049] FIG10 is a schematic diagram of another image processing process provided by an embodiment of the present application;
[0050] FIG11 is a comparison diagram of an image before and after texture rendering in an embodiment of the present application. DETAILED DESCRIPTION
[0051] 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.
[0052] In the description of the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more of the features.
[0053] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more" 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: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects 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.
[0054] The image processing method provided in the embodiment of the present application can be applied to scenarios where electronic devices are used for drawing or image editing. An application scenario of the embodiment of the present application is described below with reference to FIG1a, FIG1b and FIG1c.
[0055] See 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, thereby obtaining a painting with a material texture effect. The user can also edit the painting to obtain an image with a material texture effect.
[0056] Referring to FIG1b , a schematic diagram of another application scenario provided by an embodiment of the present application is shown. An electronic device 100 includes a display screen, and the electronic device 100 is connected to an electronic handwriting tablet (or electronic drawing tablet) via a wired or wireless connection. After the user opens the image processing application, they can use an electronic stylus to draw on the electronic handwriting tablet, and the corresponding image will be displayed on the display screen of the electronic device 100, thereby obtaining a painting with a material texture effect.
[0057] In another possible scenario, the electronic device 100 (such as a personal computer or laptop) is connected to a mouse via a wired or wireless connection. After the user opens an image processing application, he or she can use the mouse to draw, and the corresponding image will be displayed on the display screen of the electronic device 100, thereby obtaining a painting with a material texture effect.
[0058] See 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 (for example, terminal devices 200a, 200b and 200c in the figure), and the electronic device 100 can perform corresponding image processing operations in response to the user's operations on these terminal devices, and send the processed image data to these terminal devices so that the processed images 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.
[0059] Optionally, the terminal device in Figure 1c can be a portable terminal device (such as a mobile phone, tablet computer, laptop computer, personal computer (PC), UMPC, netbook, etc.), a wearable device (such as a watch, etc.), a vehicle-mounted terminal device, AR / VR device, PDA, smart home device (such as a smart TV, etc.), etc.
[0060] Optionally, in the scenario shown in FIG1c, the electronic device 100 and the terminal device (such as the terminal devices 200a, 200b and 200c in the figure) can be connected via a network 300. Optionally, the network 300 can be a local area network or the Internet, which is not limited in this application.
[0061] The above are only some possible application scenarios and this application is not limited.
[0062] 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.
[0063] Among them, exemplary embodiments of the terminal device include but are not limited to Or terminal devices with other operating systems.
[0064] 2 , the hardware structure of an electronic device to which the method provided in an embodiment of the present application is applicable is introduced.
[0065] As shown in Figure 2, 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.
[0066] 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.
[0067] It is understood that the electronic device 100 shown in FIG2 is merely an example and does not limit the electronic device, and the electronic device may have more or fewer components than shown in the figure, may combine two or more components, or may have a different component configuration. The various components shown in FIG2 may be implemented in hardware, including one or more signal processing and / or application-specific integrated circuits, software, or a combination of hardware and software.
[0068] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated into 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 based on the instruction opcode and the timing signal to complete the control of instruction fetching and execution.
[0069] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0070] 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, thereby improving the intelligence and convenience of the electronic device 100 and enhancing the user experience. The processor 110 can include different devices. For example, when a CPU and a GPU are integrated, the CPU and the 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 (such as an algorithm for processing an image into a material texture effect) is executed by the GPU to obtain faster processing efficiency.
[0071] 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), a MiniLED, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one 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 the user or information provided to the user, as well as various graphical user interfaces (GUIs). For example, the display screen 194 can display photos, videos, web pages, or files.
[0072] In the embodiment of the present application, the display screen 194 can 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.
[0073] Camera 193 (either a front-facing camera or a rear-facing camera, or one camera serving as both) is used to capture still images or videos. Typically, camera 193 includes a photosensitive element, such as a lens assembly and an image sensor. The lens assembly includes multiple lenses (convex or concave) that capture light signals reflected from the object to be photographed and transmit the captured light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signals.
[0074] The internal memory 121 can be used to store computer executable program code, which includes 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 solution of the present application, etc.). The data storage area can store data created during the use of the electronic device 100, etc.
[0075] The internal memory 121 may also store one or more computer programs corresponding to the algorithms of the present application. The one or more computer programs are stored in the internal memory 121 and configured to be executed by the one or more processors 110. The one or more computer programs include instructions that can be used to perform the various steps in the following embodiments.
[0076] 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.
[0077] 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.
[0078] A touch sensor, also known as a "touch panel," can be provided on the display screen 194. The touch sensor and the display screen 194 form a touch display screen, also known as a "touch screen." The touch sensor is used to detect touch operations applied to or near the touch sensor. The touch sensor can transmit the detected touch operations 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 provided on the surface of the electronic device 100, at a location different from that of the display screen 194.
[0079] 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.
[0080] 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 antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0081] The mobile communication module 150 can provide wireless communication solutions for the electronic device 100, including solutions for the second generation (2G), third generation (3G), fourth generation (4G), fifth generation (5G), and sixth generation (6G). The mobile communication module 150 can 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, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be provided in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be provided 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.
[0082] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted 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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the 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.
[0083] The wireless communication module 160 can provide wireless communication solutions applied to the electronic device 100, 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 technology (IR), etc. 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, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be transmitted from the processor 110, frequency modulate it, 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 an access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.
[0084] 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 jack 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.
[0085] It should be understood that in actual applications, the electronic device 100 may include more or fewer components than those shown in FIG2 , and the embodiments of the present application are not limited thereto. The illustrated electronic device 100 is merely 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.
[0086] The software system of the electronic device 100 can 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, as shown in Figure 3, the software architecture can be divided into four layers, from top to bottom: the application layer, the application framework layer (framework, FWK), the runtime and system library, and the (Linux) kernel layer.
[0087] 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 realize 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 applications mentioned below can be system applications that are installed on the electronic device when it leaves the factory, or they can be third-party applications that the user downloads from the Internet or obtains from other electronic devices while using the electronic device.
[0088] Of course, developers can write applications and install them into this layer. In one 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 use the application framework to interact with the underlying layer of the operating system (such as the kernel layer) and develop their own applications.
[0089] The application framework layer provides the application API and programming framework. It includes predefined functions and can include a window manager, content provider, view system, telephony manager, resource manager, and notification manager.
[0090] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the display (or screen), capture the display, etc.
[0091] Content providers are used to store and retrieve data and make it accessible to applications. The data may include files (such as documents, videos, images, audio), text, and other information.
[0092] The view system includes visual controls, such as those that display text, images, and documents. The view system is used to build applications. The interface within a display window can be composed of one or more views. For example, the interface for a text notification icon might include a view that displays text and a view that displays an image.
[0093] The phone manager provides communication functionality for electronic devices. The notification manager enables applications to display notifications in the status bar, which can be used to convey informational messages and automatically disappear after a short period of time without user interaction.
[0094] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.
[0095] The system's core library consists of two parts: one containing the Java language's callable functions and the other the system's core library. The application layer and application framework layer run within a virtual machine. For example, in Java, the virtual machine executes Java files from the application and framework layers as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0096] 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 provides the fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, 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.
[0097] The kernel layer provides the operating system's core system services, such as security, memory management, process management, the network protocol stack, and the driver model. These services are all implemented at the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to electronic devices, including the display driver, the keyboard driver for input devices, the Flash driver for memory-based devices, the camera driver, the audio driver, the Bluetooth driver, and the Wi-Fi driver.
[0098] It should be understood that the functional services described above are only examples. In actual applications, electronic devices can also be divided into more or fewer functional services according to other factors, or the functions of each service can be divided in other ways, or the functional services can be not divided but work as a whole.
[0099] The image processing method provided in the embodiment of the present application can be applied to the architecture shown in Figure 2 or Figure 3. 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.
[0100] First, some terms involved in the embodiments of this application are explained below.
[0101] (1) Painting carrier and material type of painting carrier
[0102] In real-life scenarios, paintings are often carried on physical media. A painting medium is the physical medium used to carry the painting. For example, a painting medium can include paper, cloth, board, etc. Generally speaking, any physical medium that can be painted on can be called a painting medium.
[0103] The material type of a painting carrier refers to the material type of the physical medium that can support a painting. From a broad classification perspective, the material types of a painting carrier may include: paper, canvas, drawing board, etc. From a more granular classification perspective, the material types of a painting carrier may include: rice paper, watercolor paper, oil painting paper, canvas, wooden drawing board, etc. This application does not impose any restrictions on this.
[0104] (2) Texture of the painting medium
[0105] In real-world scenarios, painting surfaces can have textures due to different material types and production methods. For example, a wooden painting surface will exhibit unique wood grain, while an oil painting canvas will exhibit fiber weave patterns. Similarly, paper will exhibit different textures due to its different materials and production methods. For example, the texture of rice paper is more delicate than that of optimized paper.
[0106] Taking paper as an example, its texture can often be described as grain, which refers to the natural distribution of fiber texture within the paper. Texture generally refers to the natural patterns or textures on the paper's surface, which are formed by fibers or other materials during the papermaking process. Grain typically refers to the lines or streaks on the paper, which are often caused by molds or other processing equipment during papermaking. Therefore, both the texture and grain of paper can be used to describe the appearance, feel, and quality of paper.
[0107] The texture of paper is characterized by random distribution. Paper of different textures can differ in one or more aspects, including texture brightness, texture gloss, texture depth, texture size (e.g., texture width), texture shape, texture direction, texture grain density, and texture grain fineness. These characteristics, such as texture brightness, texture gloss, texture depth, texture size (e.g., texture width), texture shape, texture direction, texture grain density, and texture grain fineness, can be referred to as texture features.
[0108] Paper texture can also be called paper pattern or PaperPrint.
[0109] (3) Painting style
[0110] The painting styles in the embodiments of the present application are divided based on the painting effect presented by the painting, or in other words, based on the visual effect of the painting. The painting effect presented by the painting is related to the material type and texture of the painting carrier. For example, if a painting is created on canvas, the painting can present the texture of the canvas, giving the painting the visual effect of an oil painting.
[0111] 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.
[0112] It should be understood that in actual scenarios, the painting styles may include more. The embodiment of the present application only lists several possible painting styles by way of example, and the present application does not limit this.
[0113] In some embodiments of the present application, one or more texture images can be obtained in advance and 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 opens the image processing application, the texture images stored in the electronic device can be selected by the user to add a texture effect to the painting.
[0114] In 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.
[0115] Optionally, the texture image in the embodiment of the present application may be a binary image. A binary image is an image in which each pixel 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.
[0116] The storage format of the texture image in the embodiment of the present application can be BMP, JPEG, PNG or TIFF, etc. The present application does not limit the storage format of the texture image.
[0117] The types of texture images involved in the embodiments of the present application are described below.
[0118] 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.
[0119] 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 based on pigment adsorption capacity, and other texture features.
[0120] Among them, the effect presented based on color absorption capacity is related to the depression of the texture. Taking paper as an example, after being soaked in liquid (such as water or liquid pigment), some areas of the paper may appear depressed. The depression phenomenon refers to the fact that after the paper is soaked in 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 these areas than in other areas.
[0121] In one possible implementation, the texture image and the background image of the same painting carrier can be mixed based on one of the following blending modes: dark mode, screen mode, light mode, color burn blending mode, and multiply blending mode. This application does not limit this.
[0122] 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, where each texture image can highlight the characteristics of the texture of the painting carrier in one or more aspects. For example, 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 based on the pigment adsorption capacity.
[0123] For example, 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.
[0124] (1) Texture layer image
[0125] The texture layer image is used to present the texture shape, texture size and texture depth characteristics of the texture of the painting carrier.
[0126] 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 characteristics of the texture under diffuse light conditions (or under light conditions with no specific direction).
[0127] An example of a texture layer image can be seen in FIG4( a ).
[0128] (2) Glossy layer image
[0129] The gloss layer image is used to depict the texture of a painting medium under specific lighting conditions. The texture outline is rendered with its dark areas eliminated and its bright areas highlighted. In other words, the gloss layer image emphasizes the bright areas of the texture. The texture characteristics of the gloss layer image are related to the direction of the light.
[0130] In other words, the gloss layer image can display the texture characteristics of the painting carrier under specific lighting conditions, such as texture brightness, texture gloss, and texture depth. Using the gloss layer image to render the user image texture can reflect the texture effect in the places where the user painted, and the dark areas can show the effect of the user's painting.
[0131] An example of a glossy layer image can be seen in FIG4( b ).
[0132] (3) Glossy absorption layer image
[0133] 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.
[0134] Compared to glossy layer images, glossy absorption layer images contain more bright areas. This means they can depict the texture characteristics of the painting medium under specific lighting conditions, including texture brightness, glossiness, and depth. Using the glossy absorption layer to render a user image with texture can create a textured effect where the user painted, while also creating the illusion of color absorption.
[0135] (4) Color deposition layer image
[0136] 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.
[0137] 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 poor, and the color presented on the paper is lighter than the color of the actual pigment.
[0138] For example, different areas of the same paper may have different texture characteristics (such as the degree of concavity). Furthermore, different areas may also have subtle differences in paper thickness or material, which can affect the color deposition effect. For example, the greater the degree of concavity, the more obvious the color deposition effect.
[0139] An example of a color deposition layer image can be seen in FIG4( c ).
[0140] (5) Shadow layer image
[0141] The shadow layer image is used to represent the texture of the painting medium. The texture outline is rendered with its dark areas highlighted and its bright areas eliminated. In other words, the shadow layer image can emphasize the dark areas of the texture outline. The texture characteristics of the shadow layer image are related to the direction of light.
[0142] It should be understood that the above are only exemplary examples of several possible types of texture images, and this application does not limit them. In actual applications, other types of texture images may be used to present other aspects of paper texture characteristics.
[0143] The following describes how to obtain a texture image by taking the above-mentioned texture image type as an example.
[0144] In one possible implementation, a painting carrier, such as a sheet of paper (for example, a white sheet of paper), may be photographed under different lighting conditions, and the obtained images may be subjected to different image processing 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.
[0145] Optionally, for multiple painting carriers of the same material but different texture characteristics (such as different texture sizes, 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 each of the different painting carriers can be obtained in the above manner.
[0146] Optionally, for painting supports made of different materials, one or more of the following can be obtained using the above method: texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images. For example, a piece of rice paper can be photographed under different lighting conditions and the resulting images processed differently to obtain the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images corresponding to the piece of rice paper. Similarly, a piece of oil painting paper can be photographed under different lighting conditions and the resulting images processed differently to obtain the texture layer images, gloss layer images, gloss absorption layer images, color deposition layer images, and shadow layer images corresponding to the piece of oil painting paper.
[0147] Taking paper as an example, the following describes how to obtain the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image.
[0148] (1) How to obtain texture layer images
[0149] Under diffuse light conditions, a photograph of the paper is taken. A higher pixel can be used for taking pictures to show the inherent texture of the paper fibers. Furthermore, the image obtained by the photograph can be processed, such as removing information such as dust spots on the paper. Then, the image obtained by the photograph 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.
[0150] For example, under outdoor cloudy light conditions (ie, diffusely scattered 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.
[0151] Taking an RGB three-channel image as an example, one implementation of the dark mode can be: for the same pixel position in a paper image (i.e., an image photographed and processed as described above) and a background image of the same size, calculate the sum of the values of the R, G, and B channels of the pixel at that position in the paper image (referred to as the value of the mixed color B), and calculate the sum of the values of the R, G, and B channels of the pixel at that position in the background image (referred to as the value of the base color A). 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 value of the pixel 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 value of the pixel 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.
[0152] The values of the R, G, and B channels range from 0 to 255. For a pixel, if the values of the R, G, and B channels of the pixel are (0, 0, 0), the pixel is displayed as black, and if the values of the R, G, and B channels of the pixel are (255, 255, 255), the pixel is displayed as white.
[0153] By applying dark mode processing to the paper image and background image, the texture in the paper image can be reflected in the texture layer image. Because the paper image was captured under diffuse lighting conditions, the texture layer image can reflect the texture shape, size, and depth characteristics of the paper texture under diffuse lighting conditions.
[0154] (2) Method of obtaining gloss layer image
[0155] Under specific directional lighting conditions, the paper is photographed. Higher pixels can be used to take pictures to show the inherent texture of the paper fibers. Furthermore, the image obtained by the photograph can be processed, such as removing information such as dust spots on the paper. Then, the image obtained by the photograph and the background image are processed in a second mixing mode to obtain the 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 specific directional light conditions, the paper is photographed, and the image obtained by the photograph and the background image are processed by "color filter" to eliminate very dark parts and reflect the outline of the bright parts, thereby obtaining the glossy layer image corresponding to the paper.
[0156] Optionally, the contrast of the captured image may be increased before the color filter mode processing is performed.
[0157] Taking an RGB three-channel image as an example, one implementation of the color filter mode may be:
[0158] For the same pixel position in the paper image (i.e., the image photographed and processed as described above) and the background image of the same size, the value of each channel of the pixel at the same position in the glossy layer image is calculated using the following formula:
[0159] Wherein, C represents the value of one channel of a pixel in the glossy layer image, A represents the value of one channel of a pixel in the background image, and B represents the value of one channel of a 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. The above method is calculated for each pixel to obtain the value of each pixel in the gloss layer image, thereby obtaining the gloss layer image.
[0161] By applying the Screen mode to the paper image and the background image, the complementary color of the paper image pixel's color is multiplied with the complementary color of the background image pixel's color, and then divided by 255 to obtain the resulting mixed pixel value. Typically, the resulting color after applying the Screen mode is lighter; for example, applying the Screen mode to any color and white results in white. For example, applying the Screen mode to the paper image and a white background image can enhance the bright areas of a texture, resulting in a texture outline with very bright highlights.
[0162] (3) Method for obtaining the image of the gloss absorption layer
[0163] Under specific lighting conditions, photograph the paper. A higher-resolution image can be used to capture the inherent texture of the paper fibers. Furthermore, the resulting image can be processed, such as to remove information such as dust spots on the paper. Alternatively, an image captured using the gloss layer image acquisition method can be used. In other words, by applying different processing to the same photographed paper image, a gloss layer image and a gloss absorption layer image can be generated.
[0164] The photographed image and the background image are then processed using a third blending mode to obtain a glossy absorption layer image corresponding to the paper. Exemplarily, the third blending mode can be a lighter color mode, for example, blending the photographed image with the background image in a lighter color. Alternatively, the background image can be a single color image. Alternatively, the background image can be the same background image used to obtain the texture layer image or the gloss layer image.
[0165] For example, under outdoor cloudy light conditions (ie, diffusely scattered light conditions), a piece of paper is photographed, and the photographed image is mixed with a white background image in a "light color" to obtain a glossy absorption layer image corresponding to the paper.
[0166] Taking an RGB three-channel image as an example, one implementation of the light color mode can be: for the same pixel position in a paper image (i.e., an image photographed and processed as described above) and a background image of the same size, calculate the sum of the values of the R, G, and B channels of the pixel at that position in the paper image (referred to as the value of the mixed color B), and calculate the sum of the values of the R, G, and B channels of the pixel at that position in the background image (referred to as the value of the base color A). 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 value of the pixel 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 value of the pixel 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 glossiness, texture depth, etc. under specific lighting conditions.
[0168] (4) Method of 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. Higher pixels can be used for photography to show the inherent texture of the paper fibers. Furthermore, the image obtained by photography can be processed, such as removing information such as spots on the paper. Then, the image obtained by photography 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 outdoor light conditions (ie, diffuse light conditions), the dyed paper is photographed, and the photographed image is mixed with a white background image by "darkening" the color 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 photographed and processed as described above) 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] Wherein, C represents the value of one channel of a pixel in the glossy layer image, A represents the value of one channel of a pixel in the background image, and B represents the value of one channel of a pixel in the paper image.
[0174] 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. The above method is calculated for each pixel to obtain the value of each pixel in the color deposition layer image, and then the gloss layer image is obtained.
[0175] Using the color darkening mode to render the texture of the user image can make only the texture appear in the unpainted areas of the user image. The darker the color of the areas painted by the user, the darker the deposition effect.
[0176] 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 that area, while other areas may be lighter in color, indicating that less color is deposited in that area. This can present the color deposition characteristics of the texture of different areas of the paper.
[0177] 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.
[0178] (5) How to obtain shadow layer images
[0179] Under specific directional lighting conditions, a photograph of the paper is taken. Higher pixels can be used for taking photos to show the inherent texture of the paper fibers. Furthermore, the image obtained by the photograph can be processed, such as removing information such as dust spots on the paper. Then, the image obtained by the photograph 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 specific directional light conditions, the paper is photographed, and the photographed image and the background image are processed by "multiplying" to enhance the outline of the dark part, thereby obtaining a gloss layer image corresponding to the paper.
[0180] Optionally, before performing the multiply blending mode processing, the light and dark of the captured image may be highlighted, and the distribution ratio of the light and dark may be adjusted.
[0181] Taking an RGB three-channel image as an example, one implementation of the multiply mode may be:
[0182] For the same pixel position in the paper image (i.e., the image photographed and processed as described above) 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 using the following formula:
[0183] 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.
[0184] 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. The above method is calculated for each pixel, so that the value of each pixel in the shadow layer image can be obtained, and then the shadow layer image can be obtained.
[0185] The resulting color after applying the Multiply mode is usually darker than both original colors. Multiplying any color with black still results in black, while multiplying any color with white preserves the original color. Applying this mode with other colors creates the effect of lighting in a dark room with that color.
[0186] In another possible implementation, a paper image under diffusely scattered light can be obtained from an existing paper texture image library. Then, a texture layer image can be obtained based on the paper image according to the above-mentioned method for obtaining a texture layer image. By performing image processing or AI processing on the paper image, an image of the paper under lighting conditions in a specific direction can be obtained. Then, a gloss layer image can be obtained according to the above-mentioned method for obtaining a gloss layer image, and a gloss absorption layer image can be obtained according to the above-mentioned method for obtaining a 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, the paper image can be obtained by actual photography or generated by AI.
[0187] 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 a single sheet of paper, a database or data table corresponding to the single sheet of paper can be established to store parameters related to one or more of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image. For example, the parameters may include material type, type and identifier of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image, image size, etc. For example, Table 1 shows an example of a data table corresponding to a single sheet of paper.
[0188] Table 1: Contents of the data table corresponding to the paper
[0189] In Table 1, "ID 1" and "aa" are used to represent specific values, and this application does not impose any restrictions on the values of the specific values. The texture image identifier can uniquely identify the texture image.
[0190] For papers of the same material but with different texture characteristics (such as texture grain size and / or texture grain density), 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 with different texture characteristics, a database or data table corresponding to the paper 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 material.
[0191] Table 2: Contents of the data table corresponding to a type of paper material
[0192] 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) 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, the smaller the density. It is also possible that there is no negative correlation between the texture granularity and the texture density. For example, when the texture granularity 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.
[0193] 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 different materials, a database or data table corresponding to different painting carrier materials can be established to store relevant parameters of one or more of the texture layer image, gloss layer image, gloss absorption layer image, color deposition layer image, and shadow layer image. For example, Table 3 shows an example of a data table corresponding to various paper materials.
[0194] Table 3: Data table contents corresponding to various paper materials
[0195] "ID 1" and the like in Table 3 are used to represent specific numerical values, and this application does not impose any restrictions on the values of the specific numerical values.
[0196] It should be understood that Table 1, Table 2, and Table 3 above are merely examples of several possible data structures, and this application does not impose any limitation on the data structure.
[0197] It should also be understood that Table 1, Table 2, and Table 3 above only show some parameters. In actual scenarios, more parameters may be included, and this application does not limit this.
[0198] In the embodiments of the present application, different texture images can be combined, and each combination can include a single texture image or 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.
[0199] According to the various texture images shown above, embodiments of the present application can combine the above texture images to obtain the following types of combinations:
[0200] Combination 1 includes: texture layer image, shadow layer image, gloss layer image, and color deposition layer image;
[0201] Combination 2 includes: texture layer image, color deposition layer image;
[0202] Combination 3 includes: texture layer image, shadow layer image, gloss layer image;
[0203] Combination 4 includes: texture layer image, shadow layer image, gloss absorption layer image;
[0204] Combination 5 includes: texture layer image, gloss layer image;
[0205] Combination 6 includes: texture layer image, gloss absorption layer image;
[0206] Combination 7 includes: texture layer image, gloss absorption layer image, color deposition layer image;
[0207] Combination 8 includes: texture layer image, gloss layer image, and color deposition layer image.
[0208] The arrangement order of the images included in the above various combinations is only a possible example, and this application does not limit the arrangement order of the images in each combination.
[0209] It should be understood that the above examples only illustrate several possible combinations and are not limiting in this application.
[0210] In the embodiment of the present application, a texture image combination identifier may be set for each texture image combination to uniquely identify the texture image combination.
[0211] In some embodiments of the present application, a correspondence between different texture images and painting styles can be set. Thus, 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 based on the correspondence to obtain a painting of the corresponding style.
[0212] Texture images or combinations of texture images can be set to achieve different painting styles based on the characteristics of different painting styles. For example, an ink painting style painting needs to present a texture effect in the area where the user paints, while also presenting the effect of color absorption. Therefore, a gloss layer image can be used to texture render the painting to achieve the ink painting style. For another example, an oil painting style painting needs 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 relatively obvious. Therefore, the texture layer image and color deposition layer image corresponding to the oil canvas can be used to texture render the painting to achieve the oil painting style.
[0213] Table 4 exemplifies the correspondence between painting styles and texture images.
[0214] Table 4: Correspondence between painting styles and texture images corresponding to the same painting carrier
[0215] 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 a texture layer image. Similarly, other types of texture images in Table 4 may also be understood in the same manner.
[0216] Alternatively, the set of texture images corresponding to the ink painting style in Table 4 can 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 be understood in the same way.
[0217] Table 5 shows the correspondence between the material type of the painting carrier and the texture image.
[0218] Table 5: Correspondence between painting styles and texture images corresponding to the same painting carrier
[0219] 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 a texture layer image. Similarly, other types of texture images in Table 5 may also be understood in the same manner.
[0220] Alternatively, the set of texture images corresponding to "Xuan Paper" in Table 5 can be replaced by the identifier of a texture image combination, for example, "texture layer image, gloss absorption layer image" can be the identifier of a texture image combination. Similarly, the set of texture images corresponding to other material types in Table 5 can be understood in the same way.
[0221] Table 6 shows the correspondence between the painting styles and the material types of the painting carriers and the texture images.
[0222] Table 6: Correspondence between painting styles and material types and texture images corresponding to different painting carriers
[0223] 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.
[0224] Alternatively, in Table 6, the set of texture images corresponding to "texture layer image 1, gloss layer image 1, and color deposition layer image 1" may be replaced by the identifier of a texture image combination. Similarly, "texture layer image 2, gloss layer image 2, and color deposition layer image 2" may be replaced by the identifier of a corresponding texture image combination.
[0225] 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.
[0226] 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 this 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 their needs, and this application does not limit this.
[0227] In one 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, outlined 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 speed at which the paint flows out during the painting process, that is, the "density" of the brush coating. For scenes that require rich and detailed colors, a smaller brush flow rate can be set to achieve this. Conversely, if the main feature of the painting is to emphasize the vividness of the color, a relatively large brush 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 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 and the more obvious the transformation characteristics.
[0228] Based on the influence of the above brush parameters on the painting style, for example, in some embodiments of the present application, if the texture granularity density is 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 texture granularity density is small, a softer brushstroke can be set to achieve a smoother painting effect. This application does not impose any restrictions on this.
[0229] In another possible implementation, the brush parameters may include one or more of a brush shape and a brush material. The brush material may also be referred to as brush granularity, and different brush materials produce line edge contours with different graininess. For example, by setting a correspondence between the density of texture granularity and the brush material, a correlation can be established 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.
[0230] Based on the above-mentioned texture images, when processing images in an embodiment 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.
[0231] The image processing method provided in the embodiment of the present application is described below with reference to FIG. 5 to FIG. 10 .
[0232] See Figure 5 for a schematic diagram illustrating the principles of the image processing method provided in an embodiment of the present application. As shown in Figure 5 , when processing a user's image, the background layer, the layer containing the user's image, and the layer containing the texture image can be blended. After blending, these layers are merged into a single layer, and the image on this layer is a texture-rendered image with a certain painting style.
[0233] 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.
[0234] 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.
[0235] Since the texture images used to achieve a certain painting style may include one or more, accordingly, the layers where the texture images in FIG. 5 are located may also include one or more, and there is only one texture image on one layer.
[0236] These layers may be arranged in the order shown in FIG5(a) or in the order shown in FIG5(b).
[0237] When blending these layers, the blending process is performed on the pixels in each layer at the same position. Taking the pixel position shown in (b) in Figure 5 as an example, when 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. This pixel value is the pixel value of the pixel at that position on the merged layer, and the image carried by this layer is the texture rendered image.
[0238] Depending on the painting style, the blending mode used to blend these layers may vary. The blending modes used include, but are not limited to, the following: Darken, Multiply, Color Burn, Linear Burn, Darker Color, Add, Lighten, Screen, Color Dodge, Linear Dodge, Lighter Color, Overlay, Soft Light, Hard Light, Vivid Light, Linear Light, Pin Light, Hard Mix, Difference, Exclusion, Subtract, Divide, etc. This application does not limit the blending modes used.
[0239] Based on the above principles, the embodiment of the present application provides a system architecture of an image processing application as shown in FIG6 , based on the system architecture shown in FIG3 .
[0240] Referring to FIG6 , a schematic diagram of the system architecture of an image processing application provided in an embodiment of the present application is shown. This architecture may include a texture image management module 11 and an image processing module 21. Optionally, it may also include a texture parameter management module 12. Optionally, it may also include a brush parameter management module 13. The texture image management module 11, texture parameter management module 12, and 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. Images processed by the image processing module 21 may be displayed by the display module 30.
[0241] 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:
[0242] Aspect 1: Storage management of texture images. The texture image management module 11 can maintain the storage location of texture images, thereby retrieving the corresponding texture image based on the material type or painting style selected by the user and providing 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, for example, by establishing and maintaining the data structures shown in Table 1, Table 2, or Table 3.
[0243] Aspect 2: Managing the correspondence between texture images and painting styles. For example, the data structure shown in Table 4 or Table 5 can be stored and maintained.
[0244] Aspect 3: In response to the user's selected painting style, material type and / or texture characteristics (for example, including the density of texture granularity and / or the size of texture granularity, etc.), the corresponding texture image is obtained and provided to the image processing module 21 (or the corresponding texture image is loaded into the image processing module 21).
[0245] 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.
[0246] 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.
[0247] It should be understood that the above is merely an example of the management functions that the texture image management module 11 may have, and the embodiment of the present application does not limit this.
[0248] 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 instruct the texture parameter management module 12 which texture image to modify.
[0249] 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 using the following method:
[0250] Method 1: If the difference between the user image and the texture image is within a tolerable range (e.g., both horizontal and vertical differences are within plus or minus 10%), the texture image can be scaled to match the user image's size. Since the size difference between the texture image and the user image is small, stretching the texture image will not significantly affect its texture features, ensuring the desired painting style is retained.
[0251] Method 2: If the size of the user image is larger than the size of the texture image and exceeds the above-mentioned tolerance range, multiple copies of the texture image can be copied and stitched together to match the size of the user image. It is understood that if the size of the stitched texture image is too large, the stitched texture image can be cropped to match the size of the user image.
[0252] In this way, the texture features in the texture image can be kept unchanged, thereby ensuring the presentation of the corresponding painting style.
[0253] Method 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.
[0254] In this way, the texture features in the texture image can be kept unchanged, thereby ensuring the presentation of the corresponding painting style.
[0255] 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 adjust the texture features of the specified texture image in the following manner to meet the user's requirements:
[0256] 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 texture granularity density. The texture image with increased texture granularity density can then be copied and spliced to obtain a texture image with a texture granularity density that meets the requirements and a size that matches the user image size.
[0257] 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 with a texture granularity density that meets the requirements and a size that matches the user image size.
[0258] 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.
[0259] It should be understood that the above is merely an example of the functions that may be implemented by the texture parameter management module 12, and the embodiments of the present application do not limit this.
[0260] The brush parameter management module 13 can set the brush according to the instructions 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 based on the texture characteristics of the texture image (such as the density of the texture grain and / or the size of the texture grain), and send an instruction to set the brush parameters to the brush parameter management module 13. The instruction indicates the specific brush parameters to the brush parameter management module 13; the brush parameter management module 13 then sets the brush according to the instruction.
[0261] The image processing module 21 can perform mixed processing on the user's image and the loaded texture image. For a specific implementation method, reference can be made to the principle shown in FIG5 .
[0262] The display module 30 can display the processed image.
[0263] It should be understood that the information flow indicated by the arrows in FIG6 is merely one possible example and is not intended to be limiting in this application. For example, after modifying a texture image, texture parameter management module 12 may not send the modified texture image to texture image management module 11, but may instead notify texture image management module 11 of the storage location of the modified texture image. For another example, image processing module 21 may store the texture-rendered image in a cache unit, and display module 30 may retrieve the image data to be displayed from this cache unit and display it.
[0264] In some embodiments of the present application, while a user is drawing, a drawing effect matching the user's selected drawing style and / or material type can be displayed in real time following the user's drawing operation. In other words, a what-you-see-is-what-you-get display effect can be achieved. This implementation is described below with reference to FIG7 .
[0265] Based on the system architecture shown in FIG6 , when the image processing application is started, the process shown in FIG7 may include the following steps:
[0266] Step 701: The electronic device receives first information, where the first information indicates a painting style and / or a material type of a painting carrier requested by a user.
[0267] In one possible implementation, a user may perform a first user operation through a user interface provided by an image processing application to submit user-requested information, such as a requested painting style and / or a material type of a painting medium, to the image processing application. This first user operation causes the image processing application to perform texture rendering on the currently drawn image based on the first information while the user is drawing the image.
[0268] 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 to trigger a function option for creating a painting (for example, the user clicks the "Create Painting" function key or selects the "Create Painting" menu command), or receive a user operation to trigger a function option for setting a texture (for example, the user clicks the "Set Texture" function key). In response to the received user operation, the electronic device displays 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 based on the received user operation for selecting the option information.
[0269] The following is an explanation of the user interface shown in Figure 8. As shown in Figure 8, the user interface 800 includes an image editing area 801, a settings area 802, and a layer operation area 803. The settings area 802 may include a menu, multiple settings function keys, etc., such as a "texture settings" function key. When the user triggers the "texture settings" function key, a painting style setting window 804 pops up. The painting style setting window 804 includes painting style options and a slider for setting the texture granularity density. The user can select a painting style through this window and further use the slider to set the texture granularity density. Optionally, the texture granularity density can be set by default.
[0270] 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.
[0271] 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.
[0272] 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.
[0273] It can be understood that the above only exemplifies an implementation method of obtaining the first information based on user interaction. In actual scenarios, the first information can also be obtained through other methods, and this application does not limit this.
[0274] This step can be implemented by the texture image management module 11 .
[0275] Step 702: The electronic device determines a texture image corresponding to the requested painting style and / or material type based on the first information.
[0276] In one possible implementation, the electronic device may determine one or more texture images corresponding to the requested painting style based on 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).
[0277] 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 images corresponding to the requested material may include all texture images corresponding to the material.
[0278] 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).
[0279] In another possible implementation, the electronic device may modify the texture image according to the texture feature requirements requested by the user to obtain a texture image that meets the texture feature requirements. For specific implementations, please refer to the functions of the texture parameter management module.
[0280] Exemplarily, a user may perform a fifth user operation based on a user interface provided by an application, and the electronic device may obtain the texture feature information set by the user based on the fifth user operation. For example, after receiving a user operation of a slider on a slider control, the electronic device may determine the texture feature information set by the user based on 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 based on 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.
[0281] 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.
[0282] 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 blends the layer where the user's image is located with the layer where the texture image is located.
[0283] The layer where the user's image is located may include one layer or multiple layers.
[0284] According to the number of texture images determined in step 702 , the layer where the texture image is located may include one layer or multiple layers.
[0285] Optionally, the arrangement order of the layer where the texture image is located and the layer where the user image is located can refer to FIG5 .
[0286] Optionally, the layer containing the texture image is not visible to the user.
[0287] Optionally, the layer containing the texture image is visible to the user. Optionally, the layer containing the texture image is not allowed to be edited by the user, or only provides limited editing functions to the user, such as only allowing transparency to be set.
[0288] The specific implementation of this step can refer to the principle shown in FIG5 .
[0289] 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.
[0290] Step 704: The electronic device displays the mixed image.
[0291] 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.
[0292] This step can be implemented by the display module 30 .
[0293] 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.
[0294] In one possible implementation, when the first information also indicates texture feature information, the electronic device may further determine brush parameters corresponding to the texture feature information based on the texture feature information indicated by the first information and a fourth correspondence, and set the brush based on the brush parameters. The fourth correspondence includes a correspondence between texture feature information and brush parameters.
[0295] In one possible implementation, when a user needs to modify a painting style, material type, or texture feature information, they can select a new painting style or material type, or set new texture feature information, using a human-computer interaction method based on a user interface provided by the application. This allows the application to perform texture rendering on the user's image based on the new painting style or material type, or the set new texture feature information. This human-computer interaction method is similar to the first user operation described above, such as selecting a new session style by triggering the "Texture Settings" function key.
[0296] 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.
[0297] In other embodiments of the present application, while a user is drawing, a drawing effect matching the user's selected drawing style or material type can be displayed based on the user's "preview" or similar instructions. If the user cancels the "preview" option, the normal display can be restored. This implementation is described below with reference to FIG9 .
[0298] Based on the system architecture shown in FIG6 , when the image processing application is started, the process shown in FIG9 may include the following steps:
[0299] Step 901: The electronic device displays an image of the user (which may be referred to as a first image).
[0300] 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 with a texture image.
[0301] Step 902: The electronic device receives a user's request for a "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.
[0302] In this step, when the user performs a user operation to trigger a preview of the function option of 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.
[0303] For example, the third user operation may include: triggering a "painting effect preview" button 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.
[0304] This step can be implemented by the texture image management module 11 .
[0305] 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.
[0306] In one possible implementation, the painting style or material type can be selected or set before the painting begins. For a specific implementation, please refer to step 701 in Figure 7. Unlike the process shown in Figure 7, in the process shown in Figure 9, when the electronic device obtains the painting style requested by the user or the material type selected, it can default to turning off the function of processing the user-drawn picture based on the texture image during the user's painting process. Alternatively, after the user selects the painting style or material type, a user interface can be provided for the user to choose whether to turn on the function of rendering based on the texture image. If the user chooses to turn on the function of rendering based on the texture image, the process shown in Figure 7 is executed. If the user chooses to turn off the function of rendering based on the texture image, the process shown in Figure 9 is executed.
[0307] In another possible implementation, after the electronic device receives a user's request for a "painting effect preview," it may display a user interface for setting or selecting a painting style and / or material type. For example, the user interface may include a function option for the user to select a painting style from multiple painting styles provided by the application, or a function option for the user to select a material type from multiple material types provided by the application. After the electronic device receives the painting style and / or material type set or selected by the user, step 904 may be executed.
[0308] This step can be implemented by the texture image management module 11 .
[0309] Step 904: The electronic device performs blending processing on the layer where the user's image is located and the layer where the texture image is located.
[0310] 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.
[0311] The specific implementation of this step can refer to the principle shown in FIG5 .
[0312] 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.
[0313] Step 905: The electronic device displays the mixed image.
[0314] For the implementation of this step, please refer to step 704.
[0315] 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.
[0316] Optionally, after receiving the user's request to cancel the “painting effect preview”, the electronic device may exit the image editing mode and continue to respond to the user's painting operation.
[0317] 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.
[0318] It should be understood that in the process shown in FIG. 9 , more specific implementation methods can refer to the aforementioned embodiments and will not be repeated here.
[0319] Compared with the image processing method shown in Figure 7, the image processing method shown in Figure 9 can be used. During the user's painting process, image processing and display can be performed in a conventional manner. 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 according to the user's "painting effect preview" request, thereby reducing resource overhead.
[0320] In other embodiments of the present application, a loaded user image can be edited. This editing operation can be used to process the user image based on the painting style or material type selected by the user, so that the user image presents the corresponding painting style. The image processing method shown in Figure 10 can be used to process existing or completed images. This method is described below with reference to Figure 10.
[0321] Based on the system architecture shown in FIG6 , when the image processing application is started, the process shown in FIG10 may include the following steps:
[0322] Step 1001: The electronic device obtains an image (which may be referred to as a first image) that a user requests to process.
[0323] 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.
[0324] Step 1002: The electronic device receives a second user operation and obtains first information based on the second user operation, wherein the first information indicates a painting style and / or a material type of a painting medium. The second user operation is used to request texture rendering of a requested first image based on the first information.
[0325] 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 based on the received user operation for selecting the option information.
[0326] For the specific implementation of this step, please refer to step 701.
[0327] Step 1003: The electronic device determines a texture image corresponding to the requested painting style and / or material type.
[0328] For the specific implementation of this step, please refer to step 702.
[0329] Step 1004: The electronic device performs blending processing on the layer where the first image requested for processing is located and the layer where the texture image is located.
[0330] 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.
[0331] The specific implementation of this step can refer to the principle shown in FIG5 .
[0332] 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.
[0333] For example, Figure 11 shows a comparative schematic diagram 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 the 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 real paper with a specific texture than before texture rendering.
[0334] On the other hand, since the image processing method provided in the embodiment of the present application uses texture images to achieve the texture effect of the image, there is no need to model the texture, which can reduce the resource overhead of image processing.
[0335] 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.
[0336] 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.
[0337] An embodiment of the present application further provides a computer-readable storage medium, 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.
[0338] 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.
[0339] An embodiment of the present application also provides a chip, including a processor, which 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.
[0340] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can 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 can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0341] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or box in the flow chart and / or block diagram, as well as the combination of the flow chart and / or box in the flow chart 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 functions specified in one or more flow charts and / or one or more boxes in the block diagram.
[0342] 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 operate in a specific manner, so that the instructions stored in the computer-readable memory produce a 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.
[0343] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that 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.
[0344] Obviously, those skilled in the art may 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 intended to include these modifications and variations.
Claims
1. An image processing method, characterized in that: Applied to electronic equipment, the method includes: launching an application, wherein the application includes a painting application or an image editing application; Acquire the painting information selected by the user, wherein the painting information includes information on the painting style or the material type of the painting carrier; Acquire a user's drawing operation, perform texture rendering on a currently drawn first image according to the drawing information, generate a second image, and display the second image, wherein the second image has a texture drawing effect matching the drawing information selected by the user.
2. The image processing method according to claim 1, wherein: The obtaining of the user's drawing operation, performing texture rendering on the currently drawn first image according to the drawing information, generating a second image, and displaying the second image includes: When the user is drawing, the second image is displayed in real time following the user's drawing operation.
3. The image processing method according to claim 1 or 2, characterized in that: Generating the second image includes: The first image is mixed with one or more texture images to generate a second image, wherein the one or more texture images correspond to the painting information selected by the user.
4. The image processing method according to any one of claims 1 to 3, characterized in that: The one or more texture images are generated based on textures corresponding to the material type of the painting style or painting carrier, and the one or more texture images are used to mix and present textures corresponding to the material type of the painting style or painting carrier.
5. The image processing method according to claim 4, characterized in that The one or more texture images are used to present different texture features of the same painting style or painting carrier, wherein the texture features include one or more of the following: texture shape, texture size, texture depth, dark contour features, bright contour features, light contour features, and effects based on pigment adsorption capacity.
6. The image processing method according to claim 5, characterized in that The texture characteristics of the effect presented based on the pigment adsorption capacity are related to the depressions presenting the texture.
7. The image processing method according to any one of claims 4 to 6, characterized in that: The one or more texture images include one or more of the following: Texture layer images, used to represent texture shape, size, and depth under diffuse light conditions; A glossy layer image, used to present a texture outline under a lighting condition in a specific direction, wherein the dark outline of the texture outline is eliminated and the bright outline is highlighted; A gloss absorption layer image, used to present a texture outline under lighting conditions in a specific direction, wherein dark portions of the texture outline are eliminated and light portions are highlighted; Color deposition layer images, used to present effects based on pigment adsorption capacity; The shadow layer image is used to present the texture outline under the lighting conditions of a specific direction, in which the bright part outline of the texture outline is eliminated and the dark part outline is highlighted.
8. The image processing method according to any one of claims 1 to 7, characterized in that: The painting information further includes information on texture features, where the information on texture features includes texture granularity density and / or texture granularity size of one or more corresponding texture images.
9. The image processing method according to claim 8, characterized in that: The method further comprises: According to the information of the texture feature selected by the user, the pattern size of the one or more texture images corresponding to the painting information is adjusted.
10. The image processing method according to any one of claims 1 to 9, characterized in that: The texture feature information includes one or more of texture shape, texture size, texture depth, dark contour features, bright contour features, light contour features, and effects presented based on pigment adsorption capacity.
11. The image processing method according to claim 10, wherein: 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; 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 light conditions in a specific direction, and the fifth image is an image of the texture of the same painting carrier after being impregnated.
12. The image processing method according to claim 11, wherein: The first blending mode is a dark mode, or the second blending mode is a screen mode, or the third blending mode is a light mode, or the fourth blending mode is a color darkening blending mode, or the fifth blending mode is a multiply blending mode.
13. The image processing method according to any one of claims 1 to 12, characterized in that: The method further comprises: A corresponding painting carrier is presented according to the painting information selected by the user, wherein the corresponding painting carrier is mixed with the corresponding one or more texture images.
14. The image processing method according to claim 13, wherein: The method further comprises: A background image corresponding to the painting carrier is displayed on the interface of the first application.
15. The image processing method according to any one of claims 1 to 14, characterized in that: The first image includes: The image currently displayed on the interface of the application; or The background image presented on the application interface.
16. The image processing method according to any one of claims 1 to 15, characterized in that: The method further comprises: Display the first edit control in the interface for creating a painting, or Display the first editing control in the texture setting function option interface, or The first editing control is displayed on the function option interface of previewing the current image.
17. The image processing method according to any one of claims 1 to 16, 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.
18. The image processing method according to any one of claims 1 to 17, 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: dark mode, filter mode, light mode, color darkening mixing mode, and multiply mixing mode.
19. The image processing method according to any one of claims 1 to 18, characterized in that: The step of performing texture rendering on the first image includes: 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.
20. The image processing method according to claim 19, wherein: The blending mode is associated with the painting style indicated by the first information, or the blending mode is associated with the material type indicated by the first information.
21. The image processing method according to any one of claims 1 to 20, characterized in that: The first information further indicates information of texture features, wherein the information of texture features indicates texture granularity density and / or texture granularity size; The method further comprises: Determining, according to the texture feature information indicated by the first information, brush parameters corresponding to the texture feature information; Sets the brush according to the brush parameters.
22. The image processing method according to claim 21, 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.
23. The image processing method according to any one of claims 1 to 22, 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 style, leather style, print style, rock color style, and metal style.
24. The image processing method according to any one of claims 1 to 23, characterized in that: The material type of the painting carrier includes one or more of paper, canvas, and drawing board.
25. A device, characterized in that The method comprises a unit or module for executing the method according to any one of claims 1 to 24.
26. A device, characterized in that include: One or more processors configured to execute the method of any one of claims 1-24.
27. A readable storage medium, characterized in that The readable storage medium includes a program, and when the program is run on a device, the device is caused to perform the method according to any one of claims 1 to 24.
28. 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 according to any one of claims 1 to 24.
29. 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 24 is implemented.
Citation Information
Patent Citations
Information processing method and device, readable storage medium and electronic device
CN114299211A
Three-dimensional scene rendering method and device
CN115330918A
Method and device for rendering virtual model, storage medium and electronic equipment
CN117036573A
Line stylization through graphics processor unit (GPU) textures
US20160012618A1
Illumination-Guided Example-Based Stylization of 3D Renderings
US20170358128A1