Skip to content

Instantly share code, notes, and snippets.

View HViktorTsoi's full-sized avatar

KINO HViktorTsoi

  • BUAA
View GitHub Profile
#!/bin/sh
#
# This script should be run via curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via fetch:
# sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
@HViktorTsoi
HViktorTsoi / numba_2d_np_array.py
Created April 15, 2022 13:55
numba 2d numpy array signature
@nb.njit(nb.float64[:, :](nb.float64[:, :], nb.float32))
@HViktorTsoi
HViktorTsoi / BLH2XYZ.py
Created March 22, 2022 11:22
BLU coord to XYZ coord.
def BLH2XYZ(B, L, H):
'''B: lat L:lon H: height'''
Lat, Lon = B, L
N, E, h = 0, 0, 0
L0 = (int((L - 1.5) / 3.0) + 1) * 3.0 #
a = 6378245.0 #
F = 298.257223563 #
@HViktorTsoi
HViktorTsoi / NonBlockVisualizer.py
Created March 13, 2022 19:09
Open3D non-blocking visualizer
import open3d as o3d
import time
class NonBlockVisualizer:
def __init__(self, point_size=2, background_color=[0, 0, 0]):
self.__visualizer = o3d.visualization.Visualizer()
self.__visualizer.create_window()
opt = self.__visualizer.get_render_option()
opt.background_color = np.asarray(background_color)
opt = self.__visualizer.get_render_option()
@HViktorTsoi
HViktorTsoi / ros_camera_info.yaml
Created December 16, 2021 09:18
demo camera info yaml file
image_width: 640
image_height: 480
camera_name: dope_webcam_0
camera_matrix:
rows: 3
cols: 3
data: [641.5, 0, 320.0, 0, 641.5, 240.0, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
@HViktorTsoi
HViktorTsoi / yesense_utc.c
Created November 4, 2021 14:21
insert yesense utc timestamp
//
// Created by hvt on 2021/11/3.
//
#include <stddef.h>
#include <stdio.h>
enum PARSE_STATES {
FIND_HEAD_0,
FIND_HEAD_1,
FIND_LENGTH,
@HViktorTsoi
HViktorTsoi / image_devignetting.py
Last active March 13, 2023 02:15
A simple implementation of image devignetting.
def devignetting(image, radius_sigma=0.3, amount=0.7, power=1.1):
"""
:param image: input image
:param radius_sigma: vignetting radius = radius_sigma * image width
:param amount: the amount of exposure increment for devignetting
:param power: increase this will add extra exposure increment on image border
:return:
"""
@HViktorTsoi
HViktorTsoi / omni_projection.py
Last active September 9, 2022 03:12
opencv python 3d->2d omni projection
import cv2
import numpy as np
import matplotlib.pyplot as plt
K = np.array([
[1377.4254511359, 0, 1054.3015274037],
[0, 1373.0788259424, 760.6952319349],
[0, 0, 1],
]).astype(np.float32)
D = np.array([-0.5522170592, 0.2365604514, 0.0021662078, -0.0028341398]).astype(np.float32)
@HViktorTsoi
HViktorTsoi / gitignore.sh
Created July 3, 2021 09:06
Create gitignore immediately.
touch .gitignore && echo '.idea\ncmake-build-debug\n.vscode' > .gitignore
@HViktorTsoi
HViktorTsoi / numpy_2_pointcloud2.py
Created June 19, 2021 05:33
Convert numpy array to PointCloud2 msg
import numpy as np
import ros_numpy
from sensor_msgs.msg import PointCloud2
"""
pc: 2d numpy array of shape (N, 4)
"""
pc_array = np.zeros(len(pc), dtype=[