WO2022133954A1 - 图像渲染方法、装置和系统、计算机可读存储介质 - Google Patents

图像渲染方法、装置和系统、计算机可读存储介质 Download PDF

Info

Publication number
WO2022133954A1
WO2022133954A1 PCT/CN2020/139162 CN2020139162W WO2022133954A1 WO 2022133954 A1 WO2022133954 A1 WO 2022133954A1 CN 2020139162 W CN2020139162 W CN 2020139162W WO 2022133954 A1 WO2022133954 A1 WO 2022133954A1
Authority
WO
WIPO (PCT)
Prior art keywords
current image
processing
image
detection result
thread
Prior art date
Application number
PCT/CN2020/139162
Other languages
English (en)
French (fr)
Inventor
刘鹏
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/139162 priority Critical patent/WO2022133954A1/zh
Priority to CN202080070570.1A priority patent/CN114556408A/zh
Publication of WO2022133954A1 publication Critical patent/WO2022133954A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular, to an image rendering method, apparatus, and system, and a computer-readable storage medium.
  • the embodiments of the present disclosure propose an image rendering method, apparatus, and system, and a computer-readable storage medium, so as to improve the flexibility of image rendering.
  • an image rendering method comprising: acquiring a target object detection result of a previous image of a current image, where the target object detection result is used to indicate the previous image The number of target objects included in the image; determining the number of threads to be started based on the target object detection result; starting the number of threads to perform rendering processing on the current image.
  • an image rendering apparatus including a processor configured to perform the following steps: acquiring a target object detection result of a previous image of a current image, the target object detection result It is used to indicate the number of target objects included in the previous image; determine the number of threads to be started based on the target object detection result; start the number of threads to perform rendering processing on the current image.
  • an image rendering system for performing rendering processing on an image, where the rendering processing includes a first processing and a second processing; the system includes a first processor and a second processing
  • the first processor is used to obtain the target object detection result of the previous image of the current image, and the target object detection result is used to indicate the number of target objects included in the previous image, based on the target
  • the object detection result determines the number of threads to be started, starts the number of threads to perform rendering processing on the current image, and executes the first processing under the invocation of the started thread; the second processor is used for The second process is executed under the invocation of the started thread.
  • the solutions of the embodiments of the present disclosure it is possible to dynamically determine the number of threads that need to be started currently based on the number of target objects included in the previous image of the current image, and in the case that the number of target objects included in the previous image is different In this case, the number of started threads is also different, so that the number of currently started threads can be adapted to different image rendering situations, and the flexibility of thread scheduling in the image rendering process is improved.
  • FIG. 1A is a schematic diagram of a thread scheduling method in a conventional image rendering process.
  • FIG. 1B is a schematic diagram of another conventional thread scheduling method in an image rendering process.
  • FIG. 2 is a flowchart of an image rendering method according to an embodiment of the present disclosure.
  • FIG. 3 is a schematic diagram of a beauty treatment process according to an embodiment of the present disclosure.
  • FIG. 4 is an overall flowchart of a beauty processing process according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a thread scheduling method in a face detection process according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of an image rendering apparatus according to an embodiment of the present disclosure.
  • first, second, third, etc. may be used in this disclosure to describe various pieces of information, such information should not be limited by these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information, without departing from the scope of the present disclosure.
  • word "if” as used herein can be interpreted as "at the time of” or "when” or "in response to determining.”
  • thread scheduling needs to be performed, that is, it is determined on which thread or threads each link of image rendering is to be processed.
  • the thread scheduling method is very important.
  • the serial scheduling mode all links of image rendering are processed on one thread, that is, the original image is processed 1 first, and after processing 1 is completed, processing 2 is performed, and so on, and finally the rendered image is obtained.
  • the parallel scheduling mode each link of image rendering is processed on two or more threads.
  • processing 11 may be performed on thread 1, and after processing 11 is completed, processing 12 may be performed on thread 1, and so on, to obtain an intermediate processing result on thread 1.
  • processing 21 may also be performed on thread 2, and after processing 21 is completed, processing 22 may be performed on thread 2, and so on, to obtain an intermediate processing result on thread 2.
  • One or more kinds of processing may be performed on both thread 1 and thread 2.
  • the processing on thread 1 may only include processing 11, and the processing on thread 1 and the processing on thread 2 may be performed in parallel.
  • processing 31, processing 32, etc. may be performed on thread 3 to obtain a rendered image.
  • the intermediate processing result on thread 1 may also be used in a certain processing process of thread 2, so that thread 2 obtains a rendered image after a series of processing.
  • thread scheduling method the number of threads used in any case is fixed, that is, either a single thread is fixedly used to serially process each process of image rendering, or a fixed number of threads are used. Multiple threads to parallelize certain processes of image rendering. It can be seen that the traditional thread scheduling method is less flexible.
  • the present disclosure provides an image rendering method, as shown in FIG. 2 , the method may include:
  • Step 201 Obtain the target object detection result of the previous image of the current image, where the target object detection result is used to indicate the number of target objects included in the previous image;
  • Step 202 Determine the number of threads to be started based on the target object detection result
  • Step 203 Start the number of threads to perform rendering processing on the current image.
  • This embodiment of the present disclosure dynamically determines the number of threads that need to be started currently based on the number of target objects included in the previous image of the current image.
  • the number of started threads can be adjusted adaptively, so that the number of currently started threads can be adapted to different image rendering situations, and the flexibility of thread scheduling in the image rendering process is improved.
  • the current image is the currently processed image
  • the previous image is the last processed image before the current image is processed.
  • the current image and the previous image may be two images in the same image sequence, and the images in the image sequence may be sequentially arranged according to the time sequence of the acquired images.
  • the current image and the previous image may be two frames of images in the video, wherein the current image and the previous image may be two adjacent image frames in the video, or different frames. two adjacent image frames.
  • the current image and the previous image for rendering processing are two adjacent image frames captured by the camera in real time
  • the current image and the previous image can be respectively The two corresponding image frames when the user drags the video progress bar to different positions.
  • the current image and the previous image may be two adjacent or non-adjacent images among the multiple images captured in the continuous shooting mode.
  • the target object can be a human face, an object of categories such as food, scenery, and documents.
  • the number of target objects included in the current image and the previous image may be 0, 1, or more than 1, and the number and category of target objects included in the same image may be the same or different.
  • the number and category of target objects included in the image can be determined by performing object detection on the image. For example, when the target object is a human face, face detection can be performed. Specifically, an image can be input into a pre-trained neural network, and a face detection result output by the neural network can be obtained.
  • the face detection result may include the number and category of the face in the image, and may also include part or all of the position, posture and key point positions of the face in the image.
  • the rendering process may include multiple processes, and different processes may be executed in parallel or in series.
  • the rendering process includes a first process and a second process. If there is a target object in the previous image, the intermediate processing result obtained by performing the first processing on the target object in the previous image may be used to perform the second processing on the target object in the current image, so that there is no need to wait for the current image to be processed. After the first processing is completed, the second processing is performed on the current image. Therefore, in step 202, the number of threads that need to be started when the current image is rendered may be determined based on the target object detection result of the previous image.
  • the target object detection result indicates that the number of target objects included in the previous image is 0, since there is no intermediate processing result of the previous image to refer to, only one thread may be started for the current image.
  • Perform rendering processing when the target object detection result indicates that the number of target objects included in the previous image is greater than or equal to 1, at least 2 threads can be started to perform rendering processing on the current image, so that one thread can perform rendering processing on the current image.
  • the second processing is performed on the current image on another thread based on the intermediate processing result of the previous image.
  • the target object detection result indicates that the number of target objects is 0
  • no thread is started, and only when the target object detection result indicates that the number of target objects is greater than or equal to 1, at least 2 threads are started for the current The image is rendered.
  • the corresponding relationship between the number of target objects and the number of threads to be started can be preset according to the actual situation, and during rendering processing, the number of threads to be started is determined according to the corresponding relationship and the detection result of the target object.
  • the number of started threads is related to the processing mode used to render the current image, and the processing mode includes parallel processing and serial processing. For example, when the number of threads is 1, the rendering processing is performed by serial processing; for another example, when the number of threads is greater than 1, the rendering processing is performed by parallel processing.
  • multiple processing procedures included in the rendering processing may be executed by the started thread calling different processors.
  • multiple threads can be started, and different threads can call different processors in parallel for processing; when multiple processing procedures are executed serially, only one thread can be started, and this thread can be used to sequentially execute Call each processor for processing.
  • FIG. 3 shows the specific process of beauty processing in some embodiments, which generally includes face detection (including face position detection, face attitude angle detection, face key point detection), skin resurfacing processing, color adjustment processing and deformation one or more of the treatments.
  • face position detection is used to determine whether there is a face in the image, and the position and size of the face when there is a face.
  • the face attitude angle detection is used to detect the attitude angle of the face based on the position of the face, including at least one of a pitch angle, a heading angle and a roll angle.
  • Face key point detection is used to detect the position of key points in the face area based on face position and face pose angle.
  • the key points may include eyes, eyebrows, mouth, nose, and the like.
  • the microdermabrasion process is used to perform microdermabrasion processing on the face area according to the position and size of the human face. Through the microdermabrasion process, the skin texture of the face area in the image can be made more delicate and the outline clearer.
  • Color adjustment is used to set the skin color of the face area to a specified color according to the position and size of the face. A more common color adjustment method is whitening.
  • the deformation processing is used to change the shape and size of the face or facial features based on the position of the face, the posture angle of the face, and the position of the key points of the face.
  • the more common deformation processing is face-lifting.
  • processors may be used, and different processors execute different beauty treatment processes.
  • face detection can be implemented by a central processing unit (Central Processing Unit, CPU)
  • microdermabrasion processing can be implemented by a graphics processing unit (Graphic Processing Unit, GPU).
  • graphics processing unit Graphic Processing Unit, GPU
  • the GPU can perform corresponding processing on the current image based on the processing result of the CPU on the previous image.
  • two threads can be started to call the CPU and GPU in parallel for processing.
  • the first processing can be performed on the current image on the first thread to obtain the first processing of the current image.
  • the processing result, and based on the first processing result of the previous image, the second processing is performed on the current image on the second thread to obtain the second processing result of the current image.
  • a thread can be started to sequentially call the CPU and the GPU for processing.
  • the first processing may be performed on the current image on a first thread to obtain a first processing result of the current image, and based on the first processing result of the current image, the first thread The second processing is performed on the current image above to obtain a second processing result of the current image.
  • the present disclosure can adaptively adjust the number of threads to be started according to different situations. Compared with the fixed single thread method, the present disclosure can realize certain parallel processing, thereby improving processing efficiency. Compared with the fixed multi-threading method, the present disclosure can avoid that when there is no human face in the previous image and there is a human face in the current image, the face detection result in the previous image cannot be referenced, resulting in a beautifying effect. less effective problem. Therefore, the solution of the present disclosure takes into account the efficiency and effect of the beauty treatment.
  • the first processor that executes the first process and the second processor that executes the second process share the same memory.
  • the time and hardware resource overhead caused by copying data between different processors reduces the cost of image rendering processing.
  • an application scenario may be determined, and the number of threads to be started may be determined based on the application scenario and the target object detection result.
  • the application scenarios include video shooting scenarios and video editing scenarios.
  • the video shooting scenarios refer to the scenarios in which continuous video frames are captured by video capture applications such as cameras, and the video editing scenarios refer to splicing and cropping videos using video editing software. etc. to deal with the scene.
  • the number of threads to be started may be determined only based on the target object detection result. For example, when the target object detection result indicates that the number of target objects included in the previous image is less than a preset value, it is determined that the number of threads to be started is 1. For another example, when the target object detection result indicates that the number of target objects included in the previous image is greater than or equal to the preset value, it is determined that the number of threads to be started is greater than or equal to two.
  • the continuity detection result between the current image and the previous image is used to indicate whether the current image and the previous image are adjacent image frames.
  • the target object detection result indicates that the number of target objects included in the previous image is greater than or equal to a preset value
  • the continuity detection result indicates that the current image and the previous image are In the case of adjacent image frames, it is determined that the number of threads to be started is greater than or equal to 2.
  • the target object detection result indicates that the number of target objects included in the previous image is less than the preset value, or the continuity detection result indicates that the current image and the previous image are In the case of not being an adjacent image frame, determine the number of threads to be started to be 1.
  • flag bits may be generated based on the target object detection result and the application scenario, different flag bits correspond to different numbers, and the number of threads to be started is determined based on the flag bits.
  • the flag bit may be a 1-bit data bit, for example, "0" means to start one thread, and "1" means to start two threads.
  • the flag bit may be generated only based on the target object detection result. For example, when the number of target objects included in the previous image is 0, the generated flag bit is "0", and when the number of target objects included in the previous image is not 0, the generated flag bit is "1" .
  • the flag bit is generated based on the target object detection result and the continuity detection result between the current image and the previous image. For example, when the number of target objects included in the previous image is 0, or the previous image and the current image are not adjacent image frames, the generated flag bit is "0". When the number is not 0 and the previous image and the current image are adjacent image frames, the generated flag bit is "1". Different flags may be generated for different application scenarios to distinguish application scenarios. For example, in a video shooting scenario, a first flag is generated, and in a video editing scenario, a second flag is generated.
  • the rendering processing may include, but is not limited to, at least one of luminance processing, color processing, resolution processing, and mosaic processing.
  • the rendering processing may include rendering processing on the target object in the current image, and may also include rendering processing on other areas in the current image than the target object, or rendering processing on the entire image area.
  • the manner in which the target object is rendered and the manner in which the other regions are rendered may be the same or different.
  • the number of threads to be started is greater than or equal to 2
  • face detection can be performed on the current image on the first thread to obtain the face detection result of the current image;
  • the current image is subjected to skin grinding processing, color adjustment processing and/or deformation processing on the second thread.
  • the first thread and the second thread are different threads.
  • the number of threads to be started is greater than or equal to 2
  • face detection can be performed on the current image on the first thread to obtain the face detection result of the current image;
  • Based on the face detection result of the image perform skin grinding and/or color adjustment processing on the current image on the second thread to obtain the processed current image;
  • the processed current image is deformed on three threads.
  • the third thread may be the same as the first thread.
  • the reason why the parallel mode is different in the video shooting scene and the video editing scene is that the adjacent image frames in the video editing scene may be discontinuous, so the positions of the faces in the adjacent image frames may be quite different. Therefore, in the video editing scenario, only the skin resurfacing processing and color adjustment and face detection can be processed in parallel, while the deformation processing and the above processing process can be processed in series, so as to ensure the beauty efficiency while taking into account the beauty accuracy.
  • FIG. 4 it is an overall flow chart of the beauty processing process of the embodiment of the present disclosure.
  • it is dynamic whether the CPU module and the GPU module run in the same thread or multiple threads (taking two threads as an example), where the CPU module mainly refers to calling resources on the CPU for processing, and the GPU module Refers to mainly calling the resources on the GPU for processing.
  • the current image frame and the previous image frame do not necessarily have a continuous relationship in time and space. This difference is common.
  • the reason is that the video may be spliced, and the video streams before and after splicing are not continuous in space, or the user may suddenly jump from a certain image frame to a farther distance from the image frame when editing the video. another image frame, causing the video stream before and after the jump to be discontinuous in time, and using the face detection result of the previous image frame to process the current image frame will cause a great error.
  • the microdermabrasion processing and image color adjustment are less dependent on the face detection results, deviations within a certain range will not cause obvious visual defects; while the deformation processing realizes functions such as face-lifting, mouth trimming, and nose trimming.
  • the accuracy of face detection results is required to be high. Therefore, in the video shooting scene, when the first flag bit is 1, the face detection is processed in one thread, and the microdermabrasion, color adjustment and deformation processing are processed in another thread, and the processing on the two threads is parallel. conduct.
  • the second flag bit when the second flag bit is 1, face detection is processed in one thread, skin resurfacing and color adjustment are processed in another thread, and the processing on the two threads is performed in parallel. After both are run, the deformation processing is performed in a single thread.
  • This scheduling scheme can avoid the use of wrong face detection results in video editing due to discontinuity in time and space.
  • the scheme has a certain parallelism, and the running time of the two parallel parts is the same on most models. large and efficient.
  • the CPU module and the GPU module perform serial processing (a small number of face detection results used in the microdermabrasion module can be updated in time).
  • the CPU and the GPU may share memory, that is, the CPU and the GPU share the same memory space.
  • the CPU can read data from this memory space, and store the processing results obtained during the beautification process in this memory space, so that the GPU can read data from this memory space. In this way, the time and hardware resource consumption caused by copying the image from the CPU to the GPU is avoided.
  • the first thread for performing face detection may include a first sub-thread, a second sub-thread and a third sub-thread, and the first sub-thread may perform face position detection on the current image to obtain a human face. face position information; on the second sub-thread, face attitude angle detection may be performed on the current image based on the face position information to obtain the face attitude angle information of the current image; in the third sub-thread The thread may perform face key point detection on the current image based on the face position information and face attitude angle information of the current image to obtain the face key point information of the current image.
  • the numbers of the second sub-threads and the third sub-threads are both equal to the number of human faces detected from the current image.
  • the first sub-thread detects whether there is a human face in the image. If it does not exist, a detection result indicating no face information can be output. If there is face information, the number of sub-threads can be determined based on the number of faces. For example, when the number of faces is 3, the number of sub-threads is determined to be 3, including sub-thread 1, sub-thread 2 and sub-thread 3.
  • Each sub-thread is used for face pose angle detection and face key point detection for a face respectively. Face pose angle detection and face keypoint detection on the same thread can be performed serially.
  • the three sub-threads can output the detected face information (including face pose angle and face key point position) respectively.
  • the first thread can also output face position information.
  • the face detection module only runs once for one frame of image, but the running times of the face pose angle detection module and the face key point detection module are positively correlated with the number of faces. In the above manner, the image rendering efficiency can be further improved, and the processing time can be prevented from increasing significantly due to the increase in the number of faces.
  • each thread runs on different processor cores respectively.
  • the number of faces is n1
  • the number of processor cores is n2
  • the face attitude angle and face key point detection module takes t to process a face
  • the time required for n1 faces is about
  • the time-consuming of processing 4 images using the thread scheduling method of the present disclosure is theoretically not much different from the time-consuming of processing 1 image, thereby effectively improving the image rendering efficiency.
  • the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.
  • An embodiment of the present disclosure further provides an image rendering apparatus, including a processor, where the processor is configured to perform the following steps:
  • the target object detection result of the previous image of the current image is used to indicate the number of target objects included in the previous image
  • the rendering process includes a first process and a second process, the first process and the second process being performed by the launched thread calling different processors.
  • the processor when the number of threads to be started is equal to 1, the processor is configured to: perform the first processing on the current image on a first thread to obtain the first Processing result; based on the first processing result of the current image, perform the second processing on the current image on the first thread to obtain the second processing result of the current image.
  • the rendering process includes a first process and a second process; in the case where the number of threads to be started is greater than or equal to 2, the processor is configured to: perform a rendering of the current image on the first thread performing the first processing to obtain a first processing result of the current image; and based on the first processing result of the previous image, performing the second processing on the current image on a second thread to obtain The second processing result of the current image; wherein the first processing of the current image and the second processing of the current image are performed in parallel, and the first thread and the second thread are different threads.
  • a first processor performing the first process and a second processor performing the second process share the same memory.
  • the first processor is a central processing unit and the second processor is a graphics processor.
  • the processor is configured to: determine an application scenario, where the application scenario includes a video shooting scenario and a video editing scenario; and determine the number of threads to be started based on the application scenario and the target object detection result.
  • the processor is configured to: when the application scene is a video shooting scene, determine the number of threads to be started based on the target object detection result; and/or when the application scene is a video editing scene , determine the number of threads to be started based on the target object detection result and the continuity detection result between the current image and the previous image, wherein the continuity detection between the current image and the previous image The result is used to indicate whether the current image and the previous image are adjacent image frames.
  • the processor when the application scene is a video shooting scene, the processor is configured to: when the target object detection result indicates that the number of target objects included in the previous image is greater than or equal to a preset value In the case of , it is determined that the number of threads to be started is greater than or equal to 2; and/or in the case that the target object detection result indicates that the number of target objects included in the previous image is less than the preset value, Determine the number of threads that need to be started to 1.
  • the processor when the application scene is a video editing scene, the processor is configured to: when the target object detection result indicates that the number of target objects included in the previous image is greater than or equal to a preset value , and the continuity detection result indicates that the current image and the previous image are adjacent image frames, determine that the number of threads to be started is greater than or equal to 2; and/or in the target object detection result Indicates that the number of target objects included in the previous image is less than the preset value, or the continuity detection result indicates that the current image and the previous image are not adjacent image frames, Determine the number of threads that need to be started to 1.
  • the processor is configured to: generate flag bits based on the target object detection result and an application scene, where different flag bits correspond to different numbers, and the application scene includes a video shooting scene and a video editing scene; The above flags determine the number of threads that need to be started.
  • the processor is configured to: when the application scene is a video shooting scene, generate the flag bit based on the target object detection result; and/or when the application scene is a video shooting scene , the flag bit is generated based on the target object detection result and the continuity detection result between the current image and the previous image, wherein the continuity detection result between the current image and the previous image is used for indicating whether the current image and the previous image are adjacent image frames.
  • the rendering processing includes beautification processing
  • the beautification processing includes one or more of face detection, skin resurfacing processing, color adjustment processing, and deformation processing.
  • the processor is configured to: perform face detection on the current image on the first thread, and obtain a face detection result; based on the face detection result of the previous image, the current image is subjected to microdermabrasion processing, color adjustment processing and/or deformation processing on the second thread, and the first thread and the The second thread is a different thread.
  • the processor is configured to: perform face detection on the current image on the first thread, and obtain a face detection result; based on the face detection result of the previous image, perform microdermabrasion processing and/or color adjustment processing on the current image on the second thread to obtain the processed current image; According to the face detection result of the current image, deformation processing is performed on the processed current image on a third thread, and the first thread and the second thread are different threads.
  • the first thread includes a first sub-thread, a second sub-thread and a third sub-thread;
  • the processor is configured to: perform a face position operation on the current image on the first sub-thread detection to obtain face position information; perform face attitude angle detection on the current image based on the face position information on the second sub-thread to obtain the face attitude angle information of the current image;
  • the third sub-thread performs face key point detection on the current image based on the face position information and face attitude angle information of the current image, and obtains face key point information of the current image.
  • the number of the second sub-thread and the third sub-thread is equal to the number of human faces detected from the current image.
  • each thread runs on a different processor core.
  • FIG. 6 shows a schematic diagram of a more specific hardware structure of a data processing apparatus provided by an embodiment of this specification.
  • the apparatus may include: a processor 601 , a memory 602 , an input/output interface 603 , a communication interface 604 and a bus 605 .
  • the processor 601 , the memory 602 , the input/output interface 603 and the communication interface 604 realize the communication connection among each other within the device through the bus 605 .
  • the processor 601 can be implemented by a general-purpose CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. program to implement the technical solutions provided by the embodiments of this specification.
  • a general-purpose CPU Central Processing Unit, central processing unit
  • a microprocessor central processing unit
  • an application specific integrated circuit Application Specific Integrated Circuit, ASIC
  • ASIC Application Specific Integrated Circuit
  • the memory 602 can be implemented in the form of a ROM (Read Only Memory, read-only memory), a RAM (Random Access Memory, random access memory), a static storage device, a dynamic storage device, and the like.
  • the memory 602 may store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, relevant program codes are stored in the memory 602 and invoked by the processor 601 for execution.
  • the input/output interface 603 is used to connect the input/output module to realize information input and output.
  • the input/output/module can be configured in the device as a component (not shown in the figure), or can be externally connected to the device to provide corresponding functions.
  • the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc.
  • the output device may include a display, a speaker, a vibrator, an indicator light, and the like.
  • the communication interface 604 is used to connect a communication module (not shown in the figure), so as to realize the communication interaction between the device and other devices.
  • the communication module may implement communication through wired means (eg, USB, network cable, etc.), or may implement communication through wireless means (eg, mobile network, WIFI, Bluetooth, etc.).
  • Bus 605 includes a path to transfer information between the various components of the device (eg, processor 601, memory 602, input/output interface 603, and communication interface 604).
  • the above-mentioned device only shows the processor 601, the memory 602, the input/output interface 603, the communication interface 604 and the bus 605, in the specific implementation process, the device may also include necessary components for normal operation. other components.
  • the above-mentioned device may only include components necessary to implement the solutions of the embodiments of the present specification, rather than all the components shown in the figures.
  • An embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the method described in any of the foregoing embodiments.
  • Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology.
  • Information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
  • a typical implementing device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, email sending and receiving device, game control desktop, tablet, wearable device, or a combination of any of these devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本公开实施例提供一种图像渲染方法、装置和系统、计算机可读存储介质,所述方法包括:获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;基于所述目标对象检测结果确定需要启动的线程的数量;启动所述数量的线程对所述当前图像进行渲染处理。

