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

LINE Creators Studioで写真を簡単 & きれいに切り抜いてもらいたい話 / Grabcut in LINE Creators Studio

LINE Creators Studioで写真を簡単 & きれいに切り抜いてもらいたい話 / Grabcut in LINE Creators Studio

2019/2/13に開催されたLINE Developer Meetup #50 in Fukuokaでの登壇資料です

LINE Developers

February 13, 2019
Tweet

More Decks by LINE Developers

Other Decks in Technology

Transcript

  1. -*/&$SFBUPST4UVEJPͰ
    ࣸਅΛ؆୯ˍ͖Ε͍ʹ
    ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    LINE Developer meetup #50 in Fukuoka
    -*/&'VLVPLB։ൃࣨഅݟ੣
    Feb 13, 2019

    View full-size slide

  2. അݟ੣
    -*/&'VLVPLBגࣜձࣾ
    ։ൃ̏ࣨॴଐ
    UMAMI MAKOTO @umakoz
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    ›`z

    View full-size slide

  3. -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    LINE Creators Studio?
    ɾεϚʔτϑΥϯ͔Β-*/&ελϯϓ͕؆୯ʹ࡞ΕΔ
    ɾࡱͬͨࣸਅΛՃ޻ͯ͠ελϯϓʹͰ͖Δ
    ɾελϯϓͷ৹ࠪਃ੥΍ൢച͕Ͱ͖Δ
    ɹIUUQTDSFBUPSMJOFNFKBTUVEJP
    ಛ௃

    View full-size slide

  4. LINE Creators StudioͰͷSticker࡞ྫ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    IUUQTDSFBUPSMJOFNFKBTUVEJP

    View full-size slide

  5. LINE Creators Studio Android
    ɾPure Kotlinʢwithout Libraryʣ
    ɾMVVM
    ɾDagger2, RxJava2, RxKotlin, RxLifecycle, 

    Retrofit2, OkHttp3, Glide, Realm, Anko, 

    Espresso, Mockito-Kotlin
    ߏ੒
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  6. History
    7FS ೥݄೔ ϦϦʔεɺͳͧͬͯ੾Γൈ͖ػೳ
    7FS ೥݄೔ ඇެ։ઃఆ
    7FS ೥݄೔ ଟݴޠରԠʢӳޠɺλΠޠɺதࠃޠɺΠϯυωγΞޠʣ
    7FS ೥݄೔ ܗͰ੾Γൈ͖ػೳ
    7FS ೥݄೔ ফ͠ΰϜػೳ
    7FS ೥݄೔ σίϑϨʔϜػೳ
    7FS ೥݄೔ 6*มߋ
    7FS ೥݄೔ ࣗಈ੾Γൈ͖ػೳʢ"OESPJEʣ
    7FS ೥݄೔ ΩϟϯϖʔϯࢀՃػೳ
    7FS ೥݄೔ ࣗಈ੾Γൈ͖ػೳʢJ04ʣ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  7. History
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    7FS ೥݄೔ ϦϦʔεɺͳͧͬͯ੾Γൈ͖ػೳ
    7FS ೥݄೔ ඇެ։ઃఆ
    7FS ೥݄೔ ଟݴޠରԠʢӳޠɺλΠޠɺதࠃޠɺΠϯυωγΞޠʣ
    7FS ೥݄೔ܗͰ੾Γൈ͖ػೳ
    7FS ೥݄೔ফ͠ΰϜػೳ
    7FS ೥݄೔σίϑϨʔϜػೳ
    7FS ೥݄೔ 6*มߋ
    7FS ೥݄೔ ࣗಈ੾Γൈ͖ػೳʢ"OESPJEʣ
    7FS ೥݄೔ ΩϟϯϖʔϯࢀՃػೳ
    7FS ೥݄೔ ࣗಈ੾Γൈ͖ػೳʢJ04ʣ

    View full-size slide

  8. ੾Γൈ͖ؔ࿈ଟ͗͢ʜ
    ɾͳͧͬͯ੾Γൈ͖
    ɾܗͰ੾Γൈ͖
    ɾফ͠ΰϜ
    ɾσίϑϨʔϜ
    ɾࣗಈ੾Γൈ͖
    ؆୯ͳૢ࡞Ͱ͖Ε͍ʹ੾Γൈ͖͍ͨʂ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  9. ͳͧͬͯ੾Γൈ͖
    ɾΠϝʔδͷԑΛͳͧͬͯ੾Γൈ͘
    ɾύε্ͷ྘ͷ఺ΛҠಈͤ͞Δ͜ͱͰඍௐ੔͢Δ
    7FSʙ
    ɾ௚ײత
    ௕ॴ
    ɾࡉ͔͍मਖ਼͕͠ʹ͍͘
    ɾҰຊͷύεͰ͔͠੾Γൈ͚ͳ͍
    ୹ॴ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  10. ܗͰ੾Γൈ͖
    ɾԁ΍࢛֯ɺϋʔτɺ੕ͷܗΛબͿ
    ɾΠϝʔδΛҠಈ΍֦େॖখɺճసͤ͞Δ͜ͱͰඍௐ੔͢Δ
    7FSʙ
    ɾ؆୯
    ௕ॴ
    ɾ༻ҙ͞ΕͨܗͰ͔͠੾Γൈ͚ͳ͍
    ୹ॴ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  11. ফ͠ΰϜ
    ɾফ͠ΰϜΛ͔͚ͨ෦෼͕ফ͑Δ
    ɾम෮ফ͠ΰϜΛ͔͚ͯ෦෼తʹΠϝʔδΛ໭͠ɺඍௐ੔͢Δ
    7FSʙ
    ɾΤοδͷࡉ͔ͳௐ੔͕Ͱ͖Δ
    ɾෳ਺ͷύεͰ੾Γൈ͖Ͱ͖Δ
    ௕ॴ
    ɾ͖Ε͍ʹ੾Γൈ͘ʹ͸ख़࿅ͷٕͱ͕࣌ؒඞཁ
    ୹ॴ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  12. σίϑϨʔϜ
    ɾΠϝʔδΛσίϨʔγϣϯ͢ΔϑϨʔϜΛબͿ
    ɾΠϝʔδΛҠಈ΍֦େॖখɺճసͤ͞Δ͜ͱͰඍௐ੔͢Δ
    7FSʙ
    ɾ௒؆୯ʹݟӫ͑ͷ͢Δελϯϓ͕࡞ΕΔ
    ௕ॴ
    ɾಉ͡Α͏ͳελϯϓ͕ྔ࢈͞ΕΔ
    ୹ॴ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  13. ࣗಈ੾Γൈ͖
    ࠓɺྲྀߦΓͷػցֶशͱ͔࢖ͬͯ
    ελϯϓʹඞཁͳ෦෼Λ੾Γൈ͚ͳ͍ʁ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    SFNPWFCH IUUQTXXXSFNPWFCH

    ػցֶश

    View full-size slide

  14. ࣗಈ੾Γൈ͖
    ɾ'BDF%FUFDUPS
    ɾ.-,JUGPS'JSFCBTF
    ɾ:0-0
    0CKFDU%FUFDUJPO
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    :0-0 IUUQTQKSFEEJFDPNEBSLOFUZPMP

    View full-size slide

  15. ࣗಈ੾Γൈ͖
    ɾ.BTL3$//
    *NBHF4FHNFOUBUJPO
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    IUUQTBSYJWPSHQEGQEG

    View full-size slide

  16. ࣗಈ੾Γൈ͖
    5FOTPS'MPX`TMJHIUXFJHIUTPMVUJPOGPS
    NPCJMFBOEFNCFEEFEEFWJDFT
    IUUQTXXXUFOTPSGMPXPSHMJUF
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    5FOTPS'MPX-JUF

    View full-size slide

  17. ࣗಈ੾Γൈ͖
    ɾࣸਅͷҰ෦͚ͩΛ࢖͏
    ɾਓ΍෺ͷશମͰ͸ͳ͘ɺҰ෦͚ͩʢإͱ͔ʣΛ࢖͏
    ɹˠྖҬΛݕग़͢Δ͚ͩͰ͸ෆे෼
    Ͳ͕͜ελϯϓʹద͍ͯ͠Δ͔Λݕग़Ͱ͖Δ͔ʁ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    ελϯϓ࡞੒࣌ͷϢʔβʔχʔζ
    IUUQTDSFBUPSMJOFNFKBTUVEJP

    View full-size slide

  18. ࣗಈ੾Γൈ͖
    ΠϝʔδͷपғΛͬ͘͟ΓͳͧΔ
    ࣗಈͰ੾Γൈ͍ͯ΋Β͏
    ࣗಈͰ੾Γൈ͍ͯཉ͍͠෦෼ʹফ͠ΰϜΛ͔͚Δ
    ࣗಈͰ੾Γൈ͍ͯཉ͘͠ͳ͍෦෼ʹम෮ফ͠ΰϜΛ͔͚Δ
    ʙͷૢ࡞Λ܁Γฦͯ͠ඍௐ੔͢Δ
    7FSʙ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  19. ࣗಈ੾Γൈ͖
    ɾ؆୯Ͱ͖Ε͍ʹ੾Γൈ͚Δ
    ௕ॴ
    ɾૢ࡞͕ෳࡶͰ׳Ε͕ඞཁ
    ୹ॴ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  20. ࣗಈ੾Γൈ͖
    ɾΠϝʔδͷલܠྖҬΛநग़͢Δ
    ɾ0QFO$7

    IUUQTPQFODWPSH
    (SBC$VU"MHPSJUIN
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  21. -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    GrabCut Algorithm
    Ϣʔβʔ͕બ୒ͨ͠ൣғ͔ΒۣܗΛੜ੒ͯ͠ೖྗ͠ɺ

    ֎ଆ͸എܠʹ಺ଆ͸લܠʹͳΔɻ
    (..ʢࠞ߹Ψ΢εϞσϧʣͰલܠͱഎܠͷըૉ਺෼෍Λֶश͢Δɻ
    ϐΫηϧͷ৭৘ใΑΓલܠʗഎܠͰ͋Δ֬཰Λ༧ଌ͢ΔϞσϧΛ࡞Δɻ

    View full-size slide

  22. -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    GrabCut Algorithm
    http://www.cs.ru.ac.za/research/g02m1682/
    Ϣʔβʔ͕બ୒ͨ͠ൣғ͔ΒۣܗΛੜ੒ͯ͠ೖྗ͠ɺ

    ֎ଆ͸എܠʹ಺ଆ͸લܠʹͳΔɻ
    (..ʢࠞ߹Ψ΢εϞσϧʣͰલܠͱഎܠͷըૉ਺෼෍Λֶश͢Δɻ
    ϐΫηϧͷ৭৘ใΑΓલܠʗഎܠͰ͋Δ֬཰Λ༧ଌ͢ΔϞσϧΛ࡞Δɻ
    ϞσϧΛ༻͍ͯϐΫηϧΛͭͳ͗άϥϑΛߏங͢Δɻ

    View full-size slide

  23. -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    GrabCut Algorithm
    http://www.cs.ru.ac.za/research/g02m1682/
    Ϣʔβʔ͕બ୒ͨ͠ൣғ͔ΒۣܗΛੜ੒ͯ͠ೖྗ͠ɺ

    ֎ଆ͸എܠʹ಺ଆ͸લܠʹͳΔɻ
    (..ʢࠞ߹Ψ΢εϞσϧʣͰલܠͱഎܠͷըૉ਺෼෍Λֶश͢Δɻ
    ϐΫηϧͷ৭৘ใΑΓલܠʗഎܠͰ͋Δ֬཰Λ༧ଌ͢ΔϞσϧΛ࡞Δɻ
    ϞσϧΛ༻͍ͯϐΫηϧΛͭͳ͗άϥϑΛߏங͢Δɻ
    ϐΫηϧΛͭͳ͙ΤοδͷॏΈΛܭࢉ͢Δɻ
    ΤοδͷॏΈͷ૯࿨͕࠷খʹͳΔΑ͏ʹ੾அ͢Δɻ

    View full-size slide

  24. GrabCut Algorithm
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    http://www.cs.ru.ac.za/research/g02m1682/
    Ϣʔβʔ͕બ୒ͨ͠ൣғ͔ΒۣܗΛੜ੒ͯ͠ೖྗ͠ɺ

    ֎ଆ͸എܠʹ಺ଆ͸લܠʹͳΔɻ
    (..ʢࠞ߹Ψ΢εϞσϧʣͰલܠͱഎܠͷըૉ਺෼෍Λֶश͢Δɻ
    ϐΫηϧͷ৭৘ใΑΓલܠʗഎܠͰ͋Δ֬཰Λ༧ଌ͢ΔϞσϧΛ࡞Δɻ
    ϞσϧΛ༻͍ͯϐΫηϧΛͭͳ͗άϥϑΛߏங͢Δɻ
    ϐΫηϧΛͭͳ͙ΤοδͷॏΈΛܭࢉ͢Δɻ
    ΤοδͷॏΈͷ૯࿨͕࠷খʹͳΔΑ͏ʹ੾அ͢Δɻ
    Ϣʔβʔʹิਖ਼ͷͨΊͷઢΛೖྗͯ͠΋Β͍ɺ࠶ͼܭࢉ͢Δɻ

    View full-size slide

  25. ࣗಈ੾Γൈ͖ͷ޻෉
    (SBC$VUલʹબ୒ྖҬΛج४ͱ͠

    ը૾ΛτϦϛϯά͢Δɻ

    ˞എܠΛશࣦͯ͏ͱਫ਼౓͕མͪΔͷͰ

    ɹϚʔδϯΛ࢒͢ɻ
    ॲཧ଎౓ͷ޲্
    τϦϛϯά
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  26. ࣗಈ੾Γൈ͖ͷ޻෉
    ϚʔΧʔͷαΠζΛ൒෼ʹͯ͠(SBC$VUΛ
    ࣮ߦ͢Δɻ
    ॲཧ଎౓ͷ޲্
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  27. ࣗಈ੾Γൈ͖ͷ޻෉
    3FOEFS4DSJQUΛ࢖͏

    "OESPJEͰ࠾༻͞Ε͍ͯΔ

    ϐΫηϧ୯ҐͷॲཧΛ

    ߴ଎ʹߦ͏ͨΊͷ4DSJQU
    ॲཧ଎౓ͷ޲্
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    QSBHNBWFSTJPO

    QSBHNBSTKBWB@QBDLBHF@OBNF DPNMJOFDPSQVTFSTUJDLFSST

    ST@BMMPDBUJPOJOQVU*NBHF
    VJOU@USFDU
    WPJE@@BUUSJCVUF@@ LFSOFM

    SPPU VDIBSJO VJOU@UY VJOU@U
    GMPBUBST6OQBDL$PMPS JO
    B
    JG B
    \
    JG YSFDU<>
    \
    SFDU<>Y
    ^

    View full-size slide

  28. ࣗಈ੾Γൈ͖ͷ޻෉
    ݩը૾ͷେ͖͞Λҡ࣋ͨ͠··੾Γൈ͘

    ˞࠷ऴతʹ࡞Δͷ͸

    ɹελϯϓ º
    ͳͷͰɺ

    ɹେ͖͗͢Δ࣌͸ϦαΠζ
    ը࣭ͷ޲্
    ݩը૾
    σΟεϓϨΠ
    Ҡಈɺ֦େॖখɺճస
    Matrix
    Matrix
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  29. ࣗಈ੾Γൈ͖ͷ޻෉
    Τοδʹ΅͔͠Λ͔͚Δɻ

    ͨͩ͠ɺ΅͔ͨ͠ϚʔΧʔΛ(SBC$VUʹ࢖͏ͱ

    ਫ਼౓͕མͪΔͷͰɺσΟεϓϨΠ্͚ͩ΅͔͢ɻ
    ඒ͠͞ͷ޲্
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  30. ࣗಈ੾Γൈ͖ͷ޻෉
    ϦΞϧλΠϜʹ΅͔͢ͱॲཧ͕஗͘ͳΔͷͰɺ

    ϚʔΧʔͷ֬ఆ࣌ʹ΅͔͢ɻ
    ඒ͠͞ͷ޲্
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  31. ࣗಈ੾Γൈ͖
    ࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨʂ
    -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩

    View full-size slide

  32. -*/&$SFBUPST4UVEJPͰࣸਅΛ؆୯ˍ͖Ε͍ʹ੾Γൈ͍ͯ΋Β͍͍ͨ࿩
    IUUQTMJOFGVLVPLBDPKQKBDBSFFSFOHJOFFS

    View full-size slide