Is it possible to add relative calexFolder
paths in exportRegistration
’s xml options?
Also there seems to be no explicit export path for Colmap export, it just saves the txt files in the same folder as the addFolder
path.
I am currently using RealityCapture in my research on 3DGS, and need to process a lot of different experiments, which are just images that need alignment and Colmap format export. I have created a Powershell script for using RealityCapture.
My current solution is having a template export_options.xml, and creating a working copy of the xml file, swapping out the calexFolder
field with the absolute path of the current experiment. However, a simple relative path would make this a lot easier.
My full powershell script below:
<#
process_all.ps1
Run one RealityCapture alignment per sub-folder of -RootFolder.
Usage:
.\process_all.ps1 -RootFolder "D:\path\to\experiments"
#>
param(
[Alias('root_folder')]
[Parameter(Mandatory=$true)]
[string]$RootFolder
)
# ─ constants ────────────────────────────────────────────────────────────────
$RealityCaptureExe = 'C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe'
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$TemplateXml = Join-Path $ScriptDir 'colmap_export_config.xml'
$WorkingXml = Join-Path $ScriptDir 'current_config.xml'
if (-not (Test-Path $TemplateXml)) { throw "Template XML not found: $TemplateXml" }
if (-not (Test-Path $RealityCaptureExe)) { throw "RealityCapture.exe not found: $RealityCaptureExe" }
# ─ main loop ────────────────────────────────────────────────────────────────
Get-ChildItem -Path $RootFolder -Directory | ForEach-Object {
$exp = $_.FullName
$imageOut = Join-Path $exp 'undistorted' # folder RealityCapture will write
$exportBase = Join-Path $exp 'colmap' # export file
Write-Host "===== $($_.Name)"
# ensure undistorted dir exists
if (-not (Test-Path $imageOut)) { New-Item -ItemType Directory -Path $imageOut | Out-Null }
# copy template → current_config.xml and fix calexFolder value
Copy-Item $TemplateXml $WorkingXml -Force
[xml]$xml = Get-Content $WorkingXml
$entry = $xml.SelectSingleNode('//entry[@key="calexFolder"]')
if (-not $entry) { throw "calexFolder entry missing in template." }
$value = $entry.SelectSingleNode('value')
$value.InnerText = $imageOut
$xml.Save($WorkingXml)
# RealityCapture (one at a time)
$rcArgs = @(
'-headless'
'-addFolder' , $exp
'-set' , 'appIncSubdirs=true'
'-align'
'-exportRegistration' , $exportBase , $WorkingXml
'-quit'
)
Start-Process -FilePath $RealityCaptureExe -ArgumentList $rcArgs -WindowStyle Hidden
Write-Host " waiting for RealityCapture to finish ..."
Wait-Process -Name 'RealityCapture'
Write-Host " done."
}
Write-Host "All experiments processed."