Hi Yakir,

On Sunday, February 09, 2014 09:14:01 PM Yakir Gagnon wrote:
>    2. regionprops
>    3. tformarray

For at least these two algorithms (and perhaps others), the only reason you 
need to have them in Matlab is because looping is so dang slow (for anything 
other than very specific circumstances). tformarray in particular is something 
of an abomination; it always takes me 15 minutes to remind myself how to use 
it. With Julia you can write much more transparent code simply by doing 
something like this:

for j = 1:size(imgT, 2), i = 1:size(imgT, 1)
    iT, jT = apply_my_transform(i, j)
   imgT[i,j] = img[round(iT), round(jT)]
end

(for brevity this omits checks on bounds, the possibility of interpolation, 
etc). This is exactly how such algorithms would be implemented if there were a 
tformarray function, so this is not a "poor man's" version. On a recent Julia 
build, you can even parallelize it fairly easily using SharedArrays.

>    6. interp1

This and more is in Grid.jl (it's more like griddedInterpolant, which is a 
much nicer interface than interp1). I see that the docs only describe 
regularly-spaced grids (which is usually the case for images), but if you look 
at the code there's a bit of support for irregularly-spaced points.

Also, the restriction/prolongation code in Grid.jl is often very useful for 
image processing.

--Tim

Reply via email to