C4IR / FAIR.m

Flexible Algorithms for Image Registration
GNU Lesser General Public License v3.0
120 stars 39 forks source link

Restriction Operation: mfPu function routine. #7

Closed hariagr closed 6 years ago

hariagr commented 6 years ago

I recommend following changes :

In the function routine mfPu, the filter function at line number 163 should be C(:,1,1) = [1 2 1]/4 The division should be by 4 instead of 2 so that the total weight is 1.

On the similar note, the function in TriMesh3 (inside add-on FAIRFEM) should be (from line number 346-367) :

% include parent nodes Pyn = 0.5yn(1:2:end,1:2:end,:); % distribute in x direction t = yn(2:2:end-1,1:2:end,:); Pyn(1:end-1,:,:) = Pyn(1:end-1,:,:) + (1/16)t; Pyn(2:end ,:,:) = Pyn(2:end ,:,:) + (1/16)*t;

% distribute in y direction t = yn(1:2:end,2:2:end-1,:); Pyn(:,1:end-1,:) = Pyn(:,1:end-1,:) + (1/16)t; Pyn(:,2:end ,:) = Pyn(:,2:end ,:) + (1/16)t;

% distribute cell-centers t1 = yc(1:2:end-1,1:2:end-1,:); t2 = yc(2:2:end ,1:2:end-1,:); t3 = yc(1:2:end-1,2:2:end ,:); t4 = yc(2:2:end ,2:2:end ,:); Pyc = 0.5yn(2:2:end,2:2:end,:) + (1/8)(t1+t2+t3+t4); Pyn(1:end-1,1:end-1,:) = Pyn(1:end-1,1:end-1,:) + (1/16)t1; Pyn(2:end ,1:end-1,:) = Pyn(2:end ,1:end-1,:) + (1/16)t2; Pyn(1:end-1,2:end ,:) = Pyn(1:end-1,2:end ,:) + (1/16)t3; Pyn(2:end ,2:end ,:) = Pyn(2:end ,2:end ,:) + (1/16)t4;

Please also find a test script and data set attached. data.zip

hariagr commented 6 years ago

The implementation is accurate for P^T, therefore not an issue anymore.