OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
運動分析與目標跟蹤

詳細描述

函式

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)
 此函式計算二維的漢寧窗係數。
 
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)
 此函式用於檢測兩幅影像之間發生的平移偏差。
 

函式文件

◆ 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 相同。
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 或其選定區域(2 次冪)新增到累加器 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>

此函式計算二維的漢寧窗係數。

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

示例如下

// 建立大小為 100x100 且型別為 CV_32F 的漢寧窗
Mat hann;
createHanningWindow(hann, Size(100, 100), CV_32F);
n 維密集陣列類
定義 mat.hpp:830
Size2i Size
定義 types.hpp:370
#define CV_32F
Definition interface.h:78
void createHanningWindow(OutputArray dst, Size winSize, int type)
此函式計算二維的漢寧窗係數。
引數
dst用於放置漢寧係數的目標陣列
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(),
如果傳入NULL,則假定尺度引數c為1.0。否則,指向的變數將被設定為最優尺度。 response = 0 )
Python
cv.phaseCorrelate(src1, src2[, window]) -> retval, response

#include <opencv2/imgproc.hpp>

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

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

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

此函式執行以下方程

  • 首先,如果使用者提供,它會對每個影像應用漢寧窗以消除可能的邊緣效應。請參閱 createHanningWindowhttps://en.wikipedia.org/wiki/Hann_function。此視窗可以被快取,直到陣列大小改變,以加快處理時間。
  • 接下來,它計算每個源陣列的正向 DFT

    \[\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