4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

OpenCVForUnityのArucoの備忘録

Last updated at Posted at 2021-02-17

バージョン

OpenCV for Unity:2.3.2
Unity:2018.3.14f1

ArUcoDictionary

マーカーのタイプを指定するもの.

public ArUcoDictionary dictionaryId = ArUcoDictionary.DICT_6X6_250;

上記の
【6X6】の部分でビット数を指定し,
【250】の部分で使用するマーカーの個数を指定している.

このコードの場合は,「6X6ビットのマーカーを250個まで使用する」という意味になる.

ビット数が小さく,使用するマーカーの数が少ないほど,エラーに対して堅牢になる.

MarkerType

image.png

  • Grid Board
    • Canonical Makerが一定の感覚で配置されているもの.
    • マーカー間の相対位置が既知なため,全てのマーカーからボード全体の向き(姿勢)を推定できる.
    • ボードの一部しか見えていない場合やオクルージョンが発生した場合でもCanonical Makerよりも高精度に姿勢推定ができる.
    • (おそらく一つしか使えない.)
    • 参考:https://docs.opencv.org/3.4/db/da9/tutorial_aruco_board_detection.html

image.png

image.png

image.png

WebCamTextureToMatHelper

  • Webカメラ周りのことを色々とやってくれる便利なやつ.
  • 映像をテクスチャからMatに変換してくれたり,カメラのFpsやWidth,Height等も教えてくれる.

参考:https://enoxsoftware.github.io/OpenCVForUnity/3.0.0/doc/html/class_open_c_v_for_unity_1_1_unity_utils_1_1_helper_1_1_web_cam_texture_to_mat_helper.html#a663ccd2cd229db13c5466e1c3edfd3e5

FpsMonitor

ArUco Create Marker Example

上記の『Ch Aruco Diamond Maker』を除いた3種類のマーカを生成できる.
ここで生成したマーカーがうまく認識されない場合は,画像を反転させると認識してくれる.自分がそうであった.

ARマーカーのID抽出

if(ids.get(0, 0) != null)
{
    Debug.Log("ID number:" + ids.get(0, 0).GetValue(0));
}
4
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?