WO2023010792A1 - Key point processing method and apparatus, readable storage medium and terminal - Google Patents

Key point processing method and apparatus, readable storage medium and terminal Download PDF

Info

Publication number
WO2023010792A1
WO2023010792A1 PCT/CN2021/142865 CN2021142865W WO2023010792A1 WO 2023010792 A1 WO2023010792 A1 WO 2023010792A1 CN 2021142865 W CN2021142865 W CN 2021142865W WO 2023010792 A1 WO2023010792 A1 WO 2023010792A1
Authority
WO
WIPO (PCT)
Prior art keywords
key point
offset
frame image
diff
max
Prior art date
Application number
PCT/CN2021/142865
Other languages
French (fr)
Chinese (zh)
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 展讯通信(上海)有限公司
Publication of WO2023010792A1 publication Critical patent/WO2023010792A1/en

Links

Images

Classifications

    • G06T5/70
    • 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 invention relates to the technical field of image processing, in particular to a key point processing method and device, a readable storage medium, and a terminal.
  • the technical problem solved by the present invention is to provide a key point processing method and device, a readable storage medium, and a terminal, which can improve the smoothness of human faces after key point processing.
  • the embodiment of the present invention provides a key point processing method, including: collecting the previous frame image and the current frame image in the video, and detecting the positions of multiple key points respectively; for each key point, determine The position offset of the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset; for each key point, according to the filtered inter-frame The offset and the position of the previous frame image, adjust the position of the key point in the current frame image.
  • the following formula is used to determine the position offset between the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset:
  • diff offset is used to indicate the position offset of the key point in the previous frame image and the current frame image
  • Rigid cur is used to indicate the position of the key point in the key point of the current frame image
  • Rigid pre uses To represent the position of the key point in the previous frame image
  • Filter() is used to represent the filter processing function
  • diff smooth is used to represent the post-filter inter-frame offset of the key point
  • radius is used to represent the filter radius.
  • the following formula is used to adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image:
  • dst pts is used to indicate the adjusted position of the key point in the current frame image
  • Rigid pre is used to indicate the position of the key point in the previous frame image
  • diff smooth is used to indicate the filtering of the key point Back frame offset.
  • adjusting the position of the key point in the current frame image before adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image, it also includes: determining according to the filtered inter-frame offset The maximum global offset between frames; according to the maximum global offset between frames and the first piecewise linear function, determine the first key point offset regression coefficient; according to the filtered inter-frame offset and the previous frame
  • the position of the image, adjusting the position of the key point in the current frame image includes: according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the position of the previous frame image, Adjust the position of the key point in the current frame image.
  • the following formula is used to determine the first key point offset regression coefficient according to the maximum global offset between frames and the first piecewise linear function:
  • Diff max is used to represent the maximum global offset between frames
  • f 1 (x) is used to represent the first piecewise linear function
  • f 1 (Diff max ) is used to represent the first key point offset regression coefficient
  • N is positive rational number.
  • Image location is used to adjust the position of the key point in the current frame according to the product of the filtered inter-frame offset and the first key point offset regression coefficient and the position of the previous frame image.
  • dst pts is used to represent the adjusted position of the key point in the current frame image
  • Rigid pre is used to represent the position of the key point in the previous frame image
  • f 1 (Diff max ) is used to represent the first
  • diff smooth is used to represent the filtered inter-frame offset of the key point.
  • the key point processing method further includes: according to the filtered inter-frame offset shift, determine the maximum global offset between frames; according to the position offset of each key point in the previous frame image and the current frame image, determine the key point acquisition stability calibration parameters; according to the maximum global offset between the frames Shift, the key point acquisition stability calibration parameters and the second piecewise linear function, determine the second key point offset regression coefficient; according to the filtered inter-frame offset and the position of the previous frame image, adjust the The position of the key point in the current frame image includes: adjusting the position of the key point in the current frame image according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image. Describe the position of the current frame image.
  • Diff max MAX(diff smooth_all )
  • Diff max is used to represent the maximum global offset between frames
  • Max() is the maximum value function
  • diff smooth_all is used to represent the filtered inter-frame offset of each key point.
  • the following formula is used to determine the key point acquisition stability calibration parameters according to the position offset of each key point in the previous frame image and the current frame image:
  • diff pts is used to indicate the absolute value of the position offset of the key point in the previous frame image and the current frame image
  • ABS() is used to indicate the absolute value function
  • diff pts_all is used to indicate that each key point is in the The absolute value of the position offset between the previous frame image and the current frame image
  • Max() is the maximum value function
  • Min() is the minimum value function
  • Stable thr is used to indicate the key point acquisition stability calibration parameter
  • M is positive rational numbers.
  • two adjacent frames of images in the historical video are selected, and the smaller the mean value of shaking of one or more key point positions between the two frames of images is, the smaller the selected value of M is.
  • the following formula is used to determine the second key point offset regression coefficient according to the maximum global offset between frames, the key point acquisition stability calibration parameter and the second piecewise linear function:
  • Diff max is used to represent the maximum global offset between frames
  • f 2 (x) is used to represent the second piecewise linear function
  • f 2 (Diff max ) is used to represent the second key point offset regression coefficient
  • Stable thr Collect stability calibration parameters for key points.
  • dst pts is used to represent the adjusted position of the key point in the current frame image
  • Rigid pre is used to represent the position of the key point in the previous frame image
  • f 2 (Diff max ) is used to represent the first Two key point offset regression coefficients
  • diff smooth is used to represent the filtered inter-frame offset of the key point.
  • the key point is a human face key point
  • the position of the key point is a pixel sequence number of the key point in the image.
  • an embodiment of the present invention provides a key point processing device, including: a key point position detection module, which is used to collect the previous frame image and the current frame image in the video, and detect the positions of multiple key points respectively ;
  • the filter module is used to determine the position offset of the previous frame image and the current frame image for each key point, and then filter the position offset to obtain the filtered inter-frame offset;
  • the position adjustment module is configured to, for each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
  • an embodiment of the present invention provides a readable storage medium on which a computer program is stored, and when the computer program is run by a processor, the steps of the above key point processing method are executed.
  • an embodiment of the present invention provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor runs the computer program, it executes Steps of the above key point processing method.
  • the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame
  • the position of the image, adjusting the position of the key point in the current frame image can use the local filtering and smoothing technology to filter out the jitter of the local point.
  • the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face.
  • the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
  • the maximum inter-frame global offset and the first piecewise linear function determine the first key point offset regression coefficient; according to the filtered inter-frame offset and the first key point offset regression
  • the product of the coefficients, and the position of the previous frame image, adjust the position of the key point in the current frame image, and the static stabilization and dynamic regression of the video stream face key points can be realized by using a piecewise linear function.
  • the key point acquisition stability calibration parameters determine the key point acquisition stability calibration parameters; according to the maximum global offset between the frames, the key point acquisition stability
  • the calibration parameter and the second piecewise linear function determine the second key point offset regression coefficient; according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the previous frame image Position, adjust the position of the key point in the current frame image, the stability calibration of the face key point detection model can be performed, and the stability of the acquisition model can be known by obtaining the stability calibration parameters, so as to facilitate the realization of the best video stream Face key point stabilization effect.
  • a piecewise linear function is obtained, which can further improve the static stability and dynamic regression of video stream face key points.
  • the position of the key point is the pixel number of the key point in the image, which effectively reduces the complexity of the algorithm.
  • Fig. 1 is the flowchart of the first kind of key point processing method in the embodiment of the present invention
  • Fig. 2 is a schematic diagram of key points of a human face in an embodiment of the present invention.
  • Fig. 3 is a flow chart of the second key point processing method in the embodiment of the present invention.
  • Fig. 4 is a flow chart of the third key point processing method in the embodiment of the present invention.
  • Fig. 5 is a flow chart of the fourth key point processing method in the embodiment of the present invention.
  • Fig. 6 is a schematic structural diagram of a key point processing device in an embodiment of the present invention.
  • the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame
  • the position of the image, adjusting the position of the key point in the current frame image can use the local filtering and smoothing technology to filter out the jitter of the local point.
  • the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face.
  • the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
  • FIG. 1 is a flow chart of a first key point processing method in an embodiment of the present invention.
  • the first key point processing method may include steps S11 to S13:
  • Step S11 collecting the previous frame image and the current frame image in the video, and detecting the positions of multiple key points respectively;
  • Step S12 For each key point, determine the position offset between the previous frame image and the current frame image, and then filter the position offset to obtain a filtered inter-frame offset;
  • Step S13 For each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
  • the method may be implemented in the form of a software program, and the software program runs in a processor integrated in a chip or a chip module.
  • the video can be a video being recorded, such as a video of beautifying and thinning the face, a video of real-time face changing/makeup changing, or a video in the process of recording and broadcasting, such as a face-lifting with an anchor interaction function, Face changing video etc. After face-lifting and face-changing, it is necessary to continue to maintain consistency, and it is necessary to continuously adjust the current frame image.
  • the key points may be human face key points, so as to adjust the human face in the video and improve the smoothness of human face display.
  • face recognition can be performed on the video stream image first, face position information is detected, and the complete face area is intercepted according to the face position information, and then face key point detection is performed, and the detection result is a face position information of key points.
  • the position of the key point may be a pixel number of the key point in the image.
  • 500 ⁇ 500pixel can represent horizontal (such as X-axis direction) pixel number is 500, vertical (such as Y-axis direction) The only key point with pixel number 500.
  • the position of the key point is the pixel number of the key point in the image, which effectively reduces the complexity of the algorithm.
  • FIG. 2 is a schematic diagram of key points of a human face in an embodiment of the present invention.
  • the key points can be cheeks, eyes, mouth, eyebrows and nose, etc.
  • the position information of cheeks, eyes, mouth, eyebrows and nose in the image can be detected by using a face key point detection model.
  • step S12 for each key point, filter processing is performed on the position offset of two frames of images.
  • diff offset is used to indicate the position offset of the key point in the previous frame image and the current frame image
  • Rigid cur is used to indicate the position of the key point in the key point of the current frame image
  • Rigid pre uses To represent the position of the key point in the previous frame image
  • Filter() is used to represent the filter processing function
  • diff smooth is used to represent the post-filter inter-frame offset of the key point
  • radius is used to represent the filter radius.
  • step S13 the position of the key point is adjusted in the current frame image.
  • dst pts is used to indicate the adjusted position of the key point in the current frame image
  • Rigid pre is used to indicate the position of the key point in the previous frame image
  • diff smooth is used to indicate the filtering of the key point Back frame offset.
  • the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame
  • the position of the image, adjusting the position of the key point in the current frame image can use the local filtering and smoothing technology to filter out the jitter of the local point.
  • the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face.
  • the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
  • FIG. 3 is a flowchart of a second key point processing method in an embodiment of the present invention.
  • the second key point processing method may include steps S11 to S12 in FIG. 1 , and may also include steps S31 to S33, which will be described below.
  • step S31 to step S32 may be performed before step S11, or may be performed after step S12.
  • the sequence number of the steps does not represent a restriction on the execution order of the steps.
  • step S31 the maximum global offset between frames is determined according to the filtered inter-frame offset.
  • Diff max Max(diff smooth_all )
  • Diff max is used to represent the maximum global offset between frames
  • Max() is the maximum value function
  • diff smooth_all is used to represent the filtered inter-frame offset of each key point.
  • step S32 a first key point offset regression coefficient is determined according to the maximum inter-frame global offset and the first piecewise linear function.
  • Diff max is used to represent the maximum global offset between frames
  • f 1 (x) is used to represent the first piecewise linear function
  • f 1 (Diff max ) is used to represent the first key point offset regression coefficient
  • N is positive rational number.
  • the selected value of N may be determined according to empirical data, for example, determined according to an average jitter value of one or more key point positions between two adjacent frames of images in a historical video. The smaller the mean value of the jitter at the key point position is, the smaller the selected value of N is.
  • the two adjacent frames of images in the historical video can be the adjacent two frames of images when the face remains still.
  • the key point detection model detects the position offset of the key points of two adjacent frames of images, and determines the jitter mean value of the key point positions.
  • the mean value of key point position jitter can be the mean value of the position offsets of the key points of two adjacent frames of images, wherein the position offset can be the pixel point difference in the X-axis direction and the pixel point difference in the Y-axis direction. Pixel difference.
  • step S33 the position of the key point in the current frame image is adjusted according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the position of the previous frame image.
  • dst pts is used to represent the adjusted position of the key point in the current frame image
  • Rigid pre is used to represent the position of the key point in the previous frame image
  • f 1 (Diff max ) is used to represent the first
  • diff smooth is used to represent the filtered inter-frame offset of the key point.
  • the first key point offset regression coefficient is determined according to the maximum inter-frame global offset and the first piecewise linear function; according to the filtered inter-frame offset and the first
  • the product of the key point offset regression coefficient, and the position of the previous frame image, adjust the position of the key point in the current frame image, and the static stability and dynamics of the video stream face key points can be realized by using a piecewise linear function return. That is to say, while improving the smoothness, the imaging stability is improved.
  • FIG. 4 is a flowchart of a third key point processing method in an embodiment of the present invention.
  • the third key point processing method may include steps S11 to S12 in FIG. 1 , and may also include steps S41 to S44, which will be described below.
  • step S41 to step S43 may be performed before step S11, or may be performed after step S12.
  • the sequence number of the steps does not represent a restriction on the execution order of the steps.
  • step S41 the maximum global offset between frames is determined according to the filtered inter-frame offset.
  • Diff max Max(diff smooth_all )
  • Diff max is used to represent the maximum global offset between frames
  • Max() is the maximum value function
  • diff smooth_all is used to represent the filtered inter-frame offset of each key point.
  • step S42 according to the position offset of each key point in the previous frame image and the current frame image, the key point acquisition stability calibration parameters are determined.
  • diff pts is used to indicate the absolute value of the position offset of the key point in the previous frame image and the current frame image
  • ABS() is used to indicate the absolute value function
  • diff pts_all is used to indicate that each key point is in the The absolute value of the position offset between the previous frame image and the current frame image
  • Max() is the maximum value function
  • Min() is the minimum value function
  • Stable thr is used to indicate the key point acquisition stability calibration parameter
  • M is positive rational numbers.
  • the selected value of M may be determined according to empirical data, for example, determined according to an average value of shaking of one or more key point positions between two adjacent frames of images in a historical video. The smaller the mean value of the jitter at the key point position is, the smaller the selected value of M is.
  • the value of M should not be too large, otherwise it will cause too insensitivity, and the jitter will not be suppressed if it is too large. For example, the person does move but mistakenly thinks it is normal jitter; the value of M should not be too small , otherwise it will be too sensitive, and small jitters will be judged as personnel movement.
  • the two adjacent frames of images in the historical video can be the adjacent two frames of images when the face remains still.
  • the key point detection model detects the position offset of the key points of two adjacent frames of images, and determines the jitter mean value of the key point positions.
  • the mean value of key point position jitter can be the mean value of the position offsets of the key points of two adjacent frames of images, wherein the position offset can be the pixel point difference in the X-axis direction and the pixel point difference in the Y-axis direction. Pixel difference.
  • the M value can be retained to avoid the influence of the extreme value of jitter and further effectively improve the imaging stability.
  • step S43 a second key point offset regression coefficient is determined according to the maximum inter-frame global offset, the key point acquisition stability calibration parameter and the second piecewise linear function.
  • Diff max is used to represent the maximum global offset between frames
  • f 2 (x) is used to represent the second piecewise linear function
  • f 2 (Diff max ) is used to represent the second key point offset regression coefficient
  • Stable thr Collect stability calibration parameters for key points.
  • the second piecewise linear function is obtained by citing the key point acquisition stability calibration parameters, which can avoid the influence of the extremum value of the jitter, and perform dynamic regression processing to further improve the stability.
  • step S44 the position of the key point in the current frame image is adjusted according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image.
  • dst pts is used to represent the adjusted position of the key point in the current frame image
  • Rigid pre is used to represent the position of the key point in the previous frame image
  • f 2 (Diff max ) is used to represent the first Two key point offset regression coefficients
  • diff smooth is used to represent the filtered inter-frame offset of the key point.
  • the key point acquisition stability calibration parameters are determined; according to the maximum global offset between frames, the The key point acquisition stability calibration parameter and the second piecewise linear function determine the second key point offset regression coefficient; according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and
  • the position of the previous frame image, adjusting the position of the key point in the current frame image can perform stability calibration on the face key point detection model, and the stability of the acquisition model can be known by obtaining the stability calibration parameters, which is convenient for implementation The best facial key point stabilization effect for video streaming.
  • a piecewise linear function is obtained, which can further improve the static stability and dynamic regression of video stream face key points.
  • FIG. 5 is a flowchart of a fourth key point processing method in an embodiment of the present invention.
  • the fourth key point processing method may include step S51 to step S57, each step will be described below.
  • step S51 facial recognition.
  • facial recognition is performed on the faces in the video to detect the location information of the faces.
  • no limitation is imposed on a specific face recognition method.
  • step S52 the pixel sequence number of the key point of the human face is detected.
  • the complete face area can be intercepted according to the face position information, and then the key point detection of the face is performed.
  • the detection result is the position information of the key point of the face, and the position of the key point can be the pixel point of the key point in the image
  • the serial number can be represented by the serial number of pixels in different directions.
  • Rigid cur can be used to represent the position of the key point in the key point of the current frame image
  • Rigid pre can be used to represent the position of the key point in the previous frame image.
  • step S53 filter processing.
  • the position offset between the previous frame image and the current frame image may be determined, and then filter processing is performed on the position offset to obtain a filtered inter-frame offset.
  • step S54 the maximum global offset between frames is determined.
  • the maximum inter-frame global offset may be determined according to the filtered inter-frame offset determined in the previous step.
  • step S55 the key point acquisition stability calibration parameters are determined.
  • key point acquisition stability calibration parameters may be determined according to position offsets of each key point between the previous frame image and the current frame image.
  • step S56 a second piecewise linear function is determined.
  • the stability calibration parameter can be introduced into the second piecewise linear function, and the second key point is determined according to the maximum global offset between frames, the key point acquisition stability calibration parameter and the second piecewise linear function Offset regression coefficients.
  • step S57 the position of the key point is adjusted.
  • the position of the key point in the current frame image may be adjusted according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image.
  • steps S51 to S57 please refer to the step descriptions in FIG. 1 to FIG. 4 for execution, and details will not be repeated here.
  • FIG. 6 is a schematic structural diagram of a key point processing device in an embodiment of the present invention.
  • the key point processing means may include:
  • Key point position detection module 61 is used for collecting previous frame image and current frame image in video, and detects the position of a plurality of key points respectively;
  • Filtering module 62 is used for, for each key point, determines the position offset of described previous frame image and current frame image, then carries out filtering process to described position offset, obtains the inter-frame offset after filtering;
  • the position adjustment module 63 is configured to, for each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
  • the above means may correspond to a chip with a data processing function in the user equipment; or correspond to a chip module including a chip with a data processing function in the user equipment, or correspond to the user equipment.
  • An embodiment of the present invention also provides a readable storage medium on which a computer program is stored, and the computer program executes the steps of the above method when the computer program is run by a processor.
  • the readable storage medium may be a computer-readable storage medium, for example, may include a non-volatile memory (non-volatile) or a non-transitory (non-transitory) memory, and may also include an optical disk, a mechanical hard disk, a solid-state hard disk, and the like.
  • the processor may be a central processing unit (Central Processing Unit, referred to as CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processor, referred to as DSP) ), application specific integrated circuit (ASIC for short), off-the-shelf programmable gate array (field programmable gate array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the memory in the embodiments of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories.
  • the non-volatile memory can be read-only memory (read-only memory, referred to as ROM), programmable read-only memory (programmable ROM, referred to as PROM), erasable programmable read-only memory (erasable PROM, referred to as EPROM) , Electrically Erasable Programmable Read-Only Memory (electrically EPROM, referred to as EEPROM) or flash memory.
  • the volatile memory can be random access memory (RAM), which acts as external cache memory.
  • RAM random access memory
  • static random access memory static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous Dynamic random access memory
  • SDRAM synchronous Dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM Synchronously connect dynamic random access memory
  • direct rambus RAM direct rambus RAM
  • An embodiment of the present invention also provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor executes the steps of the above method when running the computer program .
  • the terminals include but are not limited to terminal devices such as mobile phones, computers, and tablet computers.
  • Multiple appearing in the embodiments of the present application means two or more.
  • each module/unit contained in the product may be a software module/unit, or a hardware module/unit, or may be partly a software module/unit and partly a hardware module/unit.
  • each module/unit contained therein may be realized by hardware such as a circuit, or at least some modules/units may be realized by a software program, and the software program Running on the integrated processor inside the chip, the remaining (if any) modules/units can be realized by means of hardware such as circuits; They are all realized by means of hardware such as circuits, and different modules/units can be located in the same component (such as chips, circuit modules, etc.) or different components of the chip module, or at least some modules/units can be realized by means of software programs, The software program runs on the processor integrated in the chip module, and the remaining (if any) modules/units can be realized by hardware such as circuits; /Units can be realized by means of hardware such as circuits

Abstract

A key point processing method and apparatus, a readable storage medium, and a terminal. The method comprises: collecting a previous image frame and a current image frame in a video, and respectively detecting positions of a plurality of key points; for each key point, determining position offsets of the previous image frame and the current image frame, and then filtering the position offsets to obtain a filtered inter-frame offset; and for each key point, adjusting the position of the key point in the current image frame according to the filtered inter-frame offset and the position of the previous image frame. According to the present invention, the face smoothness after key point processing can be improved.

Description

关键点处理方法及装置、可读存储介质、终端Key point processing method and device, readable storage medium, terminal
本申请要求于2021年8月3日提交中国专利局、申请号为202110886400.7、发明名称为“关键点处理方法及装置、可读存储介质、终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the China Patent Office on August 3, 2021, with the application number 202110886400.7, and the title of the invention is "key point processing method and device, readable storage medium, terminal", the entire content of which is passed References are incorporated in this application.
技术领域technical field
本发明涉及图像处理技术领域,尤其涉及一种关键点处理方法及装置、可读存储介质、终端。The present invention relates to the technical field of image processing, in particular to a key point processing method and device, a readable storage medium, and a terminal.
背景技术Background technique
在视频图像处理技术中,随着视频美颜瘦脸、视频实时变脸/换妆、基于视频手势/人体骨骼关键点检测的体感游戏等应用的推广,对于人脸识别的平滑性和稳定性的要求越来越高。In video image processing technology, with the popularization of applications such as video beautification and face-lifting, video real-time face changing/makeup changing, and somatosensory games based on video gesture/human bone key point detection, the smoothness and stability of face recognition are required. Higher and higher.
然而,由于视频流中的人脸运动状态较为复杂,如人脸姿态的变化、人脸在图像平面内的平移、人脸与摄像头距离的变化导致人脸大小的变化等因素,均可能导致在变脸后发生关键点平滑性不足的问题。However, due to the complex motion state of the face in the video stream, factors such as changes in face posture, translation of the face in the image plane, and changes in the size of the face due to changes in the distance between the face and the camera may all cause changes in the face size. The problem of insufficient smoothness of key points occurs after changing faces.
亟需一种关键点处理方法,能够有效提高人脸关键点的平滑性。There is an urgent need for a key point processing method that can effectively improve the smoothness of face key points.
发明内容Contents of the invention
本发明解决的技术问题是提供一种关键点处理方法及装置、可读存储介质、终端,可以提高关键点处理后的人脸平滑性。The technical problem solved by the present invention is to provide a key point processing method and device, a readable storage medium, and a terminal, which can improve the smoothness of human faces after key point processing.
为解决上述技术问题,本发明实施例提供一种关键点处理方法,包括:在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量;对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。In order to solve the above technical problems, the embodiment of the present invention provides a key point processing method, including: collecting the previous frame image and the current frame image in the video, and detecting the positions of multiple key points respectively; for each key point, determine The position offset of the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset; for each key point, according to the filtered inter-frame The offset and the position of the previous frame image, adjust the position of the key point in the current frame image.
可选的,采用下述公式,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量:Optionally, the following formula is used to determine the position offset between the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset:
diff offset=Rigid cur-Rigid pre diff offset = Rigid cur - Rigid pre
diff smooth=Filter(diff offset,radius) diff smooth = Filter(diff offset , radius)
其中,diff offset用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量,Rigid cur用于表示该关键点在所述当前帧图像的关键点的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,Filter()用于表示滤波处理函数,diff smooth用于表示该关键点的滤波后帧间偏移量,radius用于表示滤波半径。 Among them, diff offset is used to indicate the position offset of the key point in the previous frame image and the current frame image, Rigid cur is used to indicate the position of the key point in the key point of the current frame image, and Rigid pre uses To represent the position of the key point in the previous frame image, Filter() is used to represent the filter processing function, diff smooth is used to represent the post-filter inter-frame offset of the key point, and radius is used to represent the filter radius.
可选的,采用下述公式,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置:Optionally, the following formula is used to adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image:
dst pts=Rigid pre+diff smooth dst pts = Rigid pre + diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,diff smooth用于表示该关键点的滤波后帧间偏移量。 Among them, dst pts is used to indicate the adjusted position of the key point in the current frame image, Rigid pre is used to indicate the position of the key point in the previous frame image, and diff smooth is used to indicate the filtering of the key point Back frame offset.
可选的,在根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置之前,还包括:根据滤波后帧间偏移量,确定帧间最大全局偏移量;根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数;根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像 的位置包括:根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Optionally, before adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image, it also includes: determining according to the filtered inter-frame offset The maximum global offset between frames; according to the maximum global offset between frames and the first piecewise linear function, determine the first key point offset regression coefficient; according to the filtered inter-frame offset and the previous frame The position of the image, adjusting the position of the key point in the current frame image includes: according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the position of the previous frame image, Adjust the position of the key point in the current frame image.
可选的,采用下述公式,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数:Optionally, the following formula is used to determine the first key point offset regression coefficient according to the maximum global offset between frames and the first piecewise linear function:
f 1(Diff max)=0,if Diff max≤1; f 1 (Diff max ) = 0, if Diff max ≤ 1;
f 1(Diff max)=(Diff max-N)/(N-1)+1,else if 1<Diff max≤N; f 1 (Diff max )=(Diff max -N)/(N-1)+1, else if 1<Diff max ≤N;
f 1(Diff max)=1,else if Diff max≥N; f 1 (Diff max )=1, else if Diff max ≥ N;
其中,Diff max用于表示帧间最大全局偏移量,f 1(x)用于表示第一分段线性函数,f 1(Diff max)用于表示第一关键点偏移回归系数,N为正有理数。 Among them, Diff max is used to represent the maximum global offset between frames, f 1 (x) is used to represent the first piecewise linear function, f 1 (Diff max ) is used to represent the first key point offset regression coefficient, and N is positive rational number.
可选的,历史视频中相邻两帧图像之间的一个或多个关键点位置抖动均值越小,所述N选值越小。Optionally, the smaller the jitter average value of one or more key point positions between two adjacent frames of images in the historical video is, the smaller the selected value of N is.
可选的,采用下述公式,根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置:Optionally, the following formula is used to adjust the position of the key point in the current frame according to the product of the filtered inter-frame offset and the first key point offset regression coefficient and the position of the previous frame image. Image location:
dst pts=Rigid pre+f 1(Diff max)×diff smooth dst pts = Rigid pre +f 1 (Diff max )×diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,f 1(Diff max)用于表示第一关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to represent the adjusted position of the key point in the current frame image, Rigid pre is used to represent the position of the key point in the previous frame image, and f 1 (Diff max ) is used to represent the first A key point offset regression coefficient, diff smooth is used to represent the filtered inter-frame offset of the key point.
可选的,在根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置之前,关键点处理方法还包括:根据滤波后帧间偏移量,确定帧间最大全局偏移量;根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数;根据所述帧间最大全局偏移量、所述关键点采集稳定性 标定参数以及第二分段线性函数,确定第二关键点偏移回归系数;根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置包括:根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Optionally, before adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image, the key point processing method further includes: according to the filtered inter-frame offset shift, determine the maximum global offset between frames; according to the position offset of each key point in the previous frame image and the current frame image, determine the key point acquisition stability calibration parameters; according to the maximum global offset between the frames Shift, the key point acquisition stability calibration parameters and the second piecewise linear function, determine the second key point offset regression coefficient; according to the filtered inter-frame offset and the position of the previous frame image, adjust the The position of the key point in the current frame image includes: adjusting the position of the key point in the current frame image according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image. Describe the position of the current frame image.
可选的,采用下述公式,根据滤波后帧间偏移量,确定帧间最大全局偏移量:Optionally, the following formula is used to determine the maximum global offset between frames according to the filtered inter-frame offset:
Diff max=MAX(diff smooth_all) Diff max = MAX(diff smooth_all )
其中,Diff max用于表示帧间最大全局偏移量,Max()为最大值函数,diff smooth_all用于表示各个关键点的滤波后帧间偏移量。 Among them, Diff max is used to represent the maximum global offset between frames, Max() is the maximum value function, and diff smooth_all is used to represent the filtered inter-frame offset of each key point.
可选的,采用下述公式,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数:Optionally, the following formula is used to determine the key point acquisition stability calibration parameters according to the position offset of each key point in the previous frame image and the current frame image:
diff pts=ABS(Rigid cur-Rigid pre) diff pts = ABS(Rigid cur -Rigid pre )
Stable thr=Min(M,Max(diff pts_all)) Stable thr = Min(M,Max(diff pts_all ))
其中,diff pts用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,ABS()用于表示绝对值函数,diff pts_all用于表示各个关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,Max()为最大值函数,Min()为最小值函数,Stable thr用于表示关键点采集稳定性标定参数,M为正有理数。 Among them, diff pts is used to indicate the absolute value of the position offset of the key point in the previous frame image and the current frame image, ABS() is used to indicate the absolute value function, and diff pts_all is used to indicate that each key point is in the The absolute value of the position offset between the previous frame image and the current frame image, Max() is the maximum value function, Min() is the minimum value function, Stable thr is used to indicate the key point acquisition stability calibration parameter, M is positive rational numbers.
可选的,选择历史视频中相邻两帧图像,该两帧图像之间的一个或多个关键点位置抖动均值越小,所述M选值越小。Optionally, two adjacent frames of images in the historical video are selected, and the smaller the mean value of shaking of one or more key point positions between the two frames of images is, the smaller the selected value of M is.
可选的,采用下述公式,根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数:Optionally, the following formula is used to determine the second key point offset regression coefficient according to the maximum global offset between frames, the key point acquisition stability calibration parameter and the second piecewise linear function:
f 2(Diff max)=0,if Diff max≤1; f 2 (Diff max ) = 0, if Diff max ≤ 1;
f 2(Diff max)=(Diff max-Stable thr)/(Stable thr-1)+1,else if 1<Diff max≤ Stable thrf 2 (Diff max )=(Diff max -Stable thr )/(Stable thr -1)+1, else if 1<Diff max ≤ Stable thr ;
f 2(Diff max)=1,else if Diff max≥Stable thrf 2 (Diff max )=1, else if Diff max ≥ Stable thr ;
其中,Diff max用于表示帧间最大全局偏移量,f 2(x)用于表示第二分段线性函数,f 2(Diff max)用于表示第二关键点偏移回归系数,Stable thr为关键点采集稳定性标定参数。 Among them, Diff max is used to represent the maximum global offset between frames, f 2 (x) is used to represent the second piecewise linear function, f 2 (Diff max ) is used to represent the second key point offset regression coefficient, Stable thr Collect stability calibration parameters for key points.
可选的,采用下述公式,根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置:Optionally, the following formula is used to adjust the position of the key point in the current frame according to the product of the filtered inter-frame offset and the second key point offset regression coefficient and the position of the previous frame image. Image location:
dst pts=Rigid pre+f 2(Diff max)×diff smooth dst pts = Rigid pre +f 2 (Diff max )×diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,f 2(Diff max)用于表示第二关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to represent the adjusted position of the key point in the current frame image, Rigid pre is used to represent the position of the key point in the previous frame image, f 2 (Diff max ) is used to represent the first Two key point offset regression coefficients, diff smooth is used to represent the filtered inter-frame offset of the key point.
可选的,满足以下一项或多项:所述关键点为人脸关键点;所述关键点的位置为所述关键点在图像中的像素点序号。Optionally, one or more of the following is satisfied: the key point is a human face key point; the position of the key point is a pixel sequence number of the key point in the image.
为解决上述技术问题,本发明实施例提供一种关键点处理装置,包括:关键点位置检测模块,用于在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;滤波模块,用于对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量;位置调整模块,用于对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。In order to solve the above technical problems, an embodiment of the present invention provides a key point processing device, including: a key point position detection module, which is used to collect the previous frame image and the current frame image in the video, and detect the positions of multiple key points respectively ; The filter module is used to determine the position offset of the previous frame image and the current frame image for each key point, and then filter the position offset to obtain the filtered inter-frame offset; The position adjustment module is configured to, for each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
为解决上述技术问题,本发明实施例提供一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时执行上述关键点处理方法的步骤。In order to solve the above technical problem, an embodiment of the present invention provides a readable storage medium on which a computer program is stored, and when the computer program is run by a processor, the steps of the above key point processing method are executed.
为解决上述技术问题,本发明实施例提供一种终端,包括存储器 和处理器,所述存储器上存储有能够在所述处理器上运行的计算机程序,所述处理器运行所述计算机程序时执行上述关键点处理方法的步骤。In order to solve the above technical problems, an embodiment of the present invention provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor runs the computer program, it executes Steps of the above key point processing method.
与现有技术相比,本发明实施例的技术方案具有以下有益效果:Compared with the prior art, the technical solutions of the embodiments of the present invention have the following beneficial effects:
在本发明实施例中,通过对前一帧图像和当前帧图像的位置偏移量进行滤波处理,得到滤波后帧间偏移量,再根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以利用局部滤波平滑技术滤除局部点的抖动。相比于现有技术中,由于帧间检测相对独立,不存在信息交互,且帧间人脸图像质量存在如噪声、亮度等差异,使得即便人脸在视频中处于静止,人脸关键点检测的帧间结果不可避免的存在对齐偏差,表现为人脸关键点无规则抖动,采用本发明实施例的方案,可以利用局部滤波平滑技术,求取全局点相对运动的同时滤除局部点的无规律抖动,提高关键点处理后的人脸平滑性。In the embodiment of the present invention, the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame The position of the image, adjusting the position of the key point in the current frame image, can use the local filtering and smoothing technology to filter out the jitter of the local point. Compared with the existing technology, since the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face. Using the scheme of the embodiment of the present invention, the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
进一步,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数;根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以通过使用分段线性函数,实现视频流人脸关键点的静态稳定和动态回归。Further, according to the maximum inter-frame global offset and the first piecewise linear function, determine the first key point offset regression coefficient; according to the filtered inter-frame offset and the first key point offset regression The product of the coefficients, and the position of the previous frame image, adjust the position of the key point in the current frame image, and the static stabilization and dynamic regression of the video stream face key points can be realized by using a piecewise linear function.
进一步,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数;根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数;根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以对人脸关键点检测模型进行稳定性标定,通过获取稳定性标定参数以知晓采集模型的稳定性情况,方便实现最佳的视频流人脸关键点稳定效果。进一步地,结合关键点采集稳定性标定参数,得到分段线性函数,可以进一步提高视频流人脸关键 点的静态稳定和动态回归。Further, according to the position offset of each key point in the previous frame image and the current frame image, determine the key point acquisition stability calibration parameters; according to the maximum global offset between the frames, the key point acquisition stability The calibration parameter and the second piecewise linear function determine the second key point offset regression coefficient; according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the previous frame image Position, adjust the position of the key point in the current frame image, the stability calibration of the face key point detection model can be performed, and the stability of the acquisition model can be known by obtaining the stability calibration parameters, so as to facilitate the realization of the best video stream Face key point stabilization effect. Furthermore, combined with key point acquisition stability calibration parameters, a piecewise linear function is obtained, which can further improve the static stability and dynamic regression of video stream face key points.
进一步,所述关键点的位置为所述关键点在图像中的像素点序号,有效降低算法复杂度。Further, the position of the key point is the pixel number of the key point in the image, which effectively reduces the complexity of the algorithm.
附图说明Description of drawings
图1是本发明实施例中第一种关键点处理方法的流程图;Fig. 1 is the flowchart of the first kind of key point processing method in the embodiment of the present invention;
图2是本发明实施例中的人脸关键点示意图;Fig. 2 is a schematic diagram of key points of a human face in an embodiment of the present invention;
图3是本发明实施例中第二种关键点处理方法的流程图;Fig. 3 is a flow chart of the second key point processing method in the embodiment of the present invention;
图4是本发明实施例中第三种关键点处理方法的流程图;Fig. 4 is a flow chart of the third key point processing method in the embodiment of the present invention;
图5是本发明实施例中第四种关键点处理方法的流程图;Fig. 5 is a flow chart of the fourth key point processing method in the embodiment of the present invention;
图6是本发明实施例中一种关键点处理装置的结构示意图。Fig. 6 is a schematic structural diagram of a key point processing device in an embodiment of the present invention.
具体实施方式Detailed ways
在视频图像处理技术中,由于视频流中的人脸运动状态较为复杂,可能导致在变脸后发生关键点平滑性不足的问题,需要提高人脸关键点的平滑性。In the video image processing technology, due to the complex motion state of the face in the video stream, it may lead to the problem of insufficient smoothness of the key points after the face change, and it is necessary to improve the smoothness of the key points of the face.
在本发明实施例中,通过对前一帧图像和当前帧图像的位置偏移量进行滤波处理,得到滤波后帧间偏移量,再根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以利用局部滤波平滑技术滤除局部点的抖动。相比于现有技术中,由于帧间检测相对独立,不存在信息交互,且帧间人脸图像质量存在如噪声、亮度等差异,使得即便人脸在视频中处于静止,人脸关键点检测的帧间结果不可避免的存在对齐偏差,表现为人脸关键点无规则抖动,采用本发明实施例的方案,可以利用局部滤波平滑技术,求取全局点相对运动的同时滤除局部点的无规律抖动,提高关键点处理后的人脸平滑性。In the embodiment of the present invention, the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame The position of the image, adjusting the position of the key point in the current frame image, can use the local filtering and smoothing technology to filter out the jitter of the local point. Compared with the existing technology, since the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face. Using the scheme of the embodiment of the present invention, the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
为使本发明的上述目的、特征和有益效果能够更为明显易懂,下面结合附图对本发明的具体实施例做详细的说明。In order to make the above objects, features and beneficial effects of the present invention more comprehensible, specific embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.
参照图1,图1是本发明实施例中第一种关键点处理方法的流程图。所述第一种关键点处理方法可以包括步骤S11至步骤S13:Referring to FIG. 1 , FIG. 1 is a flow chart of a first key point processing method in an embodiment of the present invention. The first key point processing method may include steps S11 to S13:
步骤S11:在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;Step S11: collecting the previous frame image and the current frame image in the video, and detecting the positions of multiple key points respectively;
步骤S12:对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量;Step S12: For each key point, determine the position offset between the previous frame image and the current frame image, and then filter the position offset to obtain a filtered inter-frame offset;
步骤S13:对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Step S13: For each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
可以理解的是,在具体实施中,所述方法可以采用软件程序的方式实现,该软件程序运行于芯片或芯片模组内部集成的处理器中。It can be understood that, in a specific implementation, the method may be implemented in the form of a software program, and the software program runs in a processor integrated in a chip or a chip module.
在步骤S11的具体实施中,所述视频可以为正在录制的视频,如美颜瘦脸、视频实时变脸/换妆的视频,还可以为录播传输中的视频,如具有主播互动功能的瘦脸、变脸视频等。在瘦脸、变脸后,需要继续保持一致性,也就需要持续对当前帧图像进行调整。In the specific implementation of step S11, the video can be a video being recorded, such as a video of beautifying and thinning the face, a video of real-time face changing/makeup changing, or a video in the process of recording and broadcasting, such as a face-lifting with an anchor interaction function, Face changing video etc. After face-lifting and face-changing, it is necessary to continue to maintain consistency, and it is necessary to continuously adjust the current frame image.
进一步地,所述关键点可以为人脸关键点,从而对视频中的人脸进行调整,提高人脸显示的平滑性。Further, the key points may be human face key points, so as to adjust the human face in the video and improve the smoothness of human face display.
在进行人脸关键点检测前,可以先对视频流图像进行人脸面部识别,检出人脸位置信息,根据人脸位置信息截取完整面部区域,然后进行人脸关键点检测,检测结果为人脸面部关键点位置信息。Before performing face key point detection, face recognition can be performed on the video stream image first, face position information is detected, and the complete face area is intercepted according to the face position information, and then face key point detection is performed, and the detection result is a face position information of key points.
进一步地,所述关键点的位置可以为所述关键点在图像中的像素点序号。Further, the position of the key point may be a pixel number of the key point in the image.
以一帧图像为996×1024pixel为例,则可以采用不同方向上的像素点数量进行表示,如500×500pixel可以表示横向(如X轴方向) 像素点序号为500,纵向(如Y轴方向)像素点序号为500的唯一关键点。Taking a frame of image as 996×1024pixel as an example, it can be represented by the number of pixels in different directions. For example, 500×500pixel can represent horizontal (such as X-axis direction) pixel number is 500, vertical (such as Y-axis direction) The only key point with pixel number 500.
在本发明实施例中,所述关键点的位置为所述关键点在图像中的像素点序号,有效降低算法复杂度。In the embodiment of the present invention, the position of the key point is the pixel number of the key point in the image, which effectively reduces the complexity of the algorithm.
参照图2,图2是本发明实施例中的人脸关键点示意图。Referring to FIG. 2 , FIG. 2 is a schematic diagram of key points of a human face in an embodiment of the present invention.
所述关键点可以是脸颊、眼睛、嘴巴、眉毛和鼻子等,具体地,可以采用人脸关键点检测模型检测脸颊、眼睛、嘴巴、眉毛和鼻子等在图像中的位置信息。The key points can be cheeks, eyes, mouth, eyebrows and nose, etc. Specifically, the position information of cheeks, eyes, mouth, eyebrows and nose in the image can be detected by using a face key point detection model.
在图中以104个关键点为示例,可以理解的是,关键点提取越多,越有利于提高关键点处理后的人脸平滑性,然而处理速率将受到影响,严重时出现视频卡顿,也会影响用户体验。In the figure, 104 key points are taken as an example. It can be understood that the more key points are extracted, the better the smoothness of the face after key point processing will be improved. However, the processing rate will be affected, and video freezes will occur in severe cases. It also affects user experience.
继续参照图1,在步骤S12的具体实施中,对于每个关键点,针对两帧图像的位置偏移量进行滤波处理。Continuing to refer to FIG. 1 , in the specific implementation of step S12 , for each key point, filter processing is performed on the position offset of two frames of images.
进一步地,采用下述公式,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量:Further, the following formula is used to determine the position offset between the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset:
diff offset=Rigid cur-Rigid pre diff offset = Rigid cur - Rigid pre
diff smooth=Filter(diff offset,radius) diff smooth = Filter(diff offset , radius)
其中,diff offset用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量,Rigid cur用于表示该关键点在所述当前帧图像的关键点的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,Filter()用于表示滤波处理函数,diff smooth用于表示该关键点的滤波后帧间偏移量,radius用于表示滤波半径。 Among them, diff offset is used to indicate the position offset of the key point in the previous frame image and the current frame image, Rigid cur is used to indicate the position of the key point in the key point of the current frame image, and Rigid pre uses To represent the position of the key point in the previous frame image, Filter() is used to represent the filter processing function, diff smooth is used to represent the post-filter inter-frame offset of the key point, and radius is used to represent the filter radius.
在步骤S13中,在所述当前帧图像,调整该关键点的位置。In step S13, the position of the key point is adjusted in the current frame image.
进一步地,可以采用下述公式,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置:Further, the following formula can be used to adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image:
dst pts=Rigid pre+diff smooth dst pts = Rigid pre + diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,diff smooth用于表示该关键点的滤波后帧间偏移量。 Among them, dst pts is used to indicate the adjusted position of the key point in the current frame image, Rigid pre is used to indicate the position of the key point in the previous frame image, and diff smooth is used to indicate the filtering of the key point Back frame offset.
在本发明实施例中,通过对前一帧图像和当前帧图像的位置偏移量进行滤波处理,得到滤波后帧间偏移量,再根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以利用局部滤波平滑技术滤除局部点的抖动。相比于现有技术中,由于帧间检测相对独立,不存在信息交互,且帧间人脸图像质量存在如噪声、亮度等差异,使得即便人脸在视频中处于静止,人脸关键点检测的帧间结果不可避免的存在对齐偏差,表现为人脸关键点无规则抖动,采用本发明实施例的方案,可以利用局部滤波平滑技术,求取全局点相对运动的同时滤除局部点的无规律抖动,提高关键点处理后的人脸平滑性。In the embodiment of the present invention, the filtered inter-frame offset is obtained by filtering the position offset of the previous frame image and the current frame image, and then according to the filtered inter-frame offset and the previous frame The position of the image, adjusting the position of the key point in the current frame image, can use the local filtering and smoothing technology to filter out the jitter of the local point. Compared with the existing technology, since the frame-to-frame detection is relatively independent, there is no information interaction, and there are differences in the quality of face images between frames such as noise and brightness, so that even if the face is still in the video, the face key point detection Alignment deviation is unavoidable in the frame-to-frame results, which is manifested as irregular jitter of key points of the face. Using the scheme of the embodiment of the present invention, the local filtering and smoothing technology can be used to obtain the relative motion of the global point and filter out the irregularity of the local point. Dithering to improve the smoothness of the face after key point processing.
参照图3,图3是本发明实施例中第二种关键点处理方法的流程图。所述第二种关键点处理方法可以包括图1中的步骤S11至步骤S12,还可以包括步骤S31至步骤S33,以下对步骤S31至步骤S33进行说明。Referring to FIG. 3 , FIG. 3 is a flowchart of a second key point processing method in an embodiment of the present invention. The second key point processing method may include steps S11 to S12 in FIG. 1 , and may also include steps S31 to S33, which will be described below.
需要指出的是,步骤S31至步骤S32可以在步骤S11之前执行,还可以在步骤S12之后执行,在本发明实施例中,步骤的序号不代表对各步骤之间的执行顺序的限制。It should be noted that step S31 to step S32 may be performed before step S11, or may be performed after step S12. In this embodiment of the present invention, the sequence number of the steps does not represent a restriction on the execution order of the steps.
在步骤S31中,根据滤波后帧间偏移量,确定帧间最大全局偏移量。In step S31, the maximum global offset between frames is determined according to the filtered inter-frame offset.
进一步地,可以采用下述公式,根据滤波后帧间偏移量,确定帧间最大全局偏移量:Further, the following formula can be used to determine the maximum global offset between frames according to the filtered inter-frame offset:
Diff max=Max(diff smooth_all) Diff max = Max(diff smooth_all )
其中,Diff max用于表示帧间最大全局偏移量,Max()为最大值 函数,diff smooth_all用于表示各个关键点的滤波后帧间偏移量。 Among them, Diff max is used to represent the maximum global offset between frames, Max() is the maximum value function, and diff smooth_all is used to represent the filtered inter-frame offset of each key point.
在步骤S32中,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数。In step S32, a first key point offset regression coefficient is determined according to the maximum inter-frame global offset and the first piecewise linear function.
进一步地,可以采用下述公式,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数:Further, the following formula can be used to determine the first key point offset regression coefficient according to the maximum global offset between frames and the first piecewise linear function:
f 1(Diff max)=0,if Diff max≤1; f 1 (Diff max ) = 0, if Diff max ≤ 1;
f 1(Diff max)=(Diff max-N)/(N-1)+1,else if 1<Diff max≤N; f 1 (Diff max )=(Diff max -N)/(N-1)+1, else if 1<Diff max ≤N;
f 1(Diff max)=1,else if Diff max≥N; f 1 (Diff max )=1, else if Diff max ≥ N;
其中,Diff max用于表示帧间最大全局偏移量,f 1(x)用于表示第一分段线性函数,f 1(Diff max)用于表示第一关键点偏移回归系数,N为正有理数。 Among them, Diff max is used to represent the maximum global offset between frames, f 1 (x) is used to represent the first piecewise linear function, f 1 (Diff max ) is used to represent the first key point offset regression coefficient, and N is positive rational number.
进一步地,所述N选值可以是根据经验数据确定的,例如根据历史视频中相邻两帧图像之间的一个或多个关键点位置抖动均值确定。关键点位置抖动均值越小,所述N选值越小。Further, the selected value of N may be determined according to empirical data, for example, determined according to an average jitter value of one or more key point positions between two adjacent frames of images in a historical video. The smaller the mean value of the jitter at the key point position is, the smaller the selected value of N is.
其中,历史视频中相邻两帧图像可以是在人脸保持静止状态下的相邻两帧图像,例如可以在人脸保持静止状态下,提前拍摄至少包含两帧图像的视频,然后采用同样的关键点检测模型检测相邻两帧图像的关键点的位置偏移量,并确定关键点位置的抖动均值。Wherein, the two adjacent frames of images in the historical video can be the adjacent two frames of images when the face remains still. The key point detection model detects the position offset of the key points of two adjacent frames of images, and determines the jitter mean value of the key point positions.
其中,关键点位置抖动均值可以是相邻两帧图像的关键点的位置偏移量的均值,其中,所述位置偏移量可以为X轴方向上的像素点差值以及Y轴方向上的像素点差值。Wherein, the mean value of key point position jitter can be the mean value of the position offsets of the key points of two adjacent frames of images, wherein the position offset can be the pixel point difference in the X-axis direction and the pixel point difference in the Y-axis direction. Pixel difference.
在步骤S33中,根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。In step S33, the position of the key point in the current frame image is adjusted according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the position of the previous frame image.
进一步地,可以采用下述公式,根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该 关键点在所述当前帧图像的位置:Further, the following formula can be used to adjust the position of the key point in the current frame according to the product of the filtered inter-frame offset and the first key point offset regression coefficient and the position of the previous frame image. Image location:
dst pts=Rigid pre+f 1(Diff max)×diff smooth dst pts = Rigid pre +f 1 (Diff max )×diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,f 1(Diff max)用于表示第一关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to represent the adjusted position of the key point in the current frame image, Rigid pre is used to represent the position of the key point in the previous frame image, and f 1 (Diff max ) is used to represent the first A key point offset regression coefficient, diff smooth is used to represent the filtered inter-frame offset of the key point.
在本发明实施例中,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数;根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以通过使用分段线性函数,实现视频流人脸关键点的静态稳定和动态回归。也即在提高平滑性的同时,提高成像稳定性。In the embodiment of the present invention, the first key point offset regression coefficient is determined according to the maximum inter-frame global offset and the first piecewise linear function; according to the filtered inter-frame offset and the first The product of the key point offset regression coefficient, and the position of the previous frame image, adjust the position of the key point in the current frame image, and the static stability and dynamics of the video stream face key points can be realized by using a piecewise linear function return. That is to say, while improving the smoothness, the imaging stability is improved.
参照图4,图4是本发明实施例中第三种关键点处理方法的流程图。所述第三种关键点处理方法可以包括图1中的步骤S11至步骤S12,还可以包括步骤S41至步骤S44,以下对步骤S41至步骤S44进行说明。Referring to FIG. 4 , FIG. 4 is a flowchart of a third key point processing method in an embodiment of the present invention. The third key point processing method may include steps S11 to S12 in FIG. 1 , and may also include steps S41 to S44, which will be described below.
需要指出的是,步骤S41至步骤S43可以在步骤S11之前执行,还可以在步骤S12之后执行,在本发明实施例中,步骤的序号不代表对各步骤之间的执行顺序的限制。It should be noted that step S41 to step S43 may be performed before step S11, or may be performed after step S12. In this embodiment of the present invention, the sequence number of the steps does not represent a restriction on the execution order of the steps.
在步骤S41中,根据滤波后帧间偏移量,确定帧间最大全局偏移量。In step S41, the maximum global offset between frames is determined according to the filtered inter-frame offset.
进一步地,可以采用下述公式,根据滤波后帧间偏移量,确定帧间最大全局偏移量:Further, the following formula can be used to determine the maximum global offset between frames according to the filtered inter-frame offset:
Diff max=Max(diff smooth_all) Diff max = Max(diff smooth_all )
其中,Diff max用于表示帧间最大全局偏移量,Max()为最大值函数,diff smooth_all用于表示各个关键点的滤波后帧间偏移量。 Among them, Diff max is used to represent the maximum global offset between frames, Max() is the maximum value function, and diff smooth_all is used to represent the filtered inter-frame offset of each key point.
在步骤S42中,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数。In step S42, according to the position offset of each key point in the previous frame image and the current frame image, the key point acquisition stability calibration parameters are determined.
进一步地,可以采用下述公式,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数:Further, the following formula can be used to determine the key point acquisition stability calibration parameters according to the position offset of each key point in the previous frame image and the current frame image:
diff pts=ABS(Rigid cur-Rigid pre) diff pts = ABS(Rigid cur -Rigid pre )
Stable thr=Min(M,Max(diff pts_all)) Stable thr = Min(M,Max(diff pts_all ))
其中,diff pts用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,ABS()用于表示绝对值函数,diff pts_all用于表示各个关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,Max()为最大值函数,Min()为最小值函数,Stable thr用于表示关键点采集稳定性标定参数,M为正有理数。 Among them, diff pts is used to indicate the absolute value of the position offset of the key point in the previous frame image and the current frame image, ABS() is used to indicate the absolute value function, and diff pts_all is used to indicate that each key point is in the The absolute value of the position offset between the previous frame image and the current frame image, Max() is the maximum value function, Min() is the minimum value function, Stable thr is used to indicate the key point acquisition stability calibration parameter, M is positive rational numbers.
更进一步地,所述M选值可以是根据经验数据确定的,例如根据历史视频中相邻两帧图像之间的一个或多个关键点位置抖动均值确定。关键点位置抖动均值越小,所述M选值越小。Furthermore, the selected value of M may be determined according to empirical data, for example, determined according to an average value of shaking of one or more key point positions between two adjacent frames of images in a historical video. The smaller the mean value of the jitter at the key point position is, the smaller the selected value of M is.
可以理解的是,M选值不应当过大,否则会导致过于钝感,抖动过大也仍然得不到抑制,例如人员确实进行了移动却误以为是正常抖动;M选值不应当过小,否则会导致过于敏感,较小抖动都判断为人员移动。It is understandable that the value of M should not be too large, otherwise it will cause too insensitivity, and the jitter will not be suppressed if it is too large. For example, the person does move but mistakenly thinks it is normal jitter; the value of M should not be too small , otherwise it will be too sensitive, and small jitters will be judged as personnel movement.
作为一个非限制性的例子,M可以采用1.5~5,例如M=2。As a non-limiting example, M may be 1.5-5, such as M=2.
其中,历史视频中相邻两帧图像可以是在人脸保持静止状态下的相邻两帧图像,例如可以在人脸保持静止状态下,提前拍摄至少包含两帧图像的视频,然后采用同样的关键点检测模型检测相邻两帧图像的关键点的位置偏移量,并确定关键点位置的抖动均值。Wherein, the two adjacent frames of images in the historical video can be the adjacent two frames of images when the face remains still. The key point detection model detects the position offset of the key points of two adjacent frames of images, and determines the jitter mean value of the key point positions.
其中,关键点位置抖动均值可以是相邻两帧图像的关键点的位置偏移量的均值,其中,所述位置偏移量可以为X轴方向上的像素点差值以及Y轴方向上的像素点差值。Wherein, the mean value of key point position jitter can be the mean value of the position offsets of the key points of two adjacent frames of images, wherein the position offset can be the pixel point difference in the X-axis direction and the pixel point difference in the Y-axis direction. Pixel difference.
在本发明实施例中,通过确定各个关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值的最大值,然后与M进行比较,保留其中的较小值,可以在两帧图像偏移过大时,保留M值,可以避免抖动极值的影响,进一步有效提高成像稳定性。In the embodiment of the present invention, by determining the maximum value of the absolute value of the position offset of each key point in the previous frame image and the current frame image, and then comparing with M, and retaining the smaller value, it can be used in When the offset between two frames of images is too large, the M value can be retained to avoid the influence of the extreme value of jitter and further effectively improve the imaging stability.
在步骤S43中,根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数。In step S43, a second key point offset regression coefficient is determined according to the maximum inter-frame global offset, the key point acquisition stability calibration parameter and the second piecewise linear function.
进一步地,可以采用下述公式,根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数:Further, the following formula can be used to determine the second key point offset regression coefficient according to the maximum global offset between frames, the key point acquisition stability calibration parameter and the second piecewise linear function:
f 2(Diff max)=0,if Diff max≤1; f 2 (Diff max ) = 0, if Diff max ≤ 1;
f 2(Diff max)=(Diff max-Stable thr)/(Stable thr-1)+1,else if 1<Diff max≤Stable thrf 2 (Diff max )=(Diff max -Stable thr )/(Stable thr -1)+1, else if 1<Diff max ≤Stable thr ;
f 2(Diff max)=1,else if Diff max≥Stable thrf 2 (Diff max )=1, else if Diff max ≥ Stable thr ;
其中,Diff max用于表示帧间最大全局偏移量,f 2(x)用于表示第二分段线性函数,f 2(Diff max)用于表示第二关键点偏移回归系数,Stable thr为关键点采集稳定性标定参数。 Among them, Diff max is used to represent the maximum global offset between frames, f 2 (x) is used to represent the second piecewise linear function, f 2 (Diff max ) is used to represent the second key point offset regression coefficient, Stable thr Collect stability calibration parameters for key points.
在本发明实施例中,引用关键点采集稳定性标定参数得到第二分段线性函数,可以避免抖动极值的影响的情况下,进行动态回归处理,进一步提高稳定性。In the embodiment of the present invention, the second piecewise linear function is obtained by citing the key point acquisition stability calibration parameters, which can avoid the influence of the extremum value of the jitter, and perform dynamic regression processing to further improve the stability.
在步骤S44中,根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。In step S44, the position of the key point in the current frame image is adjusted according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image.
进一步地,可以采用下述公式,根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置:Further, the following formula can be used to adjust the position of the key point in the current frame according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image. Image location:
dst pts=Rigid pre+f 2(Diff max)×diff smooth dst pts = Rigid pre +f 2 (Diff max )×diff smooth
其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,f 2(Diff max)用于表示第二关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to represent the adjusted position of the key point in the current frame image, Rigid pre is used to represent the position of the key point in the previous frame image, f 2 (Diff max ) is used to represent the first Two key point offset regression coefficients, diff smooth is used to represent the filtered inter-frame offset of the key point.
在本发明实施例中,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数;根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数;根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置,可以对人脸关键点检测模型进行稳定性标定,通过获取稳定性标定参数以知晓采集模型的稳定性情况,方便实现最佳的视频流人脸关键点稳定效果。进一步地,结合关键点采集稳定性标定参数,得到分段线性函数,可以进一步提高视频流人脸关键点的静态稳定和动态回归。In the embodiment of the present invention, according to the position offset of each key point in the previous frame image and the current frame image, the key point acquisition stability calibration parameters are determined; according to the maximum global offset between frames, the The key point acquisition stability calibration parameter and the second piecewise linear function determine the second key point offset regression coefficient; according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and The position of the previous frame image, adjusting the position of the key point in the current frame image, can perform stability calibration on the face key point detection model, and the stability of the acquisition model can be known by obtaining the stability calibration parameters, which is convenient for implementation The best facial key point stabilization effect for video streaming. Furthermore, combined with key point acquisition stability calibration parameters, a piecewise linear function is obtained, which can further improve the static stability and dynamic regression of video stream face key points.
参照图5,图5是本发明实施例中第四种关键点处理方法的流程图。所述第四种关键点处理方法可以包括步骤S51至步骤S57,以下对各个步骤进行说明。Referring to FIG. 5 , FIG. 5 is a flowchart of a fourth key point processing method in an embodiment of the present invention. The fourth key point processing method may include step S51 to step S57, each step will be described below.
在步骤S51中,面部识别。In step S51, facial recognition.
具体地,对视频中的人脸进行面部识别,以检出人脸位置信息。在本发明实施例中,对于具体的面部识别的方法不做限制。Specifically, facial recognition is performed on the faces in the video to detect the location information of the faces. In this embodiment of the present invention, no limitation is imposed on a specific face recognition method.
在步骤S52中,检测人脸关键点的像素点序号。In step S52, the pixel sequence number of the key point of the human face is detected.
具体地,可以根据人脸位置信息截取完整面部区域,然后进行人脸关键点检测,检测结果为人脸面部关键点位置信息,所述关键点的位置可以为所述关键点在图像中的像素点序号,可以采用不同方向上的像素点序号表示。Specifically, the complete face area can be intercepted according to the face position information, and then the key point detection of the face is performed. The detection result is the position information of the key point of the face, and the position of the key point can be the pixel point of the key point in the image The serial number can be represented by the serial number of pixels in different directions.
进一步地,在检测人脸关键点的像素点序号之后,可以采用 Rigid cur表示该关键点在所述当前帧图像的关键点的位置,采用Rigid pre表示所述前一帧图像中该关键点的位置。 Further, after detecting the pixel number of the key point of the human face, Rigid cur can be used to represent the position of the key point in the key point of the current frame image, and Rigid pre can be used to represent the position of the key point in the previous frame image. Location.
在步骤S53中,滤波处理。In step S53, filter processing.
具体地,可以确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量。Specifically, the position offset between the previous frame image and the current frame image may be determined, and then filter processing is performed on the position offset to obtain a filtered inter-frame offset.
在步骤S54中,确定帧间最大全局偏移量。In step S54, the maximum global offset between frames is determined.
具体地,可以根据前一步骤中确定的滤波后帧间偏移量,确定帧间最大全局偏移量。Specifically, the maximum inter-frame global offset may be determined according to the filtered inter-frame offset determined in the previous step.
在步骤S55中,确定关键点采集稳定性标定参数。In step S55, the key point acquisition stability calibration parameters are determined.
具体地,可以根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数。Specifically, key point acquisition stability calibration parameters may be determined according to position offsets of each key point between the previous frame image and the current frame image.
在步骤S56中,确定第二分段线性函数。In step S56, a second piecewise linear function is determined.
具体地,可以将稳定性标定参数引入第二分段线性函数,根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数。Specifically, the stability calibration parameter can be introduced into the second piecewise linear function, and the second key point is determined according to the maximum global offset between frames, the key point acquisition stability calibration parameter and the second piecewise linear function Offset regression coefficients.
在步骤S57中,调整关键点的位置。In step S57, the position of the key point is adjusted.
具体地,可以根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Specifically, the position of the key point in the current frame image may be adjusted according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image.
在具体实施中,有关步骤S51至步骤S57的更多详细内容请参照图1至图4中的步骤描述进行执行,此处不再赘述。In specific implementation, for more detailed content about steps S51 to S57, please refer to the step descriptions in FIG. 1 to FIG. 4 for execution, and details will not be repeated here.
参照图6,图6是本发明实施例中一种关键点处理装置的结构示意图。所述关键点处理装置可以包括:Referring to FIG. 6 , FIG. 6 is a schematic structural diagram of a key point processing device in an embodiment of the present invention. The key point processing means may include:
关键点位置检测模块61,用于在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;Key point position detection module 61, is used for collecting previous frame image and current frame image in video, and detects the position of a plurality of key points respectively;
滤波模块62,用于对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量; Filtering module 62, is used for, for each key point, determines the position offset of described previous frame image and current frame image, then carries out filtering process to described position offset, obtains the inter-frame offset after filtering;
位置调整模块63,用于对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。The position adjustment module 63 is configured to, for each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
在具体实施中,上述装置可以对应于用户设备中具有数据处理功能的芯片;或者对应于用户设备中包括具有数据处理功能芯片的芯片模组,或者对应于用户设备。In a specific implementation, the above means may correspond to a chip with a data processing function in the user equipment; or correspond to a chip module including a chip with a data processing function in the user equipment, or correspond to the user equipment.
本发明实施例还提供了一种可读存储介质,其上存储有计算机程序,所述计算机程序被处理器运行时执行上述方法的步骤。所述可读存储介质可以是计算机可读存储介质,例如可以包括非挥发性存储器(non-volatile)或者非瞬态(non-transitory)存储器,还可以包括光盘、机械硬盘、固态硬盘等。An embodiment of the present invention also provides a readable storage medium on which a computer program is stored, and the computer program executes the steps of the above method when the computer program is run by a processor. The readable storage medium may be a computer-readable storage medium, for example, may include a non-volatile memory (non-volatile) or a non-transitory (non-transitory) memory, and may also include an optical disk, a mechanical hard disk, a solid-state hard disk, and the like.
具体地,在本发明实施例中,所述处理器可以为中央处理单元(central processing unit,简称CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,简称DSP)、专用集成电路(application specific integrated circuit,简称ASIC)、现成可编程门阵列(field programmable gate array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。Specifically, in the embodiment of the present invention, the processor may be a central processing unit (Central Processing Unit, referred to as CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processor, referred to as DSP) ), application specific integrated circuit (ASIC for short), off-the-shelf programmable gate array (field programmable gate array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
还应理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,简称ROM)、可编程只读存储器(programmable ROM,简称PROM)、可擦除可编程只读存储器(erasable PROM,简称EPROM)、电可擦除可编程只读存储器(electrically EPROM,简称EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,简称RAM),其用 作外部高速缓存。通过示例性但不是限制性说明,许多形式的随机存取存储器(random access memory,简称RAM)可用,例如静态随机存取存储器(static RAM,简称SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,简称SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,简称DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,简称ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,简称SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,简称DR RAM)。It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the non-volatile memory can be read-only memory (read-only memory, referred to as ROM), programmable read-only memory (programmable ROM, referred to as PROM), erasable programmable read-only memory (erasable PROM, referred to as EPROM) , Electrically Erasable Programmable Read-Only Memory (electrically EPROM, referred to as EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, many forms of random access memory (RAM) are available, such as static random access memory (static RAM (SRAM), dynamic random access memory (DRAM), synchronous Dynamic random access memory (synchronous DRAM, referred to as SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, referred to as DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, referred to as ESDRAM), Synchronously connect dynamic random access memory (synchlink DRAM, referred to as SLDRAM) and direct memory bus random access memory (direct rambus RAM, referred to as DR RAM).
本发明实施例还提供了一种终端,包括存储器和处理器,所述存储器上存储有能够在所述处理器上运行的计算机程序,所述处理器运行所述计算机程序时执行上述方法的步骤。所述终端包括但不限于手机、计算机、平板电脑等终端设备。An embodiment of the present invention also provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor executes the steps of the above method when running the computer program . The terminals include but are not limited to terminal devices such as mobile phones, computers, and tablet computers.
应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" in this article is only an association relationship describing associated objects, which means that there may be three relationships, for example, A and/or B may mean: A exists alone, and A and B exist at the same time , there are three cases of B alone. In addition, the character "/" in this article indicates that the contextual objects are an "or" relationship.
本申请实施例中出现的“多个”是指两个或两个以上。"Multiple" appearing in the embodiments of the present application means two or more.
本申请实施例中出现的第一、第二等描述,仅作示意与区分描述对象之用,没有次序之分,也不表示本申请实施例中对设备个数的特别限定,不能构成对本申请实施例的任何限制。The first, second, etc. descriptions that appear in the embodiments of this application are only for illustration and to distinguish the description objects. Any limitations of the examples.
关于上述实施例中描述的各个装置、产品包含的各个模块/单元,其可以是软件模块/单元,也可以是硬件模块/单元,或者也可以部分是软件模块/单元,部分是硬件模块/单元。例如,对于应用于或集成于芯片的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于芯片内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现;对于应用于或集 成于芯片模组的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,不同的模块/单元可以位于芯片模组的同一组件(例如芯片、电路模块等)或者不同组件中,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于芯片模组内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现;对于应用于或集成于终端的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,不同的模块/单元可以位于终端内同一组件(例如,芯片、电路模块等)或者不同组件中,或者,至少部分模块/单元可以采用软件程序的方式实现,该软件程序运行于终端内部集成的处理器,剩余的(如果有)部分模块/单元可以采用电路等硬件方式实现。Regarding each device described in the above embodiments, each module/unit contained in the product may be a software module/unit, or a hardware module/unit, or may be partly a software module/unit and partly a hardware module/unit. . For example, for each device or product applied to or integrated into a chip, each module/unit contained therein may be realized by hardware such as a circuit, or at least some modules/units may be realized by a software program, and the software program Running on the integrated processor inside the chip, the remaining (if any) modules/units can be realized by means of hardware such as circuits; They are all realized by means of hardware such as circuits, and different modules/units can be located in the same component (such as chips, circuit modules, etc.) or different components of the chip module, or at least some modules/units can be realized by means of software programs, The software program runs on the processor integrated in the chip module, and the remaining (if any) modules/units can be realized by hardware such as circuits; /Units can be realized by means of hardware such as circuits, and different modules/units can be located in the same component (such as chips, circuit modules, etc.) or different components in the terminal, or at least some modules/units can be implemented in the form of software programs Realization, the software program runs on the processor integrated in the terminal, and the remaining (if any) modules/units can be implemented by means of hardware such as circuits.
虽然本发明披露如上,但本发明并非限定于此。任何本领域技术人员,在不脱离本发明的精神和范围内,均可作各种更动与修改,因此本发明的保护范围应当以权利要求所限定的范围为准。Although the present invention is disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, so the protection scope of the present invention should be based on the scope defined in the claims.

Claims (17)

  1. 一种关键点处理方法,其特征在于,包括:A key point processing method, characterized in that, comprising:
    在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;Collect the previous frame image and the current frame image in the video, and detect the positions of multiple key points respectively;
    对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量;For each key point, determine the position offset of the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset;
    对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。For each key point, the position of the key point in the current frame image is adjusted according to the filtered inter-frame offset and the position of the previous frame image.
  2. 根据权利要求1所述的关键点处理方法,其特征在于,采用下述公式,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量:The key point processing method according to claim 1, wherein the following formula is used to determine the position offset between the previous frame image and the current frame image, and then filter the position offset, Get the inter-frame offset after filtering:
    diff offset=Rigid cur-Rigid pre diff offset = Rigid cur - Rigid pre
    diff smooth=Filter(diff offset,radius) diff smooth = Filter(diff offset , radius)
    其中,diff offset用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量,Rigid cur用于表示该关键点在所述当前帧图像的关键点的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,Filter()用于表示滤波处理函数,diff smooth用于表示该关键点的滤波后帧间偏移量,radius用于表示滤波半径。 Among them, diff offset is used to indicate the position offset of the key point in the previous frame image and the current frame image, Rigid cur is used to indicate the position of the key point in the key point of the current frame image, and Rigid pre uses To represent the position of the key point in the previous frame image, Filter() is used to represent the filter processing function, diff smooth is used to represent the inter-frame offset after filtering of the key point, and radius is used to represent the filtering radius.
  3. 根据权利要求2所述的关键点处理方法,其特征在于,采用下述公式,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置:The key point processing method according to claim 2, wherein the following formula is used to adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image. Location:
    dst pts=Rigid pre+diff smooth dst pts = Rigid pre + diff smooth
    其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,diff smooth用于表示该关键点的滤波后帧间偏移量。 Among them, dst pts is used to indicate the adjusted position of the key point in the current frame image, Rigid pre is used to indicate the position of the key point in the previous frame image, and diff smooth is used to indicate the filtering of the key point Back frame offset.
  4. 根据权利要求2所述的关键点处理方法,其特征在于,在根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置之前,还包括:The key point processing method according to claim 2, wherein, before adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image, further include:
    根据滤波后帧间偏移量,确定帧间最大全局偏移量;Determine the maximum global offset between frames according to the filtered inter-frame offset;
    根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数;Determine the first key point offset regression coefficient according to the maximum global offset between frames and the first piecewise linear function;
    根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置包括:According to the position of the inter-frame offset after the filtering and the previous frame image, adjusting the key point at the position of the current frame image includes:
    根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Adjust the position of the key point in the current frame image according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the position of the previous frame image.
  5. 根据权利要求4所述的关键点处理方法,其特征在于,采用下述公式,根据所述帧间最大全局偏移量以及第一分段线性函数,确定第一关键点偏移回归系数:The key point processing method according to claim 4, wherein the following formula is used to determine the first key point offset regression coefficient according to the maximum global offset between the frames and the first piecewise linear function:
    f 1(Diff max)=0,if Diff max≤1; f 1 (Diff max ) = 0, if Diff max ≤ 1;
    f 1(Diff max)=(Diff max-N)/(N-1)+1,else if 1<Diff max≤N; f 1 (Diff max )=(Diff max -N)/(N-1)+1, else if 1<Diff max ≤N;
    f 1(Diff max)=1,else if Diff max≥N; f 1 (Diff max )=1, else if Diff max ≥ N;
    其中,Diff max用于表示帧间最大全局偏移量,f 1(x)用于表示第一分段线性函数,f 1(Diff max)用于表示第一关键点偏移回归系数,N为正有理数。 Among them, Diff max is used to represent the maximum global offset between frames, f 1 (x) is used to represent the first piecewise linear function, f 1 (Diff max ) is used to represent the first key point offset regression coefficient, and N is positive rational number.
  6. 根据权利要求5所述的关键点处理方法,其特征在于,The key point processing method according to claim 5, wherein,
    历史视频中相邻两帧图像之间的一个或多个关键点位置抖动均值越小,所述N选值越小。The smaller the jitter average value of one or more key point positions between two adjacent frames of images in the historical video is, the smaller the selected value of N is.
  7. 根据权利要求4所述的关键点处理方法,其特征在于,采用下述公式,根据所述滤波后帧间偏移量与所述第一关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置:The key point processing method according to claim 4, wherein the following formula is used, according to the product of the filtered inter-frame offset and the first key point offset regression coefficient, and the previous frame image position, adjust the position of the key point in the current frame image:
    dst pts=Rigid pre+f 1(Diff max)×diff smooth dst pts = Rigid pre +f 1 (Diff max )×diff smooth
    其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置,Rigid pre用于表示所述前一帧图像中该关键点的位置,f 1(Diff max)用于表示第一关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to represent the adjusted position of the key point in the current frame image, Rigid pre is used to represent the position of the key point in the previous frame image, and f 1 (Diff max ) is used to represent the first A key point offset regression coefficient, diff smooth is used to represent the filtered inter-frame offset of the key point.
  8. 根据权利要求2所述的关键点处理方法,其特征在于,在根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置之前,还包括:The key point processing method according to claim 2, wherein, before adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image, further include:
    根据滤波后帧间偏移量,确定帧间最大全局偏移量;Determine the maximum global offset between frames according to the filtered inter-frame offset;
    根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数;Determine key point acquisition stability calibration parameters according to the position offset of each key point in the previous frame image and the current frame image;
    根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数;Determine a second key point offset regression coefficient according to the maximum global offset between frames, the key point acquisition stability calibration parameter, and the second piecewise linear function;
    根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置包括:Adjusting the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image includes:
    根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置。Adjust the position of the key point in the current frame image according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the position of the previous frame image.
  9. 根据权利要求4或8所述的关键点处理方法,其特征在于,采用下述公式,根据滤波后帧间偏移量,确定帧间最大全局偏移量:The key point processing method according to claim 4 or 8, wherein the following formula is used to determine the maximum global offset between frames according to the filtered inter-frame offset:
    Diff max=MAX(diff smooth_all) Diff max = MAX(diff smooth_all )
    其中,Diff max用于表示帧间最大全局偏移量,MAX()为最大值函数,diff smooth_all用于表示各个关键点的滤波后帧间偏移量。 Among them, Diff max is used to indicate the maximum global offset between frames, MAX() is the maximum value function, and diff smooth_all is used to indicate the filtered inter-frame offset of each key point.
  10. 根据权利要求8所述的关键点处理方法,其特征在于,采用下述公式,根据各个关键点在所述前一帧图像和当前帧图像的位置偏移量,确定关键点采集稳定性标定参数:The key point processing method according to claim 8, wherein the following formula is used to determine the key point acquisition stability calibration parameters according to the position offset of each key point in the previous frame image and the current frame image :
    diff pts=ABS(Rigid cur-Rigid pre) diff pts = ABS(Rigid cur -Rigid pre )
    Stable thr=Min(M,Max(diff pts_all)) Stable thr = Min(M,Max(diff pts_all ))
    其中,diff pts用于表示该关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,ABS用()于表示绝对值函数,diff pts_all用于表示各个关键点在所述前一帧图像和当前帧图像的位置偏移量的绝对值,Max()为最大值函数,Min()为最小值函数,Stable thr用于表示关键点采集稳定性标定参数,M为正有理数。 Among them, diff pts is used to represent the absolute value of the position offset of the key point in the previous frame image and the current frame image, ABS uses () to represent the absolute value function, diff pts_all is used to represent each key point in the The absolute value of the position offset between the previous frame image and the current frame image, Max() is the maximum value function, Min() is the minimum value function, Stable thr is used to indicate the key point acquisition stability calibration parameter, M is positive rational numbers.
  11. 根据权利要求10所述的关键点处理方法,其特征在于,The key point processing method according to claim 10, wherein,
    选择历史视频中相邻两帧图像,该两帧图像之间的一个或多个关键点位置抖动均值越小,所述M选值越小。Selecting two adjacent frames of images in the historical video, the smaller the mean value of the jitter of one or more key point positions between the two frames of images, the smaller the selected value of M.
  12. 根据权利要求8所述的关键点处理方法,其特征在于,采用下述公式,根据所述帧间最大全局偏移量、所述关键点采集稳定性标定参数以及第二分段线性函数,确定第二关键点偏移回归系数:The key point processing method according to claim 8, characterized in that, the following formula is used to determine according to the maximum global offset between frames, the key point acquisition stability calibration parameters and the second piecewise linear function The second key point offset regression coefficient:
    f 2(Diff max)=0,if Diff max≤1; f 2 (Diff max ) = 0, if Diff max ≤ 1;
    f 2(Diff max)=(Diff max-Stable thr)/(Stable thr-1)+1,else if 1<Diff max≤Stable thrf 2 (Diff max )=(Diff max -Stable thr )/(Stable thr -1)+1, else if 1<Diff max ≤Stable thr ;
    f 2(Diff max)=1,else if Diff max≥Stable thrf 2 (Diff max )=1, else if Diff max ≥ Stable thr ;
    其中,Diff max用于表示帧间最大全局偏移量,f 2(x)用于表示第二分段线性函数,f 2(Diff max)用于表示第二关键点偏移回归系数,Stable thr为关键点采集稳定性标定参数。 Among them, Diff max is used to represent the maximum global offset between frames, f 2 (x) is used to represent the second piecewise linear function, f 2 (Diff max ) is used to represent the second key point offset regression coefficient, Stable thr Collect stability calibration parameters for key points.
  13. 根据权利要求8所述的关键点处理方法,其特征在于,采用下述公式,根据所述滤波后帧间偏移量与所述第二关键点偏移回归系数的乘积,以及前一帧图像的位置,调整该关键点在所述当前帧图像的位置:The key point processing method according to claim 8, wherein the following formula is used, according to the product of the filtered inter-frame offset and the second key point offset regression coefficient, and the previous frame image position, adjust the position of the key point in the current frame image:
    dst pts=Rigid pre+f 2(Diff max)×diff smooth dst pts = Rigid pre +f 2 (Diff max )×diff smooth
    其中,dst pts用于表示该关键点在所述当前帧图像的调整后的位置, Rigid pre用于表示所述前一帧图像中该关键点的位置,f 2(Diff max)用于表示第二关键点偏移回归系数,diff smooth用于表示该关键点的滤波后帧间偏移量。 Wherein, dst pts is used to indicate the adjusted position of the key point in the current frame image, Rigid pre is used to indicate the position of the key point in the previous frame image, and f 2 (Diff max ) is used to indicate the first Two key point offset regression coefficients, diff smooth is used to represent the filtered inter-frame offset of the key point.
  14. 根据权利要求1所述的关键点处理方法,其特征在于,满足以下一项或多项:The key point processing method according to claim 1, wherein one or more of the following are satisfied:
    所述关键点为人脸关键点;The key points are human face key points;
    所述关键点的位置为所述关键点在图像中的像素点序号。The position of the key point is the sequence number of the pixel of the key point in the image.
  15. 一种关键点处理装置,其特征在于,包括:A key point processing device is characterized in that it comprises:
    关键点位置检测模块,用于在视频中采集前一帧图像和当前帧图像,并分别检测多个关键点的位置;The key point position detection module is used to collect the previous frame image and the current frame image in the video, and detect the positions of multiple key points respectively;
    滤波模块,用于对于每个关键点,确定所述前一帧图像和当前帧图像的位置偏移量,然后对所述位置偏移量进行滤波处理,得到滤波后帧间偏移量;A filtering module, for each key point, determine the position offset of the previous frame image and the current frame image, and then filter the position offset to obtain the filtered inter-frame offset;
    位置调整模块,用于对于每个关键点,根据所述滤波后帧间偏移量与前一帧图像的位置,调整该关键点在所述当前帧图像的位置。The position adjustment module is configured to, for each key point, adjust the position of the key point in the current frame image according to the filtered inter-frame offset and the position of the previous frame image.
  16. 一种可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器运行时执行权利要求1至14任一项所述关键点处理方法的步骤。A readable storage medium on which a computer program is stored, wherein the computer program executes the steps of the key point processing method according to any one of claims 1 to 14 when the computer program is run by a processor.
  17. 一种终端,包括存储器和处理器,所述存储器上存储有能够在所述处理器上运行的计算机程序,其特征在于,所述处理器运行所述计算机程序时执行权利要求1至14任一项所述关键点处理方法的步骤。A terminal, comprising a memory and a processor, the memory stores a computer program that can run on the processor, wherein the processor executes any one of claims 1 to 14 when running the computer program. The steps of the key point processing method described in the item.
PCT/CN2021/142865 2021-08-03 2021-12-30 Key point processing method and apparatus, readable storage medium and terminal WO2023010792A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110886400.7A CN113627306B (en) 2021-08-03 2021-08-03 Key point processing method and device, readable storage medium and terminal
CN202110886400.7 2021-08-03

Publications (1)

Publication Number Publication Date
WO2023010792A1 true WO2023010792A1 (en) 2023-02-09

Family

ID=78382450

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/142865 WO2023010792A1 (en) 2021-08-03 2021-12-30 Key point processing method and apparatus, readable storage medium and terminal

Country Status (2)

Country Link
CN (1) CN113627306B (en)
WO (1) WO2023010792A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113627306B (en) * 2021-08-03 2023-04-07 展讯通信(上海)有限公司 Key point processing method and device, readable storage medium and terminal
CN113887547B (en) * 2021-12-08 2022-03-08 北京世纪好未来教育科技有限公司 Key point detection method and device and electronic equipment
CN114998812B (en) * 2022-07-28 2022-12-09 北京达佳互联信息技术有限公司 Method and device for updating positions of key points, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015126373A (en) * 2013-12-26 2015-07-06 ダンロップスポーツ株式会社 Image blurring correction system, program and method
CN109684920A (en) * 2018-11-19 2019-04-26 腾讯科技(深圳)有限公司 Localization method, image processing method, device and the storage medium of object key point
CN110363748A (en) * 2019-06-19 2019-10-22 平安科技(深圳)有限公司 Dithering process method, apparatus, medium and the electronic equipment of key point
CN112036255A (en) * 2020-08-07 2020-12-04 深圳数联天下智能科技有限公司 Face key point detection device
CN112183309A (en) * 2020-09-25 2021-01-05 咪咕文化科技有限公司 Face key point processing method, system, terminal and storage medium
CN113627306A (en) * 2021-08-03 2021-11-09 展讯通信(上海)有限公司 Key point processing method and device, readable storage medium and terminal

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231792B (en) * 2011-06-29 2013-04-24 南京大学 Electronic image stabilization method based on characteristic coupling
JP2015023470A (en) * 2013-07-19 2015-02-02 株式会社amuse oneself Panoramic moving image correction program, panoramic moving image correction method, recording medium, panoramic moving image correction device and panoramic photographing apparatus
CN111028191B (en) * 2019-12-10 2023-07-04 上海闻泰电子科技有限公司 Anti-shake method and device for video image, electronic equipment and storage medium
CN111950401B (en) * 2020-07-28 2023-12-08 深圳数联天下智能科技有限公司 Method, image processing system, device and medium for determining position of key point area
CN112329740B (en) * 2020-12-02 2021-10-26 广州博冠信息科技有限公司 Image processing method, image processing apparatus, storage medium, and electronic device
CN113034383A (en) * 2021-02-24 2021-06-25 大连海事大学 Method for obtaining video image based on improved grid motion statistics

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015126373A (en) * 2013-12-26 2015-07-06 ダンロップスポーツ株式会社 Image blurring correction system, program and method
CN109684920A (en) * 2018-11-19 2019-04-26 腾讯科技(深圳)有限公司 Localization method, image processing method, device and the storage medium of object key point
CN110363748A (en) * 2019-06-19 2019-10-22 平安科技(深圳)有限公司 Dithering process method, apparatus, medium and the electronic equipment of key point
CN112036255A (en) * 2020-08-07 2020-12-04 深圳数联天下智能科技有限公司 Face key point detection device
CN112183309A (en) * 2020-09-25 2021-01-05 咪咕文化科技有限公司 Face key point processing method, system, terminal and storage medium
CN113627306A (en) * 2021-08-03 2021-11-09 展讯通信(上海)有限公司 Key point processing method and device, readable storage medium and terminal

Also Published As

Publication number Publication date
CN113627306A (en) 2021-11-09
CN113627306B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
WO2023010792A1 (en) Key point processing method and apparatus, readable storage medium and terminal
US9860446B2 (en) Flare detection and mitigation in panoramic images
CN109644231B (en) Method, system, and medium providing improved video stability for mobile devices
JP6198958B2 (en) Method, apparatus, computer program, and computer-readable storage medium for obtaining a photograph
US8619148B1 (en) Image correction after combining images from multiple cameras
US8508605B2 (en) Method and apparatus for image stabilization
WO2020253618A1 (en) Video jitter detection method and device
US20190370948A1 (en) Unified Bracketing Approach for Imaging
US20130100235A1 (en) Face equalization in video conferencing
WO2014012364A1 (en) Method and device for correcting multi-exposure motion image
US9154728B2 (en) Image processing apparatus, image capturing apparatus, and program
WO2013135067A1 (en) Method and apparatus for stabilizing target object image in video
US11496710B2 (en) Image display method for video conferencing system with wide-angle webcam
US20240054655A1 (en) Image enhancement system
CN106681536A (en) Non transitory computer-readable medium and image sensing device
CN110286868A (en) Video display adjustment method and device, electronic equipment and storage medium
US20130050530A1 (en) Image capturing device and image processing method thereof
US20210027439A1 (en) Orientation adjustment of objects in images
US9904979B2 (en) Method of generating a framed video system
US10789693B2 (en) System and method for performing pre-processing for blending images
KR102585573B1 (en) Content-based image processing
WO2016155435A1 (en) Method for dynamically adjusting terminal screen display, terminal and storage medium utilizing same
US10681327B2 (en) Systems and methods for reducing horizontal misalignment in 360-degree video
US10165200B2 (en) Processing multiple image frames
CN114973344A (en) Face detection method, face detection device, terminal equipment and computer readable storage medium

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE