Skip to content

Instantly share code, notes, and snippets.

View yjxiong's full-sized avatar
💒
Working from home

yjxiong

💒
Working from home
View GitHub Profile

To use OpenCV's VideoWriter class to write an H264 encoded video, one would encounter some error like

Could not open codec libx264: unspecified error

Here is the trick. Beforehand, one has to make sure

  • --enable-libx264 is switched on in ffmpeg
  • OpenCV is downloaded in sources.
@yjxiong
yjxiong / OpenCV.sh
Created July 7, 2016 04:03
Install OpenCV with ffmpeg and CUDA
version="2.4.12"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
@yjxiong
yjxiong / dummyfig.tex
Created November 13, 2016 13:31 — forked from dpgettings/dummyfig.tex
Fancy placeholder figures in LaTeX
%% This part goes in preamble
\newcommand{\dummyfig}[1]{
\centering
\fbox{
\begin{minipage}[c][0.33\textheight][c]{0.5\textwidth}
\centering{#1}
\end{minipage}
}
}
@yjxiong
yjxiong / pnp.py
Last active February 3, 2024 03:32
SolvePnP for Head Pose Estimation
"""
Light weight head pose estimation with SolvePnP
Author: Yuanjun Xiong
"""
# parameters
fx = 1
# model points
@yjxiong
yjxiong / tracking.py
Created August 14, 2018 04:36
Sample code for tracking
import cv2
import sys
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
assert minor_ver >= 2, "Must use opencv 3.2.x up"
if __name__ == '__main__' :
# Set up tracker.
# Instead of MIL, you can also use