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 / 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;
string dateTimeString()
{
//return a string with the date and time
time_t rawtime;
time (&rawtime);;
return ctime(&rawtime);
}
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++)
{
@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 "";}
}
@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 / 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 / fileManip.h
Created December 17, 2015 22:54
to do all file manipulations
vector<string> readFile(string filename)
{
ifstream in(filename);
vector<string> res;
string line;
while (std::getline(infile,line))
{
res.push_back(line);
}
@kauevestena
kauevestena / kplanes.hpp
Created January 12, 2016 01:02
plane estimation
vec4 plane3points(vec3 u,vec3 v,vec3 w)
{
//the function returns a 4-vector with the plane equation coefficients
//assuming the form ax + by + cz + d = 0
vec4 res;
vec3 p1,p2,n;
vec d;
p1 = normalise(v - u);
p2 = normalise(w - u);
n = normalise(cross(p1,p2));
@kauevestena
kauevestena / smmtleverarm.cpp
Last active February 17, 2016 15:50
programa, com a implementação das classes e funções para cálculo da leverArm e do boresight
#include <iostream>
#include <armadillo>
#include <fstream>
#include <string>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
@kauevestena
kauevestena / nmeaRead.cpp
Created July 2, 2016 06:42
programa para a separação de mensagens NMEA
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <windows.h>
#include <sstream>
#include <stdio.h>
#include<time.h>
#include<ctime>