2016-12-14 47 views

回答

0

- 對於每個像素,使用4個最近光流值的接近度和大小對其梯度進行插值。
- 然後將時間步應用於插值梯度值以生成目標位置。
- 由於得到的位置不會直接在網格上,我可能會根據原點像素的強度計算以目標爲中心的高斯。然後使用該高斯將強度值添加到輸出圖像中的相鄰單元格中。或者,您可以採用(原始像素的)強度,並將該強度加權分割到目的地位置最近的4個細胞中心。 (我覺得這樣可能會使圖像模糊不清)

0

使用理想的變形策略,最好基於插值。在matlab中,使用「interp2」效果很好。 Matlab的例子:

s = 40; %size of data 
t = 1; %time offset 

[x,y] = meshgrid(1:s,1:s); 

binIm = (x-(s/2)).^2 +((y-(s/2)).^2)*10 <((s/3))^2; 

subplot(2,2,1); imagesc(binIm); colormap gray;axis image; 
title('eliptical mask'); 

%some rotational flow (curl) 
Ur = 10*(y-(s/2))/(s/2); 
Vr = -10*(x-(s/2))/(s/2); 

%some zooming flow (divergent) 
Uz = 10*(x-(s/2))/(s/2); 
Vz = 10*(y-(s/2))/(s/2); 

binImR = interp2(double(binIm),x-t*Ur,y-t*Vr); 
subplot(2,2,3); imagesc(binImR); axis image;colormap gray; 
hold on; quiver(Ur,Vr); 
title('rotational flow'); 

binImZ = interp2(double(binIm),x-t*Uz,y-t*Vz); 
subplot(2,2,4); imagesc(binImZ); axis image;colormap gray; 
hold on; quiver(Uz,Vz); 
title('zooming flow'); 

注意的是,更大的你做「T」,更糟糕的逼近將成爲,尤其是對旋轉運動。