<div dir="ltr">Hi there!<div><br></div><div>I am trying to perform a variation of an image translation, but am not quite sure how to go about it using ITK filters. As I understand it, in a typical image translation, if you move the image more than the image bounds you end up losing pixel data. The data (when translated) that exceeds the bounds would be lost. I'm trying to have this data wrap-around. That is if I moved a image vertically downwards, I'd like the lost data to appear at the top.</div>
<div><br></div><div>From what I saw, I don't think this falls under the category of translation or rotation. Are there any existing filters that would do this? </div><div><br></div><div>Thanks!</div><div><br></div><div>
For those familiar with MATLAB, an example of this would be along the lines of:</div><div><br></div><div>m = 100;</div><div>n = 200;</div><div>img = zeroes(m,n);</div><div><br></div><div>% some work done on img</div><div>
<br></div><div>for dx = -5:5</div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>for dy = -10:10</div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>xRange = 1:m; % A vector where xRange[i] = i</div></blockquote></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>
yRange = 1:n; % A vector where yRange[i] = i</div><div><br></div></blockquote></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>xRotated = xRange + dx -1;</div></blockquote></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>yRotated = yRange + dy -1;</div>
<div><br></div></blockquote></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><blockquote style="margin:0 0 0 40px;border:none;padding:0px">xRotated = mod(xRotated, m) + 1;<br>yRotated = mod(yRotated, n) + 1;<br>
<br>translatedImg = img(xRotated, yRotated); % image translation, with wrap around.<br><br>%% Other work with translatedImg<br></blockquote></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px">end<br>
</blockquote>end<br><div><br></div><div>Cheers,<br clear="all"><div><div dir="ltr">Ricky</div></div>
</div></div>