JuliaImages / JuliaImages/ImageFiltering.jl

Output image incorrect when OffsetArray vectors passed as kernel components

Open
#269 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
104
Forks
52
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided imfilter example with Kernel.gaussian(1) and compare the typical, factor, and vector-factor outputs. Trace the handling of the two OffsetArray vector components, then add coverage showing that a transposed or adjointed second vector produces the same image as the equivalent one-row matrix and centered factor.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.