WO2019084933A1 - 图像消抖方法、装置、终端及计算机可读存储介质 - Google Patents

图像消抖方法、装置、终端及计算机可读存储介质 Download PDF

Info

Publication number
WO2019084933A1
WO2019084933A1 PCT/CN2017/109415 CN2017109415W WO2019084933A1 WO 2019084933 A1 WO2019084933 A1 WO 2019084933A1 CN 2017109415 W CN2017109415 W CN 2017109415W WO 2019084933 A1 WO2019084933 A1 WO 2019084933A1
Authority
WO
WIPO (PCT)
Prior art keywords
parameter matrix
matching
image
feature point
outer parameter
Prior art date
Application number
PCT/CN2017/109415
Other languages
English (en)
French (fr)
Inventor
谢俊
Original Assignee
深圳市柔宇科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市柔宇科技有限公司 filed Critical 深圳市柔宇科技有限公司
Priority to PCT/CN2017/109415 priority Critical patent/WO2019084933A1/zh
Priority to CN201780096060.XA priority patent/CN111345023B/zh
Publication of WO2019084933A1 publication Critical patent/WO2019084933A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules

Definitions

  • Image debounce method device, terminal and computer readable storage medium
  • the present invention relates to the field of electronic technologies, and more particularly to an image debounce method, apparatus, terminal, and computer readable storage medium.
  • the image matching process generally needs to perform feature point matching, and obtain an appropriate external reference matrix of the camera.
  • the external parameter matrix of the shooting camera is a transformation function, which represents the coordinate correspondence relationship between the matching feature points between the marker image and the image captured by the camera, that is, how the camera that captures the marker image passes through the translation and rotation in the space. The status of the currently collected marker image can be captured.
  • the technical problem to be solved by the present invention is to provide an image debounce method, apparatus, terminal, and computer readable storage medium in view of the above-mentioned drawbacks of the prior art.
  • S10 acquiring a first outer parameter matrix of the current frame camera and a matching first feature point pair corresponding to the first outer parameter matrix;
  • S20 obtaining a first error value of the first outer parameter matrix according to the first feature point pair and the first outer parameter matrix, in combination with an internal parameter matrix of the camera;
  • S30 performing mean filtering processing on the first error value of the first outer parameter matrix to obtain a second outer parameter matrix;
  • S40 Update the first outer parameter matrix according to the second outer parameter matrix to complete debounce on the image.
  • the present invention also provides an image debounce device, including:
  • an obtaining unit configured to acquire a first outer parameter matrix of the current frame camera and a first feature point pair that is successfully matched with the first outer parameter matrix
  • a calculating unit configured to obtain a first error value of the first outer parameter matrix according to the first feature point pair and the first outer parameter matrix, in combination with an inner parameter matrix of the camera;
  • a filtering unit configured to perform mean filtering processing on the first error value of the first outer parameter matrix, to obtain a second outer parameter matrix
  • an updating unit configured to update the first outer parameter matrix according to the second outer parameter matrix to complete debounce on the image.
  • the present invention also provides a method of implementing augmented reality, including the aforementioned image debounce method.
  • the present invention also provides a terminal including a unit for performing the image debounce method described above.
  • the present invention also provides a terminal for realizing augmented reality, comprising a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are connected to each other, wherein the memory is used for storing A computer program, the computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the image debounce method described above.
  • the present invention also provides a computer readable storage medium storing a computer program, the computer program comprising program instructions, the program instructions being executed by a processor to cause the processor The aforementioned image debounce method is performed.
  • the present invention obtains a first error value of the first outer parameter matrix according to the obtained first outer parameter matrix of the current frame camera and the first matching feature pair corresponding to the first outer parameter matrix, and The first error value is subjected to mean filtering processing, so that the first outer parameter matrix subjected to the mean filtering process tends to mean, even if the outer parameter matrix of the camera obtained in each frame tends to be average, ensuring the outer required in the AR imaging process.
  • Reference The array is closer, which eliminates the jitter of the AR rendering and enhances the AR effect.
  • FIG. 1 is a schematic diagram of a specific calculation process and AR imaging acquired by an outer parameter matrix
  • Embodiment 1 of an image debounce method according to the present invention is a schematic flow chart of Embodiment 1 of an image debounce method according to the present invention
  • Embodiment 1 of an image debounce device is a schematic structural view of Embodiment 1 of an image debounce device according to the present invention.
  • FIG. 4 is a schematic diagram of error analysis of a camera external reference matrix of the present invention.
  • FIG. 6 is a schematic block diagram of an embodiment of a terminal of the present invention.
  • FIG. 7 is a schematic block diagram of a terminal for realizing augmented reality according to the present invention.
  • FIG. 1 is a specific calculation process of the camera external reference matrix acquisition and an AR imaging flowchart, as shown in FIG.
  • Step 1 Input the internal reference matrix of the camera, and the internal reference matrix describes various self-parameters of the camera, such as the number of horizontal and vertical pixels; the horizontal and vertical focal lengths of the camera. It can be calculated by pre-setting the camera or by reading the camera parameter information (pixel, focal length, etc.).
  • Step 2 Enter the marker image.
  • the marker image is an image required for subsequent acquisition of the AR rendering.
  • the marker image is a marker image stored in advance in the memory, and may be an image directly called from the image library, or may be a real shot image obtained by field shooting and stored in a memory. The process of matching feature points and feature points is extracted in the marker image and the camera image.
  • the third to sixth steps are steps of extracting feature point and feature point matching in the marker image and the camera image.
  • Step 7 Calculate the external parameter matrix of the camera using the matched feature points and the internal parameter matrix. It can be understood that the essence of the step is to describe the correspondence by finding a transformation function by the correspondence between the coordinates of the matched feature points of the two images (the marker image and the camera image). Shooting mark The camera of the object image, in the space, how to capture the state of the currently collected marker image by panning and rotating. This function is described by a matrix, which is an external parameter matrix.
  • Step 8 Perform CG mapping according to the external parameter matrix and the internal reference matrix obtained in the eighth step, that is, an internal parameter matrix representing the camera model, and an external parameter matrix representing the position and orientation transformation of the camera, and modeling in the 3D model space.
  • the captured image of the camera in the 3D model space at the current position is obtained, and finally the image calculated in the 3D model space and the image captured by the real camera are superimposed to obtain an AR effect image.
  • the obtaining process of the outer parameter matrix is a processing process of one frame image, wherein each frame obtains the outer parameter matrix and saves the obtained outer parameter matrix in the database, and the same The matching feature point pairs corresponding to the frame are also saved in the database.
  • FIG. 2 is a schematic flow chart of Embodiment 1 of the image debounce method of the present invention.
  • the execution body of the image debounce method in this embodiment may be a terminal.
  • the terminal may be a mobile terminal such as a mobile phone or a tablet computer, but is not limited thereto, and may be another terminal.
  • the image debounce method of this embodiment may include the following steps:
  • S10 Acquire a first outer parameter matrix of the current frame camera and a first feature point pair that matches the first outer parameter matrix.
  • the current frame of the present invention is at least a second frame, i.e., it is necessary to ensure that the processed image frame is at least from the second frame before performing the present invention.
  • the first outer parameter matrix of the current frame camera can be obtained by the foregoing feature point matching calculation process based on the marker image, and the matching feature point pair used in the calculation process of the first outer parameter matrix of the current frame is extracted. , that is, the first feature point pair.
  • the first feature point pair that is successfully matched with the first outer parameter matrix may be correspondingly extracted.
  • the first feature point pair includes a first matching feature point set of the marker image and a second matching feature point set of the camera image; wherein each of the first matching feature point sets has a matching point and a second Match An image matching point in the feature point set matches.
  • both ends of each straight line represent a pair of feature points.
  • the outer parameter matrix of the camera image obtained in each frame corresponds to a set of feature point pairs that are successfully matched, and each set of feature point pairs that are successfully matched is composed of two feature point sets, one from the image of the marker image.
  • a matching feature point set, a second matching feature point set from the camera image acquired by the current camera wherein the feature points in the two matching feature point sets are matched one by one, that is, each marker matching point in the marker image is An image matching point in the captured image matches, and the two matching points form a feature point pair
  • S20 Obtain a first error value of the first outer parameter matrix according to the first feature point pair and the first outer parameter matrix, in combination with the internal parameter matrix of the camera.
  • step 20 includes:
  • the terminal may directly extract the first matching feature point set and the current camera image of the marker image from the first feature point pair.
  • the second matching feature point set after acquiring the first feature point pair corresponding to the first outer parameter matrix of the current frame camera, the terminal may directly extract the first matching feature point set and the current camera image of the marker image from the first feature point pair. The second matching feature point set.
  • step B further includes:
  • B11 calculating, by using the first outer parameter matrix and the internal parameter matrix of the camera, a coordinate position of each of the marker matching points in the first matching feature point set in the current frame camera image, and determining each marker matching according to the coordinate position. The calculated coordinates of the point;
  • B12 Determine, according to the second matching feature point set, matching coordinates of each of the marker matching points in the first matching feature point set in the current frame camera image.
  • the internal parameter matrix of the camera can be called directly from the database by the terminal when needed. After obtaining the first matching feature point set, according to the obtained first outer parameter matrix of the current frame camera and the internal parameter matrix of the camera called from the database, each marker matching in the first matching feature point set can be calculated. The coordinate position of the point in the current frame camera image, which is the calculation of the marker matching point Coordinates. In other words, through the first outer parameter matrix and the inner parameter matrix, the calculated coordinates of the first matching feature point set, each of the marker matching points of the marker image in the current frame camera image are calculated.
  • the image on the left side is a marker image
  • the image on the right side is a current frame camera image.
  • 1, 2, 3, and 4 in the marker image are the four marker matching points in the first matching feature point set, wherein 1', 2', 3', 4' are marker matching points 1, 2 , 3, 4 matching coordinate positions in the current frame camera image; 1", 2 ", 3", 4" are the marker matching points 1, 2, 3, calculated by using the obtained first outer parameter matrix 4 Calculate the coordinate position in the current frame camera image.
  • a marker matching point in the marker image corresponds to two feature points in the current frame camera image, one is a feature point that matches successfully, and the other is a calculated feature point, wherein the feature point of the matching success is An image matching point in the current frame camera image in the second matching feature point set that matches the marker matching point in the first matching feature point set.
  • the calculated coordinates of each of the marker matching points in the current frame camera image can be determined; and the second matching feature point set can be determined by the second matching feature point set
  • Each of the markers matches the matching coordinates of the point in the current frame camera image. That is, as shown in Fig. 4, the matching coordinates of points 1', 2', 3', 4' and the calculated coordinates of points, 2 ⁇ , 3", 4" can be determined separately.
  • the matching coordinates and points, 2 ⁇ , 3" of the points, 2', 3', 4' are respectively determined.
  • D processing the error distance between the calculated coordinates of the matched matching points and the matching coordinates to obtain an average error distance, and the average error distance is used as the first error value of the first foreign parameter matrix.
  • the calculation is performed to obtain the average error distance, that is, the error distances are summed and summed, and divided by the number of points of the marker matching points used. And obtaining an average value of the error distance, wherein the average value of the error distance is an average error distance, wherein the average error distance is used as a first error value of the first outer parameter matrix. It can be understood that the average error distance can be used to determine the accuracy of the first outer parameter matrix.
  • the outer parameter matrix is a feature point pair that uses matching success.
  • the calculated mathematical model therefore, in this embodiment, by using the first outer parameter matrix to verify the matching result of the feature point in turn, the calculated result should be consistent with the matching result, and the average error distance obtained corresponding to the result is also very small. Therefore, in this embodiment, the average error distance calculated by using the first outer parameter matrix is used as the first error value of the first outer parameter matrix to achieve an evaluation of the accuracy of the first outer parameter matrix.
  • S30 performing mean filtering processing on the first error value of the first outer parameter matrix to obtain a second outer parameter matrix.
  • the first outer parameter matrix may be correspondingly processed before performing step S30, for example, converting the first outer parameter matrix into a mathematical model capable of linear rotation change, that is, the first outer parameter matrix It is converted into a mathematical model that can describe a linear rotation transformation or a mathematical model of an approximately linear rotation transformation.
  • the first outer parameter matrix is a mathematical model of the rotation posture and translation of the camera.
  • the rotation angle and the translation amount in the rotation posture in the mathematical model represented by the first outer parameter matrix are not linearly related, and the first outer The first error value of the reference matrix is subjected to mean filtering processing, and the first outer parameter matrix needs to be converted into a corresponding mathematical model capable of linear rotation change.
  • the mathematical model that can perform linear rotation change can be Euler angle and translation vector, and can also be quaternion and translation vector. In this embodiment, a quaternion and a translation vector are preferred.
  • performing an average filtering process on the first error value of the first outer parameter matrix may be implemented by using a weighted average method.
  • the weighted average method is to calculate the weighted arithmetic mean of the observed values by using the observations of the same variable arranged in the order of the past and using the number of the inter-orders as the weight, and use this number as the predicted future period.
  • the first error value of the first outer parameter matrix is subjected to mean filtering processing, and the first outer parameter matrix is converted into a quaternion and a translation vector, respectively, and the quaternion and the translation vector are respectively performed.
  • Performing a weighted average to obtain a weighted average of the quaternion and a weighted average of the translation vector and the weighted average of the obtained quaternion and the weighted average of the translation vector are the first error values of the first foreign parameter matrix.
  • the weighted average of the obtained quaternion and the weighted average of the translation vector are finally converted back to the matrix form to obtain the second outer parameter matrix.
  • the first outer parameter matrix is converted into a first quaternion and a first translation vector.
  • the conversion method is the same as the method of converting the existing ordinary transformation matrix into a quaternion and a translation vector, where quaternion
  • the number is a vector represented by four numbers, indicating the rotation posture of the camera; the translation vector represents the camera at X
  • step S30 includes:
  • S301 Acquire N historical error values of the camera according to preset filter lengths.
  • the length of the preset filter may be determined according to an actual jitter frame in the AR image. For example, if the actual jitter frame in the AR image is 5 frames, the length of the preset filter is 5, and thus, the required acquisition is performed.
  • the historical error value of the camera is 5, that is, the historical error value of the previous 5 consecutive frames of the current frame is obtained, wherein the historical error values of the previous 5 consecutive frames are pre-stored in the database, and the acquisition can be directly called from the database. Understand Ground, the historical error value referred to here is the error value of the camera external parameter matrix calculated by the history frame.
  • S302 performing weight processing on each of the N historical error values to obtain a historical weight corresponding to each historical error value; and performing weight processing on the first error value of the first foreign parameter matrix to obtain the first The first weight of the outer parameter matrix.
  • the peer after obtaining the N historical error values corresponding to the N frames of consecutive frames, respectively calculating the reciprocal of the N historical error values, and the reciprocal of each historical error value is its historical weight, that is, obtaining each historical error value correspondingly Historical weight.
  • the peer performs weight processing on the first error value of the first outer parameter matrix, that is, calculates a reciprocal of the first error value, and the reciprocal of the first error value is the first weight of the first outer parameter matrix.
  • the first weight and all the historical weights are summed and summed, the sum of the weights is obtained, and the reciprocal of the accumulated sum is calculated to obtain the accumulated weighted value.
  • the first weight is multiplied by the accumulated weight value, and each historical weight is multiplied by a cumulative weight value, that is, the normalization processing is completed, and the normalized weight is obtained.
  • S304 Perform weighted averaging processing on the first quaternion and the first translation vector respectively according to the normalized weight, and obtain a weighted average of the first quaternion and a weighted average of the first translation vector.
  • performing weighted averaging processing on the first translation vector that is, performing weighted averaging of each value of the translation vector and the normalization weight obtained in step S303 to obtain weighting of the first translation vector.
  • the average value, the weighted average of the first translation vector is the new translation vector, that is, the obtained second translation vector after filtering.
  • the weighted average processing on the first quaternion may be performed by using a spherical linear interpolation method to perform weighted averaging on the first quaternion.
  • the weighted average of the quaternions can only be used to obtain a weighted average of two quaternions, but this embodiment requires a weighted average of multiple quaternions, so , need 2 2 step by step to obtain a weighted average.
  • S305 The weighted average of the first quaternion is used as the second quaternary, and the weighted average of the first translation vector is used as the second translation vector.
  • S306 Perform matrix transformation on the second quaternion and the second translation vector to obtain a second outer parameter matrix. It can be understood that the second outer parameter matrix is the outer parameter matrix subjected to the mean filtering process.
  • S40 Update the first outer parameter matrix according to the second outer parameter matrix to complete debounce on the image.
  • the first outer parameter matrix is replaced with the second outer parameter matrix and saved, and in the subsequent process of acquiring the AR image, directly taking the second outer
  • the reference matrix is modeled.
  • the present invention further provides an image debounce device.
  • the image debounce device may include: an acquisition unit 31, a calculation unit 32, a filtering unit 33, and an update unit 34.
  • the obtaining unit 31 is configured to acquire a first outer parameter matrix of the current frame camera and correspond to the first outer parameter matrix. a first feature point pair that matches the success;
  • the calculating unit 32 is configured to combine the internal parameter matrix of the camera according to the first feature point pair and the first outer parameter matrix
  • the filtering unit 33 is configured to perform mean filtering processing on the first error value of the first outer parameter matrix to obtain a second outer parameter matrix;
  • the updating unit 34 is configured to update the first outer parameter matrix according to the second outer parameter matrix to complete debounce on the image.
  • the present invention also provides a method of implementing augmented reality, which can be the aforementioned image debounce method.
  • the method for implementing augmented reality in this embodiment further includes:
  • the present invention also provides a terminal including a unit for performing the image debounce method of any of the foregoing.
  • the terminal in this embodiment may be a mobile terminal such as a smart phone or a tablet computer, or may be another terminal mountain.
  • the terminal 600 of this embodiment may include a first obtaining unit 601, a first calculating unit 602, a first filtering unit 603, a first updating unit 604, and a converting unit 605.
  • the conversion unit 605 is configured to convert the first outer parameter matrix into a mathematical model capable of linear rotation change.
  • the first quaternion and the first translation vector may be obtained according to the mathematical model that can perform the linear rotation change.
  • the first acquiring unit 601 is configured to acquire a first outer parameter matrix of the current frame camera and a matching first feature point pair corresponding to the first outer parameter matrix; wherein the first feature point pair includes the marker image a first matching feature point set and a second matching feature point set of the camera image; wherein each of the marker matching points in the first matching feature point set matches one of the image matching points in the second matching feature point set.
  • the first obtaining unit 601 may include a first acquiring module 6011.
  • the first obtaining module 6011 is configured to acquire an internal parameter matrix of the camera.
  • the first calculating unit 602 is configured to combine the first feature point pair with the first outer parameter matrix, and combine the inside of the camera Referring to the matrix, the first error value of the first outer parameter matrix is obtained.
  • the first calculating unit 602 may include an extracting module 6021, a coordinate acquiring module 6022, a first calculating module 6023, and a second calculating module 6024.
  • the extraction module 6021 is configured to obtain a first matching feature point set and a second matching feature point set.
  • the coordinate obtaining module 6022 is configured to obtain, by using the first outer parameter matrix, the internal parameter matrix of the camera, and the first matching feature point set and the second matching feature point set, to obtain each marker matching point in the first matching feature point set.
  • the calculated coordinates and matching coordinates in the current frame camera image are configured to obtain, by using the first outer parameter matrix, the internal parameter matrix of the camera, and the first matching feature point set and the second matching feature point set, to obtain each marker matching point in the first matching feature point set. The calculated coordinates and matching coordinates in the current frame camera image.
  • the coordinate obtaining module 6022 is further configured to calculate, by using the first outer parameter matrix and the internal parameter matrix of the camera, a coordinate position of each of the marker matching points in the first matching feature point set in the current frame camera image, according to the coordinate position. Determine the calculated coordinates of each marker match point. Simultaneously, according to the second matching feature point set, the matching coordinates of each of the marker matching points in the first matching feature point set in the current frame camera image are determined.
  • the first calculating module 6023 is configured to obtain an error distance between the calculated coordinates of each of the marker matching points and the matching coordinates according to the calculated coordinates and the matching coordinates of each of the marker matching points in the current camera image.
  • the second calculating module 6024 is configured to process the error distance between the calculated coordinates of the matched matching points and the matching coordinates to obtain an average error distance, and the average error distance is used as the first outer parameter matrix. An error value.
  • the first filtering unit 603 is configured to perform mean filtering processing on the first error value of the first outer parameter matrix to obtain a second outer parameter matrix.
  • the first filtering unit 603 may include a historical error value calculation module 6031, a weight acquisition module 6 032, a normalization processing module 6033, a weighted average processing module 6034, and a conversion module 6035.
  • the historical error value calculation module 6031 is configured to respectively acquire N historical error values of the camera according to the preset filter length;
  • the weight obtaining module 6032 is configured to perform weight processing on each of the N historical error values to obtain a historical weight corresponding to each historical error value; and perform a weight on the first error value of the first foreign parameter matrix. Value processing, obtaining a first weight of the first outer parameter matrix;
  • the normalization processing module 6033 is configured to normalize the first weight and all the obtained historical weights Rational, get the normalized weight.
  • the weighted average processing module 6034 is configured to perform weighted average processing on the first quaternion and the first translation vector according to the normalized weight, respectively, to obtain a weighted average of the first quaternion and a first translation vector. a weighted average; and a weighted average of the first quaternion as the second quaternion, the weighted average of the first translation vector as the second translation vector;
  • the conversion module 6035 is configured to perform matrix transformation on the second quaternion and the second translation vector to obtain a second outer parameter matrix.
  • the first update unit 604 is configured to update the first outer parameter matrix according to the second outer parameter matrix to complete debounce on the image.
  • the terminal acquires a first outer parameter matrix of the current frame camera and a matching first feature point pair corresponding to the first outer parameter matrix; according to the first feature point pair and the first outer parameter matrix, combined with the camera
  • An internal error matrix obtains a first error value of the first outer parameter matrix; performs mean filtering processing on the first error value of the first outer parameter matrix to obtain a second outer parameter matrix; and pairs the first outer parameter matrix according to the second outer parameter matrix Update to complete the image debounce.
  • the mean filtering process is performed such that the first outer parameter matrix after the mean filtering process tends to mean, even if the outer parameter matrix of the camera obtained in each frame tends to mean, ensuring that the outer parameter matrix required in the AR imaging process is closer. , thereby eliminating the jitter phenomenon of the AR rendering, and enhancing the AR effect.
  • the present invention also provides a terminal that implements augmented reality.
  • the augmented reality implementation terminal 700 of this embodiment may include: one or more processors 701, one or more input devices 702, one or more output devices 703, and one or more Memory 704.
  • the above-described processor 701, input device 702, output device 703, and memory 704 complete communication with each other via communication bus 70 5 .
  • the memory 704 is for storing a computer program, and the computer program includes program instructions.
  • the processor 701 is configured to invoke program instructions to perform the following operations:
  • [0119] acquiring a first outer parameter matrix of the current frame camera and a matching first feature point pair corresponding to the first outer parameter matrix; wherein the first feature point pair includes the first matching feature point set of the marker image camera a second matching feature point set of the image; wherein each of the marker matching points in the first matching feature point set matches one of the image matching points in the second matching feature point set.
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • the average error distance is obtained, and the average error distance is used as the first error value of the first outer parameter matrix.
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • processor 701 is specifically configured to invoke a program instruction to perform the following operations:
  • the processor 701 may be a central processing unit (CPU), and may be other general-purpose processors, a digital signal processor (DSP).
  • DSP digital signal processor
  • ASIC Application Specific Integrated
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the input device 702 may include a touchpad, a fingerprint sensor (for collecting fingerprint information of the user and direction information of the fingerprint), a microphone, a button, and the like.
  • the output device 703 may include a display (LCD, TFT-LCD, 0LED, PM0LED, AMOLED, etc.), a speaker, a flash, and the like.
  • Memory 704 can include read only memory and random access memory and provides instructions and data to processor 701. A portion of memory 704 may also include non-volatile random access memory. For example, the memory 704 can also store information of the device type.
  • the processor 701, the input device 702, and the output device 703 described in the embodiment of the present invention may implement the implementation manner described in Embodiment 1 of the image debounce method provided by the embodiment of the present invention.
  • the implementation of the terminal described in the embodiment of the present invention may also be implemented, and details are not described herein again.
  • the present invention also provides a computer readable storage medium storing a computer program, the computer program comprising program instructions, the program instructions being executed by a processor
  • the processor performs the steps of implementing the image debounce method of the above embodiment.
  • the computer readable storage medium may be an internal storage unit of the terminal described in any of the foregoing embodiments, such as a hard disk or a memory of the terminal.
  • the computer readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card (SMC), and a Secure Digital (SD) card. Flash card, etc.
  • SMC smart memory card
  • SD Secure Digital
  • the computer readable storage medium may also include both an internal storage unit of the terminal and an external storage device.
  • Computer readable storage media are used to store computer programs and other programs and data required by the terminal.
  • the computer readable storage medium can also be used to temporarily store data that has been output or is about to be output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

