Skip to content

Instantly share code, notes, and snippets.

@Varun-MS
Varun-MS / FunctionTimer.h
Last active May 4, 2019 14:53
A function timer I wrote that automatically times functions, and prints the times to the console of an OpenFrameworks app. It needs to be declared on the stack to work correctly (uses the principle of object lifetimes for timing). I use it to profile the performance of my AI Algorithms.
#pragma once
#include <chrono>
#include <ofLog.h>
#include <string>
namespace AI
{
namespace PerformanceTools
{
@kylemcdonald
kylemcdonald / Camera2d.h
Created January 30, 2019 22:47
2D Zoomable Region for openFrameworks. Scroll to zoom. Left click and drag to translate.
class Camera2d : public ofCamera {
private:
ofVec2f mouseStart;
ofVec2f startPosition;
float zoom;
float maxZoom = .01;
float minZoom = 1;
float zoomSpeed = 1. / 500;
public:
void setup() {
@kylemcdonald
kylemcdonald / ZoomableRegion2D.h
Created January 30, 2019 22:27
2D Zoomable Region for openFrameworks. Right click and drag to zoom. Left click and drag to translate.
#pragma once
#include "ofMain.h"
class ZoomableRegion2D {
private:
float speed = 5;
float zoom = 1;
ofVec2f offset, startOffset, startDrag;
float startZoom;
@companje
companje / main.cpp
Last active May 4, 2019 14:54
show latitude longitude mouse rotating globe in openFrameworks
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofImage earth;
ofQuaternion qTo;
void setup() {
ofBackground(0);
@companje
companje / main.cpp
Created July 31, 2018 21:38
Latitude Longitude experiment in openFrameworks
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofImage earth;
ofQuaternion qTo;
void setup() {
ofBackground(0);
@shiyuugohirao
shiyuugohirao / ofBase64.h
Last active April 13, 2019 04:31
openFrameworks + simple Base64 encoder
//
// ofBase64.h
//
// Created by shugohirao on 2018/05/09.
//
#pragma once
#include "Poco/Base64Encoder.h"
namespace ofBase64 {
@mfandl
mfandl / file.cc
Created February 9, 2018 20:59
openFrameworks + ofxVideoRecorder setup to record video with h264
/**
* openFrameworks + ofxVideoRecorder setup to record video with h264
* You will need ffmpeg and libx264 in your system. On mac, you can use homebrew.
* reason for yuv420p:
* 'QuickTime only supports YUV planar color space with 4:2:0 chroma subsampling (use -vf format=yuv420p or -pix_fmt yuv420p) for H.264 video.'
* as mentioned here: https://trac.ffmpeg.org/wiki/Encode/H.264
*/
recorder.setVideoCodec("libx264");
string fileName = ofToDataPath("v" + ofGetTimestampString() + ".mp4");
@kylemcdonald
kylemcdonald / CameraSphere.cpp
Created October 30, 2017 07:22
Unwarp an equirectangular projection into a perspective projection using openFrameworks.
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofImage img;
ofEasyCam cam;
ofSpherePrimitive sphere;
float zoom = 0.5;
float xoff = 0;
float yoff = 0;
@baymaxium
baymaxium / content.md
Created October 18, 2017 09:13
如何用深度学习训练一个像你一样会聊天的机器人?

原文:CSDN大数据

↑ 点击上方蓝字关注我们,和小伙伴一起聊技术!

聊天机器人到底是什么呢?说白了,就是计算机程序通过听觉或文本方法进行对话。当今最流行的四个对话机器人是:苹果的Siri、微软Cortana、谷歌助理、亚马逊的Alexa。他们能够帮你查比分、打电话,当然,偶尔他们也会出错。

本文主要会详细介绍聊天机器人在文本方面的运作,我们将看到如何使用深度学习模型训练聊天机器人用我们所希望的方式在社交媒体上进行对话。

@dlublin
dlublin / ffmpeg-hap-readme.md
Created April 18, 2017 13:40
Encoding to Hap from the command line using FFmpeg

Encoding to Hap from the command line using FFmpeg

For users who prefer working with a command line or need to access advanced encoding settings for Hap the popular FFmpeg library can be used to work with Hap movies.

  1. If this is your first time using FFmpeg you may need to install it on your system, or compile it from source. In either case be sure that Snappy is enabled as part of the binary. If you already have FFmpeg on your system with Snappy enabled, you can skip this step.

    You can check that your version of FFmpeg can encode Hap using

    ffmpeg -encoders | grep hap