Skip to content

Instantly share code, notes, and snippets.

View cashiwamochi's full-sized avatar
🐢
Debug -Stay Night-

cashiwamochi cashiwamochi

🐢
Debug -Stay Night-
View GitHub Profile
#include <iostream>
#include <opencv2/opencv.hpp>
#include <vector>
#include <string>
using namespace cv;
using namespace std;
void showUsage() {
cout << "this.out [image name]" << endl;
#include "singleImageCalibration.hpp"
int main(int argc, char* argv[])
{
if(argc != 2){
showUsage();
return -1;
}
string image_name = argv[1];
@cashiwamochi
cashiwamochi / simple_triangulation.cc
Last active September 16, 2023 14:19
This code is used for simple triangulation. It uses findEssentialMat, recoverPose, triangulatePoints in OpenCV. For viewer, PCL is used. You can watch 3D points and 2 camera poses. I checked alcatraz2.jpg and alcatraz1.jpg in pcv_data.zip (https://www.oreilly.co.jp/pub/9784873116075/). Perhaps there is something wrong ( actually it looks working…
#include <opencv2/opencv.hpp>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <Eigen/Core>
#include <Eigen/LU>
@cashiwamochi
cashiwamochi / CMakeListsForSimpleTriangulation.txt
Created September 10, 2017 15:06
CMakeLists for simple_triangulation.cc. (I THINK THAT)PCL viewer is available only if you compiled PCL with pcl_visualization module. In order to do it, i need to build and install VTK8.
# minimum version of CMake
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(triangulation)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
@cashiwamochi
cashiwamochi / epipolar_keypoints_match.hpp
Last active September 11, 2017 16:34
This function is used to do feature points matching based on epipolar-line search. It does also ratio-cross-check-test.
#include <iostream>
#include <vector>
#include <cmath>
#include <opencv2/opencv.hpp>
using namespace std;
template <typename T>
static float distancePointLine(const cv::Point_<T> point, const cv::Vec<T,3>& line)
@cashiwamochi
cashiwamochi / ceres_cost_function.hpp
Created November 16, 2017 07:01
CeresSolverでH行列を計算する.トライアンギュレーションする.
#include <cmath>
#include "ceres/ceres.h"
#include "glog/logging.h"
#include <opencv2/opencv.hpp>
using namespace std;
using ceres::AutoDiffCostFunction;
@cashiwamochi
cashiwamochi / g2o_homography.cc
Created November 27, 2017 05:04
g2oでH行列
#include <Eigen/Core>
#include <iostream>
#include <opencv2/opencv.hpp>
#include "g2o/stuff/sampler.h"
#include "g2o/stuff/command_args.h"
#include "g2o/core/sparse_optimizer.h"
#include "g2o/core/block_solver.h"
#include "g2o/core/solver.h"
#include <dirent.h>
vector<string> readFileInDir(char* path_to_image) {
vector<string> paths;
DIR* dp=opendir(path_to_image);
string s_path_to_image = path_to_image;
if (dp!=NULL)
{
struct dirent* d;
@cashiwamochi
cashiwamochi / simple_kalman_filter.cc
Last active June 11, 2018 09:00
一次元の値を予測する( ? )カルマンフィルタの実装.http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf をコードに落としたら上手く動いた.http://scipy.github.io/old-wiki/pages/Cookbook/KalmanFiltering のC++版に相当するはず.
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
#include <string>
#include <fstream>
int main(int argc, char* argv[]) {
if(argc != 2) {
@cashiwamochi
cashiwamochi / cifar10ConvertToPng.nim
Last active September 23, 2018 15:27
This nim source converts binary of cifar10 to PNG. Some packages are needed, if you use this, please install them for yourself.
import os
import streams
import sequtils
import nimPNG, math, tables, base64
import private.buffer
import progress
const
height: int = 32
width: int = 32