30 private readonly Handle _handle;
39 _handle =
new Handle();
59 nuint numReprojectionErrors = 0;
60 DllHelper.ExecuteAndMapReturnCodes(() =>
61 CInterface.peak_icv_Calibration_View_GetReprojectionErrors_GetCount(
62 _handle, out numReprojectionErrors));
64 if (numReprojectionErrors == 0)
69 var cReprojectionErrors =
new Backend.Types.peak_icv_reprojection_error[numReprojectionErrors];
71 DllHelper.ExecuteAndMapReturnCodes(() =>
72 CInterface.peak_icv_Calibration_View_GetReprojectionErrors(_handle,
74 numReprojectionErrors));
75 return cReprojectionErrors.Select(cReprojectionError =>
new ReprojectionError(cReprojectionError))
93 double cMeanReprojectionError = 0;
94 DllHelper.ExecuteAndMapReturnCodes(() =>
95 CInterface.peak_icv_Calibration_View_GetMeanReprojectionError(
96 _handle, out cMeanReprojectionError));
97 return cMeanReprojectionError;
109 double cMaxReprojectionError = 0;
110 DllHelper.ExecuteAndMapReturnCodes(() =>
111 CInterface.peak_icv_Calibration_View_GetMaximumReprojectionError(
112 _handle, out cMaxReprojectionError));
113 return cMaxReprojectionError;
135 var cCoordinateSystem =
new Backend.Types.peak_icv_coordinate_system();
136 DllHelper.ExecuteAndMapReturnCodes(() =>
137 CInterface.peak_icv_Calibration_View_GetCoordinateSystem(_handle, out cCoordinateSystem));
156 var cExtrinsicParameters =
new Backend.Types.peak_icv_extrinsic_parameters();
157 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_Calibration_View_GetExtrinsicParameters(
158 _handle, out cExtrinsicParameters,
159 (nuint) Marshal.SizeOf(cExtrinsicParameters)));
178 DllHelper.ExecuteAndMapReturnCodes(() =>
179 CInterface.peak_icv_Calibration_View_GetConvexHull(_handle, out handle));
191 GC.SuppressFinalize(
this);
194 SafeHandle IHasSafeHandle.Handle => _handle;
196 internal sealed class Handle : SafeHandleZeroOrMinusOneIsInvalid
198 internal Handle() : base(true)
200 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_Calibration_View_Create(out handle));
206 internal Handle(IntPtr handle) : base(true)
211 protected override bool ReleaseHandle()
213 return CInterface.peak_icv_Calibration_View_Destroy(handle) ==
214 Backend.Types.peak_icv_status.PEAK_ICV_STATUS_SUCCESS;
218 private static class CInterface
220 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
221 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_Create(
222 out IntPtr calibration_view_handle);
224 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
225 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_Destroy(
226 IntPtr calibration_view_handle);
228 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
229 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetExtrinsicParameters(
230 Handle calibration_view_handle, out Backend.Types.peak_icv_extrinsic_parameters extrinsic_parameters,
231 nuint extrinsic_parameters_size);
233 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
234 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetCoordinateSystem(
235 Handle calibration_view_handle, out Backend.Types.peak_icv_coordinate_system coordinate_system);
237 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
238 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetReprojectionErrors_GetCount(
239 Handle calibration_view_handle, out nuint num_reprojection_errors);
241 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
242 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetReprojectionErrors(
243 Handle calibration_view_handle, [Out] Backend.Types.peak_icv_reprojection_error[] reprojection_errors,
244 nuint num_reprojection_errors);
246 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
247 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetMeanReprojectionError(
248 Handle calibration_view_handle, out
double mean_reprojection_error);
250 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
251 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetMaximumReprojectionError(
252 Handle calibration_view_handle, out
double max_reprojection_error);
254 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
255 public static extern Backend.Types.peak_icv_status peak_icv_Calibration_View_GetConvexHull(
256 Handle calibration_view_handle, out
PolygonF.Handle polygon_handle);