Closed mbauman closed 8 years ago
Thanks!
Theoretically, the fastest version should be this one, which is quite hard to read but basically does this:
for j = 1:N
# precompute the terms that come from the 2nd column of the affine transform matrix
for i = imin(j):imax(j) # skip almost all the pixels that will give NaN
# stuff involving the 1st column of the affine transform matrix
dest[i,j] = #stuff
end
end
In three dimensions (which is what I usually care about), the savings from hoisting the computations for the 2nd and 3rd columns are quite substantial.
Ah, that makes sense. I did see that, but in my use-case I needed to restrict the image down to about 10% of its original area… so I figured it'd be fastest to just do it by indexing into just the small section I need. I didn't test it, though.
Surely if you only need 10% of the area, it will indeed be faster to compute just for that region.
With these minor adjustments, I'm able to write my rotate-and-crop function that I proposed in timholy/Images.jl#397 as:
Amazingly, your much more general, higher level framework has performance on par with my specialized rotate function. Very nice work here!