當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python skimage.registration.optical_flow_ilk用法及代碼示例

用法:

skimage.registration.optical_flow_ilk(reference_image, moving_image, *, radius=7, num_warp=10, gaussian=False, prefilter=False, dtype=<class 'numpy.float32'>)

粗到細的光流估計器。

迭代Lucas-Kanade (iLK) 求解器應用於圖像金字塔的每個級別。 iLK [1] 是 TVL1 算法的快速且穩健的替代方案,盡管在渲染平麵和對象邊界方麵不太準確(請參閱[2])。

參數

reference_imagendarray,形狀(M,N[,P[,…]])

序列的第一幅灰度圖像。

moving_imagendarray,形狀(M,N[,P[,…]])

序列的第二個灰度圖像。

radiusint 可選

每個像素周圍考慮的窗口半徑。

num_warpint 可選

moving_image 扭曲的次數。

gaussian布爾型,可選

如果為 True,則使用高斯核進行局部積分。否則,使用統一內核。

prefilter布爾型,可選

是否在每個圖像扭曲之前對估計的光流進行預過濾。當為 True 時,將應用沿每個軸的窗口大小為 3 的中值濾波器。這有助於消除潛在的異常值。

dtypedtype,可選

輸出數據類型:必須是浮點數。與雙精度相比,單精度提供了良好的結果並節省了內存使用和計算時間。

返回

flowndarray, 形狀 ((reference_image.ndim, M, N[, P[, ...]])

每個軸的估計光流分量。

注意

  • 實現的算法在表2[1].
  • 不支持彩色圖像。

參考

1(1,2)

Le Besnerais, G., & Champagnat, F. (2005, September). Dense optical flow by iterative local window registration. In IEEE International Conference on Image Processing 2005 (Vol. 1, pp. I-137). IEEE. DOI:10.1109/ICIP.2005.1529706

2

Plyer, A., Le Besnerais, G., & Champagnat, F. (2016). Massively parallel Lucas Kanade optical flow for real-time video processing applications. Journal of Real-Time Image Processing, 11(4), 713-730. DOI:10.1007/s11554-014-0423-0

例子

>>> from skimage.color import rgb2gray
>>> from skimage.data import stereo_motorcycle
>>> from skimage.registration import optical_flow_ilk
>>> reference_image, moving_image, disp = stereo_motorcycle()
>>> # --- Convert the images to gray level: color is not supported.
>>> reference_image = rgb2gray(reference_image)
>>> moving_image = rgb2gray(moving_image)
>>> flow = optical_flow_ilk(moving_image, reference_image)

相關用法


注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.registration.optical_flow_ilk。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。