Skip to content

Commit

Permalink
feat: parallelize gradient magnitude
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam committed Nov 5, 2024
1 parent f67913d commit 8755d9c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/segmentation_a_direct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ Compute the gradient magnitude of an image using the Sobel operator.
"""
function imgradientmag(img)
h = centered([-1 0 1; -2 0 2; -1 0 1]')
Gx = imfilter(img, h', "replicate")
Gy = imfilter(img, h, "replicate")
Gx_future = Threads.@spawn IceFloeTracker.imfilter(img, h', "replicate")
Gy_future = Threads.@spawn IceFloeTracker.imfilter(img, h, "replicate")
Gx = fetch(Gx_future)
Gy = fetch(Gy_future)
return hypot.(Gx, Gy)
end
end

0 comments on commit 8755d9c

Please sign in to comment.