          For the video image, the content only needs to be filtered whenever the camera provides a new video frame.
          */
         viewHome.viewPicture.isPaused = true
-        viewHome.viewPicture.delegate = self
         viewHome.viewPicture.device = device
         viewHome.viewPicture.colorPixelFormat = .bgra8Unorm
     }

    
    func imageSelected(image:UIImage?)
    {
        sourceTexture = nil
        
        let loader = MTKTextureLoader(device: device)
        let cgImage = image?.cgImage
        // The still image is loaded directly into GPU-accessible memory that is only ever read from.
        
        var options = [
            
            MTKTextureLoaderOptionTextureUsage:         MTLTextureUsage.shaderRead.rawValue,
            MTKTextureLoaderOptionSRGB:                 0
        ]
        
        if #available(iOS 10.0, *)
        {
            options[MTKTextureLoaderOptionTextureStorageMode] = MTLStorageMode.private.rawValue
        }
        
        do {
            let fileTexture = try loader.newTexture(with: cgImage!, options: options as [String : NSObject]?)
            sourceTexture = fileTexture
        } catch let error as NSError {
            print("Error loading still image texture: \(error)")
        }
        
        viewHome.viewPicture.draw()
    }
}

    
    //MARK: private
    
    private func normalize(image:UIImage)
    {
        UIGraphicsBeginImageContextWithOptions(image.size, true, image.scale)
        let rect = CGRect(origin:CGPoint.zero, size:image.size)
        image.draw(in:rect)
        normalizedImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
    }
    
    private func setupMetal() {
        commandQueue = device.makeCommandQueue()
        
