Ex6:图像拼接

计算机视觉作业六

完整代码见Github:
Ex6 Image Stitching

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "ImageStitching.h"

int main() {
// read image filenames
string filepath = "../TEST-ImageData(2)/";
string outputpath = "../result/";
vector<string> filenames;

// under ubuntu environment
DIR *dir;
struct dirent *ptr;
if ((dir=opendir(filepath.c_str())) == NULL) {
perror("open directory error!");
exit(1);
}
while ((ptr=readdir(dir)) != NULL) {
if(ptr->d_type == 8)
filenames.push_back(ptr->d_name);
else
continue;
}
closedir(dir);

// run image stitching
ImageStitching stitch;
stitch.run(filepath, filenames);
}

编译运行:

1
2
linjiafengyang@ubuntu:~/Desktop/aaa/src$ g++ -o main.out main.cpp ImageStitching.cpp ./siftpp/sift.cpp -g -I ./ -I ./siftpp -O2 -L/usr/X11R6/lib -lm -lpthread -lX11
linjiafengyang@ubuntu:~/Desktop/aaa/src$ ./main.out

这里写图片描述

这里写图片描述

------本文结束感谢阅读------