Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user| final class Completion<R> { | |
| private let closure: (R) -> Void | |
| private var cancelled = false | |
| /// `closure` is called upon completion, if not cancelled. | |
| init(closure: (R) -> Void) { | |
| self.closure = closure | |
| } | |
| import Accelerate.vImage | |
| func getImageBuffer(from pixelBuffer: CVPixelBuffer) -> vImage_Buffer? { | |
| var buffer = vImage_Buffer() | |
| let bitmapInfo = CGBitmapInfo(rawValue: CGBitmapInfo.byteOrder32Little.rawValue | CGImageAlphaInfo.first.rawValue) | |
| var cgFormat = vImage_CGImageFormat(bitsPerComponent: 8, | |
| bitsPerPixel: 32, | |
| colorSpace: nil, | |
| bitmapInfo: bitmapInfo, | |
| version: 0, |
| # in a terminal | |
| # python -m pip install --user opencv-contrib-python numpy scipy matplotlib ipython jupyter pandas sympy nose | |
| import cv2 | |
| import pandas as pd | |
| import numpy as np | |
| import imutils | |
| from scipy.spatial import distance as dist | |
| from imutils import perspective |
| // | |
| // Created by はるふ on 2017/12/11. | |
| // Copyright © 2017年 ha1f. All rights reserved. | |
| // | |
| import Foundation | |
| import CoreImage | |
| import AVFoundation | |
| extension CIFilter { |
| import UIKit | |
| import PlaygroundSupport | |
| let view = UIView(frame: CGRect(x: 0, y: 0, width: 375, height: 647)) | |
| view.backgroundColor = UIColor.white | |
| let shadowView = UIView(frame: CGRect(x:50, y: 50, width:250, height:250)) | |
| view.addSubview(shadowView) | |
| let someView = UIView(frame: CGRect(x:50, y: 50, width:250, height:250)) | |
| someView.backgroundColor = UIColor.white |
| import com.google.android.gms.common.GoogleApiAvailability | |
| import com.google.android.gms.tasks.Task | |
| import splitties.init.appCtx | |
| import kotlin.coroutines.experimental.suspendCoroutine | |
| val googleApiAvailability = GoogleApiAvailability.getInstance()!! | |
| inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx) | |
| @JvmName("awaitVoid") | |
| suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation -> |
| import com.google.android.gms.common.GoogleApiAvailability | |
| import com.google.android.gms.tasks.Task | |
| import splitties.init.appCtx | |
| import kotlin.coroutines.experimental.suspendCoroutine | |
| val googleApiAvailability = GoogleApiAvailability.getInstance()!! | |
| inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx) | |
| @JvmName("awaitVoid") | |
| suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation -> |
| class RgbConversion(val rs: RenderScript, private val feedSize: Size, private val hasRotate: Boolean = true) { | |
| private var mInputAllocation: Allocation? = null | |
| private var mOutputAllocation: Allocation? = null | |
| private var mRotatedAllocation: Allocation? = null | |
| private val yuvToRgb = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs)) | |
| private val rotator = ScriptC_rotator(rs) | |
| var bufferCallback: ((ByteBuffer) -> Unit)? = null | |
| val inputSurface: Surface | |
| get() = mInputAllocation!!.surface |
| // | |
| // ViewController.swift | |
| // CameraFilter | |
| // | |
| import UIKit | |
| import AVFoundation | |
| class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate { | |
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user