Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add assert head file and fix argv.conf #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Folders
build/*
/cmake-build-debug/*
.DS_Store
*/.DS_Store
tmp/*
*.vscode
examples/data/*
7 changes: 4 additions & 3 deletions examples/task1/class1_test_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ sift_compare (features::Sift::Descriptor const& d1, features::Sift::Descriptor c
int
main (int argc, char** argv)
{
if (argc < 2)
if (argc < 3)
{
std::cerr << "Syntax: " << argv[0] << " <image>" << std::endl;
std::cerr << "Syntax: " << argv[0] << " <image>" << "out put file name path without .png format"<<std::endl;
return 1;
}

Expand Down Expand Up @@ -88,7 +88,8 @@ main (int argc, char** argv)
sift_drawing, features::Visualizer::RADIUS_BOX_ORIENTATION);

/* 保存图像文件名 */
std::string sift_out_fname = "./tmp/" + util::fs::replace_extension
std::string filename =argv[2];
std::string sift_out_fname = filename + util::fs::replace_extension
(util::fs::basename(image_filename), "sift.png");
std::cout << "保存图像: " << sift_out_fname << std::endl;
core::image::save_file(sift_image, sift_out_fname);
Expand Down
11 changes: 6 additions & 5 deletions examples/task1/class1_test_matching.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ convert_surf_descriptors(sfm::Surf::Descriptors const& surf_descr,
}

void
feature_set_matching (core::ByteImage::Ptr image1, core::ByteImage::Ptr image2)
feature_set_matching (core::ByteImage::Ptr image1, core::ByteImage::Ptr image2,std::string filename)
{
/*FeatureSet 计算并存储一个视角的特征点,包含SIFT和SURF特征点 */
sfm::FeatureSet::Options feature_set_opts;
Expand Down Expand Up @@ -223,17 +223,18 @@ feature_set_matching (core::ByteImage::Ptr image1, core::ByteImage::Ptr image2)

core::ByteImage::Ptr match_image = visualize_matching(
matching, image1, image2, feat1.positions, feat2.positions);
std::string output_filename = "./tmp/matching_featureset.png";
std::string output_filename = filename;
//std::string output_filename = "/home/xsun/ImageBasedModellingEduV1.0/tmp/matching_featureset.png";
std::cout << "Saving visualization to " << output_filename << std::endl;
core::image::save_file(match_image, output_filename);
}

int
main (int argc, char** argv)
{
if (argc < 3)
if (argc < 4)
{
std::cerr << "Syntax: " << argv[0] << " image1 image2" << std::endl;
std::cerr << "Syntax: " << argv[0] << " image1 image2" << "output filename path"<<std::endl;
return 1;
}

Expand Down Expand Up @@ -270,7 +271,7 @@ main (int argc, char** argv)
}

// 进行特征提取和特征匹配
feature_set_matching(image1, image2);
feature_set_matching(image1, image2,argv[3]);

return 0;
}
1 change: 1 addition & 0 deletions examples/task2/class2_test_fundamental_ransac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sstream>
#include <set>
#include <util/system.h>
#include <assert.h>
#include <sfm/ransac_fundamental.h>
#include "math/functions.h"
#include "sfm/fundamental.h"
Expand Down
57 changes: 56 additions & 1 deletion examples/task2/class2_test_math_basic.cc
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
//// Created by caoqi on 2018/8/30.//#include <iostream>#include <math/matrix_svd.h>#include "math/matrix.h"#include "math/vector.h"int main(int argc, char *argv[]){ /*构建一个维度为4x5的矩阵,数据类型为double的矩阵*/ math::Matrix<double, 4, 5> A; /*矩阵元素的设置和访问*/ int id=0; for(int i=0; i< A.rows; i++){ for(int j=0; j< A.cols; j++){ A(i,j) = ++id; std::cout<<A(i, j)<<" "; } std::cout<<std::endl; } std::cout<<std::endl; /*取矩阵的列元素*/ math::Vector<double, 4> col4 = A.col(4); // 取第5列元素 std::cout<<"col4: "<<col4<<std::endl; /*取矩阵的行元素*/ math::Vector<double, 5> row2 = A.row(2); // 取第3行元素 std::cout<<"row2: "<<row2<<std::endl; // 向量的创建 math::Vector<double, 5> v1; for(int i=0; i<v1.dim; i++){ v1[i] = i; } std::cout<<"v1: "; for(int i=0; i<v1.dim; i++){ std::cout<<v1[i]<<" "; } std::cout<<std::endl<<std::endl; //奇异值分解 math::Matrix<double, 4, 5>U; math::Matrix<double, 5, 5> S, V; math::matrix_svd<double, 4, 5> (A,&U, &S, &V); std::cout<<"U: "<<U<<std::endl; std::cout<<"S: "<<S<<std::endl; std::cout<<"V: "<<V<<std::endl; return 0;}
//
// Created by caoqi on 2018/8/30.
//

#include <iostream>
#include <math/matrix_svd.h>
#include "math/matrix.h"
#include "math/vector.h"

int main(int argc, char *argv[])
{

/*构建一个维度为4x5的矩阵,数据类型为double的矩阵*/
math::Matrix<double, 4, 5> A;

/*矩阵元素的设置和访问*/
int id=0;
for(int i=0; i< A.rows; i++){
for(int j=0; j< A.cols; j++){
A(i,j) = ++id;
std::cout<<A(i, j)<<" ";
}
std::cout<<std::endl;
}
std::cout<<std::endl;

/*取矩阵的列元素*/
math::Vector<double, 4> col4 = A.col(4); // 取第5列元素
std::cout<<"col4: "<<col4<<std::endl;

/*取矩阵的行元素*/
math::Vector<double, 5> row2 = A.row(2); // 取第3行元素
std::cout<<"row2: "<<row2<<std::endl;

// 向量的创建
math::Vector<double, 5> v1;
for(int i=0; i<v1.dim; i++){
v1[i] = i;
}

std::cout<<"v1: ";
for(int i=0; i<v1.dim; i++){
std::cout<<v1[i]<<" ";
}
std::cout<<std::endl<<std::endl;

//奇异值分解
math::Matrix<double, 4, 5> U;
math::Matrix<double, 5, 5> S, V;
math::matrix_svd<double, 4, 5> (A,&U, &S, &V);
std::cout<<"U: "<<U<<std::endl;
std::cout<<"S: "<<S<<std::endl;
std::cout<<"V: "<<V<<std::endl;

return 0;
}
1 change: 1 addition & 0 deletions examples/task3/class3_test_bundle_adjustment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <sfm/ransac_fundamental.h>
#include <core/image_exif.h>
#include <fstream>
#include <assert.h>
#include "math/matrix.h"
#include "math/vector.h"

Expand Down
941 changes: 940 additions & 1 deletion examples/task3/class3_test_lm_optimize.cc

Large diffs are not rendered by default.

Loading