dth);
I2 = distort_image(I,Dx,Dy);
X = repmat(1:size(I,2),size(I,1),1);
Y = repmat([1:size(I,1)]',1,size(I,2));
figure(1);
subplot(1,3,1); imagesc(I); subplot(1,3,2); imagesc(I2); colormap(gray);
subplot(1,3,3); quiver(X,Y,-Dx,Dy);
<span class="keyword">end</span>

<span class="keyword">function</span>[I2] = distort_image(I,Dx,Dy)
[h,w] = size(I);
I2 = zeros(w,h);
<span class="keyword">for</span> x=1:w
    <span class="keyword">for</span> y=1:h
        dx = Dx(y,x);
        dy = Dy(y,x);
        i1 = imageA