I’ve been creating batch scripts to automate the Reality Capture Process, and so far have a pre and post editing script to process a single image folder/model.
I’m now trying to find a script that would process the script for multiple image folders, one after another, and export into a Model folder, and I understand this could entail adding variables to the script, however, I’m not sure how to correctly apply this to get the desired result.
Here’s the initial script for processing one data set.
Yes, I did see that topic, and looking at topics similar to what I’m trying to achieve. I think that user is using different parameters and I would like to try and get a discussion for what I’m looking for, creating my script. I could offer more details if it would help make the intended result more specific. Thanks!
I am trying to understand the %%f function better, and how it executes in a Notepad ++ written batch file, in that I understand it is a for function and the variable for which allows a repeating sequence?
RealityCapture’s CLI uses basic batch scripting, so it is a good way to start there and check some general workflows.
The mentioned %%f is basically a parameter for the loop (in this case it is a root to folder). Using the scripts like this it is needed to have the batch script in the same folder where you want to work. Also, you need to check the folder structure a prepare it properly for your needs.
For example, the folders FACS 02 and FACS 03 are just image folders? Also, don’t use spaces in your folder names, instead of that use underscores. And you need to remember on the application settings (GCPs, reconstruction region, XMLs). Are you using the same for all your images or each image set has its own?
And for that structure the script could look like this:
:: root path to work folders where all the datasets are stored (%~dp0 means the folder in which this script is stored)
set RootFolder=%~dp0:: set the name for the high-poly model
:: path to RealityCapture application
set RealityCaptureExe="C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe"
::Create loop on which to run RC for all subfolders
:: for /R %%f in (%RootFolder%\..) do >>runscriptrealitycapture
for /D %%f in ("%RootFolder%*") do (
::echo Processing folder: '%%f'^
:: run RealityCapture
%RealityCaptureExe% -newScene ^
-addFolder "%%f\Images" ^
-detectMarkers ^
-importGroundControlPoints "%%f\Settings\DetectPositions.txt" ^
-align ^
-save "%%f\Project\Project.rcproj" ^
-selectMaximalComponent "%%f\Project\Project.rcproj" ^
-setReconstructionRegion "%%f\Settings\forCutFACS.rcbox" ^
-calculateHighModel ^
-save ^
-selectLargestModelComponent ^
-invertTrianglesSelection ^
-removeSelectedTriangles ^
-renameSelectedModel "Unedited" ^
-exportSelectedModel "%%f\Outputs\Harlander_Unedited.obj" ^
-save ^
-quit
)
If you have general setting it can be set as direct path to those settings.
The script wasn’t tested, so maybe it will need some refinements. Good luck with your work!
while your script update is launching Reality Capture, the operation is failing on finding images. I’m not sure why that’s the case. Also, under this line, I had I to remove the asterisk that was proceeding %RootFolder% in order for Reality Capture to launch :
for /D %%f in ("%RootFolder%") do (
::echo Processing folder: '%%f'^
This is the current state the script is looking:
:: root path to work folders where all the datasets are stored (%~dp0 means the folder in which this script is stored)
set RootFolder=%~dp0::
:: path to RealityCapture application
set RealityCaptureExe= "C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe"
::Create loop on which to run RC for all subfolders
:: for /R %%f in (%RootFolder%\..) do >>runscriptrealitycapture
for /D %%f in ("%RootFolder%") do (
::echo Processing folder: '%%f'^
:: run RealityCapture
%RealityCaptureExe% -newScene ^
-addFolder "%%f\Images" ^
-detectMarkers ^
-importGroundControlPoints "%%f\Settings\DetectPositions.txt" ^
-align ^
-save "%%f\Project\FACS.rcproj" ^
-selectMaximalComponent ^
-setReconstructionRegion "%%f\Settings\forCutFACS.rcbox" ^
-calculateHighModel ^
-save ^
-selectLargestModelComponent ^
-invertTrianglesSelection ^
-removeSelectedTriangles ^
-renameSelectedModel "Unedited" ^
-exportSelectedModel "%%f\Outputs\Unedited.obj" ^
-save ^
-quit
)
Hi,
as I wrote you before, the script wasn’t refined.
It should work like this (this one was tested):
:: root path to work folders where all the datasets are stored (%~dp0 means the folder in which this script is stored)
set RootFolder=%~dp0
:: path to RealityCapture application
set RealityCaptureExe="C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe"
::Create loop on which to run RC for all subfolders
:: for /R %%f in (%RootFolder%\..) do >>runscriptrealitycapture
for /D %%f in ("%RootFolder%*") do (
::echo Processing folder: '%%f'^
:: run RealityCapture
%RealityCaptureExe% ^
-newScene ^
-addFolder "%%f\Images" ^
-detectMarkers ^
-importGroundControlPoints "%%f\Settings\DetectPositions.txt" ^
-align ^
-save "%%f\Project\Project.rcproj" ^
-selectMaximalComponent "%%f\Project\Project.rcproj" ^
-setReconstructionRegion "%%f\Settings\forCutFACS.rcbox" ^
-calculateHighModel ^
-save ^
-selectLargestModelComponent ^
-invertTrianglesSelection ^
-removeSelectedTriangles ^
-renameSelectedModel "Unedited" ^
-exportSelectedModel "%%f\Outputs\Harlander_Unedited.obj" ^
-save ^
-quit
)
But it is possible that in attached script are unnecessary spaces, so you will need check for that.