2012/01/25

マーカー検出計画2 OpenGLの座標軸をミリ単位にする

先週はOpenGLの画面バッファにIplImageを表示するところまで作成しました。
OpenGLでマーカー上に現実上のサイズを指定して物体を書く場合は、OpenGLの座標単位をマーカーの座標単位にする必要があります。
Posit@OpenCV wikiに、カメラの内部定数などを使用して、座標系を合わせる方法が書かれていたのでコードを借りてみました。

そしたらこんな感じで表示できるようになりました。



マーカーのサイズは20mmで印刷しており、OpenGL上ではglutWireCube(100) と描画命令を出しています。
画面上でマーカーのサイズ5つ分=100mmとなっているので、ほかのオブジェクトもサイズをミリ単位で指定できると思います。

次は3Dモデルの読み込みを調べたいと思います。
椅子とかを部屋の中に置いてレイアウトのシミュレーションできる感じのものを作れればいいな〜。

ではまた。

5 件のコメント:

  1. こんにちは。私はスペイン人です。ちょっと日本語ができますが、このポストは難しいです。OpenCVは習いたいです。このサンプルのソースコード書きてもいいですか。

    どもありがとうございました。

    返信削除
  2. >>enecochan
    You can download source code from below site.
    URL:https://sites.google.com/site/playwithopencv/home/markerdetect
    FileName:20120125glutwindow.zip

    Currently, comments in source code are written in Japanese. and this version is not stable.
    I will try add English comments.

    If you start learning OpenCV, I recommend "Learning OpenCV(O'reilly)".
    It is good book.

    返信削除
  3. どうもありがとうございました! I'll have a look to the code right now.

    Comments in japanese should not be a problem with the help of a translator or dictionary. I have that book but it's quite difficult to understand for me. Too much mathematic vocabulary and concepts I didn't learn in my computer science college.

    I suppose you upload the code of every post in that link you told me, am I right? I'll check it once in a while to see your improvements. Todays addition of 3D model was a good one :)

    P.D: Is it OK to post in english in your blog for now on?

    返信削除
  4. >>enekochan
    I have uploading source code when too long for blog.

    It is hard to me writing post in english( take long time to write), so I am using japanese.
    I'd like to accompanied by English summary.

    返信削除
  5. Hello

    I am a student in taiwan.
    I am new to the openGL and I want to combined 3d object into openCV2.3 in vc2010 C language.
    I think your code can be a good sample for me to learn.
    I am not good at coding.I download 20120206_markerDetector and I dont know how to compile it.
    Can you teach me how to setting to fit in vc2010 openCV2.3 and compile.
    I have install openGL and can run the code http://www.cs.nchu.edu.tw/~fileman/glsample/cubeview
    And I know how to use openCV2.3 in vc2010.
    If you can not, not reluctantly.

    thank you

    by William
    e-mail: fqpig@hotmail.com

    返信削除