Slide 1

Slide 1 text

Image processing with Go has great potential !! Go Conference’19 Summer in Fukuoka July 13, 2019 @ po3rin

Slide 2

Slide 2 text

@po3rin Software Enginner @ Shiroyagi Corporation QBHF Golang / Python / Rust / Docker / AWS / Elasticsearch

Slide 3

Slide 3 text

QBHF നϠΪίʔϙϨʔγϣϯ͸ɺػցֶशɾࣗવ ݴޠॲཧ෼໺ͷϓϩμΫτʹྗΛೖΕ͍ͯΔձ ࣾͰ͢ɻ։ൃʹ͸ओʹ (P ΍ 1ZUIPO ͕࠾༻ ͞Ε͍ͯ·͢ɻ നϠΪίʔϙϨʔγϣϯ

Slide 4

Slide 4 text

QBHF (PͰ0(1ը૾ੜ੒αʔϏεΛ࡞Γ·͠ ͨɻ΋͠ྑ͔ͬͨΒ࢖ͬͯΈͯͩ͘͞ ͍ɻྑ͍ʂʂͱࢥͬͨΒੋඇ4UBS΋ʂ IUUQTHIMJOLDBSEDPN

Slide 5

Slide 5 text

QBHF Introduction \

Slide 6

Slide 6 text

QBHF (PͰը૾ॲཧΛॻ͍͍ͯ͘தͰ(PͰͷը૾ॲཧ ͸େ͖ͳϙςϯγϟϧ͕͋Δͱײͨ͡ɻҰํͰ ʮ(PͰը૾ॲཧʯͱ͍͏Πϝʔδ͸·ͩఆணͯ͠ ͍ͳ͍ɻͦ͜Ͱࠓճ͸ೖ໳ॻ͚ͩͰ͸ମײͰ͖ͳ ͍Α͏ͳɺ(Pը૾ॲཧͷՄೳੑΛ͓఻͑͠· ͢ɻ Introduction Ὂ

Slide 7

Slide 7 text

QBHF (PʹΑΔը૾ॲཧͷجૅ Contents Ὂ (P0QFO$7Λ࢖ͬͨը૾ॲཧ (Pը૾ॲཧͷςετख๏ (P͔ͩΒͰ͖Δʂ8FC্Ͱͷը૾ॲཧ

Slide 8

Slide 8 text

QBHF Basics of image processing (1) \

Slide 9

Slide 9 text

QBHF (PͰͷը૾ॲཧͰ͸جຊతʹ JNBHF*NBHFΠϯλʔϑΣʔεΛ ࢖͏ɻը૾ͷྖҬ΍ɺըૉ஋΍Χ ϥʔϞʔυͳͲɺը૾ͷ৘ใ͸ج ຊશͯ͜͜ͰॴಘͰ͖Δɻ Basics of image processing (1) Ὂ

Slide 10

Slide 10 text

QBHF ը૾ॲཧͰ͸ϐΫηϧ͝ͱʹॲཧ ͍ͯ͘͠ͷ͸మ൘ͷॲཧ ӈͷྫ͸ը૾ΛάϨʔεέʔϧʹ ม׵͢Δίʔυɻ͜ͷύλʔϯͰ ଟ͘ͷը૾ॲཧ͕Մೳ Basics of image processing (2) Ὂ

Slide 11

Slide 11 text

QBHF ͜͜·Ͱͷ஌͚ࣝͩͰ(PͰྨࣅը૾൑ఆ ύοέʔδΛ࡞Ε·͢ɻ؆୯Ͱ͠ΐʁ Լͷ(PQIFS܅ͷը૾͸ҧ͏ը૾Ͱ͢ ͕ɺ͜ͷύοέʔδΛ࢖͏ͱྨࣅը૾Ͱ ͋Δ͜ͱΛݕ஌Ͱ͖·͢ɻ ࣗ෼ͷ݁ࠗࣜ ͷը૾αʔόʔͰ࿈ࣸࣸਅͷഉআͷҝʹ ࡞Γ·ͨ͠ Example Ὂ

Slide 12

Slide 12 text

QBHF "WFSBHF)BTIΞϧΰϦζϜ͸ը૾ͷྨࣅ౓ݕग़ΞϧΰϦζϜɻલॲཧ͕ ؆୯ͰͦΕͳΓͷਫ਼౓Ͱྨࣅͨ͠ը૾Λ୳͢͜ͱ͕Ͱ͖Δɻ άϨʔεέʔϧԽ ը૾Λॖখ º ֤ըૉΛ૸ࠪͯ͠ฏۉ஋ΑΓ্ͳΒɺԼͳΒͱ͍͏༷ʹϋογϡԽ ޙ͸)BTIͷ஋ΛϕΫτϧͱݟͳ͠ɺͭͷϕΫτϧͷϋϛϯάڑ཭Λऔ ཧɺϋϛϯάڑ཭͕ᮢ஋ҎԼͳΒྨࣅը૾ͱ൑ఆͰ͖Δʂʂ Average Hash Ὂ

Slide 13

Slide 13 text

QBHF Gray Scale Ὂ ઌ΄Ͳͷॲཧͱಉ͡ɺϐΫ ηϧ͝ͱʹըૉ஋ͷΧϥʔ Λม͑ͯݩͷը૾ʹηοτ

Slide 14

Slide 14 text

QBHF Get Hash Ὂ ͜͜Ͱ΋ϐΫηϧ͝ ͱʹ૸ࠪ͢Δύλʔ ϯͰըૉ஋ͷฏۉ஋ Λग़͍ͯ͠Δ

Slide 15

Slide 15 text

QBHF ը૾ॲཧΞϧΰϦζϜʹཁٻ͞ΕΔ஋ΛJNBHF*NBHFͷϝιου͔Βॴಘ͢Ε ͹ޙ͸ΞϧΰϦζϜΛͦͷ··࣮૷͢Δ͚ͩɻޙ͸ը૾ॲཧಛ༗ͷϐΫηϧ͝ ͱͷ૸ࠪͷ΍Γํ͑͞஌ͬͯΕ͹ɺ΄ͱΜͲ΍Γ͍ͨࣄ͸Մೳʂ (Pը૾ॲཧͬͯҙ֎ʹ؆୯ʂʂ Conclusion Ὂ

Slide 16

Slide 16 text

QBHF Basics of image processing (2) \

Slide 17

Slide 17 text

QBHF ը૾ΛॏͶΔͱ͖͸ESBXύοέʔ δΛ࢖͍·͢ɻETUʹNBTLͨ͠ TSDΛॏͶ·͢ɻ Basics of Draw (1) Ὂ

Slide 18

Slide 18 text

QBHF (JU)VC$BSE$SFUPSͰ͸ϓϩϑΟʔϧը૾ͷؙ͵͖ Λߦͳ͍ͬͯΔɻ͜Ε΋ESBX%SBX.BTLͰՄೳ Basics of draw (2) Ὂ ETU TSD NBTL SFTVMU

Slide 19

Slide 19 text

QBHF ԁܗͷϚεΫ͸ԁΛදݱ ͢Δ*NBHFΠϯλʔ ϑΣʔεΛ࣮૷͢Δ͜ͱ ͰදݱՄೳɻͭ·Γɺ *NBHFΠϯλʔϑΣʔε ࣮͑͞૷͢Ε͹͍ΖΜͳ ը૾දݱ͕Մೳ Circle Ὂ NBTL

Slide 20

Slide 20 text

QBHF Image processing using Go + OpenCV \

Slide 21

Slide 21 text

QBHF (PͰ͞Βʹߴ౓ͳը૾ॲཧΛߦ͍͍ͨͱ͖͸ 0QFO$7Λར༻͠·͢ɻ0QFO$7͸ը૾ॲཧɾը ૾ղੳ͓Αͼػցֶश౳ͷػೳΛ࣋ͭϥΠϒϥϦͰ ͢ɻ(PݴޠͰ͸(P$7ύοέʔδ͕ศརɻ೥ ݄ʹ0QFO$7͕ϦϦʔε͞Εɺ(P$7΋ ʹରԠ͍ͯ͠·͢ɻ Go + OpenCV Ὂ IUUQTHPDWJP

Slide 22

Slide 22 text

QBHF 0QFO$7ͷ࢖͍ํ΍ҖྗΛ஌ΔͨΊʹɺ(P$POGFSFODF'VLVPLBͷϩΰΛ୊ࡐʹྠֲ੾Γൈ͖Λ΍ͬ ͯΈ·͠ΐ͏ʂϩΰ͔Βྠֲநग़͠ɺதऱͰϥʔϝϯΛָ͠Ή(PQIFS͘Μͷը૾Λ࡞Γ·͢ɻ Go + OpenCV (3) Ὂ Go + OpenCV (1) Ὂ

Slide 23

Slide 23 text

QBHF ίʔυྫ͸্هͷϦϙδτϦͷʮʯʹ͋Γ·͢ɻٕज़ॻయͷίʔυڞ༗༻ͷϦϙδτϦͰ͢ɻ Go + OpenCV (2) Ὂ

Slide 24

Slide 24 text

QBHF ํ਑ͱͯ͠͸ΩϟϥΫλʔΛ੾Γൈ ͍ͨϚεΫΛ࡞ͬͯESBX%SBXϝ ιουͰETUʹॏͶΔɻ໰୊͸NBTL ͷ࡞੒ʂ͜͜Λ0QFO$7Ͱ࣮૷͢Δ Go + OpenCV (3) Ὂ

Slide 25

Slide 25 text

QBHF ྠֲͰϚεΫΛ࡞ΔͨΊʹ͸ɺάϨʔεέʔϧɺೋ஋Խɺྠֲநग़ɺྠֲͷ಺ଆͷϕλృΓ ͷεςοϓΛܦΔඞཁ͕͋Δ Go + OpenCV (4) Ὂ $WU$PMPS 5ISFTIPME 'JOE$POUPVST %SBX$POUPVST

Slide 26

Slide 26 text

QBHF HPDW5ISFTIPMEͰ͸ը૾ͷ஋ԽΛߦͳ͍ͬͯ ·͢ɻҾ਺ʹ౉͢ᮢ஋UISFTIʹΑͬͯͲͷըૉ஋ Λڥʹ஋Խ͢Δ͔ܾఆ͠·͢ Go + OpenCV (4) Ὂ 5ISFTIPME

Slide 27

Slide 27 text

QBHF HPDW'JOE$POUPVSTͰ͸ྠֲநग़Λߦͳ͍ͬͯ· ͢ɻҾ਺ͷNPEFͰྠֲநग़͢ΔϞʔυΛબͿ͜ͱ͕ Ͱ͖·͢ɻྠֲநग़ͷ݁ՌΛHPDW%SBX$POUPVST ʹ౉ͯ͠ྠֲͷதΛന৭ͰృΓͭͿ͠·͢ɻ Go + OpenCV (5) Ὂ 'JOE$POUPVST%SBX$POUPVST

Slide 28

Slide 28 text

QBHF (P$7ͷυΩϡϝϯτ΍ &YBNQMF͸ຆͲͳ͍ແ͍͕ɺ (P$7ͷؔ਺͸0QFO$7ͷؔ਺ ͱ΄ͱΜͲಉ͡ܗΛ౿ऻ͍ͯ͠ ΔͷͰɺ$΍1ZUIPOͷ࣮૷ྫͰ ΍Γ͍ͨ͜ͱΛ୳ͤ͹ɺ͍ͩͨ ͍(PͰ΋࣮૷Ͱ͖Δɻ (P0QFO$7ͷղઆগͳ͍͚ Ͳେৎ෉ͩΑʂʂ Go + OpenCV (6) Ὂ

Slide 29

Slide 29 text

QBHF How to test image processing \

Slide 30

Slide 30 text

QBHF (PͰը૾ॲཧΛॻ͘ͱςετ΋ॻ͖ͨ͘ͳ Δɻ͔͠͠ɺ(Pͷը૾ςετͷ஌ݟ͸΄ͱ ΜͲެ։͞Ε͍ͯͳ͍ɻ͜ͷηΫγϣϯͰ͸ ଞͷը૾ॲཧύοέʔδ͔ΒֶΜͩ(Pը ૾ॲཧͷςετख๏ʹ͍͓ͭͯ࿩͠͠·͢ɻ Test of image processing Ὂ

Slide 31

Slide 31 text

QBHF جຊతʹɺඪ४ύοέʔδ΋ؚΊ ༷ͨʑͳύοέʔδ͸3(#"Λϐ Ϋηϧ͝ͱݕ͍ࠪͯ͠Δ How to test image match (1) Ὂ

Slide 32

Slide 32 text

QBHF ۪௚ʹ3(#"ΛϐΫηϧ͝ͱݕࠪ͢Δͱ͕͔͔࣌ؒΔͷͰɺඪ४ύοέʔδͰ͸ॳΊʹϐΫ ηϧ͚ͩςετ͍ͯ͠Δςετ΋͋Δɻ How to test image match (2) Ὂ

Slide 33

Slide 33 text

QBHF BOUIPOZOTJNPOCJMEͷςετͰ͸ίετ Λ཈͑Δ޻෉͕ͳ͞Ε͍ͯΔɻετϥΠυͷ஋ ࣍ݩ഑ྻͷͲ͜·Ͱ͕ԣҰྻ෼͔ Λ࢖ͬͯ Ұ࣍ݩ഑ྻʹ௚ͰΞΫηε͍ͯ͠Δɻ http://neareal.net/index.php?ComputerGraphics%2FImageProcessing%2FTheStructureOfImageData How to test image match (3) Ὂ

Slide 34

Slide 34 text

QBHF JNBHF3(#"1JY͸<>VJOUͳͷͰCZUFT&RVBMͰ΋͍͚Δɻ࣮ࡍʹ EJTJOUFHSBUJPOHJGUͰ͸ԼͷΑ͏ͳؔ਺ͰBTTFSU͍ͯ͠Δɻͨͩ͜Εͩ ͱɺͲ͜ͷϐΫηϧ͕ؒҧ͍ͬͯͨͷ͔ͷ৘ใ͕ࣦΘΕͯ͠·͏ɻ How to test image match (4) Ὂ

Slide 35

Slide 35 text

QBHF SFqFDU%FFQ&RVBMͰ΍ͬͯ͠·͏ͱ͍͏ख΋͋Δɻ࣮ࡍʹHPMBOHJNBHFͰ͸ SFqFDU%FFQ&RVBMΛ࢖ͬͯςετ͍ͯ͠Δ΋ͷ΋͋Δɻ͔͠͠ɺࣦഊ࣌ʹͦ΋ͦ΋ ըૉ͕ҧ͏ͷ͔ॎԣͷେ͖͕͞ҧ͏ͷ͔શ͘৘ใΛऔΕͳ͘ͳΔɻ How to test image match (5) Ὂ

Slide 36

Slide 36 text

QBHF #FODINBSL&R/PSNBM୯७ʹϐΫηϧΛ̍ͭͮͭBTTFSU #FODINBSL&R8JUI4USJEF4USJEFͷ஋͔ΒҰ࣍ݩ഑ྻʹ௚ͰΞΫηεͯ͠BTTFSU #FODINBSL&R8JUI#ZUFT&RVBMCZUFT&RVBMΛ࢖ͬͨBTTFSU #FODINBSL&R8JUI3FqFDUSFqFDU%FFQ&RVBMΛ࢖ͬͨBTTFSU 5FTUJNBHFYKQFH How to test image match (6) Ὂ

Slide 37

Slide 37 text

QBHF Αͬͯը૾ͷςετͰ͸ςετͷࣦഊ࣌ʹͲͷ͘Β͍ৄࡉʹ৘ ใ͕ཉ͍͔͠ʹΑͬͯը૾ςετख๏͕มΘͬͯ͘Δɻ ͱʹ͔͘εϐʔυॏࢹɺࣦഊ࣌ͷཧ༝͸͋Μ·Γؾʹ͠ͳ͍ SFqFDU%FFQ&RVBM΍CZUFT&RVBM ͱʹ͔͘ৄࡉʹࣦഊཧ༝Λ஌Γ͍ͨ 4USJEFͷ஋Λ࢖ͬͨ࣍ݩ഑ྻ΁ͷΞΫηε How to test image match (7) Ὂ

Slide 38

Slide 38 text

QBHF جຊతͳը૾ॲཧͷςετʹ͓ ͍ͯ͸JNBHF3(#"ͷςετ έʔεΛ४උ͢Δͷ͕͋ͳ͕ͪ మ൘ ͔͠͠0(1౳ͷੜ੒ςετʹ͓ ͍ͯ͸͜ͷΑ͏ͳܗͰςετ σʔλΛ༻ҙ͢Δͷ͸݁ߏ໘ ౗ɻɻ Test data (1) Ὂ

Slide 39

Slide 39 text

QBHF ը૾ॲཧͷੜ੒෺ͷςετ ʹ͓͍ͯ͸HPMEFOpMFΛ༻ҙ ͓ͯ͘͠ͱָɻͦͷࡍʹ͸ HPMEFOpMFΛੜ੒͢Δϑϥο άΛ༻ҙ͓ͯ͘͠ͱศརɻ ࣮ࡍʹHPMBOHJNBHF ύοέʔδͰ͸͜ͷΑ͏ͳ ςετ͕࣮૷͞Ε͍ͯΔɻ Test data (2) Ὂ

Slide 40

Slide 40 text

QBHF ը૾ॲཧͷςετʹ͓͚ΔHPMEFOpMF͸1/(Ͱ͋Δ͜ͱ͕๬·ΕΔɻ+1&(ࣗମ͕ MPTTZ ৘ใ͕ܽམ͢Δ ͳඇՄٯ ݩʹ໭ͤͳ͍ ѹॖํࣜͳͷͰɺҰ౓JNBHF*NBHFΛ+1&( ʹม׵ͯ͠͠·͏ͱɺݩͷը૾ʹ෮ݩ͢Δ͜ͱ͸Ͱ͖ͳ͍ҝɺHPMEFOpMFUFTUʹෆ޲͖ JNBHF*NBHF 1/( +1&( ෮ݩՄೳ ෮ݩෆՄ ॻ͖ग़͠ ॻ͖ग़͠ Test data (3) Ὂ

Slide 41

Slide 41 text

QBHF Image processing on WEB \

Slide 42

Slide 42 text

QBHF (PͰը૾ॲཧ͕Ͱ͖Δͱݴ͏͜ͱ ͸8FC"TTFNCMZͰ΋ը૾ॲཧ͕ ಈ࡞Մೳͱ͍͏͜ͱʂʂ Go + Image processing + WebAssembly (1) Ὂ

Slide 43

Slide 43 text

QBHF Go + Image processing + WebAssembly (2) Ὂ ࣗ࡞ͷ(Pը૾ॲཧύοέʔδ ը૾ʹ దͨ͠τϦϛϯάΛࣗಈͰܾఆ͢Δؙ ͵͖ύοέʔδ Ͱ͸ը૾ॲཧσϞͱ ͯ͠8FC"TTFNCMZͰ8FC্Ͱ͙͢ ʹࢼͤΔ༷ʹͯ͋͠Δɻ

Slide 44

Slide 44 text

QBHF Demo of smartcircle Ὂ ը૾ॲཧύοέʔδ͕ͲΜͳײ͡ʹಈ ͔͘ͷσϞΛ଎߈࡞ΕΔͷ΋(PͰը ૾ॲཧ͢ΔϝϦοτʂ ͨͩը૾αΠζ͕σΧΠͱগ͠ॲཧ࣌ ͕͔͔ؒΔɻɻ

Slide 45

Slide 45 text

QBHF How to Pass Image to Go (1) Ὂ एׯ೉͍͠ͷ͸+BWB4DSJQU͔Β(P΁ͷ ը૾ड͚౉͠ɻ͍ΖΜͳํ๏͕͋Δ͕ɺ ࠓճ͸VOTBGFύοέʔδΛ࢖ͬͯϙΠϯ λܦ༝Ͱը૾σʔλΛड͚౉͢ํ๏Λ঺ հ͠·͢ɻ

Slide 46

Slide 46 text

QBHF Ὂ ը૾഑ྻόοϑΝͷ௕͕͞౉͞Ε·͢ɻ CZUFTMFOHUI How to Pass Image to Go (2)

Slide 47

Slide 47 text

QBHF Ὂ ͦͷޙɺը૾σʔλΛೖΕΔثͱͯ͠ buffer slice Λը૾αΠζͰॳظԽ͠ɺͦͷϙΠϯλ Λ JavaScript ʹฦ͠·͢ɻ CZUFTMFOHUI VJOUQUS How to Pass Image to Go (3)

Slide 48

Slide 48 text

QBHF Ὂ JavaScript ଆͰGo͔Β౉͞ΕͨϙΠϯλͷઌʹը૾σʔλΛ٧ΊΕ͹ड͚౉͠׬ྃʂʂ CZUFTMFOHUI VJOUQUS How to Pass Image to Go (4)

Slide 49

Slide 49 text

QBHF Ὂ ޙ͸ϙΠϯλઌʹ͍Εͯ΋Βͬͨը૾σʔλΛσίʔυ͢Ε͹ޙ͸ͬͪ͜ͷ͓޷͖ͳը૾ ॲཧָ͕͠ΊΔʂʂ CZUFTMFOHUI VJOUQUS DBMM(PGVODUJPO How to Pass Image to Go (5)

Slide 50

Slide 50 text

QBHF Awesome Go Image Processing Package \

Slide 51

Slide 51 text

QBHF ࠷ޙʹڧ͍(Pը૾ॲཧύοέʔδ Λ঺հ͠·͢ɻ(PʹΑΔը૾ॲཧ ͷϙςϯγϟϧΛײ͡·͠ΐ͏ Awesome Go Image Processing Package Ὂ

Slide 52

Slide 52 text

QBHF Awesome Go Image Processing Package Ὂ TNBSUDSPQ͸ɺ೚ҙͷαΠζʹର͠ ͯద੾ͳը૾τϦϛϯάΛݟ͚ͭ· ͢ɻ

Slide 53

Slide 53 text

QBHF Awesome Go Image Processing Package Ὂ ͍ࣸͬͯΔ΋ͷΛҙࣝͨ͠ը૾αΠ ζมߋख๏4FBN$BSWJOHʹجͮ ͍ͨը૾αΠζมߋύοέʔδ

Slide 54

Slide 54 text

QBHF Conclusion \

Slide 55

Slide 55 text

QBHF (Pͷඪ४ύοέʔδ͚ͩͰ΋৭Μͳը૾ॲཧ͕ ࣮૷Մೳɻ·ͨ0QFO$7ͱ࢖͏͜ͱͰɺը૾ॲཧ ͷ෯͸ແݶେʹ޿͕Δɻ·ͨɺ(PͰ࣮૷͢Δ͜ ͱͰ8BTNΛ࢖ͬͯ8FC্Ͱಈ͔ͤΔɻ (Pը૾ॲཧ͸ϙςϯγϟϧ͕͍͢͝ʂʂʂ (PͰը૾ॲཧͲΜͲΜ΍͍ͬͯ͜͏ʂʂʂ Conclusion Ὂ

Slide 56

Slide 56 text

Image processing with Go has great potential !! Otemachi.go July 13, 2019 @ po3rin