정지 된 웹캠을 사용하여 각 프레임에서 움직이는 물체를 순차적으로 촬영하고 있습니다. 각 프레임의 하위 픽셀 이동을 예측하려고하지만 예상치는 떨어진다. 첫 번째 시련에서 잘못된 부분을 추정 한 이후, 나는 대상에 대한 마스크를 만들고 배경을 제거하는 동안 움직이는 물체로 시프트를 추정하려고했습니다. 그러나 픽셀 이동의 추정치는 동일했습니다.Matlab에서 움직이는 물체의 서브 픽셀 이동 추정
function delta_est = estimate_shift(s,n)
h = waitbar(0, 'Shift Estimation');
set(h, 'Name', 'Please wait...');
nr = length(s);
delta_est=zeros(nr,2);
p = [n n] % only the central (aliasing-free) part of NxN pixels is used for shift estimation
p(1)
sz = size(s{1});
S1 = fftshift(fft2(s{1})); % Fourier transform of the reference image
for i=2:nr
waitbar(i/nr, h, 'Shift Estimation');
S2 = fftshift(fft2(s{i})); % Fourier transform of the image to be registered
S2(S2==0)=1e-10;
Q = S1./S2;
A = angle(Q); % phase difference between the two images
% determine the central part of the frequency spectrum to be used
beginy = floor(sz(1)/2)-p(1)+1;
endy = floor(sz(1)/2)+p(1)+1;
beginx = floor(sz(2)/2)-p(2)+1;
endx = floor(sz(2)/2)+p(2)+1;
% compute x and y coordinates of the pixels
x = ones(endy-beginy+1,1)*[beginx:endx];
x = x(:);
y = [beginy:endy]'*ones(1,endx-beginx+1);
y = y(:);
v = A(beginy:endy,beginx:endx);
v = v(:);
% compute the least squares solution for the slopes of the phase difference plane
M_A = [x y ones(length(x),1)];
r = M_A\v;
delta_est(i,:) = -[r(2) r(1)].*sz/2/pi;
end
close(h);
오른쪽 하위 픽셀 추정으로 이동하려면 어떤 변경을해야합니까?
정말 그 엉터리 이미지에서 좋은 측정을 기대합니까? [비공식 미안합니다.] –
@ Yves Daoust 초고 해상을 위해 서브 픽셀 이동을 찾으려하기 때문에 엉뚱한 이미지를 사용하는 것이 핵심입니다. 내가 렌즈가없는 카메라를 사용하고 그의 사진을 기반으로하는 작업은 이보다 훨씬 나쁩니다. 하위 픽셀 이동을 얻는 방법에 대한 제안 사항이 있습니까? –
주어진 SNR이 낮 으면 위치가 픽셀보다 큰 표준 편차로 변동 할 것으로 예상되어 서브 픽셀 추정을 환상적으로 만듭니다. –