Skip to content

Output image incorrect when OffsetArray vectors passed as kernel components #269

@BioTurboNick

Description

@BioTurboNick

If a 2d kernel is passed as two OffsetArray vectors, the second one transposed or adjoint, the final image is incorrect.

The issue does not occur if the second component is an OffsetArray matrix with one row, or if the vector is transposed /adjointed before being passed to centered.

image = [0.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 0.0]
image_out_typical = imfilter(image, Kernel.gaussian(1))

factor1, factor2 = ImageFiltering.factorkernel(Kernel.gaussian(1))
@info factor1
@info factor2
	
image_out_factors = imfilter(image, (factor1, factor2))

factor1a = factor1 |> vec |> centered
factor2a = (factor2 |> vec |> centered)'

@info factor1a
@info factor2a

image_out_factors_vec = imfilter(image, (factor1a, factor2a))
	
plot(heatmap(image, aspectratio = 1), heatmap(image_out_typical, aspectratio = 1), heatmap(image_out_factors, aspectratio = 1), heatmap(image_out_factors_vec, aspectratio = 1))

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions