interp2 with huge matrix
이전 댓글 표시
Hello
Problem: I have a matrix (M) with 6000 by 11000 elements of complex or double type. The task is to preform a second order polynomial transformation (shift and warp) with interp2().
[X Y] = meshgrid(1:11000,1:6000); % very fast
% A and B are the coefficients
transY = A(1) + A(2)*Y + A(3)*X + A(4)*X.*Y + A(5)*X.^2 + A(6)*Y.^2; % very fast
transX = B(1) + B(2)*Y + B(3)*X + B(4)*X.*Y + B(5)*X.^2 + B(6)*Y.^2; % very fast
ZI = interp2(X,Y,M,transX,transY); % out of memory
The interp2() is very slow and as you can see there are four very large matrices and ZI would be the 5th, so running out of memory is always the case.
How to solve this problem?
So far I have tried to cut the matrix into tiles, but this does not work because of the NaN values for each tile.
Thanks in advance!
답변 (1개)
the cyclist
2011년 7월 6일
0 개 추천
By "cut the matrix into tiles" do you mean doing the interpolation by sections (such as X=1:1000, then X=1001:1100, etc)? I would expect that to work, if handled properly and being careful about edge cases. Maybe you should post the code you used to try to do that part.
댓글 수: 2
Michael
2011년 7월 6일
Ashish Uthama
2011년 7월 6일
Michael, consider editing your question to add this code with proper formatting. Aside: blkproc or blockproc might be useful(?).
카테고리
도움말 센터 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!