Code Monkey home page Code Monkey logo

vrep_dynamic_texture's Introduction

vrep_dynamic_texture

Python上で作成した画像(動画)を,v-repのシリンダオブジェクトの曲面上にテクスチャマッピングするためのサンプルです.

必要なソフトなど

  • v-rep 3.4.0
  • python, numpy, matplotlib, six

実行方法

  1. launch_vrep.bat を実行すると,v-repが起動し simple.ttt が読み込まれます.
  2. python main.py を実行する,あるいはspyder上で main.py を実行すると,v-rep内のシリンダーにpythonから送られた画像が表示されます.

仕組み

次の2つを組合せることで,Python側で用意した画像をv-repのシェイプに表示することができます.

  1. primitive-shapeのテクスチャとして,Vision sensor から取得された映像を指定することができる.
  2. Pythonなどの外部スクリプトから,Vision sensorに画像をセットすることができる.

シェイプのテクスチャにビジョンセンサを指定する

  • まず,シーンにシリンダとビジョンセンサを追加します.
    • Add -> Primitive shape -> Cylinder
    • Add -> Vision sensor -> Perspective type
  • シリンダのScene Object Propertiesダイアログを開きます.
    • Scene hierarchyのCylinderのアイコンをダブルクリック
  • Adjust texture ボタンを押します
  • Select texture from existing textures ボタンを押し, Vision_sensor を選択します.
  • Mapping modecylinder にします.
  • これでシリンダの曲面にビジョンセンサからの映像がテクスチャマッピングされました.

ビジョンセンサにPythonから画像をセットする

  • simxSetVisionSensorImage関数を使うことで,任意の画像をビジョンセンサが見たことにできます.
  • 注意点として,v-rep内のビジョンセンサの解像度の設定値と,Pythonから送信する画像データの画素数が一致している必要があります.
    • ビジョンセンサの解像度は,ビジョンセンサのScene Object Propertiesから設定できます.

参考資料

vrep_dynamic_texture's People

Contributors

ronekko avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.