Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am billyzs on github.
  • I am bzs (https://keybase.io/bzs) on keybase.
  • I have a public key whose fingerprint is 17B5 6542 1A9C 50AF E3BD 1C7A 6EE4 DAA7 ACA1 FCAC

To claim this, I am signing this object:

@billyzs
billyzs / load_imu_data.m
Last active September 23, 2016 14:49
MATLAB helper function to load IMU data into matrices
function [ imu_data, gps_data ] = load_imu_data( file_name )
%load data from txt file containing IMU output
%written by Shao Zhou billyzs.728[at] gmail.com
% imu_data is n * 13 matrix that contains data fileds in the following sequence:
% Time
% Acceleration (x, y, z) in m/s
% Angular Velocity (p, q, r) in rad/s
% Magnetic field strength (x, y, z) in muT
% Roll, Pitch, Yaw in deg
@billyzs
billyzs / stl_render.py
Created August 20, 2016 15:49
# A script to generate spherical rendering of STL Files
#!/usr/bin/env python
# A script to generate spherical rendering of STL Files
# Use with python STL_viewer.py /path/to/folder
# or python STL_viewer.py /path/to/file
# Written by Billy Zhou (billyzs.728 # gmail.com)
import vtk
import argparse, os
@billyzs
billyzs / kmeans.py
Created August 20, 2016 15:44
OpenCV Kmeans algorithm
#!/usr/bin/env python
import numpy as np
import cv2
CRITERIA = (cv2.TERM_CRITERIA_MAX_ITER + cv2.TERM_CRITERIA_EPS, 5, 1.0)
YCBCR_BLACK = np.array([[0, 128, 128]], dtype='uint8')
def k_means(img, k, criteria=CRITERIA, show=False, attempts=5):
"""
@billyzs
billyzs / cpp_file_io_pcd.cpp
Last active January 27, 2017 03:14
example of file io in C++, converts a .pcd file to a vector of PointXYZ
#include "stdafx.h"
#include "util.h"
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <vector>
#include <cstdio>
#include <sstream>
@billyzs
billyzs / image_converter.py
Created June 7, 2016 00:26
a crude color segmentation
#!/usr/bin/env python
import sys
import rospy
import cv2
import numpy as np
# from std_msgs.msg import String
from sensor_msgs.msg import Image, PointCloud2
from cv_bridge import CvBridge, CvBridgeError