Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Example does not run #19

Closed
RpfR2000 opened this issue Jan 21, 2024 · 3 comments
Closed

Example does not run #19

RpfR2000 opened this issue Jan 21, 2024 · 3 comments

Comments

@RpfR2000
Copy link

RpfR2000 commented Jan 21, 2024

I can't get the example to run when defining the plus/minus operator in the usual way (i.e., ±(a::Number, b::Number) = a + b, a - b). When I modify the example to something that does work, m1 does not equal m2. Here was my modification. Maybe I am misunderstanding the way the mean was supposed to be calculated from the integral image.

function mean_filter_integral!(out, X)
    iX = IntegralArray(X)
    for i in CartesianIndex(2, 2):CartesianIndex(size(X).-1)
        x, y = i.I
        block = iX[x+1, y+1] - iX[x-1, y+1] - iX[x+1, y-1] + iX[x-1, y-1]
        out[i] = block / 4 
    end
    return out
end
@timholy
Copy link
Member

timholy commented Jan 21, 2024

Try using IntervalSets

@timholy
Copy link
Member

timholy commented Jan 21, 2024

Also, there are 9 elements, not 4, in the range: x-1:x+1 has 3 elements

@RpfR2000
Copy link
Author

Awesome thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants