From 6b0b5075674880f93ddf830cfb155285c4b9a2f0 Mon Sep 17 00:00:00 2001 From: Carlos Paniagua Date: Wed, 6 Nov 2024 17:46:15 -0500 Subject: [PATCH] feat: implement parallel processing for gradient magnitude computation --- src/segmentation_a_direct.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/segmentation_a_direct.jl b/src/segmentation_a_direct.jl index 527031b9..fa809c18 100644 --- a/src/segmentation_a_direct.jl +++ b/src/segmentation_a_direct.jl @@ -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