Description

图像渲染方法、装置和系统、计算机可读存储介质 技术领域
本公开涉及图像处理技术领域,具体而言,涉及图像渲染方法、装置和系统、计算机可读存储介质。
背景技术
在日常生活中,常常需要对图像进行渲染处理,以获得良好的视觉效果。为了保证图像渲染的效率和准确性,需要采用适当的线程调度方式来进行图像渲染。然而,传统的线程调度方式要么固定地采用单个线程来对图像渲染的各个过程进行串行处理,要么固定地采用多个线程来对图像渲染的某些过程进行并行处理。上述线程调度方式灵活性较差。
发明内容
有鉴于此,本公开的实施例提出了图像渲染方法、装置和系统、计算机可读存储介质,以提高图像渲染的灵活性。
根据本公开实施例的第一方面,提供一种图像渲染方法,所述方法包括:获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;基于所述目标对象检测结果确定需要启动的线程的数量;启动所述数量的线程对所述当前图像进行渲染处理。
根据本公开实施例的第二方面,提供一种图像渲染装置,包括处理器,所述处理器用于执行以下步骤:获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;基于所述目标对象检测结果确定需要启动的线程的数量;启动所述数量的线程对所述当前图像进行渲染处理。
根据本公开实施例的第三方面,提供一种图像渲染系统,用于对图像进行渲染处理,所述渲染处理包括第一处理和第二处理;所述系统包括第一处理器和第二处理器;所述第一处理器用于获取当前图像的上一张图像的目标对象检测结果,所述目标 对象检测结果用于指示所述上一张图像中包括的目标对象的数量,基于所述目标对象检测结果确定需要启动的线程的数量,启动所述数量的线程对所述当前图像进行渲染处理,并在被启动的线程的调用下执行所述第一处理;所述第二处理器用于在被启动的线程的调用下执行所述第二处理。
根据本公开实施例的第四方面,提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现本公开任一实施例所述的方法。
应用本公开实施例方案,能够基于当前图像的上一张图像中包括的目标对象的数量,动态地确定当前需要启动的线程的数量,在上一张图像中包括的目标对象的数量不同的情况下,所启动的线程的数量也不同,从而能够使当前启动的线程数量适应于不同的图像渲染情况,提高了图像渲染过程中线程调度的灵活性。
附图说明
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1A是一种传统的图像渲染过程中的线程调度方式的示意图。
图1B是另一种传统的图像渲染过程中的线程调度方式的示意图。
图2是本公开实施例的图像渲染方法的流程图。
图3是本公开实施例的美颜处理过程的示意图。
图4是本公开实施例的美颜处理过程的总体流程图。
图5是本公开实施例的人脸检测过程中的线程调度方式的示意图。
图6是本公开实施例的图像渲染装置的示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例 性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。
在本公开使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开。在本公开说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
在进行图像渲染时,需要进行线程调度,即,确定在哪个或哪些线程上对图像渲染的各个环节进行处理。为了保证图像渲染的效果和速度,线程调度方式是十分重要的。传统的线程调度方式一般有两种,一种是如图1A所示的串行调度方式,另一种是如图1B所示的并行调度方式。在串行调度方式中,在一个线程上对图像渲染的所有环节进行处理,即,先对原始图像进行处理1,在处理1完成之后,再进行处理2,以此类推,最终得到渲染后的图像。在并行调度方式中,在两个或两个以上的线程上对图像渲染的各个环节进行处理。以两个线程为例,可以在线程1上进行处理11,在处理11完成之后,再在线程1上进行处理12,以此类推,得到线程1上的中间处理结果。此外,还可以在线程2上进行处理21,在处理21完成之后,再在线程2上进行处理22,以此类推,得到线程2上的中间处理结果。其中,线程1和线程2上均可以进行一种或多种处理,例如,线程1上的处理可以仅包括处理11,且线程1上的处理和线程2上的处理可以并行地进行。然后,还可以基于线程1上的中间处理结果和线程2上的中间处理结果,在线程3上进行处理31、处理32等处理,得到渲染后的图像。或者,线程1上的中间处理结果也可以用于线程2的某个处理过程,以使线程2经过一系列处理后得到渲染后的图像。
然而,无论是哪一种线程调度方式,在任何情况下所采用的线程的数量都是固定的,即,要么固定地采用单个线程来对图像渲染的各个过程进行串行处理,要么固定地采用多个线程来对图像渲染的某些过程进行并行处理。可见,传统的线程调度方式灵活性较差。
基于此,本公开提供一种图像渲染方法,如图2所示,所述方法可包括:
步骤201:获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;
步骤202:基于所述目标对象检测结果确定需要启动的线程的数量;
步骤203:启动所述数量的线程对所述当前图像进行渲染处理。
本公开实施例基于当前图像的上一张图像中包括的目标对象的数量,动态地确定当前需要启动的线程的数量,在上一张图像中包括的目标对象的数量不同的情况下,能够自适应地调整所启动的线程的数量,从而能够使当前启动的线程数量适应于不同的图像渲染情况,提高了图像渲染过程中线程调度的灵活性。
在步骤201中,当前图像为当前处理的图像,上一张图像为在处理当前图像之前,上一次处理的图像。所述当前图像与上一张图像可以是同一图像序列中的两张图像,所述图像序列中的图像可以按照采集图像的时间顺序依次排列。在一些实施例中,当前图像和上一张图像可以是视频中的两帧图像,其中,所述当前图像和上一张图像既可以是视频中相邻的两帧图像帧,也可以是不相邻的两帧图像帧。例如,在视频拍摄场景下,进行渲染处理的当前图像与上一张图像分别是摄像头实时采集到的相邻两帧图像帧,而在视频编辑场景下,当前图像和上一张图像可以分别是用户将视频进度条拖动到不同位置时对应的两帧图像帧。在另一些实施例中,当前图像和上一张图像可以是连拍模式下拍摄到的多张图像中的相邻或者不相邻的两张图像。
目标对象可以是人脸、是美食、风景、证件等类别的对象。所述当前图像和上一张图像中包括的目标对象的数量均可以是0个、1个或1个以上,同一张图像中包括的目标对象的数量和类别可以相同,也可以不同。可以通过对图像进行目标检测,以确定图像中包括的目标对象的数量和类别。例如,在目标对象为人脸的情况下,可以进行人脸检测。具体来说,可以将图像输入预先训练的神经网络,并获取所述神经网络输出的人脸检测结果。所述人脸检测结果中可以包括图像中人脸的数量和类别,还可以包括图像中人脸的位置、姿态和人脸关键点位置中的部分或全部。
在一些情况下,渲染处理可以包括多个处理过程,不同的处理过程可以并行执行,也可以串行执行。例如,述渲染处理包括第一处理和第二处理。如果上一张图像中存在目标对象,对上一张图像中的目标对象进行第一处理得到的中间处理结果可能用于对当前图像中的目标对象进行第二处理,从而无需等对当前图像的第一处理执行 完毕再对当前图像进行第二处理。因此,在步骤202中,可以基于所述上一张图像的目标对象检测结果确定对当前图像进行渲染处理时需要启动的线程的数量。例如,在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量为0时,由于没有上一张图像的中间处理结果可以参考,因此可以仅启动1个线程对当前图像进行渲染处理;在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于1时,可以启动至少2个线程对当前图像进行渲染处理,从而在一个线程对当前图像进行第一处理的同时,在另一个线程上基于上一张图像的中间处理结果对当前图像进行第二处理。又例如,在所述目标对象检测结果指示目标对象的数量为0时,不启动线程,只有当所述目标对象检测结果指示目标对象的数量大于或等于1时,才启动至少2个线程对当前图像进行渲染处理。可以根据实际情况预先设置好目标对象的数量与需要启动的线程的数量的对应关系,并在进行渲染处理时,根据该对应关系以及目标对象检测结果确定需要启动的线程的数量。所启动的线程的数量与对当前图像进行渲染处理所采用的处理方式相关,所述处理方式包括并行处理和串行处理。例如,在线程的数量为1时,通过串行处理的方式进行渲染处理;又例如,在线程的数量大于1时,通过并行处理的方式进行渲染处理。
在一些实施例中,所述渲染处理包括的多个处理过程(例如,第一处理和第二处理)可以由被启动的线程调用不同的处理器执行。在多个处理过程并行执行时,可以启动多个线程,不同的线程并行地调用不同的处理器进行处理;在多个处理过程串行执行时,可以仅启动一个线程,用这一个线程来依次调用各个处理器进行处理。
下面以渲染处理为美颜处理为例,对本公开的线程调度方式进行举例说明。本领域技术人员可以理解,美颜处理仅为渲染处理的一种可能的应用场景,并非用于限制本公开。美颜处理一般是指对人脸进行美化处理,以提高人脸的美感。图3示出了一些实施例的美颜处理的具体过程,一般包括人脸检测(包括人脸位置检测、人脸姿态角检测、人脸关键点检测)、磨皮处理、色彩调节处理和形变处理中的一种或多种处理。其中,人脸位置检测用于确定图像中是否存在人脸,以及在存在人脸的情况下人脸的位置和大小。人脸姿态角检测用于基于人脸位置检测人脸的姿态角,包括俯仰角、航向角和横滚角中的至少一者。人脸关键点检测用于基于人脸位置和人脸姿态角检测人脸区域的关键点的位置。所述关键点可包括眼睛、眉毛、嘴巴、鼻子等。磨皮处理用于根据人脸位置和大小对人脸区域进行磨皮处理,通过所述磨皮处理,能够使得图像中人脸区域的皮肤纹理更加细腻,轮廓更加清晰。色彩调节用于根据人脸位置 和大小将人脸区域的肤色设置为指定颜色,较为常见的一种色彩调节方式是美白处理。形变处理用于基于人脸位置、人脸姿态角和人脸关键点位置,更改人脸或者五官的形状和大小,较为常见的形变处理是瘦脸处理。以上仅为美颜处理的一种可能的实现方式,在实际应用中,还可根据实际需要增加或减少处理过程。
由于美颜处理涉及的处理过程较多,如果只在一个处理器上运行,实时性较低。因此,为了提高美颜处理的效率,可以采用多个处理器,不同的处理器执行不同的美颜处理过程。例如,人脸检测可以通过中央处理器(Central Processing Unit,CPU)实现,磨皮处理、色彩调节和形变处理可以通过图形处理器(Graphic Processing Unit,GPU)实现。
在上一张图像中检测到人脸的情况下,GPU可以基于CPU对上一张图像的处理结果来对当前图像进行相应的处理。此时,可以启动两个线程,并行地调用CPU和GPU进行处理。假设调用CPU进行的处理称为第一处理,调用GPU进行的处理称为第二处理,则可以在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果,以及基于所述上一张图像的第一处理结果,在第二线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果。
在上一张图像中未检测到人脸的情况下,由于CPU对上一张图像的处理结果不能用于对当前图像进行处理,因此,可以启动一个线程,依次调用CPU和GPU进行处理。具体来说,可以在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果,基于所述当前图像的第一处理结果,在所述第一线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果。
本公开能够自适应地根据不同的情况调整启动的线程数量。相比于固定地采用单线程的方式,本公开能够实现一定的并行处理,从而提高处理效率。相比于固定地采用多线程的方式,本公开能够避免上一张图像中不存在人脸而当前图像中存在人脸时,无法参考上一张图像中的人脸检测结果,从而导致美颜效果较差的问题。因此,本公开的方案兼顾了美颜处理的效率与效果。
进一步地,在图像渲染处理包括第一处理和第二处理的情况下,执行所述第一处理的第一处理器和执行所述第二处理的第二处理器共用同一内存,这样,减少了在不同的处理器之间拷贝数据所带来的时间和硬件资源的开销,减少了图像渲染处理的成本。
在一些实施例中,可以确定应用场景,基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量。其中,所述应用场景包括视频拍摄场景和视频编辑场景,视频拍摄场景是指通过摄像头等视频采集应用拍摄连续的视频帧的场景,而视频编辑场景是指通过视频编辑软件对视频进行拼接、裁剪等处理的场景。
在视频拍摄场景下,由于采集到的图像帧在时间和空间上一般是连续的,因此,可以仅基于所述目标对象检测结果确定需要启动的线程的数量。例如,在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于预设值的情况下,确定需要启动的线程的数量为1。又例如,在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于所述预设值的情况下,确定需要启动的线程的数量大于或等于2。
而在视频编辑场景下,由于无法保证相邻两帧图像帧在时间和空间上的连续性,因此,在确定需要启动的线程数量时,不仅需要考虑所述目标对象检测结果,还需要考虑所述当前图像与所述上一张图像的连续性检测结果。其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。例如,在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值,且所述连续性检测结果指示所述当前图像与所述上一张图像为相邻图像帧的情况下,确定需要启动的线程数量大于或等于2。又例如,在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值,或者所述连续性检测结果指示所述当前图像与所述上一张图像不为相邻图像帧的情况下,确定需要启动的线程数量为1。
为了便于处理,可以基于所述目标对象检测结果和应用场景生成标志位,不同的标志位对应不同的数量,基于所述标志位确定需要启动的线程的数量。所述标志位可以是1比特的数据位,例如,用“0”表示启动1个线程,用“1”表示启动2个线程。其中,在所述应用场景为视频拍摄场景时,可以仅基于所述目标对象检测结果生成所述标志位。例如,当上一张图像中包括的目标对象数量为0时,生成的标志位为“0”,当上一张图像中包括的目标对象数量不为0时,生成的标志位为“1”。在所述应用场景为视频拍编辑景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果生成所述标志位。例如,当上一张图像中包括的目标对象数量为0,或者上一张图像与当前图像不是相邻图像帧时,生成的标志位为“0”,当上一张图像中包括的目标对象数量不为0,且上一张图像与当前图像是相邻图像帧 时,生成的标志位为“1”。可以为不同的应用场景生成不同的标志位,以便对应用场景进行区分,例如,在视频拍摄场景下,生成第一标志位,在视频编辑场景下,生成第二标志位。
在步骤203中,所述渲染处理可以包括但不限于亮度处理、色彩处理、分辨率处理和马赛克处理中的至少一种。所述渲染处理可包括对当前图像中的目标对象进行渲染处理,还可以包括对当前图像中所述目标对象以外的其他区域进行渲染处理,或者对整张图像区域进行渲染处理。对所述目标对象进行渲染处理的方式与对所述其他区域进行渲染处理的方式可以相同,也可以不同。
仍以美颜处理为例。若需要启动的线程数量等于1,则可以在第一线程上对所述当前图像依次进行人脸检测、磨皮处理、色彩调节处理和形变处理。
在视频拍摄场景下,若需要启动的线程数量大于或等于2,可以在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理、色彩调节处理和/或形变处理。所述第一线程与所述第二线程为不同的线程。
在视频编辑场景下,若需要启动的线程数量大于或等于2,可以在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理和/或色彩调节处理,得到处理后的所述当前图像;基于所述当前图像的人脸检测结果,在第三线程上对处理后的所述当前图像进行形变处理。其中,第三线程可以与第一线程相同。
之所以在视频拍摄场景下和在视频编辑场景下的并行方式不同,是因为视频编辑场景中相邻图像帧有可能是不连续的,从而相邻图像帧中人脸的位置可能相差较大。因此,在视频编辑场景下,可以仅将磨皮处理和色彩调节与人脸检测进行并行处理,而将形变处理与上述处理过程进行串行处理,从而在保证美颜效率的同时,兼顾美颜的准确性。
如图4所示,是本公开实施例的美颜处理过程的总体流程图。在本实施例中,CPU模块和GPU模块是在同一个线程还是多个线程(以两个线程为例)运行是动态的,其中,CPU模块是指主要调用CPU上的资源进行处理,GPU模块是指主要调用GPU上的资源进行处理。
情况一,如果当前图像帧的上一图像帧中没有检测到人脸,那么只启动一个线 程,先运行CPU模块,再运行GPU模块,二者串行。在这种线程组织下,如果当前帧继续没有人脸,那么CPU模块只需进行人脸位置检测,无需进行人脸姿态角检测和人脸关键点检测,GPU模块只需进行图像色彩调节,无需进行磨皮处理和形变处理,串行处理时长相比并行处理不会明显增加;如果当前图像帧出现了人脸,那么由于串行,当前图像帧会立刻被美颜处理。
情况二,如果当前图像帧的上一图像帧中检测到人脸,那么将启动两个线程,分别运行CPU模块和GPU模,两个模块并行处理。该方案中是否有人脸由CPU模块的人脸检测结果决定,CPU模块可以设置标志位,指导下一帧的线程调度策略。其中,在视频拍摄场景下,仅基于上一图像帧的人脸检测结果是否为0来设置第一标志位,在视频编辑场景下,基于上一图像帧的人脸检测结果是否为0,以及上一图像帧与当前图像帧是否为相邻图像帧共同来设置第二标志位。该方案既保证了运行速度,又兼顾了美颜一致性,能有效避免从无人脸到有人脸的第一帧图像美颜效果较差的问题。
不同于视频拍摄场景,在视频编辑场景下,当前图像帧与上一图像帧不一定存在时间和空间上的连续关系。这种区别是普遍存在的,其原因在于视频可能是拼接的,拼接前后的视频流在空间上不连续,或者用户在编辑视频时,可能从某一图像帧突然跳到距离该图像帧较远的另一图像帧,造成跳转前后的视频流在时间上不连续,使用上一图像帧的人脸检测结果处理当前图像帧,将造成很大误差。考虑到磨皮处理和图像色彩调节对人脸检测结果依赖度较低,一定范围内的偏差不会造成视觉上明显缺陷;而形变处理实现的是瘦脸、修嘴、修鼻等功能,对人脸检测结果的准确度要求较高。因此,在视频拍摄场景下,第一标志位为1时,人脸检测在一个线程中进行处理,磨皮、色彩调节和形变处理在另一个线程中进行处理,且两个线程上的处理并行进行。而在视频编辑场景下,第二标志位为1时,人脸检测在一个线程中进行处理,磨皮和色彩调节均在另一个线程中进行处理,且两个线程上的处理并行进行,在二者都运行完成之后,再在单一线程中进行形变处理。这种调度方案,可以避免视频编辑中因为时间和空间上不连续而使用了错误的人脸检测结果,同时,方案具有一定的并行性,且并行的两部分运行时间在多数机型上相差不大,效率较高。在视频拍摄场景和视频编辑场景下,如果对应的标志位为0,则CPU模块和GPU模块进行串行处理(可及时更新磨皮模块中使用的少量人脸检测结果)。
在一些实施例中,CPU与GPU可以共享内存,即,CPU与GPU共用同一块内存空间。CPU可以从该内存空间读取数据,并将美颜处理过程中得到的处理结果存 储到该内存空间,以便GPU从该内存空间读取数据。这样,避免了将图像从CPU上拷贝到GPU上所带来的时间和硬件资源的消耗。
进一步地,进行人脸检测的第一线程可包括第一子线程,第二子线程和第三子线程,在所述第一子线程上可以对所述当前图像进行人脸位置检测,得到人脸位置信息;在所述第二子线程上可以基于所述人脸位置信息对所述当前图像进行人脸姿态角检测,得到所述当前图像的人脸姿态角信息;在所述第三子线程上可以基于所述当前图像的人脸位置信息和人脸姿态角信息对所述当前图像进行人脸关键点检测,得到所述当前图像的人脸关键点信息。
所述第二子线程和第三子线程的数量均等于从所述当前图像中检测到的人脸的数量。如图5所示,先由第一子线程检测图像中是否存在人脸。如果不存在,可以输出用于指示无人脸信息的检测结果。如果存在人脸信息,可以基于人脸的数量确定子线程的数量,例如,人脸数量为3时,确定子线程的数量为3,包括子线程1、子线程2和子线程3。每个子线程分别用于对一个人脸进行人脸姿态角检测和人脸关键点检测。同一线程上的人脸姿态角检测和人脸关键点检测可以串行进行。三个子线程可以分别输出检测到的人脸信息(包括人脸姿态角和人脸关键点位置)。第一线程也可以输出人脸位置信息。在图像中包括多个人脸的情况下,对于一帧图像,人脸检测模块只运行一次,但是人脸姿态角检测模块和人脸关键点检测模块,运行次数与人脸数量正相关。通过上述方式,可以进一步提高图像渲染效率,防止人脸数量增加造成处理时长显著增长。
在需要启动的线程的数量大于1的情况下,各个线程分别运行在不同的处理器内核上。假设人脸数量为n1,处理器核数为n2,人脸姿态角和人脸关键点检测模块处理一张人脸时间为t,那么在理想情况下,n1张人脸所需的时间大约为
Figure PCTCN2020139162-appb-000001
在处理器包括4个性能接近的内核的情况下,使用本公开的线程调度方式处理4张图像的耗时理论上与处理1张图像的耗时相差不大,从而有效提高了图像渲染效率。
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。
本公开实施例还提供一种图像渲染装置,包括处理器,所述处理器用于执行以下步骤:
获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;
基于所述目标对象检测结果确定需要启动的线程的数量;
启动所述数量的线程对所述当前图像进行渲染处理。
在一些实施例中,所述渲染处理包括第一处理和第二处理,所述第一处理和所述第二处理由被启动的线程调用不同的处理器执行。
在一些实施例中,在需要启动的线程的数量等于1的情况下,所述处理器用于:在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;基于所述当前图像的第一处理结果,在所述第一线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果。
在一些实施例中,所述渲染处理包括第一处理和第二处理;在需要启动的线程的数量大于或等于2的情况下,所述处理器用于:在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;以及基于所述上一张图像的第一处理结果,在第二线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果;其中,对所述当前图像的第一处理与对所述当前图像的第二处理并行进行,所述第一线程与所述第二线程为不同的线程。
在一些实施例中,执行所述第一处理的第一处理器和执行所述第二处理的第二处理器共用同一内存。
在一些实施例中,所述第一处理器为中央处理器,所述第二处理器为图形处理器。
在一些实施例中,所述处理器用于:确定应用场景,所述应用场景包括视频拍摄场景和视频编辑场景;基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量。
在一些实施例中,所述处理器用于:在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果确定需要启动的线程的数量;和/或在所述应用场景为视频编辑场景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果确定需要启动的线程数量,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
在一些实施例中,在所述应用场景为视频拍摄场景时,所述处理器用于:在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值的情况下,确定需要启动的线程的数量大于或等于2;和/或在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值的情况下,确定需要启动的线程的数量为1。
在一些实施例中,在所述应用场景为视频编辑场景时,所述处理器用于:在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值,且所述连续性检测结果指示所述当前图像与所述上一张图像为相邻图像帧的情况下,确定需要启动的线程数量大于或等于2;和/或在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值,或者所述连续性检测结果指示所述当前图像与所述上一张图像不为相邻图像帧的情况下,确定需要启动的线程数量为1。
在一些实施例中,所述处理器用于:基于所述目标对象检测结果和应用场景生成标志位,不同的标志位对应不同的数量,所述应用场景包括视频拍摄场景和视频编辑场景;基于所述标志位确定需要启动的线程的数量。
在一些实施例中,所述处理器用于:在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果生成所述标志位;和/或在所述应用场景为视频拍编辑景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果生成所述标志位,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
在一些实施例中,所述渲染处理包括美颜处理,所述美颜处理包括人脸检测、磨皮处理、色彩调节处理、形变处理中的一者或多者。
在一些实施例中,在视频拍摄场景下,若需要启动的线程数量大于或等于2,所述处理器用于:在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理、色彩调节处理和/或形变处理,所述第一线程与所述第二线程为不同的线程。
在一些实施例中,在视频编辑场景下,若需要启动的线程数量大于或等于2,所述处理器用于:在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的 人脸检测结果;基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理和/或色彩调节处理,得到处理后的所述当前图像;基于所述当前图像的人脸检测结果,在第三线程上对处理后的所述当前图像进行形变处理,所述第一线程与所述第二线程为不同的线程。
在一些实施例中,所述第一线程包括第一子线程,第二子线程和第三子线程;所述处理器用于:在所述第一子线程上对所述当前图像进行人脸位置检测,得到人脸位置信息;在所述第二子线程上基于所述人脸位置信息对所述当前图像进行人脸姿态角检测,得到所述当前图像的人脸姿态角信息;在所述第三子线程上基于所述当前图像的人脸位置信息和人脸姿态角信息对所述当前图像进行人脸关键点检测,得到所述当前图像的人脸关键点信息。
在一些实施例中,所述第二子线程和第三子线程的数量均等于从所述当前图像中检测到的人脸的数量。
在一些实施例中,在需要启动的线程的数量大于1的情况下,各个线程分别运行在不同的处理器内核上。
本公开实施例的图像渲染装置中处理器所执行的方法的具体实施例可参见前述方法实施例,此处不再赘述。
图6示出了本说明书实施例所提供的一种更为具体的数据处理装置硬件结构示意图,该设备可以包括:处理器601、存储器602、输入/输出接口603、通信接口604和总线605。其中处理器601、存储器602、输入/输出接口603和通信接口604通过总线605实现彼此之间在设备内部的通信连接。
处理器601可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。
存储器602可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器602可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器602中,并由处理器601来调用执行。
输入/输出接口603用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。
通信接口604用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。
总线605包括一通路,在设备的各个组件(例如处理器601、存储器602、输入/输出接口603和通信接口604)之间传输信息。
需要说明的是,尽管上述设备仅示出了处理器601、存储器602、输入/输出接口603、通信接口604以及总线605,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。
本公开实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前述任一实施例所述的方法。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备 等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
以上实施例中的各种技术特征可以任意进行组合,只要特征之间的组合不存在冲突或矛盾,但是限于篇幅,未进行一一描述,因此上述实施方式中的各种技术特征的任意进行组合也属于本公开的范围。
本领域技术人员在考虑公开及实践这里公开的说明书后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。

