フィルターのクリア

Object movement by estimating motion

1 回表示 (過去 30 日間)
Nataliya
Nataliya 2015 年 7 月 13 日
Hello everyone, I have estimated the motion of the frame using optical flow. I want to move the object using the estimated motion. Here is the code to move the object:
function imgComp = motionComp(imgI,u,v)
[m n C] = size(imgI);
M = size(imgI,1);
N = size(imgI,2);
f = imgI(1:M, 1:N, 1:C);
imgComp = zeros(M, N, C);
[x y] = meshgrid(1:size(imgI,2),1:size(imgI,1));
X = min(max(x+round(u), 1), N);
Y = min(max(y+round(v), 1), N);
idx = (X(:)-1)*M + Y(:);
for coloridx = 1:C
fc = f(:,:,coloridx);
imgComp(:,:,coloridx) = reshape(fc(idx), M, N);
end
end
Can anybody tell me whats wrong in this logic. As the object is not moving accordingly. Please help. Thanks

回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by