Skip to content

Instantly share code, notes, and snippets.

View MiaoDX's full-sized avatar
🎯
Focusing

MiaoDX MiaoDX

🎯
Focusing
View GitHub Profile
@MiaoDX
MiaoDX / Numba_16.04.md
Created July 1, 2020 13:36 — forked from dapperfu/Numba_16.04.md
Installing Numba (requiring llvm) on Ubuntu 16.04

Installing Numba from pip fails since Ubuntu 16.04 only has up through llvm-3.8 in its repositories.

As of version 0.16.0, llvmlite requires LLVM 3.9. It does not support earlier or later versions of LLVM.

Install LLVM-3.9 through the LLVM's Debian/Ubuntu packages (http://apt.llvm.org/).

Add:

@MiaoDX
MiaoDX / undistort_detection_result.py
Last active December 18, 2019 09:52
undistort_detection_result.py
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
#
# Demo of un-distorting 2D bbox detection result instead of image for potential speedup
# 114 484 67472.0 139.4 0.2 dets_tweak = tweak_dets_by_undistort_points_vec(dets, K=K_cam, distortion=distortion, R=undistort_R, P=undistort_P)
# 117 484 2853099.0 5894.8 6.3 im_undistort = distort_fun(im)
#
# Ref:
# https://stackoverflow.com/questions/8499984/how-to-undistort-points-in-camera-shot-coordinates-and-obtain-corresponding-undi
# FIXME, tried to use mapping array, but failed
"""
KITTI stereo disparity 3 pixel error, corrected
REFERENCES:
* [PMSNet code](https://github.com/JiaRenChang/PSMNet/blob/b6520ff9b77168e3dfe3485f8bf6a2a798361d85/finetune.py)
* [type converter](https://github.com/traveller59/torchplus/blob/master/tools.py)
MATLAB code:
```
% disp_error.m
@MiaoDX
MiaoDX / pixel_error.py
Last active May 11, 2022 00:02
PMSNet stereo disparity 3 pixel error at test phase
"""
KITTI stereo disparity 3 pixel error
REFERENCES:
* [PMSNet code](https://github.com/JiaRenChang/PSMNet/blob/b6520ff9b77168e3dfe3485f8bf6a2a798361d85/finetune.py)
* [type converter](https://github.com/traveller59/torchplus/blob/master/tools.py)
MATLAB code:
```
% disp_error.m
@MiaoDX
MiaoDX / rotation_in_pose_seq.py
Created November 23, 2018 12:29
By inverse rotation, or in other world, rotate camera from world origin and rotate back, will have completely different angles, if the sequence are maintained.
"""
Rotation inverse & different sequence.
By inverse rotation, or in other world, rotate camera from world origin and rotate back, will have completely different angles, if the sequence are maintained.
"""
import transforms3d
import math
if __name__ == '__main__':
pitch, yaw, roll = 10, 20, 30
@MiaoDX
MiaoDX / rotation_in_pose.py
Created November 23, 2018 12:10
Pose will bring point in world into camera coordinate, [R|t]=[R|-RC] R rotate camera to world coordinate, C is camara in world coordinate, and t is world origin in camera coordinate.
"""
Camera pose=[R|t]=[R|-RC], R: rotate camera to world, C: camera in world, t: world origin in camera coordinate.
"""
import transforms3d
import math
import numpy as np
def pitch_yaw_roll_C_apply_point(pitch, yaw, roll, C, p_w):
@MiaoDX
MiaoDX / euler_rotation_transform.py
Last active November 22, 2018 08:45
Transform various rotation sequences to YXZ (UnrealCV format), so the rotation sequence matters.
"""
Transform various rotation sequences to YXZ (UnrealCV format), so the rotation sequence matters.
"""
import transforms3d
import math
if __name__ == '__main__':
# pitch, yaw, roll = 10, 20, 30