Mono Aruco Camera Displayのチェックボックスを消します キャリブレーション実行時にこれが起動しないようにするためらしいです
次は,ArucoCharucoBoardのArucoCharucoBoardを設定します
変更すべき場所は,Maker Side LengthとSquare Side Lengthです
Maker Side Lengthはマーカの大きさを,Square Side LengthはQRコードの一つのマスの大きさをm単位で指定します
なので,自分が印刷したCharuco boardを定規で測って入力してください
最後に,PinholeCameraCalibrationのAruco Camera Parameters Controllerを設定します
Camera Parameterに,「自分が好きな名前.xml」を入力してください キャリブレーションデータの名前を決める部分です
リファレンスには空欄でも勝手に名前を作るよと書いてありますが,空欄だとエラーで書き出してくれませんでした
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OpenCvSharp;
publicclass web_camera : MonoBehaviour {
[SerializeField] privateint m_WebCamIndex = 1;
private Texture2D texture2D;
private VideoCapture videoCapture;
private Mat mat;
private Mat grey;
// Use this for initializationvoid Start () {
videoCapture = new VideoCapture(m_WebCamIndex);
texture2D = new Texture2D(videoCapture.FrameWidth, videoCapture.FrameHeight, TextureFormat.RGB24, false);
GetComponent<Renderer>().material.mainTexture = texture2D;
mat = new Mat();
grey = new Mat();
}
// Update is called once per framevoid Update () {
videoCapture.Read(mat);
Cv2.CvtColor(mat, grey, ColorConversionCodes.BGR2GRAY);
texture2D.LoadImage(grey.ImEncode());
}
privatevoid OnDestroy()
{
videoCapture.Dispose();
videoCapture = null;
}
}
DllNotFoundException: OpenCvSharpExtern OpenCvSharp.NativeMethods.LoadLibraries (IEnumerable`1 additionalPaths) OpenCvSharp.NativeMethods..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpenCvSharp.NativeMethods OpenCvSharp.VideoCapture..ctor (Int32 index) Rethrow as OpenCvSharpException: Failed to create VideoCapture OpenCvSharp.VideoCapture..ctor (Int32 index) webcam.Start () (at Assets/Scripts/webcam.cs:24)