大约六年前,我们作为FME几何家族的新成员增加了点云。从那时起,我们的许多客户都使用FME Point Cloud Tools用于各种操作,主要由LIDAR扫描组成。

从最受欢迎的情况表面产生,到城市场景可视化,植被生长控制, 和道路质量评估,我们的用户通常以传统形式处理点云以及出于良好的目的。

Typical uses of point clouds.

Typical uses of point clouds.

But point clouds can play unusual roles in scenarios where traditionally we wouldn’t see a place for them.

使用点云的优点

我们为什么还要考虑在其传统领域之外使用点云?好吧,这是主要答案:在处理庞大的数据量时,点云处理非常有效。

How FME Processes Point Clouds So Effectively

Here is a simple example: if we read a text file with over 3,000,000 XYZ coordinates point by point, it takes 2.5 minutes. If we read the same file as a point cloud, it takes less than 3 seconds. Visualization in the FME Data Inspector requires about the same time, so we either can spend about 5 minutes waiting to see how our data looks, or just start looking immediately.

The difference between reading 3 million points as a text file vs. as a point cloud.)

The difference between reading 3 million points as a text file vs. as a point cloud.

我们如何实现这一目标?FME中的特征转换是基于以下假设:每个功能可能具有自己的模式和/或几何形状,对于许多格式类型(例如CAD或XML)通常是正确的。这为FME用户提供了强大的力量,因为我们可以调整翻译的最佳细节。但是,这是有代价的,价格是翻译的速度。

使用点云,我们做出了不同的假设 - 所有点具有相同的组件(这是特征属性的类似物),并且组件的数据类型相同。这允许处理点不是一个一个,而是大块,不检查其数据结构是否存在任何差异。

Flexible Structure

Among other advantages of point clouds I would name the flexibility with which we can manipulate point components. We can fully change the look and geometry of the point cloud, perform advanced calculations, and then restore the original look of the point cloud, now enriched with new information.

What is also interesting is FME does not require the points to have all three coordinates – we can make a point cloud where points don’t have Z value. Or Y. Or even don’t have coordinates at all. It this case, we get a “pointless point cloud”, which may sound absurd, but it does not mean such point clouds are meaningless, it only means they have other components than XYZ. We cannot visualize their non-existent geometry, but still can use them in transformations, saving on storage not used for X, Y, and Z.

方案

在下面,我将仔细阅读多种情况,具有非常规云的使用。它们都是基于客户请求的,并且没有特别要求应用点云技术的请求 - 我们不经常考虑在转换过程中切换到其他几何类型。

The first scenario shows how to split 2D polygons into pieces of equal sizes. The second scenario performs 3D analysis. The next two examples deal with rasters – how to color a DEM, and how to calculate statistics on an arbitrary raster.

多边形瓷砖

I don’t know the exact scenario our customer had, but this was the first time I tried to use a point cloud to solve a non-point cloud problem. The customer needed to split polygons into pieces of approximately equal sizes, and the shape of the pieces didn’t really matter.

FME可以从任何几何形状中构成点云– points and other point clouds, rasters, 3D solids and surfaces, even polygons and lines. The transformer that performs such a powerful transformation is calledPointCloudCombiner。对于基于向量的几何形状,我们指定点之间的间隔,几何形状被许多均等的点代替。

首先,将多边形变成均匀间隔的点云。

首先,将多边形变成均匀间隔的点云。

FME also can, withPointCloudCoercer,将点云分为多点,分为多点。考虑到点和多点中相等数量之间的相等空间,我们可以假设我们从PointCloudCoercer占据大致相同的区域:

然后将点云分割成multipoints of approximately equal size.

然后将点云分割成multipoints of approximately equal size.

Now if we can将这些多重分子变成多边形,我们有解决方案。问题是,由于点本身没有大小,因此多点之间的差距很小。

在将多重几何形状变成多边形之前,请解决它们之间的间隙。

在将多重几何形状变成多边形之前,请解决它们之间的间隙。

在我在2013年制作的原始工作空间中,我使用了HullReplacerto get concave hulls, which then I tried to clean with a lot of vector transformers, which included概括器,Anchoredsnapper,CenterlineReplacer等等。这是工作流程中最弱的部分 - 慢,矢量输出的质量根本不是很好。亚搏在线

在撰写本文时,我决定重新评估我的多边形创建方法,并找到了一个更优雅的解决方案,该解决方案也涉及更多的几何类型 - 我决定去栅格多点。栅格单元总是具有一定的大小,如果我们将该尺寸设置为用于制作点云的间距,我们将填补零件之间的所有空白。

