TransformImages warp error

Trying to implement a log polar transform… warp gets a
MethodError: no method matching similar(::Type{Array{ColorTypes.Gray{Float64}}}, ::Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}})

The function is
function LogPolar(x)
# x is an SVector (StaticArrays), e.g., SVector(x_coord, y_coord)
ρ = log(hypot(x[1], x[2])) # hypot(x, y) calculates sqrt(x^2 + y^2)
θ = atan(x[2], x[1])
return SVector(ρ, θ)
end

Not sure what I’m doing wrong

It’s hard to tell without a minimal working example, but guessing, you might try something like this:

using TestImages
using ImageTransformations
using StaticArrays

# Example image
img = Float64.(testimage("cameraman"))
h, w = size(img)

# Choose center and radial scale
cx = (w + 1) / 2
cy = (h + 1) / 2
rmax = min(cx - 1, w - cx, cy - 1, h - cy)  # largest radius fully inside image
ρmax = log(rmax + 1)   # +1 avoids log(0)

"""
Map output pixel coords (row, col) -> input coords (row, col)
for a log-polar view:
- output row controls log-radius
- output col controls angle
"""
function logpolar(p::SVector{2,<:Real})
    y_out, x_out = p

    # Normalize output coordinates to [0,1]
    u = (y_out - 1) / (h - 1)              # radial axis
    v = (x_out - 1) / (w - 1)              # angular axis

    # Convert to polar params
    ρ = u * ρmax
    r = exp(ρ) - 1
    θ = 2π * v

    # Back to Cartesian input coordinates
    x_in = cx + r * cos(θ)
    y_in = cy + r * sin(θ)

    return SVector(y_in, x_in)
end

# Warp: output axes same size as input
img_logpolar = warp(img, logpolar, (axes(img, 1), axes(img, 2)))```