Skip to content

Instantly share code, notes, and snippets.

Roy Shilkrot royshil

Block or report user

Report or block royshil

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@royshil
royshil / gist:6318407
Created Aug 23, 2013
A CMake Find module for FFMPEG that will tear the HD apart looking for the libs and includes ;)
View gist:6318407
# - Try to find FFMPEG
# Once done this will define
# FFMPEG_FOUND - System has FFMPEG
# FFMPEG_INCLUDE_DIRS - The FFMPEG include directories
# FFMPEG_LIBRARIES - The libraries needed to use FFMPEG
# FFMPEG_LIBRARY_DIRS - The directory to find FFMPEG libraries
#
# written by Roy Shilkrot 2013 http://www.morethantechnical.com/
#
@royshil
royshil / gist:7752114
Created Dec 2, 2013
Patch for exact-image to support new libPNG
View gist:7752114
diff --git a/codecs/png.cc b/codecs/png.cc
index be70a53..65cee67 100644
--- a/codecs/png.cc
+++ b/codecs/png.cc
@@ -23,6 +23,12 @@
#include "png.hh" #include "Endianess.hh"
+#define png_infopp_NULL (png_infopp)NULL
+#define int_p_NULL (int*)NULL
+#define png_bytepp_NULL (png_bytepp)NULL
+#define Z_BEST_COMPRESSION 100
@royshil
royshil / GDoc LaTex Colorizer
Last active Dec 30, 2015
LaTeX Colorizer for Google Documents.Just add it as a script to your GDoc via Tools -> Script Editor (then create a blank script and copy-paste). Don't forget to plug in your GDoc ID in the right place (you can take it right off the URL). Rob Miller's group from CSAIL also created a similar thing: https://github.com/uid/gdoc-downloader/blob/mast…
View GDoc LaTex Colorizer
function onOpen() {
// Add a menu with items to colorize the whole document or colorize around the cursor only
DocumentApp.getUi().createMenu('LaTeX')
.addItem('Colorize LaTeX global', 'searchAndReplace')
.addItem('Colorize LaTeX local', 'searchAndReplaceLocal')
.addToUi();
}
/**
* "normalize" the text, remove coloring
@royshil
royshil / main.cpp
Created Dec 12, 2013
Simple HID "driver" for the AIPTEK HyperPen model T-6000U using libHID
View main.cpp
/*
* Simple HID "driver" for the AIPTEK HyperPen model T-6000U using libHID
* http://bfoz.github.io/libhid/
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Roy Shilkrot
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@royshil
royshil / NRUBSOpenCV.cpp
Last active Oct 7, 2019
Simple 2D NURBS renderer for OpenCV, reading a DXF file.
View NRUBSOpenCV.cpp
/*
* Simple 2D NURBS renderer for OpenCV, reading DXF files
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Roy Shilkrot
*
* Updated: Nov 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@royshil
royshil / GDocLaTeXGUI.command
Last active Aug 29, 2015
A tiny Tk GUI for compiling GDoc/LaTeX, requires Rob Miller's gdoc2latex (which you can find here: https://github.com/uid/gdoc-downloader)
View GDocLaTeXGUI.command
#!/usr/bin/env python
import Tkinter as tk
import subprocess
import os
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
@royshil
royshil / SoundUtils.cpp
Created Oct 13, 2014
This is a simple Qt wrapper around SoundTouch - a very nice Audio Time-Scale library.
View SoundUtils.cpp
/*
* SoundUtils.cpp
*
* Created on: Oct 9, 2014
* Author: roy_shilkrot
*/
#include <QDebug>
#include <QBuffer>
View SimplestColorBalance.cpp
/// perform the Simplest Color Balancing algorithm
void SimplestCB(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);
for(int i=0;i<3;i++) {
//find the low and high precentile values (based on the input percentile)
@royshil
royshil / OpenCV_Vertical_RLE.cpp
Created Jan 21, 2015
Run Length Encoding (vertical) on an OpenCV uchar Mat
View OpenCV_Vertical_RLE.cpp
#include <opencv2/opencv.hpp>
using namespace cv;
/**
* Compute RLE.
* RLE is encoded in a vector of vectors of (run length, value).
*
* @param patch_ the 8UC1 image to work on
* @param whichWay by which dimension? rows = 0, columns != 0
*/
@royshil
royshil / SimpleVideoStabilizer.cpp
Last active Sep 16, 2019
A simple video stabilizer in OpenCV, based on goodFeaturesToTrack, calcOpticalFlowPyrLK and estimateRigidTransform.
View SimpleVideoStabilizer.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <iostream>
using namespace cv;
using namespace std;
You can’t perform that action at this time.