根据分裂模式,我们可以获得不同的结果。“空间相等点多点”模式产生的区域的大小变化较小,而“嵌套相等的区域多点”会产生更好的形状。

瓷砖多边形由两种不同的分裂模式产生。

瓷砖多边形由两种不同的分裂模式产生。

Download example.

视图分析

Viewshed analysis is a common function of many GIS packages. It determines visibility from/to a certain point to/from the cells of a DEM (Digital Elevation Model) raster.

How viewshed analysis works.

How viewshed analysis works. (Credit:佐兰Čučković)

FME没有特定的变压器来执行此类分析。来自新西兰的Oberdries Consulting Ltd的Mike Oberdries问我有可能与FME进行观看分析,并通过说这是一个“ DMITRI-Type”问题来吸引我。我对自己透露太多吗?

在最初说“不”之后,我一直在思考如何解决问题,然后决定尝试使用点云技术。几天之内,我提出了一个想法,该想法成功实施并帮助我们打破了一些FME世界纪录 - 在转型期间,大约24小时,我们不得不处理17,000,000,000点。

Mike’s scenario is pretty specific to his dataset; this is why here I am going to show a more general approach to the problem.

一开始,我们只有a raster DEM and a point representing the location of the observer

观看分析问题的两个输入。

观看分析问题的两个输入。

我们generate a unique ID for each raster cell (target) and make a point cloud from the DEM withPointCloudCombiner, in which每个像素成为一个点将XYZ坐标和单元ID作为组件。

在下一步中,我们测量观察者和目标点之间的距离(使用简单的毕达哥拉斯定理 - 我的算法不考虑地球的曲率),并且make visibility rays as sets of points along the imaginary 3D lines connecting the observer and the targets。因此,例如,如果距离为100米,我们认为射线的点密度应该为5米,我们将在观察者和目标之间获得20分。

The observer’s visibility, represented as points along lines.

The observer’s visibility, represented as points along lines.

一旦我们有所有要点,我们就会用dem覆盖它们usingPointCloudonrasterComponentsetter。每个点将在其位置获得地面高程。现在我们可以轻松地将点云分成两个PointCloudFilterby comparing the difference between the point and ground elevations. If the difference is bigger than or equal to 0, the point is above or on the ground, otherwise, it is below the ground.

So, by this moment,each point “knows” whether it is above or below the ground, 和to which ray it belongs. This means from now on we don’t need X, Y, and Z in this point cloud – we can remove these components for faster processing (PointCloudComponentRemover) - 仅保留一个组件,即射线ID。

我们只能将点云放在地下下方的点云中,然后将其合并(PointCloudMerger) by ray ID. If we use only the output from the Referenced port, we get a single point per ray. Essentially, this is观察者看不到的射线列表(或单元格)。我们可以将这个点云与原始点云(具有XYZ)进行比较,对于没有匹配的光线,我们具有完整的可见性,即射线的所有点都在地面上方。

FME Workspace that overlays the DEM on the visibility ray point cloud and outputs the visible points.

FME Workspace that overlays the DEM on the visibility ray point cloud and outputs the visible points.

之后,例如,我们可以将结果栅格化(ImageRasterizer),产生一个表面(TINGenerator) from the original DEM and apply the raster as a texture onto the surface (ShareiteMadderandShareSiteMidSetter)。

生成表面模型和栅格,并叠加它们以提供有用的输出。

生成表面模型和栅格,并叠加它们以提供有用的输出。

如果我们生成一系列改变观察者海拔的射手,我们甚至可以获得一个不错的动画gif:

视图分析作为动画gif。

视图分析作为动画gif。

Download example.

栅格Coloring

我们有很多要求要求栅格着色功能。我们有一个自定义变压器rasterhsvshader由Jens Frolik通过FME Hub提供,它使用HSV(色调,饱和度,值)模型制造了DEM的彩色丘陵代表。我们也有一个非常强大的栅格ExpressionEvaluator这可以任何我们想要的方式改变像素颜色,但是即使使用简单的颜色坡道也可能需要产生令人难以置信的复杂状况。

在此期间FME World Tour 2016,我另外收到了以FME为代表的Dem Rasters的请求,并带有无聊的灰度音调,并决定解决这个问题。只要服用一个多么伟大predefined color ramp并将其应用于任何DEM。出于测试目的,我以RGB栅格的形式创建了这样的坡道paint.net

