IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
calibration_plate.py
Go to the documentation of this file.
1from __future__ import annotations
2
3import ctypes
4from typing import Any
5
6from ids_peak_icv import lib_loader
7from ids_peak_icv.backend.datatypes import peak_icv_calibration_plate_handle
8from ids_peak_icv.backend.utils import execute_and_map_return_codes, check_init_for_classes_with_classmethods_only
9
10
12 """!
13 @brief
14 Class for holding a calibration plate.
15
16 @ingroup ids_peak_icv_python_calibration
17 @since ids_peak_icv 1.1
18 """
19
20 @classmethod
21 def create_from_file(cls, file_path: str) -> CalibrationPlate:
22 """!
23 @brief
24 Creates an instance of CalibrationPlate by loading the calibration plate from a file.
25
26 For a camera calibration a calibration plate is needed.
27
28 @param file_path: An existing file path to a JSON file containing the calibration plate.
29
30 @exception IOException: If the given file_path does not exist, or the permissions are not sufficient
31 to read it.
32 @exception CorruptedException: If the file content is corrupted.
33 @return A new instance of CalibrationPlate
34
35 @since ids_peak_icv 1.1
36 """
37 c_file_path = file_path.encode('utf-8')
38
40
41 execute_and_map_return_codes(lib_loader.dll().peak_icv_Calibration_Plate_CreateFromFile,
42 ctypes.pointer(handle),
43 ctypes.c_char_p(c_file_path),
44 ctypes.c_size_t(len(c_file_path)))
45 return cls(_handle=handle)
46
47 @classmethod
48 def _create_empty(cls) -> CalibrationPlate:
50 execute_and_map_return_codes(lib_loader.dll().peak_icv_Calibration_Plate_Create,
51 ctypes.pointer(handle))
52
53 return CalibrationPlate(_handle=handle)
54
55 def __init__(self, *args: Any, **kwargs: Any) -> None:
56 """!
57 @brief
58 In order to create a CalibrationPlate, please refer to the classmethods.
59
60 @since ids_peak_icv 1.1
61 """
62 self._handle = check_init_for_classes_with_classmethods_only(self.__class__.__name__,
63 peak_icv_calibration_plate_handle,
64 *args, **kwargs)
65
66 def __del__(self) -> None:
67 if hasattr(self, '_handle'):
68 lib_loader.dll().peak_icv_Calibration_Plate_Destroy(self._handle)
None __init__(self, *Any args, **Any kwargs)
In order to create a CalibrationPlate, please refer to the classmethods.
CalibrationPlate create_from_file(cls, str file_path)
Creates an instance of CalibrationPlate by loading the calibration plate from a file.