Yeah, I had observed the part of the code you mentioned here but couldn't determine why it was commented. Replacing the parts that are masked with random noise to get zero correlation would be an excellent way to approach this. I'll work on this and report any changes.
Also, is there any specific reason you have introduced masks as a cell array containing the boundary pixels of the masked area? I'm trying to get PIVlab to work with dynamic masks. So passing only the boundary pixels and then reconstructing the mask like this by looping over each individual connected component is too much work. Of course, if we have a constant mask for all the image pairs, then this would be an excellent implementation that greatly reduces the amount of memory used. I assume you had this in mind while developing the code. :-)
A=im2bw(A,0.5); %#ok<*IM2BW>
A1=zeros(size(A));
A2=A1;A3=A1;A4=A1;
%cut mask in 4 pieces to minimize parent / child / hole problems in masks
rowshalf=round(size(A,1)/2);
colshalf=round(size(A,2)/2);
%A1(1:rowshalf,1:colshalf) = A(1:rowshalf,1:colshalf);%top left part
%A2(1:rowshalf,colshalf+1:end) = A(1:rowshalf,colshalf+1:end);%top right half
%A3(rowshalf+1:end,1:colshalf) = A(rowshalf+1:end,1:colshalf); % lower left part
%A4(rowshalf+1:end,colshalf+1:end) = A(rowshalf+1:end,colshalf+1:end); %lower right part
A1(1:rowshalf,1:colshalf) = A(1:rowshalf,1:colshalf);%top left part
A2(1:rowshalf,colshalf:end) = A(1:rowshalf,colshalf:end);%top right half
A3(rowshalf:end,1:colshalf) = A(rowshalf:end,1:colshalf); % lower left part
A4(rowshalf:end,colshalf:end) = A(rowshalf:end,colshalf:end); %lower right part
%A(:,round(size(A,2)/2))=0;
%A(round(size(A,1)/2),:)=0;
%B=A;
%B=im2bw(abs(A-B));
bwbound=[bwboundaries(A1); ...
bwboundaries(A2) ; ...
bwboundaries(A3) ; ...
bwboundaries(A4)];
%bwbound=bwboundaries(A);
importmaskx=cell(size(bwbound,1),1);
importmasky=importmaskx;
for i=1:size(bwbound,1)
temp=bwbound{i,1};
importmasky{i,1}=temp(1:3:end,1); % ABHI: changed 1:10:end to 1:3:end
temp=bwbound{i,1};
importmaskx{i,1}=temp(1:3:end,2); % ABHI: changed 1:10:end to 1:3:end
end
maskiererx=retr('maskiererx');
maskierery=retr('maskierery');
I'll modify the code to read/input mask in piv_analysis() as a logical array and then send it to pin_FFTmulti() as an additional input. I'll also modify piv_FFTmulti() to work with this. Kindly let me know if you have any better ideas to approach this.
So I'll first work on implementing this with the command line. Once I'm done with this, I may need your help to incorporate this with "PIVlab_gui.m". This m-file is quite a zig-saw puzzle :-). Since this is one of many projects I'm currently working on, it may take me some time to finish. I'll get back to you once I've finished the command-line part, and we'll take it up from there.