Skip to content

Instantly share code, notes, and snippets.

package com.reactlibrary;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.facebook.react.bridge.ReactApplicationContext;
import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
@zoecarver
zoecarver / gist:f0544f56328545fe920f4db7d407b029
Last active August 8, 2018 00:33
[updated - single thread - no custom ssl] build log of nodejs mobile
This file has been truncated, but you can view the full file.
rm -f -r out/Makefile node node_g out/Release/node \
out/Release/node.exp
rm -f -r node_modules
rm -f test.tap
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
@zoecarver
zoecarver / log
Created August 8, 2018 17:30
[second] nodejs build log
This file has been truncated, but you can view the full file.
rm -f -r out/Makefile node node_g out/Release/node \
out/Release/node.exp
rm -f -r node_modules
rm -f test.tap
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
This file has been truncated, but you can view the full file.
rm -f -r out/Makefile node node_g out/Release/node \
out/Release/node.exp
rm -f -r node_modules
rm -f test.tap
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
@zoecarver
zoecarver / main.py
Created November 26, 2018 16:17
Python script for face tracking
import cv2
from cv2 import COLOR_RGB2GRAY
from skimage.feature import hog
from sklearn.model_selection import train_test_split
from sklearn.svm import LinearSVC
import matplotlib.pyplot as plt
from glob import glob
people_glob = glob('dataset/people/*.png')
background_glob = glob('dataset/not-people/*.png')
people = []
not_people = []
for filename in people_glob:
image = cv2.imread(filename, COLOR_RGB2GRAY)
image = cv2.resize(image, (64, 64))
people.append(image)
def get_hog_features(image, visualize=False):
features = hog(
image,
orientations=9,
pixels_per_cell=(8, 8),
cells_per_block=(2, 2),
visualize=visualize,
feature_vector=True,
block_norm='L1'
)
X = np.vstack([people_features, not_people_features])
y = np.concatenate([np.ones(people_len), np.zeros(not_people_len)])
train_x, test_x, train_y, test_y = train_test_split(X, y, test_size=0.2, shuffle=True)
classifier = LinearSVC(verbose=1)
classifier.fit(train_x, train_y)
print('Accuracy: %s' % classifier.score(test_x, test_y))
def randcolorvalue():
return float(randint(0, 255)) / 255
def randcolor():
return randcolorvalue(), randcolorvalue(), randcolorvalue()
def draw_boxes(image, boxes):
image = np.copy(image)
test_image = cv2.imread('test.jpg', COLOR_RGB2GRAY) # load test image
test_image = cv2.resize(test_image, (200, 400)) # resize
# get all sliding windows we want
search_windows = \
sliding_window(test_image, y_stop=200, window=(64, 64), overlap=(.7, .7)) + \
sliding_window(test_image, y_stop=250, window=(80, 80), overlap=(.6, .6)) + \
sliding_window(test_image, y_stop=300, window=(96, 96), overlap=(.5, .5)) + \
sliding_window(test_image, y_stop=350, window=(128, 128), overlap=(.4, .4))