I’m trying to convert some Python to Julia but I’m having an issue with the following lines.
The code takes an array of gradients (all with nxm dims) and returns the median gradient (in nxm dims).
In Python the relevant code looks like this:
import cv2 import numpy as np gradx = [cv2.Sobel(img, (cv2.CV_64F), 1, 0, ksize=3) for img in images] medx = np.median(np.array(gradx), axis=0)
In Julia I have the following so far:
using Images gradx =  for img in images gx,gy = imgradients(collect(img), KernelFactors.sobel, "replicate") push!(gradx,gx) end medx = ??
Is it possible to write the above code using list comprehensions? Also, is there a function to find the median gradient, like the one provided by numpy?