Skip to content

Instantly share code, notes, and snippets.

View Harold2017's full-sized avatar
😃

Harold Harold2017

😃
View GitHub Profile
@Harold2017
Harold2017 / opencv_setup.sh
Created July 9, 2019 03:18 — forked from Mahedi-61/installing_opencv_from_source_in_Ubuntu_1804.sh
Installing OpenCV from source on Ubuntu 18.04 machine
#!/bin/bash
# This gist is a step by step instructions to build and install OpenCV from source on ubuntu 16.04 LTS
# note: The easy and quick way to install is
# sudo pip3 install opencv-python
# sudo pip3 install opencv-contrib-python
# But this easy pypi installation can’t open video files on GNU/Linux distribution or on mac OS X system.
# And on some system opencv binaries provided packages are not compiled.
# Therefor we have no way rather than build it from source.
@Harold2017
Harold2017 / Storing-Images-On-Github.md
Created August 9, 2019 05:16 — forked from joncardasis/Storing-Images-On-Github.md
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@Harold2017
Harold2017 / bench.txt
Created December 12, 2019 02:27 — forked from rodaine/bench.txt
Code snippets for my blog post "The X-Files: Avoiding Concurrency Boilerplate with golang.org/x/sync"
BenchmarkMutexCache/10-8 10000000 180 ns/op 0 B/op 0 allocs/op
BenchmarkMutexCache/100-8 10000000 187 ns/op 0 B/op 0 allocs/op
BenchmarkMutexCache/1000-8 10000000 214 ns/op 0 B/op 0 allocs/op
BenchmarkMutexCache/10000-8 10000000 231 ns/op 0 B/op 0 allocs/op
BenchmarkMutexCache/100000-8 5000000 254 ns/op 2 B/op 0 allocs/op
BenchmarkMutexCache/1000000-8 1000000 1159 ns/op 102 B/op 1 allocs/op
BenchmarkMutexCache/10000000-8 1000000 1481 ns/op 184 B/op 2 allocs/op
BenchmarkMutexCache/100000000-8 1000000 1655 ns/op 187 B/op 3 allocs/op
BenchmarkSyncMapCache/10-8 5000000 221 ns/op 0 B/op 0 allocs/op
@Harold2017
Harold2017 / fitting3D.cpp
Created August 24, 2020 03:39 — forked from ialhashim/fitting3D.cpp
Fitting 3D points to a plane or a line
template<class Vector3>
std::pair<Vector3, Vector3> best_plane_from_points(const std::vector<Vector3> & c)
{
// copy coordinates to matrix in Eigen format
size_t num_atoms = c.size();
Eigen::Matrix< Vector3::Scalar, Eigen::Dynamic, Eigen::Dynamic > coord(3, num_atoms);
for (size_t i = 0; i < num_atoms; ++i) coord.col(i) = c[i];
// calculate centroid
Vector3 centroid(coord.row(0).mean(), coord.row(1).mean(), coord.row(2).mean());
@Harold2017
Harold2017 / Eigen Cheat sheet
Created September 23, 2020 02:09 — forked from gocarlos/Eigen Cheat sheet
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.
@Harold2017
Harold2017 / qt-without-xcode.md
Created November 22, 2020 09:26 — forked from shoogle/qt-without-xcode.md
Qt without XCode - how to use Qt Creator for macOS software development without installing XCode

Qt without Xcode

How to use Qt Creator for software development on macOS without having to install Xcode

Justification

Qt refuses to install on macOS unless Apple's Xcode is installed beforehand. This is unfortunate because:

@Harold2017
Harold2017 / Eigen2CV.h
Created December 14, 2020 04:17 — forked from BloodAxe/Eigen2CV.h
This header file contains code snippet for easy mapping Eigen types to OpenCV and back with minimal overhead.
/**
* @brief Mapping functions from Eigen data types to OpenCV
* @author Eugene Khvedchenya <ekhvedchenya@gmail.com>
* @details This header file contains code snippet for easy mapping Eigen types to OpenCV and back with minimal overhead.
* @more computer-vision.talks.com/articles/mapping-eigen-to-opencv/
* Features:
* - Mapping plain data types with no overhead (read/write access)
* - Mapping expressions via evaluation (read only acess)
*
* Known issues:
@Harold2017
Harold2017 / circ_shift.h
Created April 12, 2021 02:10 — forked from tesch1/circ_shift.h
Eigen circShift and fftshift and ifftshift
// circ_shift.h
// https://stackoverflow.com/questions/46077242/eigen-modifyable-custom-expression/46301503#46301503
// this file implements circShift, fftshift, and ifftshift for Eigen vectors/matrices.
//
#pragma once
#include <Eigen/Core>
template <bool B> using bool_constant = std::integral_constant<bool, B>;
@Harold2017
Harold2017 / git-commit-log-stats.md
Created July 13, 2021 05:40 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.