Latest 0.1.4
Homepage https://github.com/oaleeapp/SwiftEyes
License 3-clause BSD
Platforms ios 9.0
Dependencies OpenCV-Dynamic
Frameworks QuartzCore, CoreVideo, AssetsLibrary, CoreMedia, CoreImage, CoreGraphics, AVFoundation, Accelerate, UIKit, ImageIO, Foundation
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

If this is first time you use OpenCV-Dynamic as the dependency, it’ll take time to install.

How to Use

Just import the framework

import SwiftEyes

In class SEMotionTrackViewController, you can see the example.

Simply use the code below can identify the motion blob.


func processImage(_ image: OCVMat!) {

// Parameters
let blurSize = 10
let sensitivityValue = 20.0
var differenceMat = OCVMat(cgSize: CGSize(width: image.size.width, height: image.size.height), type: image.type, channels: image.channels)

// from BGR to RGB
OCVOperation.convertColor(fromSource: image, toDestination: image, with: .typeBGRA2RGBA)

// set current mat
currentMat = image.clone()

// convert current mat from RGB to GrayScale
OCVOperation.convertColor(fromSource: currentMat, toDestination: currentMat, with: .typeRGBA2GRAY)

if previousMat != nil {
OCVOperation.absoluteDifference(onFirstSource: currentMat, andSecondSource: previousMat, toDestination: differenceMat)
OCVOperation.blur(onSource: differenceMat, toDestination: differenceMat, with: OCVSize(width: blurSize, height: blurSize))
OCVOperation.threshold(onSource: differenceMat, toDestination: differenceMat, withThresh: sensitivityValue, withMaxValue: 255.0, with: .binary)
}

DispatchQueue.main.sync {
cameraImageView.image = image.image()
displayImageView.image = differenceMat.image()
}

// use previous mat(frame) to compare with next mat(frame)
previousMat = currentMat

}

Videos

motion tracking
color tracking

motion tracking
color tracking

Requirements

If you didn’t install CocoaPods yet, you can install from here.

And before you run pod install, please be sure that you have install cmake as well.

To download it, simply use Homebrew to install:

brew install cmake

Installation

SwiftEyes is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SwiftEyes"

Author

Victor Lee, [email protected]

License

BSD license, respect OpenCV license as well.

Latest podspec

{
    "name": "SwiftEyes",
    "version": "0.1.4",
    "summary": "An easy way to access OpenCV library from Swift.",
    "homepage": "https://github.com/oaleeapp/SwiftEyes",
    "license": {
        "type": "3-clause BSD",
        "file": "LICENSE"
    },
    "authors": {
        "Victor Lee": "[email protected]"
    },
    "social_media_url": "http://twitter.com/oaleeapp",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/oaleeapp/SwiftEyes.git",
        "tag": "0.1.4"
    },
    "source_files": "SwiftEyes/Classes/**/*",
    "private_header_files": "SwiftEyes/Classes/Private/*.h",
    "pod_target_xcconfig": {
        "OTHER_LDFLAGS": "-lObjC"
    },
    "frameworks": [
        "QuartzCore",
        "CoreVideo",
        "AssetsLibrary",
        "CoreMedia",
        "CoreImage",
        "CoreGraphics",
        "AVFoundation",
        "Accelerate",
        "UIKit",
        "ImageIO",
        "Foundation"
    ],
    "libraries": [
        "c++",
        "ObjC",
        "z"
    ],
    "dependencies": {
        "OpenCV-Dynamic": [
            "~> 3.x"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This