2 minute read

Converting Video to Images with ffmpeg

Install ffmpeg

๋น„๋””์˜ค๋ฅผ ์ด๋ฏธ์ง€๋กœ ๋ณ€ํ™˜ํ•˜๋ ค๋ฉด ffmpeg์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

Run ffmpeg command

ffmpeg -i <Path to the video file> -qscale:v 1 -qmin 1 -vf fps=<FPS> %04d.jpg
  • ์—ฌ๊ธฐ์„œ ๋Š” ๋น„๋””์˜ค ์ด๋ฏธ์ง€์˜ ์ƒ˜ํ”Œ๋ง ์†๋„๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
  • FPS ๊ฐ’์ด 1์ด๋ฉด ์ดˆ๋‹น ํ•˜๋‚˜์˜ ์ด๋ฏธ์ง€๋ฅผ ์ƒ˜ํ”Œ๋งํ•ฉ๋‹ˆ๋‹ค.
  • -qscale:v๋Š” ๋น„๋””์˜ค ํ’ˆ์งˆ์„ ์ œ์–ดํ•˜๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.
    • ๊ฐ’์ด ๋‚ฎ์„์ˆ˜๋ก ํ’ˆ์งˆ์ด ๋†’๊ณ  ํŒŒ์ผ ํฌ๊ธฐ๊ฐ€ ์ปค์ง‘๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ 1์€ ์ตœ๊ณ  ํ’ˆ์งˆ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
  • -qmin์€ ๋น„๋””์˜ค์˜ ์ตœ์†Œ ํ’ˆ์งˆ ์ˆ˜์ค€์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
    • 1๋กœ ์„ค์ •ํ•˜๋ฉด ์ตœ์†Œ ํ’ˆ์งˆ์„ ์ตœ๊ณ ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
      -vf fps=60:
    • -vf ์˜ต์…˜์€ ๋‹ค์–‘ํ•œ ๋น„๋””์˜ค ํ•„ํ„ฐ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ฉฐ, ๊ทธ ์ค‘ ํ•˜๋‚˜๊ฐ€ fps=60์ธ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
    • fps=60์€ ๋น„๋””์˜ค์˜ ํ”„๋ ˆ์ž„ ์†๋„๋ฅผ ์ดˆ๋‹น 60 ํ”„๋ ˆ์ž„์œผ๋กœ ์„ค์ •ํ•˜๋Š” ํ•„ํ„ฐ์ž…๋‹ˆ๋‹ค.

์ƒ˜ํ”Œ๋ง ์†๋„๋Š” ๋น„๋””์˜ค ๊ธธ์ด์— ๋งž์ถ”์–ด ์กฐ์ •ํ•˜์—ฌ ์ƒ˜ํ”Œ๋ง๋œ ์ด๋ฏธ์ง€ ์ˆ˜๊ฐ€ 100์—์„œ 300 ์‚ฌ์ด๊ฐ€ ๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

60fps๋กœ ์ดฌ์˜๋œ 21์ดˆ์˜ ๋น„๋””์˜ค์ธ ๊ฒฝ์šฐ

  • ์ด ํ”„๋ ˆ์ž„ ์ˆ˜ ๊ณ„์‚ฐ: 60 fps ร— 21 seconds = 1260 frames
  • ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ ๊ณ„์‚ฐ: ์›ํ•˜๋Š” ์ด๋ฏธ์ง€ ์ˆ˜ (N)๊ฐ€ 100 ~ 300 ์‚ฌ์ด์—ฌ์•ผ ํ•˜๋ฏ€๋กœ,
    • $1260 / 300 โ‰ค ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ โ‰ค 1260 / 100$
    • ์ฆ‰, $4.2 โ‰ค ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ โ‰ค 12.6$
    • ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ์„ ์ •์ˆ˜๋กœ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋ฏ€๋กœ,
    • 5 ~ 12 ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • 60fps ๋น„๋””์˜ค์—์„œ ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ์œผ๋กœ ์ƒ˜ํ”Œ๋ฆญ ์†๋„ fps ๊ณ„์‚ฐ
    • 60fps ๋น„๋””์˜ค์—์„œ ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ์ด 12์ธ ๊ฒฝ์šฐ ์ƒ˜ํ”Œ๋ง ์†๋„๋Š” $60/12=5fps$๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.
    • ffmpeg์—์„œ fps=5๋กœ ์ถ”์ถœํ•˜๋Š” ๊ฒฝ์šฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

      ffmpeg -i <Path to the video file> -qscale:v 1 -qmin 1 -vf fps=5 %04d.jpg
      
    • Ouput frame ์ €์žฅ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•˜๋ ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ•ด์ค๋‹ˆ๋‹ค.

      ffmpeg -i <Path to the video file> -qscale:v 1 -qmin 1 -vf fps=5 <Path to the Output frame folder / %04d.jpg>
      

