#2429·openMVG

different results

Author: HerryJessicaCreated Dec 8, 2025Updated Dec 8, 2025
@echo off
setlocal

:: Configure OpenMVG paths 
set OPENMVG_BIN=E:\HerryProj\install\openMVG\release\bin
set SENSOR_DB=E:\HerryProj\install\openMVG\release\lib\openMVG

:: Check parameters
if "%1"=="" (
    echo Usage: %0 image_dir output_dir
    echo.
    echo image_dir: Input image directory
    echo output_dir: Output project directory
    goto :eof
)

if "%2"=="" (
    echo Usage: %0 image_dir output_dir
    echo.
    echo Please specify output directory
    goto :eof
)

set INPUT_DIR=%1
set OUTPUT_DIR=%2

echo Input directory: %INPUT_DIR%
echo Output directory: %OUTPUT_DIR%
echo OpenMVG path: %OPENMVG_BIN%

:: Check if paths exist
if not exist "%OPENMVG_BIN%" (
    echo Error: OpenMVG binary directory does not exist: %OPENMVG_BIN%
    echo Please modify the path configuration in the script
    goto :eof
)

if not exist "%SENSOR_DB%" (
    echo Error: Sensor database directory does not exist: %SENSOR_DB%
    echo Please modify the path configuration in the script
    goto :eof
)

:: Create output directories
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"


echo.
echo 1. Intrinsic analysis...
"%OPENMVG_BIN%\openMVG_main_SfMInit_ImageListing.exe" -i "%INPUT_DIR%" -o "%OUTPUT_DIR%" -d "%SENSOR_DB%\sensor_width_camera_database.txt" -f 1536
if errorlevel 1 goto error

echo.
echo 2. Computing features...
"%OPENMVG_BIN%\openMVG_main_ComputeFeatures.exe" -i "%OUTPUT_DIR%\sfm_data.json" -o "%OUTPUT_DIR%" -m SIFT
if errorlevel 1 goto error

echo.
echo 3. Generating image pairs...
"%OPENMVG_BIN%\openMVG_main_PairGenerator.exe" -i "%OUTPUT_DIR%\sfm_data.json" -o "%OUTPUT_DIR%\pairs.bin"
if errorlevel 1 goto error

echo.
echo 4. Computing matches...
"%OPENMVG_BIN%\openMVG_main_ComputeMatches.exe" -i "%OUTPUT_DIR%\sfm_data.json" -p "%OUTPUT_DIR%\pairs.bin" -o "%OUTPUT_DIR%\matches.putative.bin"
if errorlevel 1 goto error

echo.
echo 5. Filtering matches...
"%OPENMVG_BIN%\openMVG_main_GeometricFilter.exe" -i "%OUTPUT_DIR%\sfm_data.json" -m "%OUTPUT_DIR%\matches.putative.bin" -g f -o "%OUTPUT_DIR%\matches.e.bin"
if errorlevel 1 goto error


echo.
echo 6. Sequential reconstruction...
"%OPENMVG_BIN%\openMVG_main_SfM.exe" --sfm_engine INCREMENTAL --input_file "%OUTPUT_DIR%\sfm_data.json" --match_dir "%OUTPUT_DIR%" --output_dir "%OUTPUT_DIR%"
if errorlevel 1 goto error

echo.
echo 7. Coloring point cloud...
"%OPENMVG_BIN%\openMVG_main_ComputeSfM_DataColor.exe" -i "%OUTPUT_DIR%\sfm_data.bin" -o "%OUTPUT_DIR%\colorized.ply"
if errorlevel 1 goto error

echo.
echo Processing completed!
echo Results saved in: %OUTPUT_DIR%
goto :eof

:error
echo.
echo Error occurred during processing!
endlocal

I ran the same process multiple times with the same data and got the following different results. What could be causing the abnormal camera pose?

Image Image