SBSDKBaseAdjustableFilter

@interface SBSDKBaseAdjustableFilter : NSObject

This is the abstract base class for any of the adjustable filters in ScanbotSDK. It provides the basic logic for filtering images using the GPU or the CPU. For GPU-based filtering the SDK uses preferrably Apples Metal API where available and falls back to OpenGLES if Metal is not available. If GPU-based filtering is not supported at all, the slower CPU-based filtering is used.

  • Tests if the provided filtering method is supported on the device.

    Declaration

    Objective-C

    - (BOOL)canUseMethod:(SBSDKFilterMethod)method;

    Swift

    func canUse(_ method: SBSDKFilterMethod) -> Bool

    Parameters

    method

    The method to check.

    Return Value

    YES, if the method is supported by the device, NO otherwise.

  • Runs the filter on the given image. Automatically uses the fastest available filtering method: Metal > OpenGLES > CPU

    Declaration

    Objective-C

    - (nullable UIImage *)runFilterOnImage:(nonnull UIImage *)inputImage;

    Swift

    func run(on inputImage: UIImage) -> UIImage?

    Parameters

    inputImage

    The image to be filtered.

    Return Value

    The filtered image.

  • Runs the filter on the given image.

    Declaration

    Objective-C

    - (nullable UIImage *)runFilterOnImage:(nonnull UIImage *)inputImage
                           preferredMethod:(SBSDKFilterMethod)method;

    Swift

    func run(on inputImage: UIImage, preferredMethod method: SBSDKFilterMethod) -> UIImage?

    Parameters

    inputImage

    The image to be filtered.

    method

    The preferred method to use. If the filter method is not supported by the supported by the device it automatically selects the fastest available filtering method: Metal > OpenGLES > CPU.

    Return Value

    The filtered image.