diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/affine/compute_J.m | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
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 | |||