๊ฒฐ๊ณผ

  • 12 ํ”„๋ ˆ์ž„ ๊ฐ„๊ฒฉ์œผ๋กœ ์ถ”์ถœํ•œ ๊ฒฝ์šฐ 109๊ฐœ์˜ ์ด๋ฏธ์ง€๊ฐ€ ์ถ”์ถœ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

    image

  • ๊ฐค๋Ÿญ์‹œ S23+๋กœ ์ดฌ์˜ํ•œ ๋น„๋””์˜ค์—์„œ ์ถ”์ถœ๋œ ํ”„๋ ˆ์ž„์˜ ํ•ด์ƒ๋„๋Š” Width x Height = 3840 x 2160์ž…๋‹ˆ๋‹ค. image

์ถ”์ถœํ•˜๋Š” Video์˜ ํ•ด์ƒ๋„๋ฅผ ๋ณ€๊ฒฝํ•˜๊ณ  ์‹ถ์œผ๋ฉด -vf์˜ ์ธ์ž fps์™€ ํ•จ๊ป˜ ,๋กœ ์—ฐ๊ฒฐํ•˜์—ฌ ์ค๋‹ˆ๋‹ค.

  • ์ฆ‰, "-scale=Width:Height, fps=5"์„ ์ค๋‹ˆ๋‹ค.
  ffmpeg -i C:/Users/MNL/KHS/nerfs/data/test_video.mp4 -qscale:v 1 -qmin 1 -vf "scale=1280:720, fps=5" C:/Users/MNL/KHS/nerfs/data/frames_5/%04d.jpg

ํ•ด์ƒ๋„๊ฐ€ ๋ณ€ํ™˜๋˜์–ด ์ถ”์ถœ๋œ ์ด๋ฏธ์ง€๋“ค

image image


Tips for 3D Scene Reconstruction

Capture images or a video

  • ์Šค๋งˆํŠธํฐ์ด๋‚˜ ์นด๋ฉ”๋ผ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 3D ์žฅ๋ฉด์˜ ์ „์ฒด ํ‘œ๋ฉด์„ ์ดฌ์˜ํ•ฉ๋‹ˆ๋‹ค.

Move around the scene

  • ์žฅ๋ฉด ์ฃผ์œ„๋ฅผ ์ด๋™ํ•˜๋ฉฐ ์˜์ƒ์„ ๋…นํ™”ํ•ฉ๋‹ˆ๋‹ค.

Move slowly and smoothly

  • ๋ชจ์…˜ ๋ธ”๋Ÿฌ๋ฅผ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ์ฒœ์ฒœํžˆ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์›€์ง์ž…๋‹ˆ๋‹ค.

Consistent reconstruction

  • ์ผ๊ด€๋œ ์žฌ๊ตฌ์„ฑ์„ ์œ„ํ•ด ์ผ์ •ํ•œ ์ดˆ์  ๊ฑฐ๋ฆฌ์™€ ์ผ์ •ํ•œ ๋…ธ์ถœ ์‹œ๊ฐ„์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

Disable auto-focus

  • ์Šค๋งˆํŠธํฐ์˜ ์ž๋™ ์ดˆ์  ๊ธฐ๋Šฅ์„ ๋น„ํ™œ์„ฑํ™”ํ•˜์—ฌ ์ดˆ์  ๊ฑฐ๋ฆฌ๊ฐ€ ์ผ์ •ํ•˜๊ฒŒ ์œ ์ง€๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

Cover objects from several angles

  • ์—ฌ๋Ÿฌ ๊ฐ๋„์—์„œ ๊ฐ์ฒด๋ฅผ ์ดฌ์˜ํ•˜์—ฌ ์–‡๊ณ  ์„ธ๋ถ€์ ์ธ ๋ถ€๋ถ„๋„ ์ถฉ๋ถ„ํžˆ ๋ฎ์ด๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

Artifacts

  • SuGaR๋Š” ๋งค์šฐ ์–‡๊ณ  ์„ธ๋ถ€์ ์ธ ๊ฐ์ฒด๋ฅผ ์žฌ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์ด๋Ÿฌํ•œ ์–‡์€ ๊ฐ์ฒด๊ฐ€ ์ถฉ๋ถ„ํžˆ ๋ฎ์—ฌ ์žˆ์ง€ ์•Š๊ณ  ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ํ•œ์ชฝ ๋ฉด์—์„œ๋งŒ ๋ณด์ด๋Š” ๊ฒฝ์šฐ ์ผ๋ถ€ ์•„ํ‹ฐํŒฉํŠธ๊ฐ€ ๋‚˜ํƒ€๋‚  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

