SPAN8.
SPAN4.
Pix4D is a cloud based photogrammetry service that can generate orthophotos, point clouds and 3D models from aerial imagery. In the FME Hub are several transformers that allow you to connect to the Pix4DEngine online tools:https://hub.safe.com/?page=1&page_size=20&order=relevance&query=pix4d
In this example, we will use the FME Hub transformers and FME Server to create a process to completely automate the production of orthophotos, point clouds and 3D models from appropriate drone photography.
To get good results, we will need imagery suitable for creating stereo models. Images should have 60% overlap along the flight lines, and 30% overlap between flight lines. Images should also include photo GPS centers in their EXIF tags.
我们有一组可用于测试该过程的样本无人机照片:
We want the process to:
创建一个新的PIX4D项目
将照片上传到项目
启动PIX4D处理以创建orthophoto,点云和3D模型
Wait for the processing to complete
拉链结果
Provide the user with a download link for the results.
PIX4D在进程结束时提供通知电子邮件,但仅对帐户的所有者,并且无法更改此电子邮件,因此我们需要找到另一种方法来确定进程何时完成。PIX4DProcessLauncher可以选择等待在处理完成之前,但我们不想浪费FME发动机等待一个更大的项目需要花费多小时的过程。
One solution is to check the project parameters with the Pix4DProjectInfoRetriever to see if the project status is set to DONE. Since we are implementing this on FME Server, the easiest way to do this is to create a Schedule to run a small workspace to check the progress every few minutes.
Once the process is finished, we can request a link to a zip file of the project outputs to send to the submitter. However, this zip file is not created until it is first requested, and it may take several minutes to create, so we will create another schedule to run a workspace to wait for the zip file to be finished.
现在我们不希望所有这些时间表混淆FME服务器,以便在不再需要它们时删除它们。最简单的方法是使用FME Server的REST API来创建和删除Workspaces本身的计划。
And so we end up with three workspaces:
PIX4DAUTOMATION.
Uploads user images to FME Server
创建新的Pix4dengine项目
Uploads image to project
Launches Pix4D processing
Creates FME Server schedule to run checkPix4DProgress workspace every 5 minutes
Send ‘please wait’ HTML response to user
checkPix4DProgress
检查处理状态
If process is finished:
Deletes the process checking schedule
创建新计划以每2分钟运行每2分钟的核填充
checkPix4DZip
请求项目输出ZIP URL
If url is returned (zipping is done):
删除zip检查计划
Emails the user the zip file url
Once the workspace are uploaded to FME Server, we want to be able to run Pix4DAutomation without logging in to the FME Server interface. This is best done through FME 2019's FME Server Apps. For more detailed information please seeGetting Started with FME Server Apps。
The workspaces can be downloaded from:
Workspaces
This workspace has JPEG reader to allow the user to upload images to FME Server, and an HTML writer to return the ‘please wait’ message while Pix4D processes the images.
它还要求用户的电子邮件地址发送下载链接。
在使用工作区之前,您需要设置两个私有参数:
由于工作空间将在FME服务器上创建和删除计划,因此它需要一个身份验证令牌以允许访问这些功能。要生成此令牌,请按照下列步骤操作:
以管理员身份登录FME服务器
从右上角的“用户设置”图标,选择“管理令牌”
Click the New button to create a new token
给它代表名称(即pix4d_processs)和描述
Set a long expiration date (ie. 5 years)
For simplicity, choose All Permissions
Click OK to create the token
令牌将会显示。将其复制并粘贴到工作区中的FME云令牌参数中。下载令牌(使用下载按钮)并将其存放在一个安全的地方可能也是一个好主意,因为这是可以看到的唯一一次,它将隐藏在工作区中。亚搏在线
注册PIX4DENGINE帐户时,您将获得两个访问密钥:客户端ID和客户端秘密ID。使用以下步骤从这些键创建PIX4D Web连接:
In Workbench, choose FME Options from the menu, then choose Web Connections.
单击“管理服务”按钮
Choose Pix4DEngine from the list on the left and click the Download button
Close the Manage dialog
单击+以添加新的Web连接
将Web服务设置为Pix4dengine
Add a representative Connection Name (ie. My Pix4D Connection)
Add the Client ID and Client Secret ID onto the appropriate boxes
单击验证以测试和保存
Set the workspace Pix4D Web Connection parameter to the new connection.
第一部分读取JPEG图像上传to FME Server, but discards the geometry, so that only the headers are read. These are aggregated into a single trigger feature, to which the source files and workspace folder are added as attributes.
The JPEG reader is not really used, but is just included to enable the image upload section in the FME Server interface.
The DatetimeStamper and AttributeRounder create a timestamp used to provide a unique name for each project within the Pix4DProjectCreator
The Pix4DConnection from the private parameter is used to connect to the Pix4D service.
Pix4DCreator将返回the Pix4D project id number in the attribute proj_id.
PIX4DimageAdder使用Proj_ID属性和源图像列表来将其上传到PIX4D并使用项目注册。
PIX4DProcessLauncher启动处理,无需等待结果。
All three workspaces should be uploaded to the same repository on FME Server, but we don’t know what it’s called. However, we can extract the repository name from the workspace path, to use when creating the schedule for the polling workspaces.
Next, we create a schedule to run the polling workspace.
This submits a REST API call to the local FME server to create a new schedule, using the FME Server token in the private parameter.
PIX4D项目ID号和用户电子邮件将传递给轮询工作区作为输入参数。计划提供了一个非常长的结束日期,因为它将被过程删除。间隔设置为每5分钟。项目编号用于为每个计划创建唯一名称,允许同时运行多个进程。
Finally, we create a simple HTML response to be returned to the user to let them know that the job was successfully submitted. This workspace should be published to the Data Streaming Service, so that the HTML output is seamlessly streamed back to the user.
此工作区以间隔运行以检查PIX4D进程是否已完成。
Like in the automation workspace, the FME Server token and Pix4D connection must be set up in the Private parameters before publishing to FME Server. The workspace should be published to the Job Submitter service.
PIX4DProjectInforeTriever变压器用于获取当前项目信息,然后将项目状态检查以查看该值是否“完成”。
If the processing is complete, a REST API call is made to FME Server to delete the schedule currently running the check progress workspace,
Next, another REST API call to FME Server is made to create a new schedule to run the zip checking workspace every two minutes.
The schedule is also supplied with the project number and user email, which it will provide to the zip checking workspace.
This workspace requests the zip file location for the Pix4D output files. This zip file is not created during processing, so the first run of the workspace will kick off the zip process.
工作空间还要求设置FME服务器令牌和PIX4D Web连接。
The Emailer transformer currently uses a GMail connection that needs to be set up for your GMail account.
选择“添加Web连接”选项,然后选择Google Gmail。
Click the Authenticate button to log into GMail and authenticate the connection. This only needs to be done once per machine.
This Web Connection will be uploaded to FME Cloud when you publish the workspace. The workspace should be published to the Job Submitter service.
The Pix4DOutputFetcher transformer is used to request the zip file location. If the zipping is finished and the location is returned, a REST API call to FME Server is made to delete the zip checking schedule, then an email is sent to the user provided address with the url of the zip file. The Body of the email can be modified to provide a richer message to the user.
此示例旨在熟悉Pix4dengine服务的功能,并向您展示如何通过FME集线器Pix4D变压器访问它们。
We hope you will use this as a starting point for your own automated Pix4D processes.
©2020 S亚搏在线afe Software Inc |合法的