WO2021189880A1 - 头发的渲染方法、装置、电子设备及存储介质 - Google Patents
头发的渲染方法、装置、电子设备及存储介质 Download PDFInfo
- Publication number
- WO2021189880A1 WO2021189880A1 PCT/CN2020/129859 CN2020129859W WO2021189880A1 WO 2021189880 A1 WO2021189880 A1 WO 2021189880A1 CN 2020129859 W CN2020129859 W CN 2020129859W WO 2021189880 A1 WO2021189880 A1 WO 2021189880A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- hair
- motion state
- particle
- area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—Two-dimensional [2D] image generation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/20—Three-dimensional [3D] animation
- G06T13/40—Three-dimensional [3D] animation of characters, e.g. humans, animals or virtual beings
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—Two-dimensional [2D] image generation
- G06T11/10—Texturing; Colouring; Generation of textures or colours
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—Three-dimensional [3D] image rendering
- G06T15/04—Texture mapping
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/56—Particle system, point based geometry or rendering
Definitions
- the present disclosure relates to the field of image processing technology, and in particular to hair rendering methods, devices, electronic equipment, and storage media.
- the pixels in the hair area are subjected to rendering processing such as color replacement and blurring through the CPU (central processing unit) on the PC (personal computer) side or the server side.
- CPU central processing unit
- the current rendering method has a large amount of calculations, and the processing of the hair particle information by the CPU is often complicated, and real-time rendering cannot be realized on the mobile terminal.
- the processing of the hair particle information by the CPU is often complicated, and real-time rendering cannot be realized on the mobile terminal.
- there is an increasing demand for live broadcasting through the mobile terminal so it is necessary to provide a method capable of real-time rendering of the hair on the mobile terminal.
- the present disclosure provides a hair rendering method, method, device, electronic device, and storage medium, so as to at least solve the problem that the hair cannot be rendered in real time on the mobile terminal in the related art.
- the technical solutions of the present disclosure are as follows:
- a hair rendering method including: obtaining a target video containing hair information, selecting a target image frame from image frames of the target video; and obtaining a texture of the target image frame An image, wherein the texture image is an image in a texture format that records the motion state and state change information of pixels in the target image frame, and the hair area in the texture image is divided into at least one particle area by a grid line; Acquire the first target motion state and target state change information of the first target particle region from the texture image, wherein the first target particle region is any region of the at least one particle region; according to the first target particle region The target motion state and the target state change information determine the second target motion state of the first target particle area in the next image frame, wherein the next image frame is the target image frame of the target video The next frame of image; the motion state in the texture image is updated according to the second target motion state to render the hair region.
- the step of updating the motion state in the texture image according to the second target motion state includes: performing the motion state of the first target particle region according to the second target motion state Update and retain the movement state of the remaining particle area; the remaining particle area is other particle areas in the at least one particle area except for the first target particle area.
- the first target motion state includes first screen coordinates
- the target state change information includes a first speed
- the first target motion state and the target state change information are used to determine the first
- the step of the second target motion state of the target particle area in the next image frame includes: determining the time difference between the target image frame and the next image frame; according to the first screen coordinates, the first The difference between the speed and the time determines the second screen coordinates of the first target particle area in the next image frame as the second target motion state.
- the step of updating the motion state in the texture image according to the second target motion state includes: if the second screen coordinates are outside the hair area, re-determining the texture The hair region of the image, and determine the second target particle region from the particle region corresponding to the newly determined hair region; obtain the reference target motion state and reference target state change information of the second target particle region from the texture image; According to the reference target motion state and the reference target state change information, determine the motion state of the second target particle region in the next image frame to obtain a third target motion state; according to the third target motion The state updates the motion state in the texture image.
- the first target motion state includes a second speed
- the target state change information includes a hair direction angle
- the first target is determined according to the first target motion state and the target state change information
- the step of the second target motion state of the particle area in the next image frame includes: obtaining a preset speed; and determining the first target particle area according to the second speed, the hair direction angle, and the speed At the third speed in the next image frame, the second target motion state is obtained.
- the method further includes: determining the candidate state of each pixel in the target image frame according to the time-varying pixel state information in the target video Change information; obtain the hair direction map and the hair region mask map corresponding to the target image frame; the hair direction map contains the hair direction angle of each pixel, and the hair region mask map contains some The mask information of the hair region in the target image frame; determine the candidate motion state of each pixel according to the hair direction angle in the hair direction map and the mask information in the hair region mask map; The candidate state change information and the candidate motion state are stored in the vertex position of the at least one particle region; wherein the vertex position of the at least one particle region corresponds to the respective pixel point.
- the method further includes: storing the texture image in a first frame buffer
- the method further includes: storing the texture image in the first frame buffer in the second frame buffer; updating The subsequent texture image is stored in the first frame buffer.
- the method further includes: determining a hair region in the texture image; and performing grid division on the hair region according to a predetermined number of particle beams, A corresponding at least one particle beam is obtained; and the at least one particle beam is respectively grid-divided according to the predetermined number of particles to obtain the corresponding at least one particle area.
- the method before the step of acquiring the first target motion state and target state change information of the first target particle region from the texture image, the method further includes: setting the at least one particle beam in a set position The particle area is determined as the first target particle area.
- a hair rendering device including: an image frame determining unit configured to perform acquisition of a target video containing hair information, and select a target image frame from the image frames of the target video
- the texture image acquisition unit is configured to perform acquisition of the texture image of the target image frame, wherein the texture image is an image in a texture format that records the motion state and state change information of pixels in the target image frame, so The hair area in the texture image is divided into at least one particle area by a grid line;
- the state information obtaining unit is configured to obtain the first target motion state and target state change information of the first target particle area from the texture image, Wherein, the first target particle area is any area of the at least one particle area;
- the motion state determining unit is configured to perform determining the The second target motion state of the first target particle area in the next image frame, wherein the next image frame is the next image of the target image frame in the target video;
- the motion state update unit is configured to Performing updating the motion state in the texture image according to the second
- the motion state update unit is further configured to perform update of the motion state of the first target particle region according to the second target motion state, and retain the motion state of the remaining particle regions, wherein The remaining particle area is another particle area except for the first target particle area in the at least one particle area.
- the first target motion state includes first screen coordinates
- the target state change information includes a first speed
- the motion state determination unit includes: a time difference determination subunit configured to perform the determination The time difference between the target image frame and the next image frame; a first motion state determination subunit configured to perform determining according to the first screen coordinates, the first speed, and the time difference
- the second screen coordinates of the first target particle area in the next image frame are used as the second target motion state.
- the motion state update unit includes: a particle area determination subunit configured to perform redefining the hair area of the texture image if the second screen coordinates are outside the hair area, and resetting Determine the second target particle region in the particle region corresponding to the determined hair region; the state information acquiring subunit is configured to perform acquiring the reference target motion state and the reference target state of the second target particle region from the texture image Change information; a second motion state determination subunit configured to perform determination of the motion state of the second target particle area in the next image frame according to the reference target motion state and the reference target state change information To obtain the third target motion state; the motion state update subunit is configured to perform update of the motion state in the texture image according to the third target motion state.
- the first target motion state includes a second speed
- the target state change information includes a hair direction angle
- the motion state determination unit includes: a rate acquisition subunit configured to perform acquisition of a preset Speed; a third motion state determination subunit, configured to perform determining the third of the first target particle area in the next image frame according to the second speed, the hair direction angle, and the speed Speed to obtain the second target motion state.
- the hair rendering device further includes: a state change information determining unit configured to determine the candidate of each pixel in the target image frame according to the pixel state information that changes over time in the target video State change information; an image acquisition unit configured to perform acquisition of a hair direction map and a hair region mask map corresponding to the target image frame; the hair direction map includes the hair direction angles of the respective pixels, the The hair region mask map contains the mask information of the hair region in the target image frame; the candidate motion state determination unit is configured to execute the hair region mask map based on the hair direction angle in the hair direction map The mask information in, determines the candidate motion state of each pixel; the candidate motion state storage unit is configured to perform storing the candidate state change information and the candidate motion state to the vertex of the at least one particle area Position; wherein the vertex position of the at least one particle area corresponds to the respective pixel point.
- a state change information determining unit configured to determine the candidate of each pixel in the target image frame according to the pixel state information that changes over time in the target video State change information
- the hair rendering device further includes: a first image storage unit configured to execute storing the texture image in a first frame buffer; an image dumping unit configured to execute storing the first frame The texture image in the buffer is stored in the second frame buffer; the second image storage unit is configured to execute the storage of the updated texture image in the first frame buffer.
- the hair rendering apparatus further includes: a region determining unit configured to perform determining the hair region in the texture image; The region is grid-divided to obtain at least one corresponding particle beam; the particle beam dividing unit is configured to perform grid division of the at least one particle beam according to a predetermined number of particles to obtain at least one corresponding particle region.
- the hair rendering device further includes: a particle region determining unit configured to determine a particle region at a set position in the at least one particle beam as the first target particle region.
- an electronic device including a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to execute the instructions to achieve the above The described hair rendering method.
- a storage medium is provided.
- the electronic device can execute the hair rendering method described above.
- a computer program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of the device obtains data from the readable storage medium.
- the computer program is read and executed, so that the device executes the hair rendering method described in the above embodiment.
- the texture image of the target image frame is acquired according to the target video containing the hair information, the texture image can be processed by the GPU; the hair region in the texture image is divided into at least A particle area can realize the GPU processing of the particle area, while greatly simplifying the graphics processing efficiency of the GPU, and realizes the calculation on the mobile terminal; in addition, obtain the first target motion state and target state change information of the target particle area from the texture image According to this, the second target motion state of the first target particle region in the next image frame is determined, and the motion state in the texture image is updated according to the second target motion state to realize the rendering of the hair region.
- real-time rendering of the hair area can be realized on the mobile terminal, and the motion state of the specific particle area can be modified at the same time, so that the special rendering effect of particles flowing along the hairline direction can be realized.
- Fig. 1 is a diagram showing an application environment of a hair rendering method according to an exemplary embodiment.
- Fig. 2 is a flow chart showing a method for rendering hair according to an exemplary embodiment.
- Fig. 3 is a schematic diagram showing the structure of a particle beam according to an exemplary embodiment.
- Fig. 4 is a schematic diagram showing a display of hair rendering according to an exemplary embodiment.
- Fig. 5 is a flowchart showing a method for rendering hair according to another exemplary embodiment.
- Fig. 6 is a block diagram showing a device for rendering hair according to an exemplary embodiment.
- the hair rendering method provided in the present disclosure can be applied to the device 100 as shown in FIG. 1.
- the device 100 may be a mobile terminal, such as a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and so on.
- the device 100 may include one or more of the following components: a processing component 101, a memory 102, a power supply component 103, a multimedia component 104, an audio component 105, an input/output (I/O) interface 106, a sensor component 107, and Communication component 108.
- a processing component 101 a memory 102
- a power supply component 103 a multimedia component 104
- an audio component 105 an input/output (I/O) interface 106
- sensor component 107 a sensor component 107
- Communication component 108 Communication component
- the processing component 101 generally controls the overall operations of the device 100, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
- the processing component 101 may include one or more processors 109 to execute instructions to complete all or part of the steps of the foregoing method.
- the processing component 101 may include one or more modules to facilitate the interaction between the processing component 101 and other components.
- the processing component 101 may include a multimedia module to facilitate the interaction between the multimedia component 104 and the processing component 101.
- the memory 102 is configured to store various types of data to support operations in the device 100. Examples of such data include instructions for any application or method operating on the device 100, contact data, phone book data, messages, pictures, videos, and the like.
- the memory 102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
- SRAM static random access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM erasable Programmable read only memory
- PROM programmable read only memory
- ROM read only memory
- magnetic memory flash memory
- flash memory magnetic or optical disk.
- the power supply component 103 provides power to various components of the device 100.
- the power supply component 103 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 100.
- the multimedia component 104 includes a screen that provides an output interface between the device 100 and the user.
- the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
- the touch panel includes one or more touch sensors to sense touch, sliding, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure related to the touch or slide operation.
- the multimedia component 104 includes a front camera and/or a rear camera. When the device 100 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
- the audio component 105 is configured to output and/or input audio signals.
- the audio component 105 includes a microphone (MIC).
- the microphone When the device 100 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals.
- the received audio signal can be further stored in the memory 102 or sent via the communication component 108.
- the audio component 105 further includes a speaker for outputting audio signals.
- the I/O interface 106 provides an interface between the processing component 101 and a peripheral interface module.
- the above-mentioned peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: home button, volume button, start button, and lock button.
- the sensor component 107 includes one or more sensors for providing the device 100 with various aspects of state evaluation.
- the sensor component 107 can detect the on/off status of the device 100 and the relative positioning of components.
- the component is the display and keypad of the device 100.
- the sensor component 107 can also detect the position change of the device 100 or a component of the device 100. , The presence or absence of contact between the user and the device 100, the orientation or acceleration/deceleration of the device 100, and the temperature change of the device 100.
- the sensor assembly 107 may include a proximity sensor configured to detect the presence of nearby objects when there is no physical contact.
- the sensor component 107 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
- the sensor component 107 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
- the communication component 108 is configured to facilitate wired or wireless communication between the device 100 and other devices.
- the device 100 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof.
- the communication component 108 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel.
- the communication component 108 further includes a near field communication (NFC) module to facilitate short-range communication.
- the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
- RFID radio frequency identification
- IrDA infrared data association
- UWB ultra-wideband
- Bluetooth Bluetooth
- the device 100 may be implemented by one or more application-specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field-available A programmable gate array (FPGA), controller, microcontroller, microprocessor, or other electronic components are implemented to implement the above methods.
- ASIC application-specific integrated circuits
- DSP digital signal processors
- DSPD digital signal processing devices
- PLD programmable logic devices
- FPGA field-available A programmable gate array
- controller microcontroller, microprocessor, or other electronic components are implemented to implement the above methods.
- Fig. 2 is a flow chart showing a method for rendering hair according to an exemplary embodiment.
- the method for rendering hair can be used in the device 100 shown in Fig. 1 (and can also be specifically used in the processor 109 in Fig. 1 More specifically, it can also be applied to the GPU of the device 100), as shown in FIG. 2, including the following steps S201/S202/S203/S204/S205, which are described in detail as follows:
- step S201 a target video containing hair information is acquired, and a target image frame is selected from the image frames of the target video.
- the target video may be a video obtained by collecting the head of a human body (or an animal body) through a shooting device.
- the photographing device may be the sensor component 107 on the device 100, or may be a camera that has a network connection relationship with the device 100.
- the hair information contained in the target video may refer to information such as the location of the hair area, the size of the hair area, the real-time position of the hair area, the hair color, the length of the hair, the direction of the hair, and so on.
- the camera can shoot a target video containing hair information for a set time period, and send the captured target video to the device 100 (or directly to the processor of the device 100), and the processor performs hair rendering. Furthermore, the camera may shoot the target video in advance, and send the captured target video to the device 100 together; it may also send the target video to the processor in real time during the shooting process.
- each time sequence of the target video corresponds to an image frame
- the device 100 can perform hair rendering processing on one or some of the image frames in a one-time hair rendering program, and the one or some image frames can be understood Is the target image frame.
- the target image frame may be an image frame randomly selected from the target video, or may be several consecutive image frames selected in a time sequence.
- step S202 a texture image of the target image frame is acquired, where the texture image is an image in a texture format that records the motion state and state change information of pixels in the target image frame, and the texture image in the texture image
- the hair area is divided into at least one particle area by the grid line.
- the texture format is a pixel format that can be recognized by the GPU.
- the texture image in the embodiment of the present disclosure is the image in the texture format.
- the texture image can also be directly referred to as "texture", which can be half float (half float). Point) or float (floating point) type texture map.
- the texture image of the target image frame is acquired, and the GPU in the device 100 processes the texture image.
- the hair area in the texture image can be determined according to the color of each pixel in the target image frame. For example, the black area with an area larger than the set value is determined as the hair area, and then the corresponding information is filled in the grid corresponding to the texture image , To characterize the hair area in the texture image.
- the process of determining the hair region can also be implemented by machine learning, for example: input multiple videos containing hair information into a pre-built neural network model, and input each video frame into the neural network model.
- the neural network model performs self-learning through the input information and completes the training process. After training, the target video shot by the camera is input to the neural network model, and the neural network model can automatically output each of the target videos The hair area of the image frame.
- the hair area in the texture image is divided into at least one particle area (in some cases, other areas outside the hair area can also be grid-divided to obtain the corresponding particle area), and the particle area can be used by the device 100 is divided after acquiring the texture image, and may also be divided by an external device of the device 100 or by other components other than the processor in the device 100 (for example, it may be divided by a sensor component on the device 100).
- the hair area corresponding to the texture image can be divided according to a set number of grid lines, and the particle area can be determined according to the divided grid; the texture image can also be divided according to the distribution of hair strands, for example, each The hair strand (the distance between the hair strands is small enough) is determined as the particle area.
- the number of particle areas in the texture image can be determined according to the actual situation.
- the number of particle areas can be a larger value.
- the number of particle regions can be a smaller value.
- the target image frame may be the image frame displayed on the display screen of the device 100, that is, the texture image records the particle information of the image frame currently displayed on the display screen.
- the particle information is each pixel in the target image frame (each pixel is There may be corresponding particle area) motion state and state change information.
- the movement state is the state of the particle in the corresponding image frame, which can be position information, speed information (including speed and direction), hair direction angle, size, etc.; and state change information can refer to the state change of the particle.
- the information described can characterize the movement state of the particle in the next adjacent image frame, and can be speed, hair direction angle, rotation direction, life cycle, and so on. It should be noted that some particle information can be either motion state or state change information.
- speed can not only characterize the rate and direction information of a certain image frame (in this case, it can be used as the motion state), or it can characterize the image.
- the movement state of the frame (this can be used as state change information, it can determine the movement distance of the particle in combination with the time information, and then determine the position coordinate of the particle).
- the velocity can be used to evaluate the position of the particle at the next moment.
- the position information can be used as the movement state and the velocity can be used as the state change information
- the speed can be used to evaluate the speed of the particle at the next moment.
- the speed can be used as the motion state and the speed can be used as the state change information.
- the speed is both the motion state and the state change information.
- one texture image is not enough to store the motion state or state change information, it can be stored by using two texture images.
- two texture images can be used to store position information, speed information (including speed and direction), hair direction angle, rotation direction, life cycle, size, and other dimensions.
- step S203 obtain the first target motion state and target state change information of the first target particle area from the texture image, wherein the first target particle area is any area of the at least one particle area .
- each particle in the texture image may have its own number, and the particle information of each particle is stored in each particle area of the texture image.
- the target particle area can be randomly selected from each particle area of the texture image, or can be selected according to a specific rule (for example, a particle area at a specific position is selected). Further, the corresponding target motion state and state change information can be obtained through the particle information recorded in the target particle area, that is, the first target motion state and target state change information can be obtained.
- the specific implementation process of S203 may be: obtaining at least one of the screen coordinates, speed, direction angle, rotation attitude, current life state, life cycle, and size of the target particle from the texture image, and according to the obtained information Obtain the first target motion state and the target state change information (the corresponding target state change information can be determined according to the current motion state to be updated).
- the method further includes: determining a hair area in the texture image; performing processing on the hair area according to a predetermined number of particle beams.
- the grid is divided to obtain at least one corresponding particle beam; the at least one particle beam is respectively grid divided according to the predetermined number of particles to obtain the corresponding at least one particle area.
- the number of particle beams is used to characterize the number of particle beams contained in the hair region, and the number can be determined according to the screen resolution, rendering fineness, etc.; the number of particles is used to characterize the number of particle regions contained in the particle beam, and the number is also It can be determined according to the screen resolution, rendering fineness, etc.
- the hair area or particle beam can be divided according to grid lines at equal intervals (of course, the intervals can also be unequal). At the same time, it can be divided horizontally, vertically, or horizontally and horizontally. Vertical combination (both horizontal and vertical division, in this case, the horizontal and vertical division intervals may be the same or different), or may be divided according to a line at a certain angle (for example, 30°) to the horizontal line of the screen.
- the schematic diagram of the texture image can be as shown in Figure 3.
- the left side of Figure 3 shows a girl’s head profile.
- the head profile includes the hair profile (thick solid line) and the face profile (thin solid line).
- the hair area 301 and the face area 302 are respectively constituted.
- the hair area is divided into a plurality of particle beams, and a grid area 303 surrounded by a thick dashed line in FIG. 3 can be understood as a particle beam.
- these particle beams are also divided into multiple small areas, and these small areas may be referred to as the first target particle area 304 (also may be referred to as hair particles or particles.
- the first target particle area 304 also may be referred to as hair particles or particles.
- For the specific division please refer to the enlarged view on the right side of FIG. 3). ).
- FIG. 3 is a grid division for the entire texture image.
- only the hair area (or only the hair area and the face area) can be divided.
- a video contains multiple frames, and because the head position may change, the hair area in each frame will also change. Therefore, after obtaining a texture image, the hair area can be determined again.
- the hair area is divided into grids.
- the method before the step of acquiring the first target motion state and target state change information of the first target particle region in the at least one particle region from the texture image, the method further includes: The particle area at the set position in the at least one particle beam is determined as the first target particle area.
- the set position can be a particle area in a center position, a head position (the position where the first number is located), and a tail position (the position where the last number is located) in a certain particle beam.
- the embodiment of the present disclosure selects the target particle region from multiple particle regions of the particle beam (as shown in 304 in FIG. 3).
- the selection method can be random selection, or the center or edge particles can be selected as the target.
- the particle area in some exemplary embodiments, the target particle area may also be referred to as a head particle (the particle plays a role in driving other particles to move during the rendering process).
- the method of selecting target particles in different particle beams in the same texture image can be the same or inconsistent. Taking the inconsistency as an example, the implementation method can be specifically as follows: Select a particle at the edge of a certain particle beam The region is used as the target particle region, and in another particle beam, the particle region located in the center can be selected as the target particle region.
- the number of target particle regions corresponding to a particle beam can be one, two or more.
- the target particle region can be the selected target particle region of all particle beams in the hair region, or it can be part of the target particle region. Or the selected target particle area in a certain particle beam. Dividing the hair area in the texture image can update the motion state of the specific particle area, so that these particle areas will gradually change in the final displayed video, and achieve the rendering effect of particles flowing along the hair direction.
- step S204 determine the second target motion state of the first target particle area in the next image frame according to the first target motion state and the target state change information, where the next image frame is The next image of the target image frame in the target video.
- the next image frame is the image frame of the target image frame at the next moment.
- the moment in the "next moment" can be determined according to the frame sampling rate, and 1 min contains 60 image frames [one image per second (s) Frame] as an example, if the frame sampling rate is 5s/frame, the next image frame and the target image frame are separated by 4 image frames, and if the frame sampling rate is 1s/frame, the next image frame is between the target image frame 0 image frames apart (that is, the two are adjacent). Therefore, the selection of image frames can be adjusted according to the actual situation. For example, if the rendering fineness is high, the frame sampling rate can be a high value (more image frames need to be processed at this time), and if the rendering fineness is required If the requirement is low, the frame sampling rate can be a low value.
- the first target motion state characterizes the motion state of the first target particle area in the target image frame
- the target state change information characterizes the influence of the first target particle area on the state change in the target image frame. Therefore, By combining the two, the movement state of the first target particle area in the next image frame can be obtained, that is, the second target movement state can be obtained.
- the texture image contains the following particle information: the position coordinates of the first target particle area is (2,2), its velocity direction is the horizontal line of the screen (which can be recorded as the x-axis) positive direction 36.87°, and the velocity value is 5mm/s,
- the position coordinate is the first target motion state, and the speed direction and speed are the target state change information.
- the first target particle area is from the target image frame to the next image frame (using the target image frame and the next image frame).
- the interval time is 1s as an example) It moves 3mm in the positive direction of the x-axis and 4mm in the direction of the y-axis. Therefore, it can be determined that the position coordinates of the first target particle area in the next image frame are (5, 6), and we get The second target state of motion.
- step S205 the motion state in the texture image is updated according to the second target motion state to render the hair region.
- Updating the motion state in the texture image can be understood as directly replacing the first target motion state in the texture image with the second target motion state.
- the display screen of the device 100 displays the target image frame according to the texture image at the beginning. After the texture image is updated, the corresponding next image frame can be displayed on the display screen. At this time, the motion state of the first target particle area on the screen It will change from the first target motion state to the second target motion state, that is, the rendering effect of the flow of specific particles in the hair area is realized.
- the completion of the switching between the target image frame and the next image frame can be regarded as the completion of the rendering of the hair region. Next, you can continue with a new rendering.
- the texture image of the target image frame is obtained according to the target video containing the hair information, and the texture image can be processed by the GPU; the hair area in the texture image is divided into at least one particle area, which can realize the GPU to the particle Area processing, while greatly simplifying the graphics processing efficiency of the GPU to realize the calculation on the mobile terminal; in addition, the first target motion state and target state change information of the target particle area are obtained from the texture image, and the first target particle area is determined accordingly In the second target motion state in the next image frame, the motion state in the texture image is updated according to the second target motion state, so as to realize the rendering of the hair region.
- real-time rendering of the hair area can be realized on the mobile terminal, and the motion state of the specific particle area can be modified at the same time, so that the special rendering effect of particles flowing along the hairline direction can be realized.
- the step of updating the motion state in the texture image according to the second target motion state includes: updating the first target particle area according to the second target motion state
- the movement state of is updated, and the movement state of the remaining particle area (also referred to as the tail particle area or the tail particle) is retained; the remaining particle area is the particle in the at least one particle area except the first target particle area area.
- the movement state of the remaining particle area in the next image frame directly adopts the movement state of the target image frame, while the movement state of the first target particle area is updated in real time.
- the display state in the display screen is It is: the state of the first target particle area changes while the state of the remaining particle area does not change.
- the display schematic diagram of the hair area of the target image frame can be as shown in Figure 4(a) (the grid line may not be displayed during display), and the state of the hair can be seen clearly; after the rendering process, there is tailing
- the hair area of the rendering effect can be as shown in Figure 4(b).
- the gray area 401 in Figure 4(b) can be the first target particle area.
- the first target particle area is blurred due to motion during frame switching. While the state of particles in other areas remains unchanged, the hair can still be seen clearly, so that the particle beam flows along the direction of the hair and the rendering effect of "tailing" is realized.
- the motion state of the remaining particle area in the next image frame may not adopt the corresponding reference remaining motion state in the target image frame, but obtain the candidate remaining motion state according to the method for determining the second target motion state.
- Determine the difference between the candidate residual motion state and the reference residual motion state multiply the difference by a certain ratio (for example: 30%) and sum it with the reference residual motion state to obtain the motion of the remaining particle area in the next image frame State
- this processing method can make the remaining particles change in the rendering process, but the change range is not as large as the target particle, which can produce a "tailing" effect and the fluidity of the hair is more natural.
- operations such as color rendering (for example: replacing black particles with golden particles) on the target particle area or the remaining particle area may be performed according to the needs of the scene.
- the first target motion state includes first screen coordinates
- the target state change information includes a first speed
- the determination is based on the first target motion state and the target state change information
- the step of the second target motion state of the first target particle area in the next image frame includes: determining the time difference between the target image frame and the next image frame; The first speed and the time difference determine the second screen coordinates of the first target particle area in the next image frame as the second target motion state.
- the screen coordinates may be understood as the position coordinates of the vertices of the first target particle area in the display screen of the device 100.
- updating the screen coordinates of the first target particle area may be that the vertex position of the first target particle area is updated, while other positions are not updated.
- the second screen coordinates of the first target particle area in the next image frame are determined according to the first screen coordinates, the first speed, and the time difference, and the second screen coordinates are used as the second target motion state.
- the process of determining the motion state is simple, which can effectively improve the efficiency of hair area rendering and realize real-time rendering on the mobile terminal.
- the step of updating the motion state in the texture image according to the second target motion state includes: if the second screen coordinates are within the hair area In addition, re-determine the hair area of the texture image, and determine the second target particle area from the particle area corresponding to the newly determined hair area; obtain the reference target motion state of the second target particle area from the texture image And reference target state change information; determine the motion state of the second target particle region in the next image frame according to the reference target motion state and the reference target state change information to obtain a third target motion state; The third target motion state updates the motion state in the texture image.
- the second screen coordinates can be compared with the coordinates of each particle area in the hair area, and if none of them match, then the first screen coordinates can be considered to be outside the hair area.
- the motion state of the target particle (that is, the third target motion state) is re-determined, and the texture image is updated according to the third target motion state, which can ensure The continuity of the hair area displayed on the display screen will not cause sudden deformation of the hair area, ensuring a good hair display effect.
- the new motion state can be determined according to the third target motion state and the third target state change information, and so on. Until the determined screen coordinates are in the hair area.
- the determined screen coordinates including the aforementioned second screen coordinates
- the distance from the edge of the hair area is less than a preset threshold (the threshold can be determined according to the actual situation. The disclosure does not limit this)
- the motion state may not be re-determined, but the texture image is directly updated according to the second target motion state.
- the first target motion state includes a second speed
- the target state change information includes a hair direction angle
- the determination of the target state change information is based on the first target motion state and the target state change information.
- the step of the second target motion state of the first target particle area in the next image frame includes: obtaining a preset speed; determining the first target particle area according to the second speed, the hair direction angle, and the speed.
- the third velocity of the target particle area in the next image frame obtains the second target motion state.
- both the first speed and the second speed are speed information obtained from a certain channel in the same texture image, and their sizes can be the same.
- the speed is used as the state change information; when updating the speed, the speed is used as the motion state.
- the velocity can also be referred to as a velocity scalar, which is used to control the flow velocity of the particles, which can be preset by the user or determined by a certain algorithm (for example, the velocity scalar gradually decreases as time changes).
- the hair direction angle can refer to the angle of the speed of the first target particle area relative to the positive direction of the x-axis of the screen horizontal line, which can be understood as the direction of movement of the first target particle area, which can be represented by D (cost, sint), where t represents The angle of the target particle relative to the positive direction of the x-axis, and cost and sint respectively represent the distance components of the movement distance of the first target particle area in the x-axis and y-axis directions.
- the third speed can be calculated by the following formula:
- the third speed the second speed + hair direction angle * speed
- the second speed includes a speed value and a direction angle. Therefore, the sum of "second speed” and “hair direction angle * rate” not only includes the sum of speed values, so it can also include the fusion of direction angles.
- the third speed may not be determined in combination with the second speed. Instead, the product of the hair direction angle and the speed may be directly used as the third speed.
- the specific calculation formula may be as follows:
- the third speed v(u,v) D(cost,sint)*V, where D(cost,sint) is the direction angle of the hair, and V is the user-defined speed.
- the foregoing embodiment determines the speed information of the next image frame according to the direction angle and the speed, and the determination process is simple, which can effectively improve the computing efficiency and realize real-time rendering on the mobile terminal.
- the method before the step of obtaining the texture image of the target image frame, the method further includes: determining each pixel in the target image frame according to the pixel state information that changes with time in the target video Point candidate state change information; obtain the hair direction map and hair region mask map corresponding to the target image frame; the hair direction map contains the hair direction angle of each pixel, the hair region mask map Contains the mask information of the hair region in the target image frame; the candidate motion state of each pixel is determined according to the hair direction angle in the hair direction map and the mask information in the hair region mask map Storing the candidate state change information and the candidate motion state in the vertex position of the at least one particle area; wherein the vertex position of the at least one particle area corresponds to the respective pixel point.
- the pixel state information can refer to the state information of each pixel in the video, such as the color and position of each pixel, and the relationship between the state of the pixels over time (for example, in a certain frame, a certain pixel P1 is pure black, and In the next frame, its adjacent pixel point P2 becomes pure black, and the pixel point P1 becomes another color).
- a particle may correspond to one or more pixels (there is a mapping relationship between the particle and the pixel).
- the state change information of each particle (such as moving speed, etc.) can be determined, and the candidate can be obtained Status change information.
- the hair direction angle is the direction of the hair.
- the hair direction angle t of each particle is arranged together to form a hair direction map; in other embodiments, the hair direction map can also store the values of cos2t and sin2t (store 2t angle The sine and cosine values of is to prevent the ambiguity of the hair direction on the same straight line).
- the cost and sint can be determined by the following formulas:
- sign represents a sign function.
- t can be determined in the following ways: Sa. Calculate the grayscale image of the target image frame; Sb. Calculate the gradient image of the grayscale image; Sc. Blur the gradient image; Sd. Take each pixel of the vertical vector of Sc The direction vector of, get t.
- the mask is a string of binary codes that performs bit-and operation on the target field.
- the mask information of the hair area can indicate whether each particle is in the hair area.
- the mask information of each particle is arranged together to form a hair area mask map.
- the direction angle of each particle can be obtained, and the position information, size, etc. of each particle can be obtained according to the hair area mask map of a certain image frame.
- the hair direction map of the adjacent image frame can know the rotation direction of each particle, and the hair area mask map of the adjacent image frame can know the life cycle of each particle (for example: determine that a certain particle is generated in the A image frame, and in the B image frame Disappear, the number of frames between A and B can be used as the life cycle of the particle), speed information (for example, a certain particle is at the c position in the C image frame, but at the d position in the D image frame, you can The velocity information of the particle is determined according to the distance between the c position and the d position and the time difference between the C image frame and the D image frame).
- the hair direction map and the hair region mask map can be obtained from the target video information through the neural network model.
- the neural network model may be a CNN (Convolutional Neural Network) model or the like.
- the above embodiment determines the candidate motion state and candidate state change information of the target image frame according to the target video information, and stores this information in the texture image, which belongs to the process of pre-processing the target video, so that the subsequent hair rendering process can be carried out in an orderly manner. .
- the method further includes: storing the texture image in In the first frame buffer; after the step of updating the motion state in the texture image according to the second target motion state, the method further includes: storing the texture image in the first frame buffer in the second frame buffer Middle; store the updated texture image in the first frame buffer.
- this embodiment After acquiring the candidate state change information and the candidate motion state, this embodiment stores these two information in the corresponding vertex positions in the texture image for later use.
- the candidate state change information and the candidate motion state corresponding to the target image frame are obtained from the texture image as the target state change information and the first target motion state, respectively.
- the texture image is stored in two frame buffers, the first frame buffer and the second frame buffer.
- the texture image stored in the first frame buffer can be used as output (that is, displayed on the display screen), and the second The texture image stored in the frame buffer can be used as input.
- the texture image in the first frame buffer is input into the second frame buffer, and then the texture image in the first frame buffer Perform output display of image frames.
- the first frame buffer and the second frame buffer can also switch between input and output.
- the texture image in the first frame buffer is output at the current moment, and the second frame buffer is used as the backup of the first frame buffer for storage.
- the texture image corresponding to the next image frame; at the next moment, the texture image corresponding to the next image frame in the second frame buffer is output, and the first frame buffer is used as the backup of the second frame buffer, and the newly determined next image
- the texture image corresponding to the frame (the next image of the next image frame) is stored in the first frame buffer.
- the foregoing embodiment uses double buffering to store the texture image, which can ensure the orderliness of information input and output in the texture image, prevent data loss, and ensure the accuracy of hair rendering.
- a flow chart of a hair rendering method is provided.
- the hair rendering method is used in the device shown in FIG. 1, as shown in FIG. 5.
- the implementation process is as follows:
- S501 Obtain a hair direction map and a hair region mask map.
- S502. Use the double frame buffer to read and write particle information.
- the obtained particle information includes: particle speed, position, rotation posture, current life state, size, hair direction, and the obtained particles
- the information is stored through two textures, and the texture recording the particle information is stored in the first frame buffer, and the other frame buffer is used to back up the first frame buffer.
- the process of obtaining it can be: initialize two textures, randomly generate particles on the full screen, if a particle is located in the hair area, write the screen coordinates of the particle into the frame buffer; for the hair direction, according to the hair
- the cos2t and sin2t stored in the direction map determine the cost and sint, and obtain the hair direction D (cost, sint).
- the foregoing embodiment uses a GPU to calculate particle information and implements a GPU particle system, which greatly improves the calculation efficiency of the particle system, can achieve real-time on the mobile terminal, and realizes real-time rendering of the hair on the mobile terminal.
- Fig. 6 is a block diagram of a hair rendering apparatus 600 according to an exemplary embodiment. 6, the device includes an image frame determination unit 601, a texture image acquisition unit 602, a state information acquisition unit 603, a motion state determination unit 604, and a motion state update unit 605.
- the image frame determination unit 601 is configured to perform acquisition of a target video containing hair information, and select a target image frame from the image frames of the target video;
- the texture image acquisition unit 602 is configured to perform acquisition of the texture image of the target image frame; wherein the texture image is an image in a texture format that records the motion state and state change information of pixels in the target image frame , The hair area in the texture image is divided into at least one particle area by grid lines;
- the state information acquiring unit 603 is configured to acquire the first target motion state and target state change information of the first target particle region in the at least one particle region from the texture image;
- the motion state determining unit 604 is configured to perform determining the second target motion state of the first target particle area in the next image frame according to the first target motion state and the target state change information; the next image Frame is the next image of the target image frame in the target video;
- the motion state update unit 605 is configured to update the motion state in the texture image according to the second target motion state, so as to render the hair region.
- the hair rendering device obtained in the above embodiment obtains the texture image of the target image frame according to the target video containing the hair information, and the texture image can be processed by the GPU; the hair area in the texture image is divided into at least one particle area, which can achieve The GPU processes the particle area and greatly simplifies the graphics processing efficiency of the GPU to realize the calculation on the mobile terminal.
- the first target motion state and target state change information of the target particle area are obtained from the texture image, and the first target state change information is determined accordingly.
- the motion state in the texture image is updated according to the second target motion state, so as to realize the rendering of the hair area.
- real-time rendering of the hair area can be realized on the mobile terminal, and the motion state of the specific particle area can be modified at the same time, so that the special rendering effect of particles flowing along the hairline direction can be realized.
- the motion state update unit is further configured to update the motion state of the first target particle area according to the second target motion state, and retain the motion state of the remaining particle area
- the remaining particle area is the particle area of the at least one particle area where the first target particle area is removed.
- the first target motion state includes first screen coordinates
- the target state change information includes a first speed
- the motion state determination unit includes: a time difference determination subunit, configured To perform the determination of the time difference between the target image frame and the next image frame
- the first motion state determination subunit is configured to perform the determination based on the first screen coordinates, the first speed, and the time difference The value determines the second screen coordinates of the first target particle area in the next image frame as the second target motion state.
- the motion state update unit includes: a particle area determining subunit configured to perform redefining the hair of the texture image if the second screen coordinates are outside the hair area Region, and determine the second target particle region from the particle region corresponding to the newly determined hair region; the state information acquiring subunit is configured to perform acquiring the reference target motion state of the second target particle region from the texture image And reference target state change information; a second motion state determination subunit configured to perform determining that the second target particle area is in the next image frame according to the reference target motion state and the reference target state change information The third target motion state is obtained; the motion state update subunit is configured to execute the update of the motion state in the texture image according to the third target motion state.
- the first target motion state includes a second speed
- the target state change information includes a hair direction angle
- the motion state determination unit includes: a rate acquisition subunit configured to perform acquisition A preset rate; a third motion state determination subunit configured to perform determining that the first target particle area is in the next image frame according to the second speed, the hair direction angle, and the rate To obtain the second target motion state.
- the hair rendering device further includes: a state change information determining unit configured to perform determining each of the target image frames according to the pixel state information that changes over time in the target video Candidate state change information of the pixel; the image acquisition unit is configured to perform the acquisition of the hair direction map and the hair region mask map corresponding to the target image frame; the hair direction map contains the hair direction of each pixel The hair area mask map contains the mask information of the hair area in the target image frame; the candidate motion state determination unit is configured to perform the calculation based on the hair direction angle in the hair direction map and the hair direction angle.
- the mask information in the area mask map determines the candidate motion state of each pixel; the candidate motion state storage unit is configured to perform storing the candidate state change information and the candidate motion state in the at least one particle The vertex position of the region; wherein the vertex position of the at least one particle region corresponds to the respective pixel point.
- the hair rendering device further includes: a first image storage unit configured to execute storing the texture image in the first frame buffer; and an image dumping unit configured to execute The texture image in the first frame buffer is stored in the second frame buffer; the second image storage unit is configured to perform storing the updated texture image in the first frame buffer.
- the hair rendering device further includes: a region determining unit configured to perform determining the hair region in the texture image; and a region dividing unit configured to perform a predetermined number of particle beams Perform grid division on the hair area to obtain at least one corresponding particle beam; the particle beam division unit is configured to perform grid division on the at least one particle beam according to a predetermined number of particles to obtain the corresponding at least one particle beam. A particle area.
- the hair rendering device further includes: a particle area determining unit configured to perform determining a particle area at a set position in the at least one particle beam as the first target Particle area.
- an electronic device is also provided.
- the schematic structural diagram of the electronic device may be as shown in FIG. 1.
- the electronic device includes: a processor; a memory for storing executable instructions of the processor;
- the processor is configured to execute the instructions to implement the hair rendering method described in the foregoing embodiment.
- non-transitory computer-readable storage medium including instructions, such as the memory 102 including instructions, and the foregoing instructions may be executed by the processor 120 of the device 100 to complete the foregoing method.
- the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
- a computer program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of the device reads from the readable storage medium And execute the computer program, so that the device executes the hair rendering method described in the above embodiment.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Processing Or Creating Images (AREA)
- Image Generation (AREA)
- Studio Devices (AREA)
- Image Analysis (AREA)
Abstract
Description
Claims (20)
- 一种头发的渲染方法,其特征在于,包括:获取包含头发信息的目标视频,从所述目标视频的图像帧中选择目标图像帧;获取所述目标图像帧的纹理图像,其中,所述纹理图像为记录所述目标图像帧中像素点的运动状态和状态变化信息的纹理格式的图像,所述纹理图像中的头发区域被格网线划分为至少一个粒子区域;从所述纹理图像中获取第一目标粒子区域的第一目标运动状态和目标状态变化信息,其中,所述第一目标粒子区域为所述至少一个粒子区域中的任一区域;根据所述第一目标运动状态和所述目标状态变化信息,确定所述第一目标粒子区域在下一图像帧中的第二目标运动状态,其中,所述下一图像帧为所述目标视频中所述目标图像帧的下一帧图像;根据所述第二目标运动状态对所述纹理图像中的运动状态进行更新,以对所述头发区域进行渲染。
- 根据权利要求1所述的头发的渲染方法,其特征在于,所述根据所述第二目标运动状态对所述纹理图像中的运动状态进行更新的步骤,包括:根据所述第二目标运动状态对所述第一目标粒子区域的运动状态进行更新,并保留剩余粒子区域的运动状态,其中,所述剩余粒子区域为所述至少一个粒子区域中除去所述第一目标粒子区域外的其他粒子区域。
- 根据权利要求1或2所述的头发的渲染方法,其特征在于,所述第一目标运动状态包括第一屏幕坐标,所述目标状态变化信息包括第一速度;所述根据所述第一目标运动状态和所述目标状态变化信息,确定所述第一目标粒子区域在下一图像帧中的第二目标运动状态的步骤,包括:确定所述目标图像帧和所述下一图像帧间的时间差值;根据所述第一屏幕坐标、所述第一速度和所述时间差值,确定所述第一目标粒子区域在所述下一图像帧中的第二屏幕坐标,作为所述第二目标运动状态。
- 根据权利要求3所述的头发的渲染方法,其特征在于,所述根据所述第二目标运动状态对所述纹理图像中的运动状态进行更新的步骤,包括:若所述第二屏幕坐标处于所述头发区域之外,重新确定所述纹理图像的头发区域,并从新确定的头发区域所对应的粒子区域中确定第二目标粒子区域;从所述纹理图像中获取所述第二目标粒子区域的参考目标运动状态和参考目标状态变化信息;根据所述参考目标运动状态和所述参考目标状态变化信息,确定所述第二目标粒子区域在所述下一图像帧中的运动状态,得到第三目标运动状态;根据所述第三目标运动状态对所述纹理图像中的运动状态进行更新。
- 根据权利要求1或2所述的头发的渲染方法,其特征在于,所述第一目标运动状态包括第二速度,所述目标状态变化信息包括头发方向角;所述根据所述第一目标运动状态和所述目标状态变化信息,确定所述第一目标粒子区域在下一图像帧中的第二目标运动状态的步骤,包括:获取预先设定的速率;根据所述第二速度、所述头发方向角和所述速率,确定所述第一目标粒子区域在所述下一图像帧中的第三速度,得到所述第二目标运动状态。
- 根据权利要求1-5任一所述的头发的渲染方法,其特征在于,在所述获取所述目标图像帧的纹理图像的步骤之前,还包括:根据所述目标视频中随时间变化的像素状态信息,确定所述目标图像帧中各个像素点的候选状态变化信息;获取所述目标图像帧对应的头发方向图和头发区域掩码图,其中,所述头发方向图中包含有所述各个像素点的头发方向角,所述头发区域掩码图中包含有所述目标图像帧中头发区域的掩码信息;根据所述头发方向图中的头发方向角和所述头发区域掩码图中的掩码信息,确定所述各个像素点的候选运动状态;将所述候选状态变化信息和所述候选运动状态存储到所述至少一个粒子区域的顶点位置上;其中,所述至少一个粒子区域的顶点位置与所述各个像素点对应。
- 根据权利要求6所述的头发的渲染方法,其特征在于,在所述将所述候选状态变化信息和所述候选运动状态存储到所述至少一个粒子区域的顶点位置上的步骤之后,还包括:将所述纹理图像存储到第一帧缓冲中;在所述根据所述第二目标运动状态对所述纹理图像中的运动状态进行更新的步骤之后,还包括:将第一帧缓冲中的纹理图像存储到第二帧缓冲中;将更新后的所述纹理图像存储到所述第一帧缓冲中。
- 根据权利要求1-7任一所述的头发的渲染方法,其特征在于,在所述获取所述目标图像帧的纹理图像的步骤之后,还包括:确定所述纹理图像中的头发区域;根据预先确定的粒子束数量对所述头发区域进行格网划分,得到对应的至少一个粒子束;根据预先确定的粒子数量对所述至少一个粒子束分别进行格网划分,得到对应的至少一个粒子区域。
- 根据权利要求8所述的头发的渲染方法,其特征在于,在所述从所述纹理图像中获取第一目标粒子区域的第一目标运动状态和目标状态变化信息的步骤之前,还包括:将所述至少一个粒子束中处于设定位置的粒子区域,确定为所述第一目标粒子区域。
- 一种头发的渲染装置,其特征在于,包括:图像帧确定单元,被配置为执行获取包含头发信息的目标视频,从所述目标视频的图像帧中选择目标图像帧;纹理图像获取单元,被配置为执行获取所述目标图像帧的纹理图像,其中,所述纹理图像为记录所述目标图像帧中像素点的运动状态和状态变化信息的纹理格式的图像,所述纹理图像中的头发区域被格网线划分为至少一个粒子区域;状态信息获取单元,被配置为执行从所述纹理图像中获取第一目标粒子区域的第一目标运动状态和目标状态变化信息,其中,所述第一目标粒子区域为所述至少一个粒子区域中的任一区域;运动状态确定单元,被配置为执行根据所述第一目标运动状态和所述目标状态变化信息,确定所述第一目标粒子区域在下一图像帧中的第二目标运动状态,其中,所述下一图像帧为所述目标视频中所述目标图像帧的下一帧图像;运动状态更新单元,被配置为执行根据所述第二目标运动状态对所述纹理图像中的运动状态进行更新,以对所述头发区域进行渲染。
- 根据权利要求10所述的头发的渲染装置,其特征在于,所述运动状态更新单元,还被配置为执行根据所述第二目标运动状态对所述第一目标粒子区域的运动状态进 行更新,并保留剩余粒子区域的运动状态,其中,所述剩余粒子区域为所述至少一个粒子区域中除去所述第一目标粒子区域外的其他粒子区域。
- 根据权利要求10或11所述的头发的渲染装置,其特征在于,所述第一目标运动状态包括第一屏幕坐标,所述目标状态变化信息包括第一速度;所述运动状态确定单元,包括:时间差值确定子单元,被配置为执行确定所述目标图像帧和所述下一图像帧间的时间差值;第一运动状态确定子单元,被配置为执行根据所述第一屏幕坐标、所述第一速度和所述时间差值,确定所述第一目标粒子区域在所述下一图像帧中的第二屏幕坐标,作为所述第二目标运动状态。
- 根据权利要求12所述的头发的渲染装置,其特征在于,所述运动状态更新单元,包括:粒子区域确定子单元,被配置为执行若所述第二屏幕坐标处于所述头发区域之外,重新确定所述纹理图像的头发区域,并从新确定的头发区域所对应的粒子区域中确定第二目标粒子区域;状态信息获取子单元,被配置为执行从所述纹理图像中获取所述第二目标粒子区域的参考目标运动状态和参考目标状态变化信息;第二运动状态确定子单元,被配置为执行根据所述参考目标运动状态和所述参考目标状态变化信息,确定所述第二目标粒子区域在所述下一图像帧中的运动状态,得到第三目标运动状态;运动状态更新子单元,被配置为执行根据所述第三目标运动状态对所述纹理图像中的运动状态进行更新。
- 根据权利要求10或11所述的头发的渲染装置,其特征在于,所述第一目标运动状态包括第二速度,所述目标状态变化信息包括头发方向角;所述运动状态确定单元,包括:速率获取子单元,被配置为执行获取预先设定的速率;第三运动状态确定子单元,被配置为执行根据所述第二速度、所述头发方向角和所述速率,确定所述第一目标粒子区域在所述下一图像帧中的第三速度,得到所述第二目标运动状态。
- 根据权利要求10-14任一所述的头发的渲染装置,其特征在于,所述头发的渲染装置,还包括:状态变化信息确定单元,被配置为执行根据所述目标视频中随时间变化的像素状态信息,确定所述目标图像帧中各个像素点的候选状态变化信息;图像获取单元,被配置为执行获取所述目标图像帧对应的头发方向图和头发区域掩码图,其中,所述头发方向图中包含有所述各个像素点的头发方向角,所述头发区域掩码图中包含有所述目标图像帧中头发区域的掩码信息;候选运动状态确定单元,被配置为执行根据所述头发方向图中的头发方向角和所述头发区域掩码图中的掩码信息,确定所述各个像素点的候选运动状态;候选运动状态存储单元,被配置为执行将所述候选状态变化信息和所述候选运动状态存储到所述至少一个粒子区域的顶点位置上;其中,所述至少一个粒子区域的顶点位置与所述各个像素点对应。
- 根据权利要求15所述的头发的渲染装置,其特征在于,所述头发的渲染装置,还包括:第一图像存储单元,被配置为执行将所述纹理图像存储到第一帧缓冲中;图像转存单元,被配置为执行将第一帧缓冲中的纹理图像存储到第二帧缓冲中;第二图像存储单元,被配置为执行将更新后的所述纹理图像存储到所述第一帧缓冲中。
- 根据权利要求10-16任一所述的头发的渲染装置,其特征在于,所述头发的渲染装置还包括:区域确定单元,被配置为执行确定所述纹理图像中的头发区域;区域划分单元,被配置为执行根据预先确定的粒子束数量对所述头发区域进行格网划分,得到对应的至少一个粒子束;粒子束划分单元,被配置为执行根据预先确定的粒子数量对所述至少一个粒子束分别进行格网划分,得到对应的至少一个粒子区域。
- 根据权利要求17所述的头发的渲染装置,其特征在于,所述头发的渲染装置,还包括:粒子区域确定单元,被配置为执行将所述至少一个粒子束中处于设定位置的粒子区域,确定为所述第一目标粒子区域。
- 一种电子设备,其特征在于,包括:处理器;用于存储所述处理器可执行指令的存储器;其中,所述处理器被配置为执行所述指令,以实现如权利要求1至9中任一项所述的头发的渲染方法。
- 一种存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得所述电子设备能够执行如权利要求1至9中任一项所述的头发的渲染方法。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2022549140A JP7390495B2 (ja) | 2020-03-27 | 2020-11-18 | 髪のレンダリング方法、装置、電子機器及び記憶媒体 |
| US17/897,309 US20220414963A1 (en) | 2020-03-27 | 2022-08-29 | Hair rendering method and apparatus, electronic device and storage medium |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010230272.6A CN113516743A (zh) | 2020-03-27 | 2020-03-27 | 头发的渲染方法、装置、电子设备及存储介质 |
| CN202010230272.6 | 2020-03-27 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US17/897,309 Continuation US20220414963A1 (en) | 2020-03-27 | 2022-08-29 | Hair rendering method and apparatus, electronic device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2021189880A1 true WO2021189880A1 (zh) | 2021-09-30 |
Family
ID=77890877
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2020/129859 Ceased WO2021189880A1 (zh) | 2020-03-27 | 2020-11-18 | 头发的渲染方法、装置、电子设备及存储介质 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US20220414963A1 (zh) |
| JP (1) | JP7390495B2 (zh) |
| CN (1) | CN113516743A (zh) |
| WO (1) | WO2021189880A1 (zh) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20220164852A1 (en) * | 2020-11-20 | 2022-05-26 | The Procter & Gamble Company | Digital Imaging and Learning Systems and Methods for Analyzing Pixel Data of an Image of a Hair Region of a User's Head to Generate One or More User-Specific Recommendations |
| KR102575743B1 (ko) * | 2021-10-14 | 2023-09-06 | 네이버 주식회사 | 이미지 번역 방법 및 시스템 |
| CN114037740B (zh) * | 2021-11-09 | 2024-07-19 | 北京字节跳动网络技术有限公司 | 图像数据流的处理方法、装置及电子设备 |
| CN114219877B (zh) * | 2021-12-06 | 2024-06-25 | 北京字节跳动网络技术有限公司 | 人像头发流动特效处理方法、装置、介质和电子设备 |
| CN114898006B (zh) * | 2022-05-20 | 2025-09-30 | 北京字跳网络技术有限公司 | 交互方法、装置、设备及存储介质 |
| CN115359151A (zh) * | 2022-08-26 | 2022-11-18 | 北京字跳网络技术有限公司 | 特效处理方法、装置、电子设备和存储介质 |
| CN116778059A (zh) * | 2023-03-28 | 2023-09-19 | 网易(杭州)网络有限公司 | 虚拟水面波纹生成方法、装置、存储介质与电子设备 |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107958480A (zh) * | 2017-11-23 | 2018-04-24 | 腾讯科技(上海)有限公司 | 图像渲染方法、装置及存储介质 |
| US20180181803A1 (en) * | 2016-12-27 | 2018-06-28 | Shenzhen University | Pedestrian head identification method and system |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4695275B2 (ja) * | 2001-03-07 | 2011-06-08 | 独立行政法人科学技術振興機構 | 動画像生成システム |
| JP2007286669A (ja) * | 2006-04-12 | 2007-11-01 | Sony Corp | 画像処理装置および方法、並びにプログラム |
| JP2009020874A (ja) * | 2007-06-11 | 2009-01-29 | Kyushu Institute Of Technology | 髪シミュレーション方法およびその装置 |
| CN103606186B (zh) * | 2013-02-02 | 2016-03-30 | 浙江大学 | 一种图像与视频的虚拟发型建模方法 |
| JP2017054337A (ja) * | 2015-09-10 | 2017-03-16 | ソニー株式会社 | 画像処理装置および方法 |
| US9870638B2 (en) * | 2016-02-24 | 2018-01-16 | Ondrej Jamri{hacek over (s)}ka | Appearance transfer techniques |
-
2020
- 2020-03-27 CN CN202010230272.6A patent/CN113516743A/zh active Pending
- 2020-11-18 WO PCT/CN2020/129859 patent/WO2021189880A1/zh not_active Ceased
- 2020-11-18 JP JP2022549140A patent/JP7390495B2/ja active Active
-
2022
- 2022-08-29 US US17/897,309 patent/US20220414963A1/en not_active Abandoned
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180181803A1 (en) * | 2016-12-27 | 2018-06-28 | Shenzhen University | Pedestrian head identification method and system |
| CN107958480A (zh) * | 2017-11-23 | 2018-04-24 | 腾讯科技(上海)有限公司 | 图像渲染方法、装置及存储介质 |
Non-Patent Citations (2)
| Title |
|---|
| LYU MENGYA, DU HUAPENG, TANG YONG: "A Novel Algorithm of Collision Handling for Fluid based Hair Model", JOURNAL OF YANSHAN UNIVERSITY, vol. 34, no. 5, 30 September 2010 (2010-09-30), pages 417 - 420, XP055853229, ISSN: 1007-791X, DOI: 10.3969/j.issn.1007-791X.2010.05.008 * |
| WU CHEN: "Research and Implementation on Video-based Fast Hair Capture Method", INFORMATION & TECHNOLOGY, CHINA MASTER'S THESES FULL-TEXT DATABASE, 15 January 2015 (2015-01-15), XP055853232 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113516743A (zh) | 2021-10-19 |
| JP2023515410A (ja) | 2023-04-13 |
| JP7390495B2 (ja) | 2023-12-01 |
| US20220414963A1 (en) | 2022-12-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2021189880A1 (zh) | 头发的渲染方法、装置、电子设备及存储介质 | |
| US10032076B2 (en) | Method and device for displaying image | |
| JP7038853B2 (ja) | 画像処理方法及び装置、電子機器並びにコンピュータ可読記憶媒体 | |
| KR102301447B1 (ko) | 비디오 처리 방법, 비디오 처리 장치 및 저장 매체 | |
| CN111985268B (zh) | 一种人脸驱动动画的方法和装置 | |
| US10154228B1 (en) | Smoothing video panning | |
| US9824723B1 (en) | Direction indicators for panoramic images | |
| CN107977934B (zh) | 图像处理方法及装置 | |
| US12417597B2 (en) | Systems and methods for augmented reality video generation | |
| CN114071223A (zh) | 基于光流的视频插帧的生成方法、存储介质及终端设备 | |
| CN114422692B (zh) | 视频录制方法、装置及电子设备 | |
| CN110211211B (zh) | 图像处理方法、装置、电子设备及存储介质 | |
| CN112614228A (zh) | 三维网格的简化方法、装置、电子设备和存储介质 | |
| WO2022142388A1 (zh) | 特效显示方法及电子设备 | |
| WO2023093792A1 (zh) | 一种图像帧的渲染方法及相关装置 | |
| CN116582637A (zh) | 视频会议画面的分屏方法及相关设备 | |
| CN114898039A (zh) | 三维模型构建方法、装置、电子设备及存储介质 | |
| EP3799415A2 (en) | Method and device for processing videos, and medium | |
| CN107239758A (zh) | 人脸关键点定位的方法及装置 | |
| JP7427786B2 (ja) | 拡張現実に基づく表示方法、機器、記憶媒体及びプログラム製品 | |
| CN114095646B (zh) | 图像处理方法、装置、电子设备及存储介质 | |
| CN110312117B (zh) | 数据刷新方法及装置 | |
| CN116092147A (zh) | 视频处理方法、装置、电子设备及存储介质 | |
| WO2019061118A1 (zh) | 全景拍摄方法及终端 | |
| CN115396740B (zh) | 全景视频的播放方法、装置、电子设备及可读存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20927952 Country of ref document: EP Kind code of ref document: A1 |
|
| ENP | Entry into the national phase |
Ref document number: 2022549140 Country of ref document: JP Kind code of ref document: A |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 20927952 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 31.03.2023) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 20927952 Country of ref document: EP Kind code of ref document: A1 |