彩色坡道作为RGB栅格。

彩色坡道作为RGB栅格。

How can we spread these colors along the range of DEM elevations? The answer should be already obvious – with a point cloud!

我们将原始的栅格变成点云,将XYZ值复制到临时组件(x_orig,y_orig,z_orig),然后设置新的xyz值:

在我们借用其颜色之前,颜色坡道栅格也需要进行一些转换。我们重新采样颜色坡道,使其沿着Y轴具有一个像素,适用于高程范围内的每个整数值。Then we georeference the ramp so that it gets placed along the points of our DEM point cloud, which is currently, as the paragraph above explains, just set of points along a line:

The original raster becomes an elevation-sorted point cloud (the line up the middle), and the color ramp is placed along it.

The original raster becomes an elevation-sorted point cloud (the line up the middle), and the color ramp is placed along it.

PointCloudonrasterComponentsetter将RGB值从坡道带到DEM点,然后PointCloudComponentCopierrestores the original XYZ values。Now if we栅格our point cloud, we will get a nicely colored RGB raster (the original is on the left along with the color ramp, the result of the coloring is on the right):

原始的栅格和彩色坡道(左)和颜色的结果(右)。

原始的栅格和彩色坡道(左)和颜色的结果(右)。

Using this technique means that the color ramp does not necessarily have to look as a traditional stripe with gradually changing colors – we can use ANY image to color the raster and get some stunningly beautiful images that resemble agate-like patterns.

原始光栅(左上)和几个输出使用各种图像作为彩色坡道。

原始光栅(左上)和几个输出使用各种图像作为彩色坡道。

Download example.

栅格统计

Another frequent request isRasterStatistics colculator。不幸的是,截至2016年5月,FME没有这样的变压器。解决它非常容易,因为如上所示,我们可以将光栅变成点云,对于这种几何,我们有pointCloudStatisticalculculator

使用FME计算栅格统计pointCloudStatisticalculculator。

使用FME计算栅格统计pointCloudStatisticalculculator

Once the statistics are calculated, we can merge the statistical attributes back with the original raster or process them separately.

Download example.

结论

I really hope my examples showed how powerful point cloud techniques can be when they are applied outside of their traditional domain.

充分重组点云的几何表示并将其恢复为原始外观的潜力是比较和分析不同数据集的绝佳方法。

Plus, the ability to go between different geometry types allows us to choose the best geometry for a particular operation.

Finally, imagine if we could in the future apply the point cloud processing speed to regular vector features. Well, this bright future might be not that far away – we’re working hard to make it happen soon.

我应该为下一次FME世界巡回演唱会提出一个口号:“一次有所作为,一次有100万个功能”?

关于Data 大数据 激光雷达 表现 点云 栅格

Dmitri花园

Dmitri is the scenario creation expert at Safe Software, which means he spends his days playing with FME and testing what amazing things it can do.

Comments

4对“像点云一样思考:有效数据处理的提示”的回应”

  1. 科林 says:

    优秀作品!!

  2. 阿德里安·卡拉克(Adrian Carac) says:

    嗨,dmitri,
    I used an approach similar to your Viewshed Analysis for Aerodrome terrain penetrating Obstacle Limitation Surfaces (OLS).
    我创建了一个带有两个输入的自定义变压器,一个用于地形的DEM和CAD的一组3DPolylines作为OLS。
    I create convex hulls of both the inputs, clip them against each other to get only a small area of interest for processing, used the 2DGridAccumulator to create a grid of points for the area of interest with an user inputted spacing that I drape on both the inputs.
    I then subtract the two obtained Z values to get a new attribute that I then normalize to 5 (I like 5) via it’s range from StatisticsCalulator and 3DForcer and I send the points to a ContourGenerator with Interval set to 1 to get 5 contours (from normalization), filter the lines with elevation=0, combine the lines and drape them on one of the inputs to make them 3D.
    然后,我清洁了CAD中的结果(我在3Dpolylines的边缘上得到了很多文物)。
    The result looks’ like this (I used pointcloud instead of DEM for prettier visualization)https://imgur.com/a/yt26yeb
    如果我弄清楚如何清洁FME中的工件,我将将其发布到集线器上。

  3. 佐兰 says:

    Hello Dimitri,
    Very interesting stuff !
    Would you mind to provide a proper link/credit for my illustration titled “How viewshed analysis works”. I’m glad you’re using it, no problem with that !
    谢谢 !

Leave a Reply

Related Posts