Skip to content

Instantly share code, notes, and snippets.

@tonyromarock
tonyromarock / add-semseg-border.py
Created March 30, 2022 12:24
Python script to add a colored border to a semantic segmentation map.
import argparse
import os
import imageio
from skimage import measure
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(description='Script to add a color border to semantic images.')
parser.add_argument('image', type=str, default="", help="Input image to convert")
@tonyromarock
tonyromarock / bag_to_images.py
Created September 9, 2021 08:54
Extract a folder of images from a rosbag (Python 3)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Script adapted from https://gist.github.com/wngreene/835cda68ddd9c5416defce876a4d7dd9
# for use in Python 3.
"""Extract images from a rosbag.
"""
import os
@tonyromarock
tonyromarock / NBA_stats_mining.py
Last active April 27, 2018 16:13
Scrapping NBA player stats from stats.nba.com
import requests
import csv
import sys
# get me all active players
url_allPlayers = ("http://stats.nba.com/stats/commonallplayers?IsOnlyCurrentSeason"
"=0&LeagueID=00&Season=2015-16")
#request url and parse the JSON
@tonyromarock
tonyromarock / demo_code.js
Last active April 8, 2016 22:00
Creating a simple scene using enchant.js
enchant();
window.onload = function () {
var game = new Core(400, 320);
game.width = 400;
game.height = 320;
game.preload('http://ratherreadblog.com/runnerdemo/images/WalkingBlob.png',
'http://ratherreadblog.com/runnerdemo/images/window.png',
'http://ratherreadblog.com/runnerdemo/images/background.png');
game.fps = 10;
@tonyromarock
tonyromarock / QueenGame.html
Created March 13, 2016 16:21
The Eight Queens Puzzle made with EaselJS
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Dorsa' rel='stylesheet' type='text/css'>
<script src="http://code.createjs.com/easeljs-0.8.1.min.js"></script>
<script>
var stage;
var chessBoard = [];
var Reds = []; // holds the index of the red marked fields
@tonyromarock
tonyromarock / queens-solver.py
Last active March 13, 2016 15:06
Using Python-Constraint to solve the eight queens puzzle
#!/usr/bin/env python2
from constraint import *
problem = Problem()
cols = range(1,9) # these are the variables
rows = range(1,9) # these are the domains
problem.addVariables(cols, rows) # adding multiple variables at once
# that each queen has to be in a separate column is
@tonyromarock
tonyromarock / bmp_producer.py
Created January 24, 2016 11:30
Converting MNIST data set into grayscale images.
#! /usr/bin/python
# Creating gray scale BMP images
# 28 by 28 images (Total pixels: 784)
import struct, array, os
from numpy import genfromtxt
def main():