Skip to content

Instantly share code, notes, and snippets.

View kauevestena's full-sized avatar
💭
working on my PhD =D

Kauê de Moraes Vestena kauevestena

💭
working on my PhD =D
View GitHub Profile
@kauevestena
kauevestena / smmt2.cpp
Last active December 19, 2015 14:32
smmt2
#include <stdio.h> // Needed for printf etc
#include <objbase.h> // Needed for COM functionality
#include "xsens_cmt_static.h"
#include <conio.h> // included for _getch and _kbhit
#include <string.h>
#include <time.h>
#include <iostream>
#include <math.h>
#include <cv.h>
@kauevestena
kauevestena / kmisc.h
Last active December 4, 2015 18:36
Misc SMMT2
//you shall need opencv and/or armadillo libs
//you may need to load 'kStringManip.h'
Mat loadMatrixFromXML(string filename)
{
Mat m;
FileStorage fs(filename, FileStorage::READ);
fs[subsBefChar(filename,".")] >> m;
fs.release();
return m;
@kauevestena
kauevestena / kStringManip.h
Last active February 24, 2019 16:13
functions for simple string manipulation
string subsAfLChar(string input,string character)
{
//return the string after the last occur. of the specified character
int pos = input.rfind(character);
if(pos != -1)
{
return input.substr(pos+1,string::npos);
}
else {return "";}
}
std::vector<cv::Point2f> objectPoints_(int h_,int v_,double lenght)
{
//function to return a list of object points, giving the parameters of a checkerboard
std::vector<cv::Point2f> object_points;
cv::Point2f temp;
for (int i=0;i<v_;i++)
{
for (int j=0;j<h_;j++)
{
string dateTimeString()
{
//return a string with the date and time
time_t rawtime;
time (&rawtime);;
return ctime(&rawtime);
}
@kauevestena
kauevestena / good_matches.h
Last active June 4, 2017 03:22
to remove outliers from the matching algorithms
void filterMatches(const std::vector<cv::DMatch> matches,const std::vector<cv::KeyPoint>&keypoints1,const std::vector<cv::KeyPoint>& keypoints2,std::vector<cv::DMatch>& goodMatches,double dist,double confidence_interval)
{
goodMatches.clear();
// converting keypoints to just 2D points
std::vector<cv::Point2f> points1, points2;
for (std::vector<cv::DMatch>::const_iterator it= matches.begin();it!= matches.end(); ++it)
{
// from de matches, extract just the keypoints of the left frame
float x= keypoints1[it->queryIdx].pt.x;
float y= keypoints1[it->queryIdx].pt.y;