Skip to content

Instantly share code, notes, and snippets.

View mpkuse's full-sized avatar

Manohar Kuse mpkuse

View GitHub Profile
@mpkuse
mpkuse / opencv-filestorage.cpp
Created December 5, 2019 04:18
OpenCV 3 Read Write FileStorage YAML Example
//
// OpenCV provides an easy class interface for read and write cv::Mat
// can also use these with Eigen by converting eigen mat to cv::Mat using
// cv::cv2eigen() and cv::eigen2cv()
// Writing to file
cv::FileStorage storage("test.yml", cv::FileStorage::WRITE);
storage << "img" << img;
storage.release();
@mpkuse
mpkuse / CMakeLists.txt
Last active November 9, 2020 08:56
Ros Quickies
cmake_minimum_required(VERSION 2.8.3)
project(roveo_sensor_calibration)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
@mpkuse
mpkuse / rosbag_images_to_compressedimages.py
Last active November 12, 2020 14:24
rosbag Convert all raw images to compressed images. All other topics are copied from input bag to output bag
#!/usr/bin/env python
"""Convert all raw images to compressed images. All other topics are copied from input bag
to output bag
USAGE:::
python image_raw_to_compressed.py _bag:=/home/ttekep/data/gtsam/random2.bag
"""
import rospy
@mpkuse
mpkuse / main.py
Created January 19, 2021 11:09
Python ROS (rospy) dealing with rotation matrix and transformations
from tf.transformations import quaternion_matrix #Return homogeneous rotation matrix from quaternion.
from tf.transformations import quaternion_from_matrix #Return quaternion from rotation matrix.
from tf.transformations import quaternion_multiply
"""
>>> dir( tf.transformations )
['Arcball', '_AXES2TUPLE', '_EPS', '_NEXT_AXIS', '_TUPLE2AXES', '__builtins__', '__doc__', '__docformat__', '__file__', '__name__', '__package__', '_import_module', 'arcball_constrain_to_axis', 'arcball_map_to_sphere', 'arcball_nearest_axis', 'clip_matrix', 'compose_matrix', 'concatenate_matrices', 'decompose_matrix', 'division', 'euler_from_matrix', 'euler_from_quaternion', 'euler_matrix', 'identity_matrix', 'inverse_matrix', 'is_same_transform', 'math', 'numpy', 'orthogonalization_matrix', 'projection_from_matrix', 'projection_matrix', 'quaternion_about_axis', 'quaternion_conjugate', 'quaternion_from_euler', 'quaternion_from_matrix', 'quaternion_inverse', 'quaternion_matrix', 'quaternion_multiply', 'quaternion_slerp', 'random_qu