还记得成龙演的那部《十二生肖》里用3d扫描和打印技术复制的生肖吗?

3d打印是近几年兴起的一种技术,除了存储 物体表面的位置信息,还有颜色,密度等信息 。
而3d扫描其实在军用领域很早以前就有了。
如果使用普通的数据库来存储,得把这些属性拆开来存。
而在postgresql中,你完全不需要把这些属性拆开,他们本来就是一体的,用好pg的扩展接口就好了。
postgresql 扩展指南 :
<a href="https://yq.aliyun.com/articles/55981">https://yq.aliyun.com/articles/55981</a>
3d扫描的基础知识,来自百度百科
lidar——light detection and ranging,即激光探测与测量。
是利用gps(global position system)和imu(inertial measurement unit,惯性测量装置)机载激光扫描。
其所测得的数据为数字表面模型(digital surface model, dsm)的离散点表示,数据中含有 空间三维信息 和 激光强度 信息。
应用分类(classification)技术在这些原始数字表面模型中移除建筑物、人造物、覆盖植物等测点,即可获得数字高程模型(digital elevation model, dem),并同时得到地面覆盖物的高度。
机载lidar技术在国外的发展和应用已有十几年的历史,但是我国在这方面的研究和应用还只是刚刚起步,其中利用航空激光扫描探测数据进行困难地区dem、dom、dlg数据产品生产是当今的研究热点之一。
该技术在地形测绘、环境检测、三维城市建模等诸多领域具有广阔的发展前景和应用需求,有可能为测绘行业带来一场新的技术革命。
针对不同的应用领域及成果要求,结合灵活的搭载方式,lidar技术可以广泛应用于基础测绘、道路工程、电力电网、水利、石油管线、海岸线及海岛礁、数字城市等领域,提供高精度、大比例尺(1:500至1:10000)的空间数据成果。
例子
激光扫描设备装置可记录一个单发射脉冲返回的首回波﹑中间多个回波与最后回波,通过对每个回波时刻记录,可同时获得多个高程信息,将imu/dgps系统和激光扫描技术进行集成,飞机向前飞行时,扫描仪横向对地面发射连续的激光束,同时接受地面反射回波,imu/dgps系统记录每一个激光发射点的瞬间空间位置和姿态,从而可计算得到激光反射点的空间位置。
激光雷达的激光束扫瞄机场的滑道,探测飞机将遇到的风切变,即逆风的改变。
<a href="https://en.wikipedia.org/wiki/point_cloud">https://en.wikipedia.org/wiki/point_cloud</a>
前面提到了lidar扫描的数据包括了位置信息,以及其他传感器在对应这个位置采集的其他信息如 rgb、时间、温度、湿度等等(你可以大开脑洞想,什么都有)。
也就是说,每一个点都包含了大量的信息。
point cloud则是很多点的集合,所以信息量是非常庞大的。
postgresql 存储的point cloud格式与pdal(point data abstraction library)库一致。
非常好的复用了pdal的数据结构,操作方法等。
因为pdal的通用性,所以兼容性也非常的好。
基本类型,样例
pcpoint的聚合类型,一个pcpatch存储的是一些临近pcpoint的聚合。
样例
构造pcpoint
pcpoint转换成人类可读的文本
取pcid
将pcpoint转换为ogc wkb编码的二进制
读取pcpoint包含的维度(指定属性)信息
读取pcpoint的属性,返回array
把多个pcpoint聚合成一个pcpatch
pcpatch中包含多少个pcpoint
返回pcpatch包含的pcpoint的pcid
将pcpatch转换为ogc wkb编码的二进制
将pcpatch转换为文本
返回json格式的文本
解压pcpatch
多个pcpatch聚合为一个pcpatch
判断两个pcpatch是否有交叉
将pcpatch转换为pcpoint
求pcpatch中包含的某个维度的信息的平均值
求pcpatch中包含的某个维度的信息的最大值
求pcpatch中包含的某个维度的信息的最小值
求pcpatch中所有pcpoint的所有维度的平均值
求pcpatch中所有pcpoint的所有维度的最大值
求pcpatch中所有pcpoint的所有维度的最小值
返回pcpatch中在指定维度上大于指定值的pcpoint
返回pcpatch中在指定维度上小于指定值的pcpoint
返回pcpatch中在指定维度上在指定范围的pcpoint
返回pcpatch中在指定维度上等于指定值的pcpoint
压缩pcpatch
返回pcpatch中第n个pcpoint,正值从头开始计数,负值反向计数。
判断pcpatch和geometry是否有相交
返回pcpatch中与geometry相交的点组成的一个新的pcpatch
将pcpatch中的位置属性的信息转换为geometry类型
postgresql point cloud,使用document输入时,可以指定压缩方法。
写法如下,
支持的压缩方法如下
the point and patch binary formats start with a common header, which provides:
endianness flag, to allow portability between architectures
pcid number, to look up the schema information in the pointcloud_formats table
point binary
the patch binary formats have additional standard header information:
the compression number, which indicates how to interpret the data
the number of points in the patch
patch binary (uncompressed)
pcpatch的压缩格式的二进制表述请参考
<a href="https://github.com/pgpointcloud/pointcloud">https://github.com/pgpointcloud/pointcloud</a>
有两种格式导入
from wkb
from pdal
参考
<a href="https://en.wikipedia.org/wiki/lidar">https://en.wikipedia.org/wiki/lidar</a>
<a href="http://baike.baidu.com/view/2922098.htm">http://baike.baidu.com/view/2922098.htm</a>
<a href="http://pointcloud.org/">http://pointcloud.org/</a>
<a href="http://www.pdal.io/">http://www.pdal.io/</a>
<a href="http://www.pdal.io/quickstart.html">http://www.pdal.io/quickstart.html</a>