The reporting system uses a simple and easy to understand script based on a substitution mechanism which converts templates into a human readable documents filled with important information, for example an HTML file with listed project information.
The application exposes variables, which are automatically replaced with a proper value by the system. The value of a variable will be printed to the final report, when it is in a template in this form: $(variable_name). For example:
Today is $(dateTime)
will be automatically replaced to render the current date and time. In fact, it is not necessary a variable name but it can be even an expression $(expression) in the bracket and you can also control the rendering style, for example:
Focal length [35mm] = $(focalLength*36:.2)
will evaluate expression in the brackets and multiply focalLength with 36 to get the focal length w.r.t. 35mm film format. It will be written as a floating point value rounded to two decimal places.
Functions can control the way how these variables are filled, can define or remove variables. A function also starts with a $ sign, but its name is not enclosed in brackets: $function_name(). For example:
$ImportFile("Reports\\images\\camera.png", "camera.png")
will copy the file from the application reports folder to the export attachment folder.
The system also uses functions as creators and iterators of the function/variable scope, for example:
$ExportCameras( innerFunctionText )
will iterate all cameras, it will define variables which are holding information about the iterated camera and for each iterated camera it will expand and substitute innerFunctionText.
To explain this in detail, assume we have a component with 3 cameras which are calculated from images “image1.jpg”, “image2.jpg”, “image3.jpg” and the component is exported. The function $ExportCameras will read the first camera information, set up new variables (like camera matrices, calibration, flags etc.) and then it will expand innerFunctionText. The expanded text can contain all previous and these new variables. After the expansion, $ExportCameras function will move to the second camera and it will do the same. Then it will do the same with the last camera. If the template text looks like this:
$ExportCameras(Camera $(index), image=”$(imageName).$(imageExt)\n”)
then the result will look like:
Camera 1, image=”image1.jpg” Camera 2, image=”image2.jpg” Camera 3, image=”image3.jpg”
Please note that you can also use other functions, as well, and you can also use them recursively. For more complex examples, please check templates provided with the RealityCapture installation which are located in the installation folder under Reports sub-folder.
The system recognizes two export locations – the main file location – which was defined by the user in the export dialog and the attachments folder – which is created automatically and which is intended for storing the generated content. Unless stated otherwise, all export paths are automatically relative w.r.t. the attachment folder. For example:
$SaveOrtho( "$(orthoGuid)", "color", "image.jpg", 800, 800 )
will create and store “image.jpg“ under the attachments folder. If you need to access/store files using an absolute path, then you can do it by adding a prefix “global://” to the path, e.g. ”global://d:/exports/image.jpg”
To create a new template, you need some small coding or web-developer skills to create the template. However, even an non-expert can easily modify existing templates. RealityCapture default templates are located in the application installation folder under “Reports”.
The Export reports dialog displays reports defined in the reports definition file “Report.xml” located directly in the application installation folder. After you create your own report template, let’s say it is called “myReport.html”, simply add the following lines to the “Report.xml” between the existing “<Report>” and <Report> tags:
<format id="{00000000-0000-0000-0000-000000000000}" mask="*.htm" desc="Your Custom Report Name" writer="CapturingReality.Export.ReportWriter"> <hint>Describe what the report is intended for</hint> <body>$Include("Reports\myReport.html")</body> </format>
where id="{00000000-0000-0000-0000-000000000000}" should be a unique identifier of your template. For your personal purposes, it is completely sufficient to change few zeros to a number, e.g. {00000000-0000-0000-0000-000000000001}. However, if you want to share your template, then this value should be unique and you should use an online GUID generator. Please also note that the body string is also substituted and it just includes your template file. Also note that you can create any type of files, not just HTML ones.
The following help pages describe functions and variables exported by RealityCapture which can used to build your own templates.
However, in order to improve the RealityCapture application and help experiences, feel free to send us your feedback. We would love to help you with creating your template or extending the default ones.
Functions sets and their functions, expressions and variables
Project information, exporter scope, and basic function set
Learn how to export information about project images
Component export functions and variables
Learn how to get information about cameras
Learn how to add custom point statics to reports
Check the list of control points and constraints functionalities
Learn how to generate model reports
See the list of ortho projection export functions
See the list of map export functions