Skip to content

Commit

Permalink
feat: implement parallel processing for gradient magnitude computation
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam committed Nov 6, 2024
1 parent 644d1f0 commit 6b0b507
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/segmentation_a_direct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,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

0 comments on commit 6b0b507

Please sign in to comment.