Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ココがダメだよWebCamTexture

 ココがダメだよWebCamTexture

イケてないと悪評高いUnityのWebCamTextureを使ってみたので、ダメな部分を紹介します。

6b37e5c21ba723dacede78124b25d5a8?s=128

Masaya Yashiro

June 21, 2017
Tweet

Transcript

  1. ίί͕μϝͩΑ WebCamTexture @yashims85

  2. ήʔϜҎ֎ͰUnity

  3. ήʔϜҎ֎ͰUnity "OESPJEJ04྆ରԠ 6*ΤσΟλ σόΠεػೳ

  4. ͳΜ͔ͩΜͩ ήʔϜҎ֎΋࡞Γ΍͍͢

  5. ΧϝϥΞϓϦ

  6. WebCamTextureͱ͸

  7. WebCamTexture • Unityඪ४ͷσόΠεΧϝϥAPI • Χϝϥͷө૾͕Ϩϯμʔ͞ΕΔTextureͷࢠΫϥε • Android/iOS/Editor্Ͱ໰୊ͳ͘ಈ͘ • ྑ͍ᷚ͸ฉ͔ͳ͍ •

    ΧϝϥΞηοτങ͏ʹͯ͠΋ɺҰ౓WebCamTexture ࢖ͬͯΈͳ͍ͱͲ͏͍͏ͷ͕ཉ͍͔͠෼͔Βͳ͍
  8. ࢖͍ํ private struct Fhd { public const int Width =

    1920; public const int Height = 1080; } private int Fps = 30; private WebCamTexture WebCam { get; set; } void Start() { WebCam = new WebCamTexture( WebCamTexture.devices[0].name, Fhd.Width, Fhd.Height, Fps ); WebCam.Play(); } private void OnDestroy() { WebCam.Stop(); Destroy(WebCam); }
  9. ؆୯ͩʔ

  10. ͳΜ͔ΊͬͪΌॏ͍ (ϊʔϚϧͷΧϝϥΞϓϦͱൺ΂ͯ)

  11. ͳΜ͔ΊͬͪΌॏ͍ private struct Fhd { public const int Width =

    1920; public const int Height = 1080; } private int Fps = 8; private WebCamTexture WebCam { get; set; } void Start() { WebCam = new WebCamTexture( WebCamTexture.devices[0].name, Fhd.Width, Fhd.Height, Fps ); WebCam.Play(); }
  12. ·ͩ୺຤ʹΑͬͯ͸ॏ͍

  13. ·ͩ୺຤ʹΑͬͯ͸ॏ͍ private struct Hd { public const int Width =

    1280; public const int Height = 720; } private int Fps = 8; private WebCamTexture WebCam { get; set; } void Start() { WebCam = new WebCamTexture( WebCamTexture.devices[0].name, Hd.Width, Hd.Height, Fps ); WebCam.Play(); }
  14. ͳΜ͔Portraitͷ࣌ө૾͕ߥ͍

  15. ͳΜ͔Portraitͷ࣌ө૾͕ߥ͍ private struct Hd { public const int Width =

    720; public const int Height = 1280; } private int Fps = 8; private WebCamTexture WebCam { get; set; } void Start() { WebCam = new WebCamTexture( WebCamTexture.devices[0].name, Hd.Width, Hd.Height, Fps ); WebCam.Play(); }
  16. औಘग़དྷΔΞεൺ͕ มΘΒͳ͍ΜͰ͕͢

  17. มΘΒͳ͍Ξεൺ ཉ͍͠Ξεൺ ฦͬͯ͘Δө૾ͷΞεൺ Y ԣ')% Y ԣ')% Y ॎ')% Y

    ԣ')% Y ')%௕ล Y ԣ')% Y )%௕ล Y ԣ)%
  18. LandscapeͰ͔͠ը૾͕औΕ ͳ͍ͷͰCenterCrop͢Δ͠ ͔ͳ͍

  19. LandscapeͰ͔͠ը૾͕औΕ ͳ͍ͷͰCenterCrop͢Δ͠ ͔ͳ͍

  20. ࠷ऴతͳPortraitͷղ૾౓ • VGA: 640x480 QY QY ࢀߟ

  21. WebCamTextureΫι͞·ͱΊ • VGAҎԼΛ֮ޛ • 15FPS(ྲྀੴʹϠόΠͷͰ௿εϖ୺຤͸ແࢹ͠ ͯͪΐͬͱ໭ͨ͠) • ి஑৯͏

  22. ͦ͏ͩ AssetΛങ͓͏

  23. NatCamΛങͬͨ • https://www.assetstore.unity3d.com/jp/#!/content/52154 • ࢖͑ͯͳ͍͚Ͳɺ৭ʑߴػೳ • iOS/AndroidରԠ • FaceTrackingͰ͖Δ •

    Texture2D΁ͷอଘαϙʔτ • Movie΋Մ
  24. ݁ՌɺͲ͏͔ͩͬͨ

  25. Ͱ͖ͨ • FPS͕޲্ • ߴղ૾౓Ͱॏ͘ͳΒͳ͍ • ফඅిྗ࡟ݮ

  26. Ͱ͖ͳ͔ͬͨ • औಘղ૾౓ࢦఆ • 16:9ղ૾౓͔͠ϓϦηοτͰ༻ҙ͞Εͯͳ ͍ • มߋग़དྷΔ͔͸ະݕূ

  27. ͋Δఔ౓ͷ඼࣭UP

  28. ·ͱΊ WebCamTextureΛϞόΠϧͰ࢖͏৔߹ɺੑ ೳ໘ͰͭΒΈ͕͋Δɻ ͓·͚Ͱ࢖͏ͳΒྑ͍͕ɺओཁػೳͷ৔߹͸ AssetΛೖΕͨ΄͏͕ྑ͍ɻ