cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \
-D PYTHON_EXECUTABLE=/home/yiming/.miniconda/bin/python \
-D WITH_CUDA=ON \
-D WITH_MATLAB=ON \
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# update systems | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
# system essentials | |
sudo apt-get -qq install build-essential git wget cmake curl | |
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils | |
sudo apt-get -qq install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev |
VideoReader : Could not read file due to an unexpected error. Reason: Unable to initialize the video properties
sudo apt install ubuntu-restricted-extras
Make sure the installed version of MATLAB supports the installed version of CUDA. This is very important. I compiled OpenCV with CUDA9.0 and try to compile a mexFunction calling OpenCV CUDA functions in Matlab R2018b. They this release only supports CUDA9.1 so I rolled back to R2018a.
Reference:
GPU Support by Release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%// This make.m is for MATLAB | |
%// Function: compile c++ files which rely on OpenCV for Matlab using mex | |
%// Author : zouxy | |
%// Date : 2014-03-05 | |
%// HomePage : http://blog.csdn.net/zouxy09 | |
%// Email : [email protected] | |
%// Modified by Yiming Lin to support OpenCV3 and Ubuntu | |
%// Date 2018-10-08 | |
%% Please modify your path of OpenCV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
#For dlib’s 68-point facial landmark detector: | |
FACIAL_LANDMARKS_68_IDXS = OrderedDict([ | |
("mouth", (48, 68)), | |
("inner_mouth", (60, 68)), | |
("right_eyebrow", (17, 22)), | |
("left_eyebrow", (22, 27)), | |
("right_eye", (36, 42)), | |
("left_eye", (42, 48)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import call | |
from glob import glob | |
import threading | |
import queue | |
anno_files = glob('./*.csv') | |
vids = [] | |
for af in anno_files: | |
with open(af) as f: | |
lines = f.readlines() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import subprocess | |
import shlex | |
import json | |
# function to find the resolution of the input video file | |
def findVideoMetada(pathToInputVideo): | |
cmd = "ffprobe -v quiet -print_format json -show_streams" | |
args = shlex.split(cmd) | |
args.append(pathToInputVideo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# asssume you're in the dlib | |
cd dlib && mkdir build-armeabi-v7a && cd build-armeabi-v7a; | |
$ANDROID_CMAKE \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=../../../dlib-build-armeabi-v7a \ | |
-DANDROID_NDK=$ANDROID_NDK \ | |
-DANDROID_TOOLCHAIN=clang \ | |
-DANDROID_ABI=armeabi-v7a \ | |
-DANDROID_NATIVE_API_LEVEL=26 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installs Zsh with Oh-My-Zsh without root privileges | |
# | |
# Instructions | |
# 1) bash install_zsh.sh | |
# 2) edit .zshrc and add the path to your Zsh binary to the PATH variable | |
# 3) add `set-option -g default-shell <path to zsh>/bin/zsh` to `~/.tmux.conf` | |
# | |
# References: https://www.drewsilcock.co.uk/compiling-zsh | |
# | |
# ## Ncruses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
tips from Jie: | |
1) Put worker_proc in a py file. The code may not work properly if you define it directly in your notebook. On the other hand, dispenser_proc can be defined in the notebook. | |
2) Use multiprocessing.Queue, not queue.Queue. | |
3) It's essential to have a job dispenser thread. Multiprocessing queue has a finite capacity. If you send jobs from your main thread, your code could hang. | |
If dispensing jobs in the main thread, it may hang. Reason: workers try to put stuff into the result queue, result queue becomes full, the main thread is not reading from result queue because it still tries to put stuff into the job queue, the workers hang such that they won’t read from the job queue, both workers are main thread hang | |
4) I use None to indicate 'end of queue'. It's important for the worker_proc to put None back into the job_queue once it gets a None, otherwise other workers may hang. | |
""" |