SuGaR์˜ scene reconstruction ์ž์„ธํ•œ ์„ค๋ช…

Poisson reconstruction

  • SuGaR๋Š” ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ๋ณด์ด๋Š” ํ‘œ๋ฉด ๋ถ€๋ถ„์— 3D ํฌ์ธํŠธ๋ฅผ ์ƒ˜ํ”Œ๋งํ•˜์—ฌ Poisson reconstruction์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

Visibility constraint

  • ๊ฐ€์‹œ์„ฑ ์ œ์•ฝ์€ ์žฅ๋ฉด ํ‘œ๋ฉด ๋’ค์— ์œ„์น˜ํ•œ Gaussian ๋ ˆ๋ฒจ ์…‹์˜ ๋’ท๋ฉด์— ์ƒ˜ํ”Œ๋ง ํฌ์ธํŠธ๊ฐ€ ๋†“์ด๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•ฉ๋‹ˆ๋‹ค.
  • ์ด ์ œ์•ฝ์ด ์—†์œผ๋ฉด self-collisions์™€ ๋งŽ์€ ๋ถˆํ•„์š”ํ•œ vertices๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ์žฌ๊ตฌ์„ฑ ํ›„ mesh์— ๋งŽ์€ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Limitations of visibility constraint

  • ์ด ๊ฐ€์‹œ์„ฑ ์ œ์•ฝ์œผ๋กœ ์ธํ•ด SuGaR๋Š” ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ๋ณด์ด์ง€ ์•Š๋Š” ํ‘œ๋ฉด ๋ถ€๋ถ„์„ scene reconstructionํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
  • ์–‡์€ ๊ฐ์ฒด๊ฐ€ ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ํ•œ์ชฝ ๋ฉด์—์„œ๋งŒ ๋ณด์ด๋Š” ๊ฒฝ์šฐ, Poisson reconstruction์€ closed surface๋ฅผ ์žฌ๊ตฌ์„ฑํ•˜๋ ค ํ•˜๋ฉฐ, ์–‡์€ ๊ฐ์ฒด์˜ ํ‘œ๋ฉด์„ ํ™•์žฅํ•˜๊ฒŒ ๋˜์–ด inaccurate mesh๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Artifacts in thin objects

  • ์–‡์€ ๊ฐ์ฒด๊ฐ€ ํ•œ์ชฝ ๋ฉด์—์„œ๋งŒ ๋ณด์ด๋Š” ๊ฒฝ์šฐ, ํ‘œ๋ฉด์ด ํ™•์žฅ๋˜์–ด ๋ถ€์ •ํ™•ํ•œ mesh๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
  • ์ด๋Ÿฌํ•œ artifacts๋Š” ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ์ถฉ๋ถ„ํžˆ ๋ฎ์—ฌ ์žˆ์ง€ ์•Š์€ ์–‡์€ ๊ฐ์ฒด์—์„œ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Hybrid representation

  • ์ด๋Ÿฌํ•œ artifacts๋Š” ํ•˜์ด๋ธŒ๋ฆฌ๋“œ ํ‘œํ˜„์—์„œ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • Gaussian texturing์ด refinement ๊ณผ์ •์—์„œ ์ด๋Ÿฌํ•œ artifacts์— low-opacity๋ฅผ ๋ถ€์—ฌํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

Avoiding Artifacts in SuGaR

Identifying new camera poses

  • ์ƒˆ๋กœ์šด ์นด๋ฉ”๋ผ ํฌ์ฆˆ๋ฅผ ์‹๋ณ„ํ•˜์—ฌ ํ•™์Šต ์ด๋ฏธ์ง€์—์„œ ๋ณด์ด์ง€ ์•Š๋Š” ํ‘œ๋ฉด ๋ถ€๋ถ„์„ ๋ฎ์Šต๋‹ˆ๋‹ค.
  • ์ด๋Ÿฌํ•œ ํฌ์ฆˆ๋Š” ๋ณด์ด๋Š” ๋ถ€๋ถ„๊ณผ same level set์— ์žˆ์„ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์€ ๋ถ€๋ถ„์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

Adding camera poses

  • Poisson reconstruction์„ ์ ์šฉํ•  ๋•Œ ํฌ์ธํŠธ ์ƒ˜ํ”Œ๋ง์— ์‚ฌ์šฉ๋˜๋Š” ์นด๋ฉ”๋ผ ์„ธํŠธ์— ์ด๋Ÿฌํ•œ ์นด๋ฉ”๋ผ ํฌ์ฆˆ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • ์ด๋Ÿฌํ•œ ์•„์ด๋””์–ด๋ฅผ ์ฝ”๋“œ์— ๋ฐ˜์˜ํ•˜์—ฌ ๊ณง ์—…๋ฐ์ดํŠธํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

image

Leave a comment