Skip to content

Use the Vision framework in iOS 11+ with Appcelerator Titanium.

License

Notifications You must be signed in to change notification settings

chrisbowley/titanium-vision

 
 

Repository files navigation

iOS 11+ Vision in Titanium

Use the native iOS 11+ "Vision" framework in Axway Titanium.

Original image Processed image
Before After

Requirements

  • Titanium SDK 6.2.0 or later

API's

Methods

detectTextRectangles(args)

  • image (String | Ti.Blob - Required)
  • callback (Function - Required)
  • reportCharacterBoxes (Boolean - Optional)
  • regionOfInterest (Object(x, y, width, height) - Optional)

detectFaceRectangles(args)

  • image (String | Ti.Blob - Required)
  • callback (Function - Required)
  • regionOfInterest (Object(x, y, width, height) - Optional)

Example

var Vision = require('ti.vision');

var win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

var btn = Ti.UI.createButton({
    title: 'Recognize Image Rectangles'
});

btn.addEventListener('click', function() {
    if (!Vision.isSupported()) {
        return Ti.API.error('Sorry dude, iOS 11+ only!');
    }
    
    Vision.detectTextRectangles({
        image: 'image_sample_tr.png',
        callback: function(e) {
            if (!e.success) {
                return Ti.API.error(e.error);
            }
            
            Ti.API.info(e);
        }
    });
});

win.add(btn);
win.open();

Build

cd iphone
appc ti build -p ios --build-only

Legal

This module is Copyright (c) 2017-Present by Appcelerator, Inc. All Rights Reserved. Usage of this module is subject to the Terms of Service agreement with Appcelerator, Inc.

About

Use the Vision framework in iOS 11+ with Appcelerator Titanium.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 95.2%
  • JavaScript 4.8%