本发明涉及图像消抖方法、装置、终端及计算机可读存储介质,本发明通过获取当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应的匹配成功的第一特征点对;根据第一特征点对与第一外参矩阵,结合摄像头的内参矩阵,获得第一外参矩阵的第一误差值;针对第一外参矩阵的第一误差值进行均值滤波处理,获得第二外参矩阵;根据第二外参矩阵对第一外参矩阵进行更新,以完成对图像的消抖。本发明根据所获得的当前帧摄像头的第一外参矩阵以及对应的匹配成功的第一特征点对,获得第一外参矩阵的第一误差值,并对第一误差值进行均值滤波处理,确保AR成像过程中所有的外参矩阵趋于均值,消除AR效果图的抖动现象,增强AR效果。

Description

图像消抖方法、 装置、 终端及计算机可读存储介质 技术领域
[0001] 本发明涉及电子技术领域, 更具体地说, 涉及一种图像消抖方法、 装置、 终端 及计算机可读存储介质。
背景技术
[0002] 根据增强现实技术 (Augmented Reality, 简称 AR) 的成像原理可知, 图像的匹 配过程一般均需要进行特征点匹配, 以及获得合适的拍摄摄像头的外参矩阵。 拍摄摄像头的外参矩阵是一个变换函数, 其表示的是标志物图像与摄像头拍摄 的图像之间的匹配特征点的坐标对应关系, 即拍摄标志物图像的摄像头在空间 中如何通过平移和旋转, 可以拍摄到当前采集到的标志物图像状态。
[0003] 现有的 AR效果图像, 在获取对应的外参矩阵吋, 由于在获取外参矩阵的过程 中, 所进行的特征点匹配的准确性不稳定以及每一帧所计算得到的外参矩阵并 非绝对为最优解, 导致即使摄像头对着标志物不动, 所计算出来的外参矩阵也 会不断变化, 从而导致最终 AR成像吋所得到的 AR效果图存在不同程度的抖动现 象, 降低了 AR效果。
技术问题
[0004] 本发明要解决的技术问题在于, 针对现有技术的上述缺陷, 提供一种图像消抖 方法、 装置、 终端及计算机可读存储介质。
问题的解决方案
技术解决方案
[0005] 本发明解决其技术问题所采用的技术方案是: 构造一种图像消抖方法, 包括以 下步骤:
[0006] S10: 获取当前帧摄像头的第一外参矩阵以及与所述第一外参矩阵对应的匹配 成功的第一特征点对;
[0007] S20: 根据所述第一特征点对与所述第一外参矩阵, 结合摄像头的内参矩阵, 获得所述第一外参矩阵的第一误差值; [0008] S30: 针对所述第一外参矩阵的第一误差值进行均值滤波处理, 获得第二外参 矩阵;
[0009] S40: 根据所述第二外参矩阵对所述第一外参矩阵进行更新, 以完成对图像的 消抖。
[0010] 本发明还提供一种图像消抖装置, 包括:
[0011] 获取单元, 用于获取当前帧摄像头的第一外参矩阵以及与所述第一外参矩阵对 应的匹配成功的第一特征点对;
[0012] 计算单元, 用于根据所述第一特征点对与所述第一外参矩阵, 结合摄像头的内 参矩阵, 获得所述第一外参矩阵的第一误差值;
[0013] 滤波单元, 用于针对所述第一外参矩阵的第一误差值进行均值滤波处理, 获得 第二外参矩阵;
[0014] 更新单元, 用于根据所述第二外参矩阵对所述第一外参矩阵进行更新, 以完成 对图像的消抖。
[0015] 本发明还提供一种实现增强现实的方法, 包括前述图像消抖方法。
[0016] 本发明还提供一种终端, 该终端包括用于执行上述图像消抖方法的单元。
[0017] 本发明还提供一种实现增强现实的终端, 包括处理器、 输入设备、 输出设备和 存储器, 所述处理器、 输入设备、 输出设备和存储器相互连接, 其中, 所述存 储器用于存储计算机程序, 所述计算机程序包括程序指令, 所述处理器被配置 用于调用所述程序指令, 执行前述的图像消抖方法。
[0018] 本发明还提供一种计算机可读存储介质, 所述计算机可读存储介质存储有计算 机程序, 所述计算机程序包括程序指令, 所述程序指令当被处理器执行吋使所 述处理器执行前述的图像消抖方法。
发明的有益效果
有益效果
[0019] 本发明根据所获得的当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应的 匹配成功的第一特征点对, 获得第一外参矩阵的第一误差值, 并对第一误差值 进行均值滤波处理, 使得经过均值滤波处理后的第一外参矩阵趋于均值, 即使 每一帧得到的摄像头的外参矩阵均趋于均值, 确保 AR成像过程中所需的外参矩 阵更接近, 进而消除了 AR效果图的抖动现象, 增强了 AR效果。
对附图的简要说明
附图说明
[0020] 下面将结合附图及实施例对本发明作进一步说明, 附图中:
[0021] 图 1是外参矩阵获取的具体计算过程及 AR成像的示意图;
[0022] 图 2是本发明图像消抖方法实施例一的流程示意图;
[0023] 图 3是本发明图像消抖装置实施例一的结构示意图;
[0024] 图 4是本发明摄像头外参矩阵误差分析示意图;
[0025] 图 5是本发明特征点匹配结果示意图;
[0026] 图 6是本发明一种终端实施例的示意性框图;
[0027] 图 7是本发明一种实现增强现实的终端的示意性框图。
实施该发明的最佳实施例
本发明的最佳实施方式
[0028] 为了对本发明的技术特征、 目的和效果有更加清楚的理解, 现对照附图详细说 明本发明的具体实施方式。
[0029] 图 1为摄像头外参矩阵获取的具体计算过程及 AR成像流程图, 如图 1所示:
[0030] 第一步: 输入摄像头的内参矩阵, 内参矩阵描述了摄像头的各种自身参数, 如 横、 纵像素数量; 摄像头的横、 纵归一化焦距等。 通过对摄像头做预先设定得 到, 或者通过读取摄像头参数信息 (像素、 焦距等) 直接计算得到。
[0031] 第二步: 输入标志物图像。 标志物图像为用于后续获取 AR效果图所需的图像 。 其中, 标志物图像为预先存储在存储器中的标志物图像, 可以是从图像库中 直接调用的图像, 也可以是通过现场拍摄得到并保存在存储器中的实拍图像。 在标志物图像和摄像头图像中提取特征点和特征点匹配的过程。
[0032] 第三步至第六步为在标志物图像和摄像头图像中提取特征点和特征点匹配的过 程。
[0033] 第七步: 使用匹配的特征点和内参矩阵, 计算摄像头的外参矩阵。 可以理解地 , 该步骤的实质是, 通过两幅图像 (标志物图像和摄像头图像) 的匹配的特征 点的坐标的对应关第, 寻找一个变换函数, 来描述这个对应关系。 即拍摄标志 物图像的摄像头, 在空间中如何通过平移和旋转, 可以拍摄到当前采集到的标 志物图像状态, 这个函数使用矩阵的方式描述, 即为外参矩阵。
[0034] 第八步: 根据第八步获得的外参矩阵和内参矩阵进行 CG绘图, 即代表摄像头 模型的内参矩阵, 代表摄像头位置姿态变换的外参矩阵, 在 3D模型空间中进行 建模, 得到当前位置下摄像头在 3D模型空间的拍摄图像, 最后将 3D模型空间计 算出的图像和现实摄像头拍摄的图像叠加, 获得 AR效果图像。
[0035] 可以理解地, 上述外参矩阵的获得流程为一帧图像的处理过程, 其中, 每一帧 在获得外参矩阵后, 都将所获得的外参矩阵保存在数据库中, 同吋将与该帧对 应的匹配成功的特征点对也保存在数据库中。
[0036] 上述即为基于标志物的 AR的基本原理, 由于第六步特征点匹配的准确性不稳 定和第七步计算的外参矩阵不能总得到最优解, 即第七步计算得到的外参矩阵 经常会是一个误差不大的估计。 因此, 即使摄像头对着标志物不动, 计算出来 的外参矩阵也会不断变化, 体现在 CG动画上就是会不断抖动。
[0037] 为了解决上述问题, 本发明提出了一种图像消抖方法。 参阅图 2, 图 2是本发明 图像消抖方法实施例一的流程示意图。 本实施例中的图像消抖方法的执行主体 可以为终端。 其中, 终端可以为手机、 平板电脑等移动终端, 但并不限于此, 还可以为其他终端。
[0038] 如图 2所示, 本实施例的图像消抖方法可以包括以下步骤:
[0039] S10: 获取当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应的匹配成功 的第一特征点对。
[0040] 在本实施例中, 本发明的当前帧至少为第二帧, 即在执行本发明前需确保所处 理的图像帧至少是从第二帧幵始的。 其中, 当前帧摄像头的第一外参矩阵可通 过前述基于标志物图像的特征点匹配计算处理得到, 同吋提取在当前帧第一外 参矩阵的计算过程中所使用的匹配成功的特征点对, 即第一特征点对。 具体实 施过程中, 在获取当前帧摄像头的第一外参矩阵后, 即可对应提取出与第一外 参矩阵对应的匹配成功的第一特征点对。
[0041] 其中, 第一特征点对包括标志物图像的第一匹配特征点集和摄像头图像的第二 匹配特征点集; 其中, 第一匹配特征点集中的每一个标志物匹配点与第二匹配 特征点集中的一个图像匹配点匹配。
[0042] 如图 5所示, 图 5中, 每一条直线的两端代表一个特征点对。 其中, 每一帧所获 得的摄像头图像的外参矩阵均对应一个匹配成功的特征点对集合, 且每一个匹 配成功的特征点对集合由 2个特征点集合组成, 一个来自标志物图像的第一匹配 特征点集, 一个来自当前摄像头采集的摄像头图像的第二匹配特征点集, 其中 , 两个匹配特征点集中的特征点一一对应匹配, 即标志物图像中每一个标志物 匹配点与摄像图像中的一个图像匹配点匹配, 这两个匹配点形成一个特征点对
[0043] S20: 根据第一特征点对与第一外参矩阵, 结合摄像头的内参矩阵, 获得第一 外参矩阵的第一误差值。
[0044] 具体地, 步骤 20包括:
[0045] A: 获取第一匹配特征点集和第二匹配特征点集。
[0046] 终端在获取到与当前帧摄像头的第一外参矩阵对应的第一特征点对后, 可以直 接从第一特征点对中提取标志物图像的第一匹配特征点集和当前摄像头图像的 第二匹配特征点集。
[0047] B: 利用第一外参矩阵、 摄像头的内参矩阵、 以及第一匹配特征点集和第二匹 配特征点集, 获得第一匹配特征点集中每一个标志物匹配点在当前帧摄像头图 像中的计算坐标和匹配坐标。
[0048] 在本实施例中, 步骤 B进一步包括:
[0049] B11 : 利用第一外参矩阵和摄像头的内参矩阵, 计算第一匹配特征点集中的每 一个标志物匹配点在当前帧摄像头图像中的坐标位置, 根据坐标位置确定每一 个标志物匹配点的计算坐标;
[0050] B12: 根据第二匹配特征点集, 确定第一匹配特征点集中的每一个标志物匹配 点在当前帧摄像头图像中的匹配坐标。
[0051] 摄像头的内参矩阵可由终端在需要使用吋直接从数据库中调用。 在获得第一匹 配特征点集后, 根据所获得的当前帧摄像头的第一外参矩阵, 以及从数据库中 调用的摄像头的内参矩阵, 可以计算出第一匹配特征点集中的每一个标志物匹 配点在当前帧摄像头图像中的坐标位置, 该坐标位置即为标志物匹配点的计算 坐标。 换言之, 通过第一外参矩阵和内参矩阵, 计算出第一匹配特征点集中, 标志物图像的每一个标志物匹配点在当前帧摄像头图像中的计算坐标。
[0052] 如图 4所示, 图 4中, 左侧的图像为标志物图像, 右侧的图像为当前帧摄像头图 像。 其中, 标志物图像中的 1、 2、 3、 4为第一匹配特征点集中的四个标志物匹 配点, 其中, 1'、 2'、 3'、 4'为标志物匹配点 1、 2、 3、 4在当前帧摄像头图像中 的匹配坐标位置; 1"、 2"、 3"、 4"为利用所获得的第一外参矩阵进行计算得到的 标志物匹配点 1、 2、 3、 4在当前帧摄像头图像中的计算坐标位置。 换言之, 标 志物图像中的一个标志物匹配点在当前帧摄像头图像中对应有两个特征点, 一 个是匹配成功的特征点, 一个是计算得到的特征点, 其中, 匹配成功的特征点 为第二匹配特征点集中的当前帧摄像头图像中与第一匹配特征点集中的标志物 匹配点匹配的图像匹配点。
[0053] 因此, 通过第一外参矩阵和内参矩阵, 可以确定每一个标志物匹配点在当前帧 摄像头图像中的计算坐标; 以及通过第二匹配特征点集, 可以确定第一匹配特 征点集中的每一个标志物匹配点在当前帧摄像头图像中的匹配坐标。 即如图 4所 示, 可以分别确定点 1'、 2'、 3'、 4'的匹配坐标和点 、 2〃、 3"、 4"的计算坐标。
[0054] C: 根据每一个标志物匹配点在当前摄像头图像中的计算坐标和匹配坐标, 获 得每一个标志物匹配点的计算坐标与匹配坐标之间的误差距离。
[0055] 具体地, 如图 4所示, 在分别确定点 、 2'、 3'、 4'的匹配坐标和点 、 2〃、 3"、
4"计算坐标后, 分别计算点 与点 这两个坐标之间的距离 dl, 点 2"与点 2'这两 个坐标之间的距离 d2, 点 3"与点 3'这两个坐标之间的距离 d3, 点 4"与点 4'这两个 坐标之间的距离 d4。
[0056] D: 对所获得的所有标志物匹配点的计算坐标与匹配坐标之间的误差距离进行 处理, 获得平均误差距离, 平均误差距离作为第一外参矩阵的第一误差值。
[0057] 在获得所有标志物匹配点的计算坐标与匹配坐标之间的误差距离后, 进行计算 , 取得平均误差距离, 即将误差距离累加求和, 再除以所使用的标志物匹配点 的点数, 求得误差距离的平均值, 该误差距离的平均值为平均误差距离, 其中 , 该平均误差距离作为第一外参矩阵的第一误差值。 可以理解地, 平均误差距 离可以用来判断第一外参矩阵的准确度。 外参矩阵是利用匹配成功的特征点对 计算出来的数学模型, 因此, 本实施例通过利用第一外参矩阵反过来验证特征 点的匹配结果吋, 所计算出来的结果理应与匹配结果一致, 对应所获得的平均 误差距离也就会非常小。 所以本实施例中, 通过将利用第一外参矩阵计算出来 的平均误差距离, 作为第一外参矩阵的第一误差值, 以实现对第一外参矩阵的 准确度的评估。
[0058] S30: 针对第一外参矩阵的第一误差值进行均值滤波处理, 获得第二外参矩阵
[0059] 可以理解地, 在执行步骤 S30之前可以先对第一外参矩阵进行相应的处理, 例 如, 将第一外参矩阵转换为可进行线性旋转变化的数学模型, 即将第一外参矩 阵转换为可以描述线性的旋转变换的数学模型或者近似线性的旋转变换的数学 模型。 第一外参矩阵为摄像头的旋转姿态以及平移的数学模型, 但是, 第一外 参矩阵所表示的数学模型中的旋转姿态中的旋转角以及平移量不是线性相关的 , 若要对第一外参矩阵的第一误差值进行均值滤波处理, 则需将第一外参矩阵 转换为对应的可进行线性旋转变化的数学模型。 其中, 可进行线性旋转变化的 数学模型可以为欧拉角和平移向量, 也可以为四元数和平移向量。 本实施例中 , 优选四元数和平移向量。
[0060] 可选的, 对第一外参矩阵的第一误差值进行均值滤波处理可采用加权平均法实 现。 加权平均法, 就是利用过去若干个按照吋间顺序排列起来的同一变量的观 测值并以吋间顺序数为权数, 计算出观测值的加权算术平均数, 以这一数字作 为预测未来期间该变量预测值的一种趋势预测法。
[0061] 换言之, 本实施例对第一外参矩阵的第一误差值进行均值滤波处理, 可以通过 将第一外参矩阵转换为四元数和平移向量后, 分别对四元数和平移向量进行加 权平均, 获得四元数的加权平均值和平移向量的加权平均值, 所获得的四元数 的加权平均值和平移向量的加权平均值即为第一外参矩阵的第一误差值进行均 值滤波处理后的结果, 最终将所获得的四元数的加权平均值和平移向量的加权 平均值再次转换回矩阵的形式, 即可获得第二外参矩阵。
[0062] 具体地, 在本实施例, 将第一外参矩阵转换为第一四元数和第一平移向量。 转 换方法与现有普通变换矩阵转换为四元数和平移向量的方法相同, 其中, 四元 数是用四个数表示的向量, 表示摄像头的旋转姿态; 平移向量代表摄像头在 X
Υ Ζ轴正方向上平移的距离。
[0063] 第一外参矩阵转换为第一四元数和第一平移向量的具体转换如下:
!、,
[0064]
1 H 2
i
Figure imgf000010_0001
狻转凝摔
Figure imgf000010_0002
Figure imgf000010_0003
[0065] 其中对第一外参矩阵的均值滤波处理的具体步骤如下:
[0066] 即在本实施例中, 步骤 S30包括:
[0067] S301 : 根据预设滤波器长度, 分别获取摄像头的 N个历史误差值。
[0068] 预设滤波器的长度可以根据 AR图像中实际抖动帧进行确定, 例如, 若 AR图像 中实际抖动帧为 5帧, 则预设滤波器的长度为 5, 此吋, 所需获取的摄像头的历 史误差值为 5个, 即获取当前帧的前连续 5帧的历史误差值, 其中, 前连续 5帧的 历史误差值均预先保存在数据库中, 获取吋可直接从数据库中调用。 可以理解 地, 这里所指的历史误差值为历史帧所计算出的摄像头外参矩阵的误差值。
[0069] S302: 对 N个历史误差值分别进行权值处理, 获得每一个历史误差值对应的历 史权值; 同吋对第一外参矩阵的第一误差值进行权值处理, 获得第一外参矩阵 的第一权值。
[0070] 在获得 N帧连续帧对应的 N个历史误差值后, 分别计算这 N个历史误差值的倒数 , 每一个历史误差值的倒数为其历史权值, 即获得每一个历史误差值对应的历 史权值。 同吋对第一外参矩阵的第一误差值进行权值处理, 即计算第一误差值 的倒数, 该第一误差值的倒数为第一外参矩阵的第一权值。
[0071] S303: 对第一权值和所获得的所有历史权值进行归一化处理, 获得归一化权值
[0072] 具体地, 首先, 将第一权值和所有历史权值 (即 N个历史权值) 累加求和, 获 得权值累加和, 计算该累加和的倒数, 获得累加权值。 接着, 将第一权值乘以 累加权值, 同吋将每一个历史权值分别乘一累加权值, 即完成归一处理, 获得 归一化权值。
[0073] 可以理解地, 对权值进行归一化处理的目的是为了缩放权值, 使这些权值和为
1, 以避免出现数值越算越大或越算越小的错误。
[0074] 例如, 两个数 al、 a2算加权平均, al*0.5+a2*0.5或者 al*0.1+a2*0.9来计算是合 理的, 但是 al*0.6+a2*0.6就会让结果算得比 al、 a2中较大的值还要大, 这是不合 理的。 因此, 本实施例中, 先对所有权值进行归一化处理, 以提高计算的准确 度及效率。
[0075] S304: 根据归一化权值, 分别对第一四元数和第一平移向量进行加权平均处理 , 获得第一四元数的加权平均值和第一平移向量的加权平均值。
[0076] 具体地, 本实施例中, 对第一平移向量进行加权平均处理, 就是将平移向量的 各个值与步骤 S303中获得的归一化权值进行加权平均, 获得第一平移向量的加 权平均值, 该第一平移向量的加权平均值即为新的平移向量, 即经过滤波处理 后的所得到的第二平移向量。
[0077] 本实施例中, 根据归一化权值, 对第一四元数进行加权平均处理可以利用球面 线性插值法, 对第一四元数进行加权平均。 以下为球面插值公式, p、 q为用于 插值的四元数, t为 q的归一化权值 (所以 p的权值为 1-t) , Θ为向量 p、 q的夹角 用向量夹角公式 cose=p.q/(lpl*lql)可以求得。
[]
Figure imgf000012_0001
[0078] 由上述公式可以看出, 在对四元数进行加权平均吋, 只能用于求 2个四元数的 加权平均, 但是本实施例需要求多个四元数的加权平均, 因此, 需要 2个 2个逐 步求加权平均。
[0079] 例如, 假设有 q0、 ql到 qn多个四元数, 它们的权值分别为 t0、 tl到 tn。 首先取 最前面 2个四元数假设为 q0、 ql , 它们的权值 (使用上面提到的归一化权值等效 , 因为上面提到的归一化权值为总体的归一化, 这里依然需要两两归一化计算 ) 为 t0、 tl。 对 t0、 tl , 进行归一化处理, 使之和为 1, 记为 t0'、 tl'。 将 q0、 ql、 t0'、 tl'带入公式算出新的四元数, 设为 w, 计算 w的权值 tw= t0+tl。 之后使用 w 和接下来的四元数 q2使用同样的方法计算加权平均, 计算新的 w和 tw。 接下来 q3 到 qn依次重复此操作。 最后得到的 w就是最终的四元数的加权平均值。
[0080] S305: 将第一四元数的加权平均值作为第二四元数, 第一平移向量的加权平均 值作为第二平移向量。
[0081] S306: 将第二四元数和第二平移向量进行矩阵变换, 获得第二外参矩阵。 可以 理解地, 第二外参矩阵即为经过均值滤波处理的外参矩阵。
[0082] S40: 根据第二外参矩阵对第一外参矩阵进行更新, 以完成对图像的消抖。
[0083] 在本实施例中, 在获得第二外参矩阵后, 将第一外参矩阵替换为第二外参矩阵 并保存, 且在后续的获取 AR图像的过程中, 直接取第二外参矩阵进行建模。 通 过采用经过均值滤波处理后的得到的第二外参矩阵, 可有效消除 AR图像中的抖 动现象。
[0084] 本发明还提供一种图像消抖装置, 如图 3所示, 该图像消抖装置可以包括: 获 取单元 31、 计算单元 32、 滤波单元 33以及更新单元 34。
[0085] 获取单元 31, 用于获取当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应 的匹配成功的第一特征点对;
[0086] 计算单元 32, 用于根据第一特征点对与第一外参矩阵, 结合摄像头的内参矩阵
, 获得第一外参矩阵的第一误差值;
[0087] 滤波单元 33, 用于针对第一外参矩阵的第一误差值进行均值滤波处理, 获得第 二外参矩阵;
[0088] 更新单元 34, 用于根据第二外参矩阵对第一外参矩阵进行更新, 以完成对图像 的消抖。
[0089] 本发明还提供一种实现增强现实的方法, 该实现增强现实的方法可以前述的图 像消抖方法。
[0090] 优选地, 本实施例的实现增强现实的方法还包括:
[0091] 根据摄像头的内参矩阵及第二外参矩阵, 在预设的模型中绘制出摄像头当前位 置下的虚拟图形;
[0092] 将所获得的虚拟图形与当前帧摄像头图像进行合成, 得到合成图像。
[0093] 本发明还提供一种终端, 该终端包括用于执行前述任一项的图像消抖方法的单 元。 本实施例的终端可以为智能手机、 平板电脑等移动终端, 也可以为其他终 山
[0094] 具体地, 如图 6所示, 本实施例的终端 600可以包括第一获取单元 601、 第一计 算单元 602、 第一滤波单元 603、 第一更新单元 604及转换单元 605。 其中, 转换 单元 605用于将第一外参矩阵转换为可进行线性旋转变化的数学模型。
[0095] 可选的, 根据该可进行线性旋转变化的数学模型可以获得第一四元数和第一平 移向量。
[0096] 第一获取单元 601, 用于获取当前帧摄像头的第一外参矩阵以及与第一外参矩 阵对应的匹配成功的第一特征点对; 其中, 第一特征点对包括标志物图像的第 一匹配特征点集和摄像头图像的第二匹配特征点集; 其中, 第一匹配特征点集 中的每一个标志物匹配点与第二匹配特征点集中的一个图像匹配点匹配。
[0097] 可选的, 第一获取单元 601可以包括第一获取模块 6011。
[0098] 第一获取模块 6011, 用于获取摄像头的内参矩阵。
[0099] 第一计算单元 602, 用于根据第一特征点对与第一外参矩阵, 结合摄像头的内 参矩阵, 获得第一外参矩阵的第一误差值。
[0100] 可选的, 第一计算单元 602可以包括提取模块 6021、 坐标获取模块 6022、 第一 计算模块 6023及第二计算模块 6024。
[0101] 提取模块 6021, 用于获取第一匹配特征点集和第二匹配特征点集。
[0102] 坐标获取模块 6022, 用于利用第一外参矩阵、 摄像头的内参矩阵、 以及第一匹 配特征点集和第二匹配特征点集, 获得第一匹配特征点集中每一个标志物匹配 点在当前帧摄像头图像中的计算坐标和匹配坐标。
[0103] 坐标获取模块 6022, 还用于利用第一外参矩阵和摄像头的内参矩阵, 计算第一 匹配特征点集中的每一个标志物匹配点在当前帧摄像头图像中的坐标位置, 根 据坐标位置确定每一个标志物匹配点的计算坐标。 同吋, 根据第二匹配特征点 集, 确定第一匹配特征点集中的每一个标志物匹配点在当前帧摄像头图像中的 匹配坐标。
[0104] 第一计算模块 6023, 用于根据每一个标志物匹配点在当前摄像头图像中的计算 坐标和匹配坐标, 获得每一个标志物匹配点的计算坐标与匹配坐标之间的误差 距离。
[0105] 第二计算模块 6024, 用于对所获得的所有标志物匹配点的计算坐标与匹配坐标 之间的误差距离进行处理, 获得平均误差距离, 平均误差距离作为第一外参矩 阵的第一误差值。
[0106] 第一滤波单元 603, 用于针对第一外参矩阵的第一误差值进行均值滤波处理, 获得第二外参矩阵。
[0107] 可选的, 第一滤波单元 603可以包括历史误差值计算模块 6031、 权值获取模块 6 032、 归一化处理模块 6033、 加权平均处理模块 6034以及转换模块 6035。
[0108] 历史误差值计算模块 6031, 用于根据预设滤波器长度, 分别获取摄像头的 N个 历史误差值;
[0109] 权值获取模块 6032, 用于对 N个历史误差值分别进行权值处理, 获得每一个历 史误差值对应的历史权值; 同吋对第一外参矩阵的第一误差值进行权值处理, 获得第一外参矩阵的第一权值;
[0110] 归一化处理模块 6033, 用于对第一权值和所获得的所有历史权值进行归一化处 理, 获得归一化权值。
[0111] 加权平均处理模块 6034, 用于根据归一化权值, 分别对第一四元数和第一平移 向量进行加权平均处理, 获得第一四元数的加权平均值和第一平移向量的加权 平均值; 并将第一四元数的加权平均值作为第二四元数, 第一平移向量的加权 平均值作为第二平移向量;
[0112] 转换模块 6035, 用于将第二四元数和第二平移向量进行矩阵变换, 获得第二外 参矩阵。
[0113] 第一更新单元 604, 用于根据第二外参矩阵对第一外参矩阵进行更新, 以完成 对图像的消抖。
[0114] 如上, 终端获取当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应的匹配 成功的第一特征点对; 根据第一特征点对与第一外参矩阵, 结合摄像头的内参 矩阵, 获得第一外参矩阵的第一误差值; 针对第一外参矩阵的第一误差值进行 均值滤波处理, 获得第二外参矩阵; 根据第二外参矩阵对第一外参矩阵进行更 新, 以完成对图像的消抖。 由于根据所获得的当前帧摄像头的第一外参矩阵以 及与第一外参矩阵对应的匹配成功的第一特征点对, 获得第一外参矩阵的第一 误差值, 并对第一误差值进行均值滤波处理, 使得经过均值滤波处理后的第一 外参矩阵趋于均值, 即使每一帧得到的摄像头的外参矩阵均趋于均值, 确保 AR 成像过程中所需的外参矩阵更接近, 进而消除了 AR效果图的抖动现象, 增强了 AR效果。
[0115] 本发明还提供了一种实现增强现实的终端。
[0116] 如图 7所示, 该实施例的实现增强现实的终端 700可以包括: 一个或多个处理器 701、 一个或多个输入设备 702、 一个或多个输出设备 703以及一个或多个存储器 704。 上述处理器 701、 输入设备 702、 输出设备 703和存储器 704通过通信总线 70 5完成相互之间的通信。
[0117] 存储器 704用于存储计算机程序, 计算机程序包括程序指令。
[0118] 处理器 701被配置用于调用程序指令, 执行以下操作:
[0119] 获取当前帧摄像头的第一外参矩阵以及与第一外参矩阵对应的匹配成功的第一 特征点对; 其中, 第一特征点对包括标志物图像的第一匹配特征点集和摄像头 图像的第二匹配特征点集; 其中, 第一匹配特征点集中的每一个标志物匹配点 与第二匹配特征点集中的一个图像匹配点匹配。
[0120] 根据第一特征点对与第一外参矩阵, 结合摄像头的内参矩阵, 获得第一外参矩 阵的第一误差值;
[0121] 针对第一外参矩阵的第一误差值进行均值滤波处理, 获得第二外参矩阵; [0122] 根据第二外参矩阵对第一外参矩阵进行更新, 以完成对图像的消抖。
[0123] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0124] 获取第一匹配特征点集和第二匹配特征点集;
[0125] 利用第一外参矩阵、 摄像头的内参矩阵、 以及第一匹配特征点集和第二匹配特 征点集, 获得第一匹配特征点集中每一个标志物匹配点在当前帧摄像头图像中 的计算坐标和匹配坐标;
[0126] 根据每一个标志物匹配点在当前摄像头图像中的计算坐标和匹配坐标, 获得每 一个标志物匹配点的计算坐标与匹配坐标之间的误差距离;
[0127] 对所获得的所有标志物匹配点的计算坐标与匹配坐标之间的误差距离进行处理
, 获得平均误差距离, 平均误差距离作为第一外参矩阵的第一误差值。
[0128] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0129] 利用第一外参矩阵和摄像头的内参矩阵, 计算第一匹配特征点集中的每一个标 志物匹配点在当前帧摄像头图像中的坐标位置, 根据坐标位置确定每一个标志 物匹配点的计算坐标;
[0130] 根据第二匹配特征点集, 确定第一匹配特征点集中的每一个标志物匹配点在当 前帧摄像头图像中的匹配坐标。
[0131] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0132] 获取摄像头的内参矩阵。
[0133] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0134] 根据预设滤波器长度, 分别获取摄像头的 N个历史误差值;
[0135] 对 N个历史误差值分别进行权值处理, 获得每一个历史误差值对应的历史权值
; 同吋对第一外参矩阵的第一误差值进行权值处理, 获得第一外参矩阵的第一 权值; [0136] 对第一权值和所获得的所有历史权值进行归一化处理, 获得归一化权值。
[0137] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0138] 将第一外参矩阵转换为可进行线性旋转变化的数学模型, 根据所述数学模型获 得第一四元数和第一平移向量。
[0139] 进一步的, 处理器 701具体被配置用于调用程序指令执行以下操作:
[0140] 根据归一化权值, 分别对第一四元数和第一平移向量进行加权平均处理, 获得 第一四元数的加权平均值和第一平移向量的加权平均值; 其中, 对第一四元数 进行加权平均可以利用球面线性插值法。
[0141] 将第一四元数的加权平均值作为第二四元数, 第一平移向量的加权平均值作为 第二平移向量;
[0142] 将第二四元数和第二平移向量进行矩阵变换, 获得第二外参矩阵。
[0143] 可以理解地, 在本发明的实施例中, 处理器 701可以是中央处理单元(Central Processing Unit, CPU) , 还可以是其他通用处理器、 数字信号处理器(Digital Signal Processor, DSP)、 专用集成电路 (Application Specific Integrated
Circuit, ASIC)、 现成可编程门阵列(Field-Programmable Gate Array, FPGA)或 者其他可编程逻辑器件、 晶体管逻辑器件、 分立硬件组件等。 通用处理器可以 是微处理器或者该处理器也可以是任何常规的处理器等。
[0144] 输入设备 702可以包括触控板、 指纹采传感器 (用于采集用户的指纹信息和指 纹的方向信息) 、 麦克风、 按键等。 输出设备 703可以包括显示器 (LCD、 TFT- LCD、 0LED、 PM0LED、 AMOLED等) 、 扬声器、 闪光灯等。
[0145] 存储器 704可以包括只读存储器和随机存取存储器, 并向处理器 701提供指令和 数据。 存储器 704的一部分还可以包括非易失性随机存取存储器。 例如, 存储器 704还可以存储设备类型的信息。
[0146] 具体实现中, 本发明实施例中所描述的处理器 701、 输入设备 702、 输出设备 70 3可执行本发明实施例提供的图像消抖方法的实施例一中所描述的实现方式, 也 可执行本发明实施例所描述的终端的实现方式, 在此不再赘述。
[0147] 本发明还提供一种计算机可读存储介质, 所述计算机可读存储介质存储有计算 机程序, 所述计算机程序包括程序指令, 所述程序指令当被处理器执行吋使所 述处理器执行实现上述实施例的图像消抖方法的步骤。
[0148] 计算机可读存储介质可以是前述任一实施例所述的终端的内部存储单元, 例如 终端的硬盘或内存。 该计算机可读存储介质也可以是所述终端的外部存储设备 , 例如所述终端上配备的插接式硬盘, 智能存储卡 (Smart Media Card, SMC) , 安全数字 (Secure Digital, SD) 卡, 闪存卡 (Flash Card) 等。
[0149] 进一步地, 计算机可读存储介质还可以既包括所述终端的内部存储单元也包括 外部存储设备。 计算机可读存储介质用于存储计算机程序及终端所需的其他程 序和数据。 计算机可读存储介质还可以用于暂吋地存储已经输出或者将要输出 的数据。
[0150] 以上实施例只为说明本发明的技术构思及特点, 其目的在于让熟悉此项技术的 人士能够了解本发明的内容并据此实施, 并不能限制本发明的保护范围。 凡跟 本发明权利要求范围所做的均等变化与修饰, 均应属于本发明权利要求的涵盖 范围。
[0151] 应当理解的是, 对本领域普通技术人员来说, 可以根据上述说明加以改进或变 换, 而所有这些改进和变换都应属于本发明所附权利要求的保护范围。

