From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: 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. --- .../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