Claims (40)

  1. 一种图像渲染方法,其特征在于,所述方法包括:
    获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;
    基于所述目标对象检测结果确定需要启动的线程的数量;
    启动所述数量的线程对所述当前图像进行渲染处理。
  2. 根据权利要求1所述的方法,其特征在于,所述渲染处理包括第一处理和第二处理,所述第一处理和所述第二处理由被启动的线程调用不同的处理器执行。
  3. 根据权利要求2所述的方法,其特征在于,在需要启动的线程的数量等于1的情况下,所述启动所述数量的线程对所述当前图像进行渲染处理,包括:
    在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;
    基于所述当前图像的第一处理结果,在所述第一线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果。
  4. 根据权利要求2所述的方法,其特征在于,所述渲染处理包括第一处理和第二处理;在需要启动的线程的数量大于或等于2的情况下,所述启动所述数量的线程对所述当前图像进行渲染处理,包括:
    在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;以及
    基于所述上一张图像的第一处理结果,在第二线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果;
    其中,对所述当前图像的第一处理与对所述当前图像的第二处理并行进行。
  5. 根据权利要求2至4任意一项所述的方法,其特征在于,执行所述第一处理的第一处理器和执行所述第二处理的第二处理器共用同一内存。
  6. 根据权利要求5所述的方法,其特征在于,所述第一处理器为中央处理器,所述第二处理器为图形处理器。
  7. 根据权利要求1所述的方法,其特征在于,所述基于所述目标对象检测结果确定需要启动的线程的数量,包括:
    确定应用场景,所述应用场景包括视频拍摄场景和视频编辑场景;
    基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量。
  8. 根据权利要求7所述的方法,其特征在于,所述基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量,包括:
    在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果确定需要启动的线程的数量;和/或
    在所述应用场景为视频编辑场景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果确定需要启动的线程数量,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
  9. 根据权利要求8所述的方法,其特征在于,在所述应用场景为视频拍摄场景时,所述基于所述目标对象检测结果确定需要启动的线程的数量,包括:
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值的情况下,确定需要启动的线程的数量大于或等于2;和/或
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值的情况下,确定需要启动的线程的数量为1。
  10. 根据权利要求8所述的方法,其特征在于,在所述应用场景为视频编辑场景时,所述基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果确定需要启动的线程数量,包括:
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值,且所述连续性检测结果指示所述当前图像与所述上一张图像为相邻图像帧的情况下,确定需要启动的线程数量大于或等于2;和/或
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值,或者所述连续性检测结果指示所述当前图像与所述上一张图像不为相邻图像帧的情况下,确定需要启动的线程数量为1。
  11. 根据权利要求7所述的方法,其特征在于,所述基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量,包括:
    基于所述目标对象检测结果和应用场景生成标志位,不同的标志位对应不同的数量,所述应用场景包括视频拍摄场景和视频编辑场景;
    基于所述标志位确定需要启动的线程的数量。
  12. 根据权利要求11所述的方法,其特征在于,所述基于所述目标对象检测结果和应用场景生成标志位,包括:
    在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果生成所述标志位; 和/或
    在所述应用场景为视频拍编辑景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果生成所述标志位,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
  13. 根据权利要求1所述的方法,其特征在于,所述渲染处理包括美颜处理,所述美颜处理包括人脸检测、磨皮处理、色彩调节处理、形变处理中的一者或多者。
  14. 根据权利要求13所述的方法,其特征在于,在视频拍摄场景下,若需要启动的线程数量大于或等于2,所述启动所述数量的线程对所述当前图像进行渲染处理,包括:
    在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;
    基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理、色彩调节处理和/或形变处理。
  15. 根据权利要求13所述的方法,其特征在于,在视频编辑场景下,若需要启动的线程数量大于或等于2,所述启动所述数量的线程对所述当前图像进行渲染处理,包括:
    在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;
    基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理和/或色彩调节处理,得到处理后的所述当前图像;
    基于所述当前图像的人脸检测结果,在第三线程上对处理后的所述当前图像进行形变处理。
  16. 根据权利要求14或15所述的方法,其特征在于,所述第一线程包括第一子线程,第二子线程和第三子线程;所述在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果,包括:
    在所述第一子线程上对所述当前图像进行人脸位置检测,得到人脸位置信息;
    在所述第二子线程上基于所述人脸位置信息对所述当前图像进行人脸姿态角检测,得到所述当前图像的人脸姿态角信息;
    在所述第三子线程上基于所述当前图像的人脸位置信息和人脸姿态角信息对所述当前图像进行人脸关键点检测,得到所述当前图像的人脸关键点信息。
  17. 根据权利要求16所述的方法,其特征在于,所述第二子线程和第三子线程的数量均等于从所述当前图像中检测到的人脸的数量。
  18. 根据权利要求1所述的方法,其特征在于,在需要启动的线程的数量大于1的情况下,各个线程分别运行在不同的处理器内核上。
  19. 一种图像渲染装置,包括处理器,其特征在于,所述处理器用于执行以下步骤:
    获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量;
    基于所述目标对象检测结果确定需要启动的线程的数量;
    启动所述数量的线程对所述当前图像进行渲染处理。
  20. 根据权利要求19所述的装置,其特征在于,所述渲染处理包括第一处理和第二处理,所述第一处理和所述第二处理由被启动的线程调用不同的处理器执行。
  21. 根据权利要求20所述的装置,其特征在于,在需要启动的线程的数量等于1的情况下,所述处理器用于:
    在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;
    基于所述当前图像的第一处理结果,在所述第一线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果。
  22. 根据权利要求20所述的装置,其特征在于,所述渲染处理包括第一处理和第二处理;在需要启动的线程的数量大于或等于2的情况下,所述处理器用于:
    在第一线程上对所述当前图像进行所述第一处理,得到所述当前图像的第一处理结果;以及
    基于所述上一张图像的第一处理结果,在第二线程上对所述当前图像进行所述第二处理,得到所述当前图像的第二处理结果;
    其中,对所述当前图像的第一处理与对所述当前图像的第二处理并行进行。
  23. 根据权利要求20至22任意一项所述的装置,其特征在于,执行所述第一处理的第一处理器和执行所述第二处理的第二处理器共用同一内存。
  24. 根据权利要求23所述的装置,其特征在于,所述第一处理器为中央处理器,所述第二处理器为图形处理器。
  25. 根据权利要求19所述的装置,其特征在于,所述处理器用于:
    确定应用场景,所述应用场景包括视频拍摄场景和视频编辑场景;
    基于所述应用场景和所述目标对象检测结果确定需要启动的线程的数量。
  26. 根据权利要求25所述的装置,其特征在于,所述处理器用于:
    在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果确定需要启动的线程的数量;和/或
    在所述应用场景为视频编辑场景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果确定需要启动的线程数量,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
  27. 根据权利要求26所述的装置,其特征在于,在所述应用场景为视频拍摄场景时,所述处理器用于:
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值的情况下,确定需要启动的线程的数量大于或等于2;和/或
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值的情况下,确定需要启动的线程的数量为1。
  28. 根据权利要求26所述的装置,其特征在于,在所述应用场景为视频编辑场景时,所述处理器用于:
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量大于或等于预设值,且所述连续性检测结果指示所述当前图像与所述上一张图像为相邻图像帧的情况下,确定需要启动的线程数量大于或等于2;和/或
    在所述目标对象检测结果指示所述上一张图像中包括的目标对象的数量小于所述预设值,或者所述连续性检测结果指示所述当前图像与所述上一张图像不为相邻图像帧的情况下,确定需要启动的线程数量为1。
  29. 根据权利要求25所述的装置,其特征在于,所述处理器用于:
    基于所述目标对象检测结果和应用场景生成标志位,不同的标志位对应不同的数量,所述应用场景包括视频拍摄场景和视频编辑场景;
    基于所述标志位确定需要启动的线程的数量。
  30. 根据权利要求29所述的装置,其特征在于,所述处理器用于:
    在所述应用场景为视频拍摄场景时,基于所述目标对象检测结果生成所述标志位;和/或
    在所述应用场景为视频拍编辑景时,基于所述目标对象检测结果以及所述当前图像与所述上一张图像的连续性检测结果生成所述标志位,其中,所述当前图像与所述上一张图像的连续性检测结果用于指示所述当前图像与所述上一张图像是否为相邻图像帧。
  31. 根据权利要求19所述的装置,其特征在于,所述渲染处理包括美颜处理,所述美颜处理包括人脸检测、磨皮处理、色彩调节处理、形变处理中的一者或多者。
  32. 根据权利要求31所述的装置,其特征在于,在视频拍摄场景下,若需要启动的线程数量大于或等于2,所述处理器用于:
    在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;
    基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理、色彩调节处理和/或形变处理。
  33. 根据权利要求31所述的装置,其特征在于,在视频编辑场景下,若需要启动的线程数量大于或等于2,所述处理器用于:
    在第一线程上对所述当前图像进行人脸检测,得到所述当前图像的人脸检测结果;
    基于所述上一张图像的人脸检测结果,在第二线程上对所述当前图像进行磨皮处理和/或色彩调节处理,得到处理后的所述当前图像;
    基于所述当前图像的人脸检测结果,在第三线程上对处理后的所述当前图像进行形变处理。
  34. 根据权利要求32或33所述的装置,其特征在于,所述第一线程包括第一子线程,第二子线程和第三子线程;所述处理器用于:
    在所述第一子线程上对所述当前图像进行人脸位置检测,得到人脸位置信息;
    在所述第二子线程上基于所述人脸位置信息对所述当前图像进行人脸姿态角检测,得到所述当前图像的人脸姿态角信息;
    在所述第三子线程上基于所述当前图像的人脸位置信息和人脸姿态角信息对所述当前图像进行人脸关键点检测,得到所述当前图像的人脸关键点信息。
  35. 根据权利要求34所述的装置,其特征在于,所述第二子线程和第三子线程的数量均等于从所述当前图像中检测到的人脸的数量。
  36. 根据权利要求19所述的装置,其特征在于,在需要启动的线程的数量大于1的情况下,各个线程分别运行在不同的处理器内核上。
  37. 一种图像渲染系统,其特征在于,用于对图像进行渲染处理,所述渲染处理包括第一处理和第二处理;所述系统包括第一处理器和第二处理器;
    所述第一处理器用于获取当前图像的上一张图像的目标对象检测结果,所述目标对象检测结果用于指示所述上一张图像中包括的目标对象的数量,基于所述目标对象检测结果确定需要启动的线程的数量,启动所述数量的线程对所述当前图像进行渲染处理,并在被启动的线程的调用下执行所述第一处理;
    所述第二处理器用于在被启动的线程的调用下执行所述第二处理。
  38. 根据权利要求37所述的系统,其特征在于,在被启动的线程的数量大于或等于2时,所述第一处理器和所述第二处理器由不同的线程调用。
  39. 根据权利要求37或38所述的系统,其特征在于,所述第一处理器为中央处理器,所述第二处理器为图形处理器。
  40. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1至18任意一项所述的方法。
