diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m | |
parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m | 31 |
1 files changed, 31 insertions, 0 deletions
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 @@ | |||
1 | function [JJ,mask] = compute_J(A,D,I,center,window_size_h) | ||
2 | %% function J = compute_J(A,D,I,center,window_size_h) | ||
3 | % | ||
4 | |||
5 | [size_y,size_x] = size(I); | ||
6 | |||
7 | center_x = center(1); | ||
8 | center_y = center(2); | ||
9 | |||
10 | [XX,YY] = meshgrid(1:size_x,1:size_y); | ||
11 | x = reshape(XX,size_x*size_y,1); | ||
12 | y = reshape(YY,size_x*size_y,1); | ||
13 | index(:,1) = x-center_x; | ||
14 | index(:,2) = y-center_y; | ||
15 | |||
16 | position_new = A*index'+ [D(1),0;0,D(2)]*ones(2,size_x*size_y); | ||
17 | position_new(1,:) = position_new(1,:)+center_x; | ||
18 | position_new(2,:) = position_new(2,:)+center_y; | ||
19 | |||
20 | position_new_x = reshape(position_new(1,:),size_y,size_x); | ||
21 | position_new_y = reshape(position_new(2,:),size_y,size_x); | ||
22 | |||
23 | [J,mask]= m_interp4(I,position_new_x,position_new_y); | ||
24 | |||
25 | JJ = J(center(2)-window_size_h(2):center(2)+window_size_h(2),... | ||
26 | center(1)-window_size_h(1):center(1)+window_size_h(1)); | ||
27 | mask = mask(center(2)-window_size_h(2):center(2)+window_size_h(2),... | ||
28 | center(1)-window_size_h(1):center(1)+window_size_h(1)); | ||
29 | |||
30 | |||
31 | |||