From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../toolbox/toolbox_basic/affine/compute_J.m | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m (limited to 'SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m') diff --git a/SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m b/SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m new file mode 100755 index 0000000..80db273 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m @@ -0,0 +1,31 @@ +function [JJ,mask] = compute_J(A,D,I,center,window_size_h) +%% function J = compute_J(A,D,I,center,window_size_h) +% + +[size_y,size_x] = size(I); + +center_x = center(1); +center_y = center(2); + +[XX,YY] = meshgrid(1:size_x,1:size_y); +x = reshape(XX,size_x*size_y,1); +y = reshape(YY,size_x*size_y,1); +index(:,1) = x-center_x; +index(:,2) = y-center_y; + +position_new = A*index'+ [D(1),0;0,D(2)]*ones(2,size_x*size_y); +position_new(1,:) = position_new(1,:)+center_x; +position_new(2,:) = position_new(2,:)+center_y; + +position_new_x = reshape(position_new(1,:),size_y,size_x); +position_new_y = reshape(position_new(2,:),size_y,size_x); + +[J,mask]= m_interp4(I,position_new_x,position_new_y); + +JJ = J(center(2)-window_size_h(2):center(2)+window_size_h(2),... + center(1)-window_size_h(1):center(1)+window_size_h(1)); +mask = mask(center(2)-window_size_h(2):center(2)+window_size_h(2),... + center(1)-window_size_h(1):center(1)+window_size_h(1)); + + + -- cgit v1.2.2