PCT/CN2020/139162 2020-12-24 2020-12-24 图像渲染方法、装置和系统、计算机可读存储介质 WO2022133954A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/139162 WO2022133954A1 (zh) 2020-12-24 2020-12-24 图像渲染方法、装置和系统、计算机可读存储介质
CN202080070570.1A CN114556408A (zh) 2020-12-24 2020-12-24 图像渲染方法、装置和系统、计算机可读存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/139162 WO2022133954A1 (zh) 2020-12-24 2020-12-24 图像渲染方法、装置和系统、计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2022133954A1 true WO2022133954A1 (zh) 2022-06-30

Family

ID=81667878

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/139162 WO2022133954A1 (zh) 2020-12-24 2020-12-24 图像渲染方法、装置和系统、计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN114556408A (zh)
WO (1) WO2022133954A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100295852A1 (en) * 2009-05-25 2010-11-25 Chia-Lin Yang Graphics processing system with power-gating control function, power-gating control method, and computer program products thereof
CN108093151A (zh) * 2016-11-22 2018-05-29 京瓷办公信息系统株式会社 图像形成装置及记录介质
CN110489228A (zh) * 2019-07-16 2019-11-22 华为技术有限公司 一种资源调度的方法和电子设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100295852A1 (en) * 2009-05-25 2010-11-25 Chia-Lin Yang Graphics processing system with power-gating control function, power-gating control method, and computer program products thereof
CN108093151A (zh) * 2016-11-22 2018-05-29 京瓷办公信息系统株式会社 图像形成装置及记录介质
CN110489228A (zh) * 2019-07-16 2019-11-22 华为技术有限公司 一种资源调度的方法和电子设备

