Thanks Tim. And thank you for your packages ;)

I've implented a simple function myself, I'm not sure it is completly right
and efficient.
I'll search the list for yours.

function bilinear(A, x, y)
    u0, u1, uλ = ifloor(x), iceil(x), x%1
    v0, v1, vλ = ifloor(y), iceil(y), y%1
    @inbounds A00 = 1<=u0<=size(A,1) && 1<=v0<=size(A,2) ? A[u0,v0] :
zero(eltype(A))
    @inbounds A10 = 1<=u1<=size(A,1) && 1<=v0<=size(A,2) ? A[u1,v0] :
zero(eltype(A))
    @inbounds A01 = 1<=u0<=size(A,1) && 1<=v1<=size(A,2) ? A[u0,v1] :
zero(eltype(A))
    @inbounds A11 = 1<=u1<=size(A,1) && 1<=v1<=size(A,2) ? A[u1,v1] :
zero(eltype(A))
    (1-vλ) * ((1-uλ)*A00 + uλ*A10)   +   vλ * ((1-uλ)*A01 + uλ*A11)
end



On Tue Nov 18 2014 at 8:58:34 AM Tim Holy <tim.h...@gmail.com> wrote:

> I'm too busy with other things right now to implement this, but you can
> search
> this list for an old post from me that contains a fast image interpolation
> algorithm.
>
> --Tim
>
> On Wednesday, November 12, 2014 03:57:05 AM Cristóvão Duarte Sousa wrote:
> > Hi,
> >
> > I would like to get the interpolated value at a non-integer point of an
> > image.
> > Using Images.jl and Grid.jl I've tried doing
> >
> > using Images, TestImages, Grid
> > img = convert(Image{Gray},testimage("mandrill"))  # for example
> >
> > img_bi = CoordInterpGrid((1:size(img,1), 1:size(img,2)), img.data,
> BCnearest
> > , InterpLinear)
> > img_bi[12.34, 56.78]
> >
> > which doesn't work due to img.data being
> > an Array{Gray{UfixedBase{Uint8,8}},2} .
> >
> > On the other hand, this
> >
> > img_bi = CoordInterpGrid((1:size(img,1), 1:size(img,2)), convert(Matrix{
> > Float64}, img.data), BCnearest, InterpLinear)
> >
> > works.
> > However I'd like to avoid the conversion.
> >
> > Is there a nice way to do it, or must I implement the bilinear
> > interpolation myself?
> >
> > Thanks,
> > Cristóvão
>
>

Reply via email to