Claims

权利要求书
[权利要求 1] 一种图像消抖方法, 其特征在于, 包括以下步骤:
S10: 获取当前帧摄像头的第一外参矩阵以及与所述第一外参矩阵对 应的匹配成功的第一特征点对;
S20: 根据所述第一特征点对与所述第一外参矩阵, 结合摄像头的内 参矩阵, 获得所述第一外参矩阵的第一误差值;
S30: 针对所述第一外参矩阵的第一误差值进行均值滤波处理, 获得 第二外参矩阵;
S40: 根据所述第二外参矩阵对所述第一外参矩阵进行更新, 以完成 对图像的消抖。
[权利要求 2] 根据权利要求 1所述的图像消抖方法, 其特征在于, 所述第一特征点 对包括标志物图像的第一匹配特征点集和摄像头图像的第二匹配特征 点集; 其中, 所述第一匹配特征点集中的每一个标志物匹配点与所述 第二匹配特征点集中的一个图像匹配点匹配。
[权利要求 3] 根据权利要求 2所述的图像消抖方法, 其特征在于, 所述步骤 S20包括
A: 获取所述第一匹配特征点集和第二匹配特征点集;
B: 利用所述第一外参矩阵、 摄像头的内参矩阵、 以及所述第一匹配 特征点集和第二匹配特征点集, 获得所述第一匹配特征点集中每一个 标志物匹配点在当前帧摄像头图像中的计算坐标和匹配坐标;
C: 根据所述每一个标志物匹配点在当前摄像头图像中的计算坐标和 匹配坐标, 获得所述每一个标志物匹配点的计算坐标与匹配坐标之间 的误差距离;
D: 对所获得的所有标志物匹配点的计算坐标与匹配坐标之间的误差 距离进行处理, 获得平均误差距离, 所述平均误差距离作为所述第一 外参矩阵的第一误差值。
[权利要求 4] 根据权利要求 3所述的图像消抖方法, 其特征在于, 所述步骤 B包括 Bl l : 利用所述第一外参矩阵和摄像头的内参矩阵, 计算所述第一匹 配特征点集中的每一个标志物匹配点在当前帧摄像头图像中的坐标位 置, 根据所述坐标位置确定所述每一个标志物匹配点的计算坐标; B12: 根据所述第二匹配特征点集, 确定所述第一匹配特征点集中的 每一个标志物匹配点在当前帧摄像头图像中的匹配坐标。
[权利要求 5] 根据权利要求 1所述的图像消抖方法, 其特征在于, 在所述步骤 S20之 前进一步包括:
获取所述摄像头的内参矩阵。
[权利要求 6] 根据权利要求 1所述的图像消抖方法, 其特征在于, 所述步骤 S30包括
S301 : 根据预设滤波器长度, 分别获取所述摄像头的 N个历史误差值
S302: 对所述 N个历史误差值分别进行权值处理, 获得每一个历史误 差值对应的历史权值; 同吋对所述第一外参矩阵的第一误差值进行权 值处理, 获得所述第一外参矩阵的第一权值;
S303: 对所述第一权值和所获得的所有历史权值进行归一化处理, 获 得归一化权值。
[权利要求 7] 根据权利要求 6所述的图像消抖方法, 其特征在于, 所述步骤 S301之 前还包括:
将所述第一外参矩阵转换为可进行线性旋转变化的数学模型。
[权利要求 8] 根据权利要求 7所述的图像消抖方法, 其特征在于, 所述方法还包括
: 根据所述数学模型获得第一四元数及第一平移向量。
[权利要求 9] 根据权利要求 8所述的图像消抖方法, 其特征在于, 所述步骤 S30进一 步包括:
S304: 根据所述归一化权值, 分别对所述第一四元数和第一平移向量 进行加权平均处理, 获得所述第一四元数的加权平均值和所述第一平 移向量的加权平均值;
S305: 将所述第一四元数的加权平均值作为第二四元数, 所述第一平 移向量的加权平均值作为第二平移向量;
S306: 将所述第二四元数和第二平移向量进行矩阵变换, 获得所述第 二外参矩阵。
根据权利要求 9所述的图像消抖方法, 其特征在于, 所述根据所述归 一化权值, 对所述第一四元数进行加权平均处理包括:
根据所述归一化权值, 利用球面线性插值法, 对所述第一四元数进行 加权平均。
一种图像消抖装置, 其特征在于, 包括:
获取单元, 用于获取当前帧摄像头的第一外参矩阵以及与所述第一外 参矩阵对应的匹配成功的第一特征点对;
计算单元, 用于根据所述第一特征点对与所述第一外参矩阵, 结合摄 像头的内参矩阵, 获得所述第一外参矩阵的第一误差值;
滤波单元, 用于针对所述第一外参矩阵的第一误差值进行均值滤波处 理, 获得第二外参矩阵;
更新单元, 用于根据所述第二外参矩阵对所述第一外参矩阵进行更新 , 以完成对图像的消抖。
一种实现增强现实的方法, 其特征在于, 包括权利要求 1-10任一项所 述的图像消抖方法。
根据权利要求 12所述的实现增强现实的方法, 其特征在于, 还包括: 根据摄像头的内参矩阵及第二外参矩阵, 在预设的模型中绘制出摄像 头当前位置下的虚拟图形;
将所获得的虚拟图形与当前帧摄像头图像进行合成, 得到合成图像。 一种终端, 其特征在于, 包括用于执行如权利要求 1-10任一项权利要 求所述的方法的单元。
一种实现增强现实的终端, 其特征在于, 包括处理器、 输入设备、 输 出设备和存储器, 所述处理器、 输入设备、 输出设备和存储器相互连 接, 其中, 所述存储器用于存储计算机程序, 所述计算机程序包括程 序指令, 所述处理器被配置用于调用所述程序指令, 执行如权利要求 1-10任一项所述的方法。
[权利要求 16] —种计算机可读存储介质, 其特征在于, 所述计算机可读存储介质存 储有计算机程序, 所述计算机程序包括程序指令, 所述程序指令当被 处理器执行吋使所述处理器执行如权利要求 1-10任一项所述的方法。
PCT/CN2017/109415 2017-11-03 2017-11-03 图像消抖方法、装置、终端及计算机可读存储介质 WO2019084933A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/109415 WO2019084933A1 (zh) 2017-11-03 2017-11-03 图像消抖方法、装置、终端及计算机可读存储介质
CN201780096060.XA CN111345023B (zh) 2017-11-03 2017-11-03 图像消抖方法、装置、终端及计算机可读存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/109415 WO2019084933A1 (zh) 2017-11-03 2017-11-03 图像消抖方法、装置、终端及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019084933A1 true WO2019084933A1 (zh) 2019-05-09

