Skip to content

Commit 143d1fd

Browse files
committed
plz README before use J3D
1 parent 5ce6dbe commit 143d1fd

File tree

1 file changed

+334
-0
lines changed

1 file changed

+334
-0
lines changed

README.md

+334
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
# J3D模型重建系统
2+
#### **J3DReconstruction**
3+
4+
#### 本应用是Windows下基于openMVG+openMVS的三维重建解决方案以及基于Qt的可视化桌面平台
5+
6+
程序为摄影测量影像的三维重建提供解决方案,可将摄影测量的原始影像进行特征匹配重建为三维点云,重建深度图为点云加密,三角网重建,纹理映射,生成纹理模型。
7+
8+
若有幸您能喜欢的话,请为我点上一颗star,谢谢啦。
9+
10+
11+
12+
### 简介
13+
14+
本项目主要是前段时间因学业及项目需要,去鼓捣了一下多目三维重建这个东西,然后其实发现国外开源的框架和库不少,我索性就照着openMVG和openMVS两个开源库做了一个二次开发,把开源库大体上的功能封装起来,用qt做了一个windows桌面程序,也免得大家去linux下面编译各种库,在脚本里面跑程序了。本来许多人也并不是为了鼓捣这源码的,只是想看看这些开源库的效果而已嘛。
15+
16+
如果有想在windows下配置环境编译的同学可以fork下来研究研究,由于是个人项目,若是有什么bug或者其他问题可以私信联系我。或者不愿意麻烦的,可以直接下载编译后的二进制程序直接Windows下运行就行,希望给同是研究三维重建这一块儿的同学们帮上一些小忙。
17+
18+
由于windows下配置相关三方库的操作步骤较为繁琐,如果同学恰巧和我一样也是用的msvc2017_64的编译器(**vs2017**或者是带有**v141平台工具集的vs2019**),那么可以使用我上传的二进制依赖库,来快速进行环境的配置,我也简单做了一个小视频,来帮助大家快速地部署生成项目
19+
20+
视频地址:https://www.bilibili.com/video/BV1p5411g7Ht/
21+
22+
二进制依赖库包地址链接:https://pan.baidu.com/s/1ZEh6Ts7V4JAAb15y5r89RQ 提取码:40zz
23+
24+
25+
26+
27+
### 功能
28+
29+
#### Function
30+
31+
本应用实现了如下功能:
32+
33+
openMVG库中基于SIFT及其他几种特征子算法的特征提取、特征匹配的封装
34+
35+
openMVG库中提供的全局及增量sfm、sfp、空中三角测量、生成稀疏点云和相机姿态信息的封装
36+
37+
openMVS库中提供的密集点云生成管道封装
38+
39+
openMVS库中提供的三角网模型重建及精炼管道封装
40+
41+
openMVS库中提供的纹理映射管道封装
42+
43+
openMVS库中提供的基于GLFW库的可视化模型预览封装
44+
45+
OSG库中提供的基于openGL库的可视化模型预览及格式转换封装(转换到osgb格式可以在smart3D打开、若本机安装obj2gltf插件可转换到gltf供Cesium加载)
46+
47+
基于空间前方交会的图像像点坐标到实景三维坐标的映射可视化组件
48+
49+
50+
51+
### 构建
52+
53+
#### Build
54+
55+
本项目在开发时的环境如下:
56+
57+
Windows 10 + VisualStudio 2017
58+
59+
openMVG
60+
61+
openMVS
62+
63+
(本项目所用的openMVG、openMVS在原项目的基础上有做细微更改,实际构建使用的代码也在我的仓库中,有需要的同学可以一起使用,若使用原版库,则J3DGUI中预览模型只能使用兼容模式)
64+
65+
openCV(openCV 3.4.1 & openCV 3.4.1_contrib)
66+
67+
VCG:(VCG 1.0.0)
68+
69+
CGAL(CGAL 5.0.2 x64)
70+
71+
Boost(boost_1_67_0-msvc-14.1-64 )
72+
73+
QT (qt-opensource-windows-x86-5.14.2)
74+
75+
LibQGLViewer(libQGLViewer-2.6.4)
76+
77+
Ceres(ceres-solver-1.14.0)
78+
79+
Eigen (eigen-3.3.7)
80+
81+
GoogleFlags (gflags 2.2.2)
82+
83+
GoogleLog (glog 0.3.3)
84+
85+
CXSParse(CXSParse 3.1.1)
86+
87+
LIBJPEG(jpeg-9d)
88+
89+
GLFW(glfw-3.3.2)
90+
91+
LIBPNG(libpng 1.6.37)
92+
93+
GLEW(glew-2.1.0)
94+
95+
GDAL(gdal-2.0.3)
96+
97+
98+
99+
##### Windows下构建过程:
100+
101+
1.请将上述库和环境一一构建(该项目基于x64,建议构建x64的库),其中三方库需要在每个vs工程中INSTALL二进制库(INSTALL后库目录会在C盘的Program Files中,不INSTALL也可以,只要能找到具体include目录和lib目录及文件即可)
102+
103+
2.fork并pull本项目到本地,然后在vs中打开本项目代码,(由于需要用到qt,请在vs中下载qt拓展,并配置好相关编译器(我用的是msvc2017_64))
104+
105+
3.检查所有项目(J3DMVSEngine、J3DViewRender、J3DEngine、J3DGUI、J3DViewer)的项目属性,并检查各个三方库的include目录(C++-常规-附加包含目录)、lib目录(链接器-常规-附加库目录)(链接器-输入-附加依赖项)是否正确(我的三方库统一安装在C:\openMVS下,如果不是安装于此,需要进行相关的修改)
106+
107+
108+
109+
### 示例
110+
111+
#### Example
112+
113+
​ 构建并编译J3DReconstruction,执行J3DEngine以及J3DGUI应用程序,可实现在J3DGUI程序中可视化调用openMVG及openMVS的构建管道
114+
115+
​ 管道中算法实现及介绍可参考openMVG及openMVS的Wiki页面:
116+
117+
[https://github.com/cdcseacave/openMVS/wiki]()
118+
119+
[https://github.com/openMVG/openMVG/wiki]()
120+
121+
122+
123+
##### SFM及MVS重建模块:
124+
125+
将源图片放在一个文件夹里
126+
若是相机型号比较冷门,需要在文件-添加相机参数中添加相机的几项参数(这个参数可以参考下图去图片元数据中获取,若没有元数据或不齐全,可以去google一下对应相机的具体参数,程序是通过以下公式进行粗略计算的)
127+
$$
128+
sensorWidth = 2 * ( focal * std::tan( (0.5 * FOV)/57.296) );
129+
$$
130+
若是利用焦距/FOV等参数计算不够精确,也可自行获取相机型号及传感器宽度值手动导入SenWidDB.txt
131+
132+
**(※※※注:若SFM步骤时提示There is no defined intrinsic data in order to compute an essential matrix for the initial pair,则说明缺失源图片的相机传感器参数,需要根据以下图片中的情况进行手动添加,否则会SFM重建失败※※※)**
133+
134+
![senwidinfo](images/senwidinfo.png)
135+
136+
添加之后在SenWidDB.txt中理应也会出现对应的 相机型号;传感器宽度值
137+
138+
若SenWidDB.txt中无源图片对应的相机型号,会出现SFM重建失败等错误。
139+
140+
当然其实大多数的相机都有预设值,源于官方数据,不需要手动添加的的,具体可以在程序路径中的SenWidDB.txt查询。
141+
142+
我也提供了一组测试图片,在项目的test文件夹中,可自行下载并添加NIKON D60的传感器参数(23.6mm)
143+
144+
145+
146+
然后在程序中中选择全自动三维重建选项,(若提示无缓存访问权限,请用管理员身份运行)填写源图片路径、输出重建结果路径以及其他参数,确认后即可跟随管道完成重建任务,最终可在J3DGUI程序中可视化查看结果
147+
148+
**(若是全自动出现程序未响应或者其他错误,可以尝试分步进行,目前发现偶尔在win7遇到这样的问题)**
149+
150+
151+
152+
![engine](images/engine.png)
153+
154+
155+
156+
![参数设置](images/paras.png)
157+
158+
程序运行结束后,在输出路径中会有对应的重建文件,用J3DGUI或用其他第三方模型预览器打开都可。
159+
160+
![预览模型](images/gui.png)
161+
162+
可视化预览也支持以下键盘操作
163+
164+
调整视角:鼠标左键按住拖动
165+
调整大小:鼠标滚轮调整
166+
调整视点:鼠标双击模型某 点/面 将其居中
167+
显示相机位置:C键
168+
渲染点云:P键
169+
调整点云中的点大小:A/S键 A键放大 S键缩小
170+
渲染网格:M键
171+
渲染纹理:T键
172+
173+
viewer和convert工具可直接使用OSG库中的osgviewer.exe和osgconv.exe替换程序所需的OSGViewer.exe和osgcv.exe
174+
175+
(或者本项目Release包中也有相应二进制文件可直接使用)
176+
177+
178+
179+
##### 坐标映射模块:
180+
181+
​ 从J3DGUI的**文件-坐标映射**打开,选择完整运行SFM引擎中的步骤后的目录(即含有SparseCloud.J3D文件的重建结果目录),以及目标地形DSM数据(需使用三方软件生成,如CC或photoscan等)。
182+
183+
注意:需要SFM重建数据和DSM数据的地理参考相同(J3D的SFM引擎默认使用ECEF坐标系),则需三方软件生成ECEF坐标系下的DSM文件,如果无法获取ECEF坐标系下的DSM数据,则建议使用J3DGUI中 **分步三维重建-导入其他SFM数据**中的功能,导入其他软件生成的Blocks Exchange XML格式的SFM数据,只需保证生成XML数据时使用的地理参考和DSM数据相同即可(建议使用cgcs2000高斯投影坐标等米制XYZ数据,可以获得较好映射效果)
184+
185+
导入后可以选择可用的影像,在影像上右键选择像点,即可映射对应点的地理坐标,并保存到点集,可将点集输出为dxf格式在Auto CAD等软件中预览。
186+
187+
![坐标映射功能](images/intersector.jpg)
188+
189+
190+
191+
192+
193+
### 版权及证书
194+
195+
#### J3DReconstruction License (include OpenMVG and OpenMVS License)
196+
197+
##### Included third parties license details
198+
199+
Copyright (c) 2020 Michael Jiao.
200+
201+
J3DReconstruction is licensed under an MIT/X style license. And this program includes works distributed under the terms of another license(s) and other copyright notice(s).
202+
203+
* __SeaCave__<br />
204+
Copyright (c) 2007 SEACAVE SRL.
205+
Licensed under a [Boost license](http://www.boost.org/users/license.html).
206+
207+
* __easyexif__<br />
208+
[https://github.com/mayanklahiri/easyexif](https://github.com/mayanklahiri/easyexif)
209+
Copyright (c) 2010 Mayank Lahiri.
210+
Distributed under the [New BSD License](http://opensource.org/licenses/BSD-3-Clause).
211+
212+
* __histogram__<br />
213+
Copyright (c) Jansson Consulting & Pierre Moulon.
214+
Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
215+
216+
* __htmlDoc__<br />
217+
Copyright (c) Pierre Moulon.
218+
Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
219+
220+
* __ACRANSAC__<br />
221+
Copyright (c) Pierre Moulon.
222+
Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
223+
224+
* __stlplus3__<br />
225+
[http://stlplus.sourceforge.net](http://stlplus.sourceforge.net)
226+
Copyright (c) 1999-2004 Southampton University, 2004 onwards Andy Rushton. All rights reserved.
227+
Licensed under the [BSD license](http://opensource.org/licenses/bsd-license.php).
228+
229+
* __rectangle-bin-packing__<br />
230+
[http://clb.demon.fi/projects/rectangle-bin-packing](http://clb.demon.fi/projects/rectangle-bin-packing)
231+
Copyright (c) Jukka Jylänki.
232+
Released to Public Domain, do whatever you want with it.
233+
234+
* __ceres-solver__<br />
235+
[http://ceres-solver.org](http://ceres-solver.org)
236+
Copyright 2015 Google Inc. All rights reserved.
237+
Licensed under the [New BSD license](http://ceres-solver.org/license.html).
238+
239+
* __lmfit__<br />
240+
[http://apps.jcns.fz-juelich.de/doku/sc/lmfit](http://apps.jcns.fz-juelich.de/doku/sc/lmfit)
241+
Copyright (c) Joachim Wuttke.
242+
Licensed under the [FreeBSD license](http://opensource.org/licenses/BSD-2-Clause).
243+
244+
* __TRWS__<br />
245+
[http://pub.ist.ac.at/~vnk/software.html](http://pub.ist.ac.at/~vnk/software.html)
246+
Copyright (c) Vladimir Kolmogorov.
247+
Licensed under the [MSR-SSLA license](http://research.microsoft.com/en-us/um/people/antr/vrr/vrr/license.htm).
248+
249+
* __ibfs__<br />
250+
[http://www.cs.tau.ac.il/~sagihed/ibfs](http://www.cs.tau.ac.il/~sagihed/ibfs)
251+
Copyright (c) Haim Kaplan and Sagi Hed.
252+
This software can be used for research purposes only.
253+
254+
* __loopy-belief-propagation__<br />
255+
[https://github.com/nmoehrle/mvs-texturing](https://github.com/nmoehrle/mvs-texturing)
256+
Copyright (c) Michael Waechter.
257+
Licensed under the [BSD 3-Clause license](http://opensource.org/licenses/BSD-3-Clause).
258+
259+
* __eigen__<br />
260+
[http://eigen.tuxfamily.org](http://eigen.tuxfamily.org)
261+
Copyright (c) Eigen authors.
262+
Distributed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
263+
Compiled with EIGEN_MPL2_ONLY to ensure MPL2 compatible code.
264+
265+
* __OpenCV__<br />
266+
[http://opencv.org](http://opencv.org)
267+
Copyright (c) 2015, Itseez.
268+
Licensed under the [BSD license](http://opensource.org/licenses/bsd-license.php).
269+
270+
* __Boost__<br />
271+
[http://www.boost.org](http://www.boost.org)
272+
Copyright Beman Dawes, David Abrahams, 1998-2005.
273+
Copyright Rene Rivera 2004-2007.
274+
Licensed under a [Boost license](http://www.boost.org/users/license.html).
275+
276+
* __CGAL__<br />
277+
[http://www.cgal.org](http://www.cgal.org)
278+
Copyright (c) 1995-2015 The CGAL Project. All rights reserved.
279+
Licensed under the [GPL](http://www.gnu.org/copyleft/gpl.html)/[LGPL license](http://www.gnu.org/copyleft/lesser.html).
280+
281+
* **cmdLine**
282+
Copyright (c) Pascal Monasse. Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
283+
284+
* **CppUnitLite** (optional)
285+
Public domain.
286+
287+
* **cxsparse** (optional)
288+
Copyright (c) 2006-2012, Timothy A. Davis. Distributed under the [GNU LGPL license](http://opensource.org/licenses/lgpl-license).
289+
290+
* **easyexif**
291+
Copyright (c) 2010 Mayank Lahiri. Distributed under the [New BSD License](http://opensource.org/licenses/BSD-3-Clause).
292+
293+
* **fast**
294+
Copyright (c) 2006, 2008 Edward Rosten Distributed under the [New BSD License](https://opensource.org/licenses/BSD-3-Clause).
295+
296+
* **flann**
297+
Copyright (c) 2008-2011 Marius Muja ([[email protected]](mailto:[email protected])). All rights reserved. Copyright (c) 2008-2011 David G. Lowe ([[email protected]](mailto:[email protected])). All rights reserved. Distributed under the [BSD License](http://www.opensource.org/licenses/bsd-license.php).
298+
299+
* **histogram**
300+
Copyright (c) Jansson Consulting & Pierre Moulon. Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
301+
302+
* **hnswlib**
303+
Copyright (c) hnswlib authors. Licensed under the [Apache-2.0 license](https://opensource.org/licenses/Apache-2.0).
304+
305+
* **htmlDoc**
306+
Copyright (c) Pierre Moulon. Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
307+
308+
* **jpeg**
309+
Copyright (c) Independent JPEG Group License. Licensed under the [Independent JPEG Group License](https://spdx.org/licenses/IJG).
310+
311+
* **lemon**
312+
Copyright (c) Lemon authors. Licensed under the [Boost License 1.0](http://www.boost.org/LICENSE_1_0.txt).
313+
314+
* **png** (optional)
315+
Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson Licensed under the [lib png license](http://www.libpng.org/pub/png/src/libpng-LICENSE.txt).
316+
317+
* **progress**
318+
Copyright (c) Pierre MOULON Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
319+
320+
* **stlplus3**
321+
Copyright (c) 1999-2004 Southampton University, 2004 onwards Andy Rushton. All rights reserved. Licensed under the [BSD license](http://opensource.org/licenses/bsd-license.php).
322+
323+
* **GDAL**
324+
All Copyright Licensed under the [GDAL license](https://github.com/openscenegraph/OpenSceneGraph/blob/master/LICENSE.txt).
325+
326+
* **tiff** (optional)
327+
Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc. Licensed under a BSD-like license.
328+
329+
* **vectorGraphics**
330+
Copyright (c) Pierre Moulon Licensed under the [MPL2 license](http://opensource.org/licenses/MPL-2.0).
331+
332+
* **zlib** (optional)
333+
Copyright (C) 1995-2005 Jean-loup Gailly Licensed under the [zlib license](http://opensource.org/licenses/Zlib).
334+

0 commit comments

Comments
 (0)