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 /
Last active Dec 15, 2019
Warp an image to cylindrical coordinates for cylindrical panorama stitching, using Python OpenCV
import cv2
import numpy as np
def cylindricalWarp(img, K):
"""This function returns the cylindrical warp for a given image and intrinsics matrix K"""
h_,w_ = img.shape[:2]
# pixel coordinates
y_i, x_i = np.indices((h_,w_))
X = np.stack([x_i,y_i,np.ones_like(x_i)],axis=-1).reshape(h_*w_,3) # to homog
Kinv = np.linalg.inv(K)
royshil /
Last active Jan 21, 2020
A script to copy Tensorflow headers to build custom C++ applications
# inspired by a part of:
# Assumes Tensorflow libraries and were built with Bazel,
# and the ${TF_ROOT}/tensorflow/contrib/makefile/ script was executed.
set -o nounset
set -o errexit
set -o pipefail
royshil / BUILD
Created Mar 8, 2018
Scripts for cross-compiling Tensorflow 1.5+ for the Jetson TK1 arm-based SoM
package(default_visibility = ["//visibility:public"])
name = "toolchain",
toolchains = {
"armeabi-v7a|compiler": ":cc-compiler-armeabi",
"k8|compiler": ":cc-compiler-local",
royshil /
Last active Jan 27, 2018
Setup an automatic Tensorflow-CUDA-Docker-Jupyter machine on Google Cloud Platform
# First you must install the 4.4.0 kernel:
# $ sudo apt-get install linux-image-4.4.0-112-generic
# find all the other kernels and remove them:
# $ sudo apt-get purge linux-image-4.13.0-1008-gcp
# $ sudo update-grub
# $ sudo reboot
sudo apt-get update && sudo apt-get install -y \
import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from import astronaut
from skimage.util import img_as_float
import maxflow
from scipy.spatial import Delaunay
royshil /
Created Sep 29, 2017
Laplacian pyramid blending with a mask in OpenCV-Python
# adapted from
import cv2
import numpy as np
def Laplacian_Pyramid_Blending_with_mask(A, B, m, num_levels = 6):
# assume mask is float32 [0,1]
# generate Gaussian pyramid for A,B and mask
GA = A.copy()
royshil / circle_of_deadlines.html
Created Jun 20, 2017
A d3v4 visualization of yearly submission deadlines (conference, grant, etc). Tool for the hungry assistant professor.
View circle_of_deadlines.html
<!DOCTYPE html>
<meta charset="utf-8">
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
royshil /
Last active Feb 12, 2020
How to implement Touch-to-Focus in Android using Camera2 APIs
//Override in your touch-enabled view (this can be differen than the view you use for displaying the cam preview)
public boolean onTouch(View view, MotionEvent motionEvent) {
final int actionMasked = motionEvent.getActionMasked();
if (actionMasked != MotionEvent.ACTION_DOWN) {
return false;
if (mManualFocusEngaged) {
Log.d(TAG, "Manual focus already engaged");
return true;
royshil /
Last active Oct 8, 2019
Download All PDFs in a URL using Python mechanize
# This is kind-of based off of this:
import cookielib
import urllib2
import mechanize
from time import sleep
import os
import cgi
# A routine to download a file from a link, by simulating a click on it
royshil / GLWidgetOpenGL4Example.cpp
Last active Jul 17, 2019
Simple example of OpenGL 4.1 in a QGLWidget
View GLWidgetOpenGL4Example.cpp
* GLWidgetOpenGL4Example.h
* Created on: Apr 23, 2016
* Author: roy_shilkrot
class GLWidgetOpenGL4Example : public QGLWidget {
You can’t perform that action at this time.