Emscriptenは、C++をJavaScriptにコンパイルする、LLVMベースのコンパイラ。
このドキュメントでは、特定のプロジェクトに依存せず、Emscripten向けに、CMakeを使用してC++プロジェクトをビルドする方法を紹介する。
このドキュメントで扱う各ツールのバージョンは、以下のものとする:
| var gulp = require('gulp'); | |
| var sourcemaps = require('gulp-sourcemaps'); | |
| var source = require('vinyl-source-stream'); | |
| var buffer = require('vinyl-buffer'); | |
| var browserify = require('browserify'); | |
| var watchify = require('watchify'); | |
| var babel = require('babelify'); | |
| function compile(watch) { | |
| var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
| //人物インデックスフレームデータを_bodyDataにコピー | |
| bodyIndexFrame.CopyFrameDataToArray(_bodyData); | |
| //depthframeからカラースペースに | |
| kinect.CoordinateMapper.MapDepthFrameToColorSpace(_depthData, _colorPoints); | |
| for (int depthIndex=0; depthIndex < length; depthIndex++){ | |
| byte player = _bodyData[depthIndex]; | |
| //もし人物の領域ならば | |
| if (player != 0xff){ | |
| ColorSpacePoint colorPoint = _colorPoints[depthIndex]; | |
| //整数に変換している |
| #!/bin/env python | |
| import numpy as np | |
| import scipy.misc | |
| from scipy.fftpack import dct, idct | |
| import sys | |
| H = 128 | |
| W = 128 | |
| lenna = scipy.misc.imresize(scipy.misc.lena(), (H, W)).astype(float) |
| // 最初にこの関数を実行し、ログに出力されたURLにアクセスしてOAuth認証する | |
| function twitterAuthorizeUrl() { | |
| Twitter.oauth.showUrl(); | |
| } | |
| // OAuth認証成功後のコールバック関数 | |
| function twitterAuthorizeCallback(request) { | |
| return Twitter.oauth.callback(request); | |
| } |
| typedef enum : NSUInteger { | |
| MTLPixelFormatInvalid = 0, | |
| /* Ordinary 8 bit formats */ | |
| MTLPixelFormatA8Unorm = 1, | |
| MTLPixelFormatR8Unorm = 10, | |
| MTLPixelFormatR8Unorm_sRGB = 11, | |
| MTLPixelFormatR8Snorm = 12, | |
| MTLPixelFormatR8Uint = 13, | |
| MTLPixelFormatR8Sint = 14, |
| // context: m_width, m_height of m_texture (MTLTexture), m_path (NSString) location of the image | |
| // assumptions: loading RGBA8 image from main bundle | |
| NSString *const path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:m_path]; | |
| UIImage *const image = [UIImage imageWithContentsOfFile:path]; | |
| const NSUInteger bitsPerComponent = 8; | |
| const NSUInteger bytesPerRow = ((bitsPerComponent * 4 / 8) * m_width); | |
| const CGBitmapInfo bitmapInfo = CGBitmapInfo(kCGImageAlphaPremultipliedLast); |
| using UnityEngine; | |
| using System.Collections; | |
| using System.Runtime.InteropServices; | |
| public class VideoPicker : MonoBehaviour { | |
| public Texture2D shareButtonImage; // Use this for initialization | |
| [DllImport("__Internal")] | |
| private static extern void OpenVideoPicker(string game_object_name, string function_name); |
| import cairo,argparse,random | |
| #TEST: https://jcmellado.github.io/js-aruco/getusermedia/getusermedia.html | |
| #http://terpconnect.umd.edu/~jwelsh12/enes100/markergen.html | |
| #http://terpconnect.umd.edu/~jwelsh12/enes100/markers.js | |
| markers_opts = [[False,True,True,True,True],[False,True,False,False,False] | |
| ,[True,False,True,True,False],[True,False,False,False,True]]; | |
| import string | |
| digs = string.digits + string.letters |
The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.
The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.
If you do load the