Hi everybody.
I have a code to modify. This is the original code:
I have to rotate the little matrix (img), so it does mean to rotate his index: ndx
For example if I have to flip it, I just write:
But if I want to rotate it (+90'), how can I do?
I have a code to modify. This is the original code:
Code:
N=nn-n+1; M=mm-m+1;
for (j=1; j<=N; ++j) {
J=j+n-1;
for (i=1; i<=M; ++i) {
I=i+m-1;
for (jj=j,jj2=1; jj<=J; ++jj,++jj2) {
for (ii=i,ii2=1; ii<=I; ++ii,++ii2) {
ndx=ii-1+mm*(jj-1);
ndx2=ii2-1+m*(jj2-1);
if (!toFill[ndx2]) {
err=img[ndx ] - Ip[ndx2 ]; patchErr += err*err;
err=img[ndx+=mmnn] - Ip[ndx2+=mn]; patchErr += err*err;
err=img[ndx+=mmnn] - Ip[ndx2+=mn]; patchErr += err*err;
}
}
}
}
}
For example if I have to flip it, I just write:
Code:
ndx=(I-ii+1)-1+mm*(jj-1);
Comment