Family

ID=66331274

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/109415 WO2019084933A1 (zh) 2017-11-03 2017-11-03 图像消抖方法、装置、终端及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN111345023B (zh)
WO (1) WO2019084933A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2169589A2 (en) * 2008-09-30 2010-03-31 Mazda Motor Corporation Image processing device for vehicle and corresponding method and computer program product
CN102256061A (zh) * 2011-07-29 2011-11-23 武汉大学 一种二维三维混合的视频稳定方法
CN102780846A (zh) * 2012-07-11 2012-11-14 清华大学 一种基于惯导信息的电子稳像方法
CN103236082A (zh) * 2013-04-27 2013-08-07 南京邮电大学 面向捕获静止场景的二维视频的准三维重建方法
US20150208042A1 (en) * 2011-07-01 2015-07-23 Utc Fire & Security Corporation System and method for auto-commissioning an intelligent video system
CN107241544A (zh) * 2016-03-28 2017-10-10 展讯通信(天津)有限公司 视频稳像方法、装置及摄像终端

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10235747B2 (en) * 2012-03-09 2019-03-19 Disney Enterprises, Inc. System and method for determining the current parameters of a zoomable camera
CN104077596A (zh) * 2014-06-18 2014-10-01 河海大学 一种无标志物跟踪注册方法
CN104715482B (zh) * 2015-03-20 2017-08-11 四川大学 一种ransac计算基本矩阵中内点门限自动设置方法
CN105894499B (zh) * 2016-03-25 2018-09-14 华南理工大学 一种基于双目视觉的空间物体三维信息快速检测方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2169589A2 (en) * 2008-09-30 2010-03-31 Mazda Motor Corporation Image processing device for vehicle and corresponding method and computer program product
US20150208042A1 (en) * 2011-07-01 2015-07-23 Utc Fire & Security Corporation System and method for auto-commissioning an intelligent video system
CN102256061A (zh) * 2011-07-29 2011-11-23 武汉大学 一种二维三维混合的视频稳定方法
CN102780846A (zh) * 2012-07-11 2012-11-14 清华大学 一种基于惯导信息的电子稳像方法
CN103236082A (zh) * 2013-04-27 2013-08-07 南京邮电大学 面向捕获静止场景的二维视频的准三维重建方法
CN107241544A (zh) * 2016-03-28 2017-10-10 展讯通信(天津)有限公司 视频稳像方法、装置及摄像终端

