1 minute read

Estimating Camera Poses with COLMAP

Install COLMAP

  • ์ตœ์‹  ๋ฒ„์ „์˜ COLMAP (๊ฐ€๋Šฅํ•˜๋ฉด CUDA ์ง€์›)์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉํ•˜๋ ค๋Š” ์ด๋ฏธ์ง€๋ฅผ /input ๋””๋ ‰ํ† ๋ฆฌ์— ๋„ฃ์Šต๋‹ˆ๋‹ค.

Run conversion script

  • COLMAP์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€์—์„œ ์นด๋ฉ”๋ผ ํฌ์ฆˆ๋ฅผ ๊ณ„์‚ฐํ•˜๋ ค๋ฉด Gaussian Splatting์˜ ์›๋ž˜ ๊ตฌํ˜„์—์„œ gaussian_splatting/convert.py ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:
python gaussian_splatting/convert.py -s <location>
  • gaussian-splatting/convert.py๋ฅผ ๋ณด์‹œ๋ฉด, ์ดฌ์˜ํ•œ input ์ด๋ฏธ์ง€๋“ค์— ๋Œ€ํ•ด Image undistortion๊นŒ์ง€ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
### Image undistortion
## We need to undistort our images into ideal pinhole intrinsics.
img_undist_cmd = (colmap_command + " image_undistorter \
    --image_path " + args.source_path + "/input \
    --input_path " + args.source_path + "/distorted/sparse/0 \
    --output_path " + args.source_path + "\
    --output_type COLMAP")
exit_code = os.system(img_undist_cmd)
if exit_code != 0:
    logging.error(f"Mapper failed with code {exit_code}. Exiting.")
    exit(exit_code)

Handling multiple sub-models

  • COLMAP์ด ๋ชจ๋“  ์ด๋ฏธ์ง€๋ฅผ ๋™์ผํ•œ ๋ชจ๋ธ๋กœ ์žฌ๊ตฌ์„ฑํ•˜์ง€ ๋ชปํ•˜๊ณ  ์—ฌ๋Ÿฌ ์„œ๋ธŒ ๋ชจ๋ธ์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๊ธฐ๋ณธ์ ์œผ๋กœ convert.py ์Šคํฌ๋ฆฝํŠธ๋Š” ์ฒซ ๋ฒˆ์งธ ์„œ๋ธŒ ๋ชจ๋ธ์—๋งŒ ์ด๋ฏธ์ง€ ์™œ๊ณก ์ œ๊ฑฐ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ์ฒซ ๋ฒˆ์งธ ์„œ๋ธŒ ๋ชจ๋ธ์— ์ด๋ฏธ์ง€๊ฐ€ ๋ช‡ ๊ฐœ ์—†๋Š” ๊ฒฝ์šฐ, ๊ฐ€์žฅ ํฐ ์„œ๋ธŒ ๋ชจ๋ธ๋งŒ ๋‚จ๊ธฐ๊ณ  ๋‚˜๋จธ์ง€๋Š” ์‚ญ์ œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

Keep the largest sub-model

  • ์ž…๋ ฅ ์ด๋ฏธ์ง€๊ฐ€ ์žˆ๋Š” ์†Œ์Šค ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์—ด๊ณ , /distorted/sparse/ ํ•˜์œ„ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์—ฝ๋‹ˆ๋‹ค.
  • 0/, 1/ ๋“ฑ์œผ๋กœ ์ด๋ฆ„ ๋ถ™์—ฌ์ง„ ์—ฌ๋Ÿฌ ํ•˜์œ„ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ๋ณด์ผ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
  • ๊ฐ€์žฅ ํฐ ํŒŒ์ผ์„ ํฌํ•จํ•˜๋Š” ํ•˜์œ„ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ํ•˜์œ„ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์‚ญ์ œํ•˜๊ณ , ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ 0/์œผ๋กœ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
  • ๊ทธ๋Ÿฐ ๋‹ค์Œ ๋งค์นญ ๊ณผ์ •์„ ๊ฑด๋„ˆ๋›ฐ๊ณ  convert.py ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:
python gaussian_splatting/convert.py -s <location> --skip_matching

Merging sub-models (optional)

  • ์„œ๋ธŒ ๋ชจ๋ธ๋“ค์ด ๊ณตํ†ต์œผ๋กœ ๋“ฑ๋ก๋œ ์ด๋ฏธ์ง€๋ฅผ ํฌํ•จํ•˜๋Š” ๊ฒฝ์šฐ, COLMAP์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹จ์ผ ๋ชจ๋ธ๋กœ ๋ณ‘ํ•ฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋‹จ, ์„œ๋ธŒ ๋ชจ๋ธ ๋ณ‘ํ•ฉ ํ›„์—๋Š” ์ „์—ญ ๋ฒˆ๋“ค ์กฐ์ •์„ ๋‹ค์‹œ ์‹คํ–‰ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์‹œ๊ฐ„์ด ๋งŽ์ด ์†Œ์š”๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

https://github.com/Anttwo/SuGaR?tab=readme-ov-file

Leave a comment