The Wayback Machine - https://web.archive.org/web/20201107144436/https://github.com/RxSwiftCommunity/RxVision
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

RxVision

RxVision (based on RxSwift)

Basic usage.

let mlRequest: RxVNCoreMLRequest<CGImage> = VNCoreMLRequest.rx.request(model: model, imageCropAndScaleOption: .scaleFit)

mlRequest
    .observable
    .subscribe { [unowned self] (event) in
        switch event {
            case .next(let completion):       
                let cgImage = completion.value // NB you can easily pass the value along to the completion handler 
                if let result = completion.request.results?[0] as? VNClassificationObservation {
                    os_log("results: %@", type: .debug, result.identifier)
                }
            default:
                break
        }
    }
    .disposed(by: disposeBag)

let imageRequestHandler = VNImageRequestHandler(cgImage: cgImage, orientation: .up, options: requestOptions)
do {
    try imageRequestHandler.rx.perform([mlRequest], on: cgImage) // NB you can easily pass the value along to the completion handler
} catch {
    print(error)
}

Carthage setup.

github "RxSwiftCommunity/RxVision" ~> 0.1.0

Copyright (c) RxSwiftCommunity

You can’t perform that action at this time.