Skip to content

Instantly share code, notes, and snippets.

View m1keall1son's full-sized avatar

Michael Allison m1keall1son

View GitHub Profile
@m1keall1son
m1keall1son / ImageRecorder.cs
Created June 15, 2021 20:02
Multithreaded Unity Recorder package PNG image sequence recorder class
using System;
using System.IO;
using System.Collections.Generic;
using UnityEditor.Recorder.Input;
using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Rendering;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Concurrent;
@m1keall1son
m1keall1son / SampleVideoAtomDump.txt
Last active March 8, 2019 20:16
MP4 Atom Dump from sample video 2
//ATOM DUMP FROM ORIGINAL FILE
[ftyp] size=8+24
major_brand = isom
minor_version = 200
compatible_brand = isom
compatible_brand = iso2
compatible_brand = avc1
compatible_brand = mp41
[free] size=8+0
@m1keall1son
m1keall1son / WMFVideoReadWrite.cpp
Last active February 19, 2022 07:48
C++ Program to read a video file and re-encode it to H.264 / AAC using Windows Media Foundation
//USAGE $ program.exe path\\to\\video-in.mp4 path\\to\\video-out.mp4
#include <iostream>
#include <string>
#include <mfidl.h> // Media Foundation interfaces
#include <mfapi.h> // Media Foundation platform APIs
#include <mferror.h> // Media Foundation error codes
#include <mfreadwrite.h>
#include <wmcontainer.h> // ASF-specific components
@m1keall1son
m1keall1son / AnimationController.cpp
Last active May 24, 2017 22:22
Animation Controller firmware
///this code is not tested
////.h
struct Color {
Color(){}
Color( int r, int g, int b ):r( static_cast<float>(r) ),g( static_cast<float>(g) ),b( static_cast<float>(b) ){}
float r{0};
float g{0};
float b{0};
};
@m1keall1son
m1keall1son / AnimationController.js
Last active May 24, 2017 22:24
Animation Controller example
//this code is not tested
class Color {
constructor(r, g, b){
if(arguments.length === 1){
this.r = r.r;
this.g = r.g;
this.b = r.b;
}else{
this.r = r;
@m1keall1son
m1keall1son / ArduinoC.cpp
Last active January 3, 2017 12:28
read serial from arduino on linux
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
@m1keall1son
m1keall1son / cvColorBalance.cpp
Created December 28, 2016 22:30
Simple Color Balancing in OpenCV
//! in - src image to balance
//! out - empty mat to merge results into
//! percent - 0 - 100. somewhere around 20 looks good.
void colorBalance(Mat& in, Mat& out, float percent) {
assert(in.channels() == 3);
assert(percent > 0 && percent < 100);
float half_percent = percent / 200.0f;
vector<Mat> tmpsplit; split(in,tmpsplit);