Also Published As

Publication number Publication date
CN111345023A (zh) 2020-06-26
CN111345023B (zh) 2021-07-20

Similar Documents

Publication Publication Date Title
US9607388B2 (en) System and method of pose estimation
WO2019205852A1 (zh) 确定图像捕捉设备的位姿的方法、装置及其存储介质
WO2018119889A1 (zh) 三维场景定位方法和装置
CN110276317B (zh) 一种物体尺寸检测方法、物体尺寸检测装置及移动终端
JP5668091B2 (ja) 3dカメラポーズ推定方法
US9135678B2 (en) Methods and apparatus for interfacing panoramic image stitching with post-processors
WO2021114868A1 (zh) 降噪方法、终端及存储介质
WO2022156755A1 (zh) 一种室内定位方法、装置、设备和计算机可读存储介质
WO2017091927A1 (zh) 图像处理方法和双摄像头系统
WO2021139176A1 (zh) 基于双目摄像机标定的行人轨迹跟踪方法、装置、计算机设备及存储介质
CN112686877B (zh) 基于双目相机的三维房屋损伤模型构建测量方法及系统
CN111127524A (zh) 一种轨迹跟踪与三维重建方法、系统及装置
JP5772825B2 (ja) 画像処理学習装置、画像処理学習方法、および画像処理学習プログラム
CN110728644B (zh) 图像生成方法、装置、电子设备和可读存储介质
CN111583381B (zh) 游戏资源图的渲染方法、装置及电子设备
WO2023005457A1 (zh) 位姿计算方法和装置、电子设备、可读存储介质
CN113256718A (zh) 定位方法和装置、设备及存储介质
CN113298870A (zh) 一种物体的姿态跟踪方法、装置、终端设备和存储介质
CN111882655A (zh) 三维重建的方法、装置、系统、计算机设备和存储介质
CN111862150A (zh) 图像跟踪的方法、装置、ar设备和计算机设备
CN114926316A (zh) 距离测量方法、装置、电子设备及存储介质
CN113610702B (zh) 一种建图方法、装置、电子设备及存储介质
CN113793370B (zh) 三维点云配准方法、装置、电子设备及可读介质
CN115705651A (zh) 视频运动估计方法、装置、设备和计算机可读存储介质
CN113160270A (zh) 视觉地图生成方法、装置、终端及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17930840

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17930840

Country of ref document: EP

Kind code of ref document: A1