Also Published As

Publication number Publication date
CN114556408A (zh) 2022-05-27

Similar Documents

Publication Publication Date Title
US20200167582A1 (en) Liveness detection method, apparatus and computer-readable storage medium
JP2022528294A (ja) 深度を利用した映像背景減算法
BR112021007094A2 (pt) método de processamento de imagem, aparelho, e dispositivo
JP7209851B2 (ja) 画像変形の制御方法、装置およびハードウェア装置
US10666874B2 (en) Reducing or eliminating artifacts in high dynamic range (HDR) imaging
CN105430269B (zh) 一种应用于移动终端的拍照方法及装置
US11783455B2 (en) History clamping for denoising dynamic ray-traced scenes using temporal accumulation
CN112470164A (zh) 姿态校正
CN115689963A (zh) 一种图像处理方法及电子设备
US20220188961A1 (en) Data processing method and sensor device for performing the same
WO2022048414A1 (zh) 一种图像生成方法、装置、设备及存储介质
US20190205689A1 (en) Method and device for processing image, electronic device and medium
TWI711004B (zh) 圖片處理方法和裝置
WO2022133954A1 (zh) 图像渲染方法、装置和系统、计算机可读存储介质
WO2021237736A1 (zh) 图像处理方法、装置和系统,计算机可读存储介质
CN113989895A (zh) 一种人脸皮肤分割方法、电子设备及存储介质
TWI482099B (zh) 影像處理紀錄系統及其影像處理紀錄方法
CN111314627A (zh) 用于处理视频帧的方法和装置
US11871104B2 (en) Recommendations for image capture
US20230115371A1 (en) Efficient vision perception
US20220292344A1 (en) Processing data in pixel-to-pixel neural networks
US20240112358A1 (en) Deep learning model for high resolution predictions
JP2011254233A (ja) 画像処理装置および方法、並びに、プログラム
US20230342889A1 (en) Frequency domain edge enhancement of image capture
WO2023059962A1 (en) Efficient vision perception

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: 20966526

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20966526

Country of ref document: EP

Kind code of ref document: A1