Functions
The following functions are available globally.
-
Ensures that
xis in the range[min, max].Declaration
Swift
public func clamp<T>(_ x: T, min: T, max: T) -> T where T : Comparable -
Fast conversion from MLMultiArray to CGImage using the vImage framework.
Declaration
Swift
public func createCGImage(fromFloatArray features: MLMultiArray, min: Float = 0, max: Float = 255) -> CGImage?Parameters
featuresA multi-array with data type FLOAT32 and three dimensions (3, height, width).
minThe smallest value in the multi-array. This value, as well as any smaller values, will be mapped to 0 in the output image.
maxThe largest value in the multi-array. This and any larger values will be will be mapped to 255 in the output image.
Return Value
a new CGImage or nil if the conversion fails
-
Undocumented
Declaration
Swift
public func createUIImage(fromFloatArray features: MLMultiArray, min: Float = 0, max: Float = 255) -> UIImage?
Functions Reference