Skip to content

Instantly share code, notes, and snippets.

View forestsen's full-sized avatar
💭
I may be slow to respond.

Haipeng Wang forestsen

💭
I may be slow to respond.
View GitHub Profile
@naoya-chiba
naoya-chiba / PCL.cpp
Created August 12, 2018 17:02
SSII2018のTSを例題に,PCL (C++)とOpen3D (Python) の比較.のソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <tuple>
#include <Eigen/Core>
#include <pcl/io/ply_io.h>
#include <pcl/point_cloud.h>
#include <pcl/common/transforms.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/features/normal_3d.h>
@paniq
paniq / perfect_spatial_hashing.txt
Last active June 21, 2024 14:56
Perfect Spatial Hashing
# forays into
Perfect Spatial Hashing (Lefebvre & Hoppe)
http://hhoppe.com/perfecthash.pdf
how it works:
There are two parts: a slow encoding step, and a fast decoding step.
Encoding
@gocarlos
gocarlos / Eigen Cheat sheet
Last active September 10, 2024 02:31
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
@devteampentagon
devteampentagon / Closest Pair Of Points.java
Created January 7, 2017 16:19
Closest Pair Of Points
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* http://www.geeksforgeeks.org/closest-pair-of-points-onlogn-implementation/
* https://www.youtube.com/watch?v=_pSl90jq-m0 another good explanation
* Given coordinates of points find closest pair points distance.
*
/*
Following file take opencv mat file as an input and convert it to proper tensor object
Created by : Kumar Shubham
Date : 27-03-2016
*/
//Loading Opencv fIles for processing
//#include <opencv2/opencv.hpp>
@kyrs
kyrs / opencv_tensor.cc
Last active February 15, 2024 12:44
File Takes an Image Mat file as an input and convert it to tensor.
/*
Following file take opencv mat file as an input and run inception model on it
Created by : Kumar Shubham
Date : 27-03-2016
*/
//Loading Opencv fIles for processing
#include <opencv2/opencv.hpp>
/// perform the Simplest Color Balancing algorithm
void SimplestCB(Mat& in, Mat& out, float percent) {
assert(in.channels() == 3);
assert(percent > 0 && percent < 100);
float half_percent = percent / 200.0f;
vector<Mat> tmpsplit; split(in,tmpsplit);
for(int i=0;i<3;i++) {
//find the low and high precentile values (based on the input percentile)
@ialhashim
ialhashim / DBSCAN.hpp
Last active March 24, 2024 22:04
Portable Clustering Algorithms in C++ (DBSCAN) and (Mean-Shift) and (k-medoids)
#pragma once
// Code adapted from https://github.com/propanoid/DBSCAN
#include <vector>
#include <algorithm>
#include <omp.h>
// Any basic vector/matrix library should also work
#include <Eigen/Core>
@paultsw
paultsw / boundingSphere.hs
Last active February 26, 2019 02:29
Implementations of Ritter's sphere bound algorithm
boundingSphere :: [(Float,Float,Float)] -> ((Float,Float,Float),Float) --takes a list of points in 3D to a pair (center,radius)
boundingSphere points =
case points of --induction on number of points: 0,1,2, or 3+
[] -> ((0,0,0),0)
p:[] -> (p,0)
(p1,p2,p3):(q1,q2,q3):[] -> (((p1+q1)/2,(p2+q2)/2,(p3+q3)/2),dist (p1,p2,p3) (q1,q2,q3))
p:pts -> let
y@(y1,y2,y3) = head $ filter (\pt -> (dist pt p) - 0.1 < (maximum $ map (dist p) pts)) pts
z@(z1,z2,z3) = head $ filter (\pt -> (dist pt y) - 0.1 < (maximum $ map (dist y) pts)) pts
initSphere@(ctr,rad) = (((y1+z1)/2, (y2+z2)/2, (y3+z3)/2), dist y z / 2)