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

Rubyで画像ファイルから様々なオブジェクトを検出する / ruby-opencv-heiseirb-2

Rubyで画像ファイルから様々なオブジェクトを検出する / ruby-opencv-heiseirb-2

Tomoki Ishimaru

March 14, 2019
Tweet

More Decks by Tomoki Ishimaru

Other Decks in Programming

Transcript

  1. RubyͰը૾ϑΝΠϧ͔Β
    ༷ʑͳΦϒδΣΫτΛݕग़͢Δ
    2019/03/14 ฏ੒.rb #2 @MedPeer, Inc.
    Tomoki Ishimaru / @thom_i40

    View full-size slide

  2. ࣗݾ঺հ
    • Tomoki Ishimaru
    • GMO AD Marketing Inc.
    • ϑϩϯτΤϯυ / αʔόʔαΠυ
    • झຯ͸Իָͱࣸਅͱ૸Δ͜ͱ
    @thom_i40

    View full-size slide

  3. ࠓ೔࿩͢͜ͱ
    • ը૾ॲཧϥΠϒϥϦʮOpenCVʯͷ֓ཁ
    • ruby-opencvͷ֓ཁ
    • ruby-opencvΛ༻͍ͨ෺ମೝࣝ
    • ruby-opencvΛ׆༻ͨ͠੒Ռ෺

    View full-size slide

  4. ࠓ೔࿩͞ͳ͍͜ͱ
    • ಈըͷೖग़ྗ΍੍ޚ
    • ػցֶशͱOpenCV
    • ruby-opencvͷ࢓૊Έ
    • ίϯϐϡʔλϏδϣϯͷ࢓૊Έ

    View full-size slide

  5. • Πϯςϧ͕։ൃ
    • Φʔϓϯιʔεͷը૾/ө૾ॲཧϥΠϒϥϦ
    • ΫϩεϓϥοτϑΥʔϜࢦ޲Ͱઃܭ
    • C++, Java, Python, MATLABΛαϙʔτ
    • ༷ʑͳόΠϯσΟϯά͕ଘࡏ
    OpenCV

    View full-size slide

  6. ruby-opencv
    • Ruby༻ͷOpenCVϥούʔ
    • Ruby 2ܥ / OpenCV 2.4.13Λαϙʔτ
    • RubyDoc.infoͰυΩϡϝϯτΛఏڙ

    https://www.rubydoc.info/gems/ruby-opencv/frames

    View full-size slide

  7. ؀ڥߏங(OS X)
    • HomebrewͰOpenCVΛΠϯετʔϧ
    • gem install Ͱ ruby-opencv Λಋೖ
    https://github.com/ruby-opencv/ruby-opencv

    View full-size slide

  8. ࠓճ঺հ͢Δػೳ
    • إݕग़
    • ԁݕग़
    • ௚ઢݕग़
    • ୅දతͳը૾ॲཧػೳ
    • ςϯϓϨʔτϚονϯά

    View full-size slide

  9. άϨʔεέʔϧ / ೋ஋Խॲཧ
    src = CvMat.load('Sailboat.bmp')
    gray = src.BGR2GRAY
    bin = gray.threshold(128, 255, :binary)

    View full-size slide

  10. Haar෼ྨثʹΑΔإݕग़

    View full-size slide

  11. Haar෼ྨثʹΑΔإݕग़

    View full-size slide

  12. Haar෼ྨثʹΑΔإݕग़
    ͨͬͨ਺ߦͰ࣮૷Մೳ

    View full-size slide

  13. ςϯϓϨʔτϚονϯά

    View full-size slide

  14. ςϯϓϨʔτϚονϯά

    View full-size slide

  15. ࠓճ࡞ͬͨ੒Ռ෺

    View full-size slide

  16. ָේը૾͔ΒϝϩσΟΛநग़

    View full-size slide

  17. ָේը૾͔ΒϝϩσΟΛநग़

    View full-size slide

  18. ָේը૾͔ΒϝϩσΟΛநग़

    View full-size slide

  19. ࢖ͬͨػೳ

    View full-size slide

  20. ೋ஋Խॲཧ

    View full-size slide

  21. ςϯϓϨʔτϚονϯά

    View full-size slide

  22. ϝϩσΟΛநग़

    View full-size slide

  23. ·ͱΊ
    • OpenCVʹ͍ͭͯ঺հͨ͠
    • ruby-opencvΛ༻͍ͨ෺ମݕग़ʹ͍ͭͯ঺հͨ͠
    • ָේը૾͔ΒϝϩσΟΛநग़͢ΔγεςϜΛ࡞ͬͨ
    • RubyͰ΋جຊతͳը૾ೝ͕ࣝͰ͖Δ͜ͱ͕Θ͔ͬͨ

    View full-size slide

  24. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
    @thom_i40

    View full-size slide