Skip to content

Commit

Permalink
v1.0.5 Support for Hololens1 and Hololens2. (XR System: Legacy Built-…
Browse files Browse the repository at this point in the history
…in XR / XR Plugin Management WindowsMR / XR Plugin Management OpenXR) This closes #47, closes #45, closes #44, closes #43, closes #42, closes #36, closes #29 .
  • Loading branch information
EnoxSoftware committed Oct 24, 2022
1 parent 438b027 commit 430cad4
Show file tree
Hide file tree
Showing 93 changed files with 9,832 additions and 12,897 deletions.
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
using System;
using OpenCVForUnity.CoreModule;

namespace HoloLensWithOpenCVForUnityExample
{
[System.Serializable]
public struct CameraParameters
{
public string calibration_date;
public int frames_count;
public int image_width;
public int image_height;
public int calibration_flags;
public double[] camera_matrix;
public double[] distortion_coefficients;
public double avg_reprojection_error;

public CameraParameters(int frames_count, int image_width, int image_height, int calibration_flags, double[] camera_matrix, double[] distortion_coefficients, double avg_reprojection_error)
{
this.calibration_date = DateTime.Now.ToString();
this.frames_count = frames_count;
this.image_width = image_width;
this.image_height = image_height;
this.calibration_flags = calibration_flags;
this.camera_matrix = camera_matrix;
this.distortion_coefficients = distortion_coefficients;
this.avg_reprojection_error = avg_reprojection_error;
}

public CameraParameters(int frames_count, int image_width, int image_height, int calibration_flags, Mat camera_matrix, Mat distortion_coefficients, double avg_reprojection_error)
{
double[] camera_matrixArr = new double[camera_matrix.total()];
camera_matrix.get(0, 0, camera_matrixArr);

double[] distortion_coefficientsArr = new double[distortion_coefficients.total()];
distortion_coefficients.get(0, 0, distortion_coefficientsArr);

this.calibration_date = DateTime.Now.ToString();
this.frames_count = frames_count;
this.image_width = image_width;
this.image_height = image_height;
this.calibration_flags = calibration_flags;
this.camera_matrix = camera_matrixArr;
this.distortion_coefficients = distortion_coefficientsArr;
this.avg_reprojection_error = avg_reprojection_error;
}

public Mat GetCameraMatrix()
{
Mat m = new Mat(3, 3, CvType.CV_64FC1);
m.put(0, 0, camera_matrix);
return m;
}

public Mat GetDistortionCoefficients()
{
Mat m = new Mat(distortion_coefficients.Length, 1, CvType.CV_64FC1);
m.put(0, 0, distortion_coefficients);
return m;
}
}
}
using System;
using OpenCVForUnity.CoreModule;

namespace HoloLensWithOpenCVForUnityExample
{
[System.Serializable]
public struct CameraParameters
{
public string calibration_date;
public int frames_count;
public int image_width;
public int image_height;
public int calibration_flags;
public double[] camera_matrix;
public double[] distortion_coefficients;
public double avg_reprojection_error;

public CameraParameters(int frames_count, int image_width, int image_height, int calibration_flags, double[] camera_matrix, double[] distortion_coefficients, double avg_reprojection_error)
{
this.calibration_date = DateTime.Now.ToString();
this.frames_count = frames_count;
this.image_width = image_width;
this.image_height = image_height;
this.calibration_flags = calibration_flags;
this.camera_matrix = camera_matrix;
this.distortion_coefficients = distortion_coefficients;
this.avg_reprojection_error = avg_reprojection_error;
}

public CameraParameters(int frames_count, int image_width, int image_height, int calibration_flags, Mat camera_matrix, Mat distortion_coefficients, double avg_reprojection_error)
{
double[] camera_matrixArr = new double[camera_matrix.total()];
camera_matrix.get(0, 0, camera_matrixArr);

double[] distortion_coefficientsArr = new double[distortion_coefficients.total()];
distortion_coefficients.get(0, 0, distortion_coefficientsArr);

this.calibration_date = DateTime.Now.ToString();
this.frames_count = frames_count;
this.image_width = image_width;
this.image_height = image_height;
this.calibration_flags = calibration_flags;
this.camera_matrix = camera_matrixArr;
this.distortion_coefficients = distortion_coefficientsArr;
this.avg_reprojection_error = avg_reprojection_error;
}

public Mat GetCameraMatrix()
{
Mat m = new Mat(3, 3, CvType.CV_64FC1);
m.put(0, 0, camera_matrix);
return m;
}

public Mat GetDistortionCoefficients()
{
Mat m = new Mat(distortion_coefficients.Length, 1, CvType.CV_64FC1);
m.put(0, 0, distortion_coefficients);
return m;
}
}
}
Loading

0 comments on commit 430cad4

Please sign in to comment.