Skip to content

Instantly share code, notes, and snippets.

View rohanpsingh's full-sized avatar
🤖

Rohan P. Singh rohanpsingh

🤖
View GitHub Profile
## Example command-line usage: $ for i in *.dae; do echo $i; blender -b --python convert.py -- $i ${i%.dae}.obj; done
## Need to be careful about face normals direction of exported object
import bpy
import sys
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
dae_in = argv[0]
@rohanpsingh
rohanpsingh / convert_mask_to_json.py
Created October 14, 2020 12:36
Script to convert binary masks to the JSON label format required for Mask R-CNN
import os
import argparse
import json
import numpy as np # (pip install numpy)
from PIL import Image # (pip install Pillow)
from skimage import measure # (pip install scikit-image)
from shapely.geometry import Polygon, MultiPolygon # (pip install Shapely)
SPLIT_RATIO = 0.9
@rohanpsingh
rohanpsingh / bag_to_png.py
Last active April 26, 2023 08:53
Script to extract depth and rgb frames for a rosbag file.
import argparse
import os
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
sys.path.append("/usr/lib/python2.7/dist-packages/")
import rospy
import rosbag