Skip to content

Instantly share code, notes, and snippets.

@frakw
frakw / labelme_gen_mask_img.py
Created December 4, 2023 18:54
Convert all labelme generated json into mask image in every subdirectory
# Author : frakw
# Date : 2023-12-04
# Description : Convert all labelme generated json into mask image in every subdirectory
# Usage : python labelme_gen_mask_img.py
import json
import numpy as np
import cv2
import os
import fnmatch
@lb5160482
lb5160482 / rotm2quat.cpp
Created January 15, 2018 21:54
Rotation matrix to quaternion conversion c++
inline float SIGN(float x) {
return (x >= 0.0f) ? +1.0f : -1.0f;
}
inline float NORM(float a, float b, float c, float d) {
return sqrt(a * a + b * b + c * c + d * d);
}
// quaternion = [w, x, y, z]'
Mat mRot2Quat(const Mat& m) {
@lewislepton
lewislepton / glsl.json
Last active April 17, 2024 01:26
GLSL snippets for visual studio code/kode studio
/*
AUTO-COMPLETE SNIPPETS FOR GLSL WITHIN VISUAL CODE STUDIO
Lewis Lepton
https://lewislepton.com
useful places that i grabbed info from
http://www.shaderific.com/glsl
https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
plus various other papers & books
*/
@alan-mushi
alan-mushi / json_parser.c
Last active March 25, 2024 19:23
Examples for the json-c tutorial.
/*
* A simple example of json string parsing with json-c.
*
* clang -Wall -g -I/usr/include/json-c/ -o json_parser json_parser.c -ljson-c
*/
#include <json.h>
#include <stdio.h>
int main() {
struct json_object *jobj;
@dbrockman
dbrockman / degrees-radians.h
Created February 12, 2013 21:52
Convert degrees <-> radians C macros
// Converts degrees to radians.
#define degreesToRadians(angleDegrees) (angleDegrees * M_PI / 180.0)
// Converts radians to degrees.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / M_PI)