Skip to content

Instantly share code, notes, and snippets.

cv::Mat xyz(vdisp.rows, vdisp.cols, CV_32FC3);
cv::reprojectImageTo3D( vdisp, xyz, Q, 0);
std::cout << xyz.rows << " " << xyz.cols << std::endl;
//--Pcl code
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_xyz (new pcl::PointCloud<pcl::PointXYZ>);
cloud->is_dense = false; // ??
@berak
berak / gist:3697344
Created September 11, 2012 09:58
make checkers
#include <stdio.h>
#include <stdlib.h>
//
// checker 17 11 > ch17_11.pgm
//
int main(int argc, char **argv)
{
int w=argc>1?atoi(argv[1]):15;
//
// ------------------------------------------------- serialport.h --------------------------------------------------------
//
#ifndef __serialport_onboard__
#define __serialport_onboard__
int serialOpen (int nComPortNr, int readOnly);
int serialClose();
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include <iostream>
#include <fstream>
using namespace cv;
#include "opencv2/core/core.hpp"
template <class T> void process( Mat_<T> & m, T & res, int i, int j)
{
T a = m(0,0);
T b = m(i,j);
res = a+b;
}
int main()
{
@berak
berak / gist:9830239
Last active August 29, 2015 13:57
missing cv::createLBPHFaceRecognizer() code for java/jni wrap
//
// facerec.cpp, this goes into your dll/so.
// this is just an example for lbp, but it will work similar for fisher and eigen, too.
//
#include "jni.h"
#include "opencv2/contrib/contrib.hpp"
//
int tv=13;
namedWindow("win1");
createTrackbar("win1","win1",&tv,100);
Mat img(400,400,CV_8UC3,Scalar(200,80,80));
while(1)
{
Mat m2 = img.clone();
// do something with tv:
m2 += Scalar::all(tv);
@berak
berak / msbp
Created December 4, 2014 07:56
#include <opencv2/opencv.hpp>
using namespace std;
#include <cstdio>
#include <iostream>
using namespace cv;
//
//
// "Multimode Spatiotemporal Background Modeling for Complex Scenes"
@berak
berak / gist:615702b399a05f79fb89
Last active August 29, 2015 14:14
restricted face compare
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
//
// try to find a frontal face 1st, if that fails, fall back to profile
//
@berak
berak / gen_matlab.py
Created June 3, 2015 05:09
matlab wrapper
#!/usr/bin/env python
import sys, re, os, time
from string import Template
from parse_tree import ParseTree, todict, constants
from filters import *
class MatlabWrapperGenerator(object):
"""
MatlabWrapperGenerator is a class for generating Matlab mex sources from
a set of C++ headers. MatlabWrapperGenerator objects can be default