OpenCV 4.13.0
開源計算機視覺庫 (Open Source Computer Vision)
正在載入...
正在搜尋...
未找到匹配項
運動分析和物件跟蹤

詳細說明

函式

void cv::accumulate (InputArray src, InputOutputArray dst, InputArray mask=noArray())
 將影像新增到累加器影像中。
 
void cv::accumulateProduct (InputArray src1, InputArray src2, InputOutputArray dst, InputArray mask=noArray())
 將兩個輸入影像的逐元素乘積新增到累加器影像中。
 
void cv::accumulateSquare (InputArray src, InputOutputArray dst, InputArray mask=noArray())
 將源影像的平方新增到累加器影像中。
 
void cv::accumulateWeighted (InputArray src, InputOutputArray dst, double alpha, InputArray mask=noArray())
 更新執行平均值。
 
void cv::createHanningWindow (OutputArray dst, Size winSize, int type)
 該函式計算二維 Hanning 窗係數。
 
void cv::divSpectrums (InputArray a, InputArray b, OutputArray c, int flags, bool conjB=false)
 執行第一個傅立葉頻譜與第二個傅立葉頻譜的逐元素除法。
 
Point2d cv::phaseCorrelate (InputArray src1, InputArray src2, InputArray window=noArray(), double *response=0)
 該函式用於檢測兩幅影像之間發生的平移偏差。
 
Point2d cv::phaseCorrelateIterative (InputArray src1, InputArray src2, int L2size=7, int maxIters=10)
 迭代地檢測兩幅影像之間的平移偏差。
 

函式文件 (Function Documentation)

◆ accumulate()

void cv::accumulate ( InputArray src,
InputOutputArray dst,
InputArray mask = noArray() )
Python
cv.accumulate(src, dst[, mask]) -> dst

#include <opencv2/imgproc.hpp>

將影像新增到累加器影像中。

該函式將src或其部分元素加到dst中

\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{如果} \quad \texttt{mask} (x,y) \ne 0\]

該函式支援多通道影像。每個通道獨立處理。

該函式cv::accumulate可用於例如收集靜態攝像機拍攝場景的背景統計資訊,並用於進一步的前背景分割。

引數
src輸入影像型別為CV_8UC(n)CV_16UC(n)CV_32FC(n)CV_64FC(n),其中n為正整數。
dst累加器影像,通道數與輸入影像相同,深度為CV_32F或CV_64F。
mask可選操作掩碼。
另請參閱
accumulateSquareaccumulateProductaccumulateWeighted

◆ accumulateProduct()

void cv::accumulateProduct ( InputArray src1,
InputArray src2,
InputOutputArray dst,
InputArray mask = noArray() )
Python
cv.accumulateProduct(src1, src2, dst[, mask]) -> dst

#include <opencv2/imgproc.hpp>

將兩個輸入影像的逐元素乘積新增到累加器影像中。

該函式將兩個影像或其選定區域的乘積加到累加器dst中

\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{如果} \quad \texttt{mask} (x,y) \ne 0\]

該函式支援多通道影像。每個通道獨立處理。

引數
src1第一個輸入影像,1通道或3通道,8位或32位浮點。
src2第二個輸入影像,型別與src1相同,大小與src1相同。
dst累加器影像,通道數與輸入影像相同,32位或64位浮點。
mask可選操作掩碼。
另請參閱
accumulateaccumulateSquareaccumulateWeighted

◆ accumulateSquare()

void cv::accumulateSquare ( InputArray src,
InputOutputArray dst,
InputArray mask = noArray() )
Python
cv.accumulateSquare(src, dst[, mask]) -> dst

#include <opencv2/imgproc.hpp>

將源影像的平方新增到累加器影像中。

該函式將輸入影像src或其選定區域的平方加到累加器dst中

\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{如果} \quad \texttt{mask} (x,y) \ne 0\]

該函式支援多通道影像。每個通道獨立處理。

引數
src輸入影像,1通道或3通道,8位或32位浮點。
dst累加器影像,通道數與輸入影像相同,32位或64位浮點。
mask可選操作掩碼。
另請參閱
accumulateSquareaccumulateProductaccumulateWeighted

◆ accumulateWeighted()

void cv::accumulateWeighted ( InputArray src,
InputOutputArray dst,
double alpha,
InputArray mask = noArray() )
Python
cv.accumulateWeighted(src, dst, alpha[, mask]) -> dst

#include <opencv2/imgproc.hpp>

更新執行平均值。

該函式計算輸入影像src和累加器dst的加權和,使dst成為幀序列的執行平均值

\[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{如果} \quad \texttt{mask} (x,y) \ne 0\]

也就是說,alpha調節更新速度(累加器“遺忘”早期影像的速度)。該函式支援多通道影像。每個通道獨立處理。

引數
src輸入影像,1通道或3通道,8位或32位浮點。
dst累加器影像,通道數與輸入影像相同,32位或64位浮點。
alpha輸入影像的權重。
mask可選操作掩碼。
另請參閱
accumulateaccumulateSquareaccumulateProduct

◆ createHanningWindow()

void cv::createHanningWindow ( OutputArray dst,
Size winSize,
int type )
Python
cv.createHanningWindow(winSize, type[, dst]) -> dst

#include <opencv2/imgproc.hpp>

該函式計算二維 Hanning 窗係數。

更多資訊請參閱(https://en.wikipedia.org/wiki/Hann_function)和(https://en.wikipedia.org/wiki/Window_function)。

下面是一個示例

// 建立一個100x100的Hanning視窗,型別為CV_32F
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);
n 維密集陣列類
定義於 mat.hpp:840
Size2i Size
定義 types.hpp:370
#define CV_32F
定義位於 interface.h:78
void createHanningWindow(OutputArray dst, Size winSize, int type)
該函式計算二維 Hanning 窗係數。
引數
dst用於放置Hanning係數的目標陣列
winSize視窗大小的規格(寬度和高度都必須大於1)
type建立的陣列型別

◆ divSpectrums()

void cv::divSpectrums ( InputArray a,
InputArray b,
OutputArray c,
int flags (標誌),
bool conjB=false )
Python
cv.divSpectrums(a, b, flags[, c[, conjB]]) -> c

#include <opencv2/imgproc.hpp>

執行第一個傅立葉頻譜與第二個傅立葉頻譜的逐元素除法。

函式cv::divSpectrums對第一個陣列除以第二個陣列執行逐元素除法。這些陣列是CCS打包的或複數矩陣,它們是實數或複數傅立葉變換的結果。

引數
a第一個輸入陣列。
b第二個輸入陣列,與src1大小和型別相同。
c輸出陣列,與src1大小和型別相同。
flags (標誌)操作標誌;目前唯一支援的標誌是cv::DFT_ROWS,它表示src1和src2的每一行都是一個獨立的1D傅立葉頻譜。如果您不想使用此標誌,則只需新增0作為值。
conjB可選標誌,在乘法之前共軛第二個輸入陣列(true)或不共軛(false)。

◆ phaseCorrelate()

Point2d cv::phaseCorrelate ( InputArray src1,
InputArray src2,
InputArray window=noArray(),
double * response=0 )
Python
cv.phaseCorrelate(src1, src2[, window]) -> retval, response

#include <opencv2/imgproc.hpp>

該函式用於檢測兩幅影像之間發生的平移偏差。

該操作利用傅立葉移位定理在頻域中檢測平移。它可以用於快速影像配準和運動估計。更多資訊請參閱https://en.wikipedia.org/wiki/Phase_correlation

計算兩個提供的源陣列的互功率譜。如果需要,陣列將使用getOptimalDFTSize進行填充。

該函式執行以下方程:

  • 首先,它對每個影像應用Hanning視窗以消除可能的邊緣效應,如果使用者提供了該視窗。請參閱createHanningWindowhttps://en.wikipedia.org/wiki/Hann_function。此視窗可以被快取,直到陣列大小改變,以加快處理速度。
  • 接下來,它計算每個頻域陣列的傅立葉變換

    \[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\]

    其中\(\mathcal{F}\)是前向DFT。
  • 然後,它計算每個頻域陣列的互功率譜

    \[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\]

  • 接下來,透過逆DFT將互相關轉換為時域

    \[r = \mathcal{F}^{-1}\{R\}\]

  • 最後,它計算峰值位置,並圍繞峰值計算一個5x5的加權質心,以實現亞畫素精度。

    \[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\]

  • 如果響應引數非零,則計算為r在峰值周圍5x5質心內的元素之和。它被歸一化為最大值為1(表示存在單個峰值),並且當存在多個峰值時會減小。
引數
src1源浮點陣列(CV_32FC1或CV_64FC1)
src2源浮點陣列(CV_32FC1或CV_64FC1)
window用於減少邊緣效應的加窗係數的浮點陣列(可選)。
response峰值周圍5x5質心內的訊號功率,介於0和1之間(可選)。
返回
檢測到的兩個陣列之間的相位偏移(亞畫素)。
另請參閱
dftgetOptimalDFTSizeidftmulSpectrums createHanningWindow

◆ phaseCorrelateIterative()

Point2d cv::phaseCorrelateIterative ( InputArray src1,
InputArray src2,
int L2size=7,
int maxIters=10 )
Python
cv.phaseCorrelateIterative(src1, src2[, L2size[, maxIters]]) -> retval

#include <opencv2/imgproc.hpp>

迭代地檢測兩幅影像之間的平移偏差。

此函式透過在相位相關空間中進行迭代移位細化來改進亞畫素精度,從而擴充套件了標準的phaseCorrelate方法,如[133]中所述。

引數
src1源浮點陣列(CV_32FC1或CV_64FC1)
src2源浮點陣列(CV_32FC1或CV_64FC1)
L2size迭代移位細化演算法使用的相關鄰域的大小。
maxIters迭代細化演算法將執行的最大迭代次數。
返回
檢測到的陣列之間的亞畫素移位。
另請參閱
phaseCorrelatedftidftcreateHanningWindow