Skip to content

Instantly share code, notes, and snippets.

@Ajk4
Ajk4 / rotation_params_from_rotation_matrix.py
Last active April 9, 2019 09:23
pitch_roll_yaw from rotation_matrix
# Based on https://gist.github.com/crmccreary/1593090
import numpy as np
import math
def isclose(x, y, rtol=1.e-5, atol=1.e-8):
return abs(x-y) <= atol + rtol * abs(y)
def euler_angles_from_rotation_matrix(R):
yaw = 0.0
@Ajk4
Ajk4 / point_cloud_to_depth_map.py
Last active January 26, 2024 12:25
Convert point cloud to depth map
import numpy as np
def pointcloud_to_depth_map(pointcloud: np.ndarray, theta_res=150, phi_res=32, max_depth=50, phi_min_degrees=60,
phi_max_degrees=100) -> np.ndarray:
"""
All params are set so they match default carla lidar settings
"""
assert pointcloud.shape[1] == 3, 'Must have (N, 3) shape'
assert len(pointcloud.shape) == 2, 'Must have (N, 3) shape'
@Ajk4
Ajk4 / main.py
Last active August 25, 2017 10:39
Keras - problem with session in multi-threaded environment.
from scipy import io
import numpy as np
from keras.utils import np_utils
from sklearn.model_selection import train_test_split
from PIL import Image
from sklearn.metrics import confusion_matrix
import tensorflow as tf
from threading import Thread
from keras.models import Sequential
@Ajk4
Ajk4 / actions.ts
Last active July 20, 2017 08:36
Redux in TypeScript
export type UiAction = {
type: 'SET_INVITE_OTHER_USERS_MODAL_OPENED',
modalOpened: boolean
} | {
type: 'SET_IMAGES_FILTER_QUERY',
filterQuery: string
}
export const setInviteOtherUsersModalOpened = (modalOpened: boolean): UiAction => ({
type: 'SET_INVITE_OTHER_USERS_MODAL_OPENED',