Skip to content

Instantly share code, notes, and snippets.

View yuki-inaho's full-sized avatar

yuki-inaho

View GitHub Profile
@yuki-inaho
yuki-inaho / ndarray_median_with_completion.py
Last active September 10, 2020 09:39
ndarray element-wise median with completion check
'''
$ python ndarray_median_with_completion.py
[[1 2 1]
[2 1 2]
[1 2 1]]
'''
from typing import List
import numpy as np
@yuki-inaho
yuki-inaho / convert_see3cam_toml_720p_to_1080p.py
Last active September 9, 2020 16:00
convert intrinsic parameters of see3cam so as to conform 720p to 1080p
import os
import toml
import click
from collections import OrderedDict
from ruamel import yaml # "import yaml" cannot deal with nested list
import pdb
import copy
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@yuki-inaho
yuki-inaho / Dockerfile
Last active June 23, 2020 07:03
Install vscode on docker (partitional)
# vscode
RUN wget -O vscode-amd64.deb https://go.microsoft.com/fwlink/?LinkID=760868
RUN apt-get update && apt-get install -y gdebi
RUN yes | gdebi vscode-amd64.deb
RUN rm vscode-amd64.deb
@yuki-inaho
yuki-inaho / EmptyReaderDCAM710.cpp
Last active May 18, 2020 11:51
To check function call statistics without depth image processing
#include <vector>
#include <cmath>
#include <iostream>
#include "PicoZense_api.h"
using namespace std;
int main(int argc, char *argv[])
{
PsReturnStatus status;
int32_t deviceIndex = 0;
@yuki-inaho
yuki-inaho / PointCloud2_to_PCD.py
Created March 18, 2020 13:49
PointCloud2_to_PCD.py
import ros_numpy
import rospy
from sensor_msgs.msg import PointCloud2
import open3d as o3d
class PointCloud2Converter:
def __init__(self):
self.pc_npy = None
self.sub_pc = rospy.Subscriber('/aspara_detector/ground_point_cloud', PointCloud2, self.callback_pcl)
self.pcd = o3d.geometry.PointCloud()
@yuki-inaho
yuki-inaho / colorize_long_int_img.py
Last active January 14, 2020 02:27
Colorize Long Int 1Channel Images (such as IR, Depth...)
def colorize_long_int_img(img, max_var):
img_colorized = np.zeros([img.shape[0],img.shape[1],3]).astype(np.uint8)
img_colorized[:,:,1]=255
img_colorized[:,:,2]=255
img_hue = img.copy().astype(np.float32)
img_hue[np.where(img_hue > max_var)] = 0
zero_idx = np.where((img_hue>max_var) | (img_hue == 0))
img_hue *= 255.0/max_var
img_colorized[:,:,0] = img_hue.astype(np.uint8)
img_colorized = cv2.cvtColor(img_colorized, cv2.COLOR_HSV2RGB)
import sys
import re
import os
import glob
import shutil
import copy
try :
import cv2
except :