sample for MPSImageCanny

Is there a working example for the new MPSImageCanny (and MPSImageEDLines) functionality ?

I tried several ways (e.g. different texture sized, parameter) all leading to various errors like total freeze of my MBP under BigSur and Xcode 12.3


Code Block             let luminanceWeights: [Float] = [ 0.2126, 0.7152, 0.0722]
            // Allocating sufficient space to store or data
            let pointerToFloats = UnsafeMutablePointer<Float>.allocate(capacity: luminanceWeights.count)
            pointerToFloats.assign(from: luminanceWeights, count: luminanceWeights.count)
            let canny = MPSImageCanny(device: self.metalDevice!, linearToGrayScaleTransform: luminanceWeights, sigma: 3)
            canny.useFastMode = false
            canny.highThreshold = 0.8
            canny.lowThreshold = 0.2


Is there any code snippet proven working I could base my work on ?