イケてないと悪評高いUnityのWebCamTextureを使ってみたので、ダメな部分を紹介します。
ίί͕μϝͩΑWebCamTexture@yashims85
View Slide
ήʔϜҎ֎ͰUnity
ήʔϜҎ֎ͰUnity"OESPJEJ04྆ରԠ6*ΤσΟλσόΠεػೳ
ͳΜ͔ͩΜͩήʔϜҎ֎࡞Γ͍͢
ΧϝϥΞϓϦ
WebCamTextureͱ
WebCamTexture• Unityඪ४ͷσόΠεΧϝϥAPI• Χϝϥͷө૾͕Ϩϯμʔ͞ΕΔTextureͷࢠΫϥε• Android/iOS/Editor্Ͱͳ͘ಈ͘• ྑ͍ᷚฉ͔ͳ͍• ΧϝϥΞηοτങ͏ʹͯ͠ɺҰWebCamTextureͬͯΈͳ͍ͱͲ͏͍͏ͷ͕ཉ͍͔͔͠Βͳ͍
͍ํ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);}
؆୯ͩʔ
ͳΜ͔ΊͬͪΌॏ͍(ϊʔϚϧͷΧϝϥΞϓϦͱൺͯ)
ͳΜ͔ΊͬͪΌॏ͍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();}
·ͩʹΑͬͯॏ͍
·ͩʹΑͬͯॏ͍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();}
ͳΜ͔Portraitͷ࣌ө૾͕ߥ͍
ͳΜ͔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();}
औಘग़དྷΔΞεൺ͕มΘΒͳ͍ΜͰ͕͢
มΘΒͳ͍Ξεൺཉ͍͠Ξεൺ ฦͬͯ͘Δө૾ͷΞεൺY ԣ')% Y ԣ')%Y ॎ')% Y ԣ')%Y ')%ล Y ԣ')%Y )%ล Y ԣ)%
LandscapeͰ͔͠ը૾͕औΕͳ͍ͷͰCenterCrop͢Δ͔͠ͳ͍
࠷ऴతͳPortraitͷղ૾• VGA: 640x480QYQYࢀߟ
WebCamTextureΫι͞·ͱΊ• VGAҎԼΛ֮ޛ• 15FPS(ྲྀੴʹϠόΠͷͰεϖແࢹͯͪ͠ΐͬͱͨ͠)• ి৯͏
ͦ͏ͩAssetΛങ͓͏
NatCamΛങͬͨ• https://www.assetstore.unity3d.com/jp/#!/content/52154• ͑ͯͳ͍͚Ͳɺ৭ʑߴػೳ• iOS/AndroidରԠ• FaceTrackingͰ͖Δ• Texture2Dͷอଘαϙʔτ• MovieՄ
݁ՌɺͲ͏͔ͩͬͨ
Ͱ͖ͨ• FPS্͕• ߴղ૾Ͱॏ͘ͳΒͳ͍• ফඅిྗݮ
Ͱ͖ͳ͔ͬͨ• औಘղ૾ࢦఆ• 16:9ղ૾͔͠ϓϦηοτͰ༻ҙ͞Εͯͳ͍• มߋग़དྷΔ͔ະݕূ
͋Δఔͷ࣭UP
·ͱΊWebCamTextureΛϞόΠϧͰ͏߹ɺੑೳ໘ͰͭΒΈ͕͋Δɻ͓·͚Ͱ͏ͳΒྑ͍͕ɺओཁػೳͷ߹AssetΛೖΕͨ΄͏͕ྑ͍ɻ