Skip to content

Instantly share code, notes, and snippets.

View kevinhughes27's full-sized avatar

Kevin Hughes kevinhughes27

View GitHub Profile
@kevinhughes27
kevinhughes27 / Makefile
Created April 4, 2013 15:48
MinGW Makefile for OpenCV Project
CC = g++
CFLAGS = -g -Wall
SRCS = HelloWorld.cpp
PROG = HelloWorld.exe
OPENCV = -I"C:\opencv\build\include" -L"C:\opencv\build\x86\mingw\lib" -lopencv_core243 -lopencv_highgui243
$(PROG) : $(SRCS)
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(OPENCV)
@kevinhughes27
kevinhughes27 / Makefile
Created April 4, 2013 15:51
g++ Makefile for OpenCV Project
CC = g++
CFLAGS = -g -Wall
SRCS = HelloWorld.cpp
PROG = HelloWorld
OPENCV = `pkg-config opencv --cflags --libs`
LIBS = $(OPENCV)
$(PROG):$(SRCS)
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LIBS)
@kevinhughes27
kevinhughes27 / opencv.pro
Created April 4, 2013 15:54
Add OpenCV to Qt Creator Project
# add these lines to your .pro file
INCLUDEPATH += /usr/local/lib
LIBS +=`pkg-config opencv --cflags --libs`
@kevinhughes27
kevinhughes27 / CMakeLists.txt
Created April 4, 2013 15:57
PCL CMake File
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(HelloWorld)
set(EXE HelloWorld)
find_package(PCL 1.6 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
@kevinhughes27
kevinhughes27 / setdir.sh
Created April 4, 2013 16:17
Sets the directory for execution to be the lowest directory. This is helpful for ensuring relative paths work inside your program
#!/bin/bash
set -e
cd $(readlink -f $(dirname $0))
exec ./exe $*
@kevinhughes27
kevinhughes27 / opencv_blackfly.cpp
Last active January 24, 2024 19:39
A simple program showing how to capture from a Point Grey Research Camera and display the image using OpenCV
#include "FlyCapture2.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace FlyCapture2;
int main()
@kevinhughes27
kevinhughes27 / Eigen3_NumPy_Print.cpp
Last active December 21, 2015 18:29
NumPy style printing in C++ for Eigen 3
using namespace Eigen;
typedef Matrix< float64_t, Dynamic, Dynamic, ColMajor > EMatrix;
using std::cout;
using std::endl;
void print(EMatrix A)
{
int n = A.rows();
int m = A.cols();
@kevinhughes27
kevinhughes27 / eigen3_snips.cpp
Last active July 22, 2023 00:15
Eigen3 Snips
using namespace Eigen;
// these are the typedefs I like to work with
typedef Matrix< double, Dynamic, 1, ColMajor > EVector;
typedef Matrix< double, Dynamic, Dynamic, ColMajor > EMatrix;
// Mean
EVector mean = X.rowwise().sum() / X.rows();
// Standard Deviation
@kevinhughes27
kevinhughes27 / cv2sg.cpp
Last active December 24, 2015 05:39
Using OpenCV and Shogun Machine Learning
/* Using OpenCV and Shogun Machine Learning
* gist by Kevin Hughes
*/
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <shogun/base/init.h>
#include <shogun/lib/common.h>
#include <shogun/lib/SGMatrix.h>
@kevinhughes27
kevinhughes27 / robust_pca_project.py
Last active January 2, 2016 23:29
An Implementation of the robust subspace projection technique described in: A. Leonardis and H. Bischof. Robust recognition using eigenimages. Computer Vision and Image Understanding, 78:99--118, 2000. based off of source provided by the original authors
#!/usr/bin/env python
# robust_pca_project.py
#
# Author: Kevin Hughes
# Date: May 2013
"""
An Implementation of the robust subspace projection technique described in: