Skip to main content

opencv_binding_generator/
supported_module.rs

1// !! Update `pub static SUPPORTED_MODULES` in `enums.rs` when changing this
2#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
3pub enum SupportedModule {
4	/// alphamat
5	AlphaMat,
6	/// aruco
7	Aruco,
8	/// aruco_detector
9	ArucoDetector,
10	/// barcode
11	Barcode,
12	/// bgsegm
13	BgSegm,
14	/// bioinspired
15	Bioinspired,
16	/// calib
17	Calib,
18	/// calib3d
19	Calib3d,
20	/// cannops
21	///
22	/// Not supported
23	CannOps,
24	/// ccalib
25	CCalib,
26	/// core
27	///
28	/// Always present
29	Core,
30	/// cudaarithm
31	CudaArithm,
32	/// cudabgsegm
33	CudaBgSegm,
34	/// cudacodec
35	CudaCodec,
36	/// cudafeatures2d
37	CudaFeatures2d,
38	/// cudafilters
39	CudaFilters,
40	/// cudaimgproc
41	CudaImgProc,
42	/// cudalegacy
43	CudaLegacy,
44	/// cudaobjdetect
45	CudaObjDetect,
46	/// cudaoptflow
47	CudaOptFlow,
48	/// cudastereo
49	CudaStereo,
50	/// cudawarping
51	CudaWarping,
52	/// cudev
53	///
54	/// Not supported
55	CuDev,
56	/// cvv
57	Cvv,
58	/// dnn
59	Dnn,
60	/// dnn_superres
61	DnnSuperRes,
62	/// dpm
63	Dpm,
64	/// face
65	Face,
66	/// features
67	Features,
68	/// features2d
69	Features2d,
70	/// flann
71	Flann,
72	/// freetype
73	Freetype,
74	/// fuzzy
75	Fuzzy,
76	/// gapi
77	Gapi,
78	/// geometry
79	Geometry,
80	/// hdf
81	Hdf,
82	/// hfs
83	Hfs,
84	/// highgui
85	HighGui,
86	/// img_hash
87	ImgHash,
88	/// imgcodecs
89	ImgCodecs,
90	/// imgproc
91	ImgProc,
92	/// intensity_transform
93	IntensityTransform,
94	/// line_descriptor
95	LineDescriptor,
96	/// mcc
97	Mcc,
98	/// ml
99	Ml,
100	/// objdetect
101	ObjDetect,
102	/// optflow
103	OptFlow,
104	/// ovis
105	Ovis,
106	/// phase_unwrapping
107	PhaseUnwrapping,
108	/// photo
109	Photo,
110	/// plot
111	Plot,
112	/// ptcloud
113	PtCloud,
114	/// quality
115	Quality,
116	/// rapid
117	Rapid,
118	/// rgbd
119	Rgbd,
120	/// saliency
121	Saliency,
122	/// sfm
123	Sfm,
124	/// shape
125	Shape,
126	/// signal
127	Signal,
128	/// stereo
129	Stereo,
130	/// stitching
131	Stitching,
132	/// structured_light
133	StructuredLight,
134	/// superres
135	SuperRes,
136	/// surface_matching
137	SurfaceMatching,
138	/// text
139	Text,
140	/// tracking
141	Tracking,
142	/// video
143	Video,
144	/// videoio
145	VideoIo,
146	/// videostab
147	VideoStab,
148	/// viz
149	Viz,
150	/// wechat_qrcode
151	WechatQrCode,
152	/// xfeatures2d
153	XFeatures2d,
154	/// ximgproc
155	XImgProc,
156	/// xobjdetect
157	XObjDetect,
158	/// xphoto
159	XPhoto,
160	/// xstereo
161	XStereo,
162}
163
164impl SupportedModule {
165	pub fn try_from_opencv_name(name: &str) -> Option<Self> {
166		let name_is = |check_name| name.eq_ignore_ascii_case(check_name);
167		match () {
168			_ if name_is("alphamat") => Some(Self::AlphaMat),
169			_ if name_is("aruco") => Some(Self::Aruco),
170			_ if name_is("aruco_detector") => Some(Self::ArucoDetector),
171			_ if name_is("barcode") => Some(Self::Barcode),
172			_ if name_is("bgsegm") => Some(Self::BgSegm),
173			_ if name_is("bioinspired") => Some(Self::Bioinspired),
174			_ if name_is("calib") => Some(Self::Calib),
175			_ if name_is("calib3d") => Some(Self::Calib3d),
176			_ if name_is("cannops") => Some(Self::CannOps),
177			_ if name_is("ccalib") => Some(Self::CCalib),
178			_ if name_is("core") => Some(Self::Core),
179			_ if name_is("cudaarithm") => Some(Self::CudaArithm),
180			_ if name_is("cudabgsegm") => Some(Self::CudaBgSegm),
181			_ if name_is("cudacodec") => Some(Self::CudaCodec),
182			_ if name_is("cudafeatures2d") => Some(Self::CudaFeatures2d),
183			_ if name_is("cudafilters") => Some(Self::CudaFilters),
184			_ if name_is("cudaimgproc") => Some(Self::CudaImgProc),
185			_ if name_is("cudalegacy") => Some(Self::CudaLegacy),
186			_ if name_is("cudaobjdetect") => Some(Self::CudaObjDetect),
187			_ if name_is("cudaoptflow") => Some(Self::CudaOptFlow),
188			_ if name_is("cudastereo") => Some(Self::CudaStereo),
189			_ if name_is("cudawarping") => Some(Self::CudaWarping),
190			_ if name_is("cudev") => Some(Self::CuDev),
191			_ if name_is("cvv") => Some(Self::Cvv),
192			_ if name_is("dnn") => Some(Self::Dnn),
193			_ if name_is("dnn_superres") => Some(Self::DnnSuperRes),
194			_ if name_is("dpm") => Some(Self::Dpm),
195			_ if name_is("face") => Some(Self::Face),
196			_ if name_is("features") => Some(Self::Features),
197			_ if name_is("features2d") => Some(Self::Features2d),
198			_ if name_is("flann") => Some(Self::Flann),
199			_ if name_is("freetype") => Some(Self::Freetype),
200			_ if name_is("fuzzy") => Some(Self::Fuzzy),
201			_ if name_is("gapi") => Some(Self::Gapi),
202			_ if name_is("geometry") => Some(Self::Geometry),
203			_ if name_is("hdf") => Some(Self::Hdf),
204			_ if name_is("hfs") => Some(Self::Hfs),
205			_ if name_is("highgui") => Some(Self::HighGui),
206			_ if name_is("img_hash") => Some(Self::ImgHash),
207			_ if name_is("imgcodecs") => Some(Self::ImgCodecs),
208			_ if name_is("imgproc") => Some(Self::ImgProc),
209			_ if name_is("intensity_transform") => Some(Self::IntensityTransform),
210			_ if name_is("line_descriptor") => Some(Self::LineDescriptor),
211			_ if name_is("mcc") => Some(Self::Mcc),
212			_ if name_is("ml") => Some(Self::Ml),
213			_ if name_is("objdetect") => Some(Self::ObjDetect),
214			_ if name_is("optflow") => Some(Self::OptFlow),
215			_ if name_is("ovis") => Some(Self::Ovis),
216			_ if name_is("phase_unwrapping") => Some(Self::PhaseUnwrapping),
217			_ if name_is("photo") => Some(Self::Photo),
218			_ if name_is("plot") => Some(Self::Plot),
219			_ if name_is("ptcloud") => Some(Self::PtCloud),
220			_ if name_is("quality") => Some(Self::Quality),
221			_ if name_is("rapid") => Some(Self::Rapid),
222			_ if name_is("rgbd") => Some(Self::Rgbd),
223			_ if name_is("saliency") => Some(Self::Saliency),
224			_ if name_is("sfm") => Some(Self::Sfm),
225			_ if name_is("shape") => Some(Self::Shape),
226			_ if name_is("signal") => Some(Self::Signal),
227			_ if name_is("stereo") => Some(Self::Stereo),
228			_ if name_is("stitching") => Some(Self::Stitching),
229			_ if name_is("structured_light") => Some(Self::StructuredLight),
230			_ if name_is("superres") => Some(Self::SuperRes),
231			_ if name_is("surface_matching") => Some(Self::SurfaceMatching),
232			_ if name_is("text") => Some(Self::Text),
233			_ if name_is("tracking") => Some(Self::Tracking),
234			_ if name_is("video") => Some(Self::Video),
235			_ if name_is("videoio") => Some(Self::VideoIo),
236			_ if name_is("videostab") => Some(Self::VideoStab),
237			_ if name_is("viz") => Some(Self::Viz),
238			_ if name_is("wechat_qrcode") => Some(Self::WechatQrCode),
239			_ if name_is("xfeatures2d") => Some(Self::XFeatures2d),
240			_ if name_is("ximgproc") => Some(Self::XImgProc),
241			_ if name_is("xobjdetect") => Some(Self::XObjDetect),
242			_ if name_is("xphoto") => Some(Self::XPhoto),
243			_ if name_is("xstereo") => Some(Self::XStereo),
244			_ => None,
245		}
246	}
247
248	pub fn opencv_name(self) -> &'static str {
249		match self {
250			Self::AlphaMat => "alphamat",
251			Self::Aruco => "aruco",
252			Self::ArucoDetector => "aruco_detector",
253			Self::Barcode => "barcode",
254			Self::BgSegm => "bgsegm",
255			Self::Bioinspired => "bioinspired",
256			Self::Calib => "calib",
257			Self::Calib3d => "calib3d",
258			Self::CannOps => "cannops",
259			Self::CCalib => "ccalib",
260			Self::Core => "core",
261			Self::CudaArithm => "cudaarithm",
262			Self::CudaBgSegm => "cudabgsegm",
263			Self::CudaCodec => "cudacodec",
264			Self::CudaFeatures2d => "cudafeatures2d",
265			Self::CudaFilters => "cudafilters",
266			Self::CudaImgProc => "cudaimgproc",
267			Self::CudaLegacy => "cudalegacy",
268			Self::CudaObjDetect => "cudaobjdetect",
269			Self::CudaOptFlow => "cudaoptflow",
270			Self::CudaStereo => "cudastereo",
271			Self::CuDev => "cudev",
272			Self::CudaWarping => "cudawarping",
273			Self::Cvv => "cvv",
274			Self::Dnn => "dnn",
275			Self::DnnSuperRes => "dnn_superres",
276			Self::Dpm => "dpm",
277			Self::Face => "face",
278			Self::Features => "features",
279			Self::Features2d => "features2d",
280			Self::Flann => "flann",
281			Self::Freetype => "freetype",
282			Self::Fuzzy => "fuzzy",
283			Self::Gapi => "gapi",
284			Self::Geometry => "geometry",
285			Self::Hdf => "hdf",
286			Self::Hfs => "hfs",
287			Self::HighGui => "highgui",
288			Self::ImgCodecs => "imgcodecs",
289			Self::ImgHash => "img_hash",
290			Self::ImgProc => "imgproc",
291			Self::IntensityTransform => "intensity_transform",
292			Self::LineDescriptor => "line_descriptor",
293			Self::Mcc => "mcc",
294			Self::Ml => "ml",
295			Self::ObjDetect => "objdetect",
296			Self::OptFlow => "optflow",
297			Self::Ovis => "ovis",
298			Self::PhaseUnwrapping => "phase_unwrapping",
299			Self::Photo => "photo",
300			Self::Plot => "plot",
301			Self::PtCloud => "ptcloud",
302			Self::Quality => "quality",
303			Self::Rapid => "rapid",
304			Self::Rgbd => "rgbd",
305			Self::Saliency => "saliency",
306			Self::Sfm => "sfm",
307			Self::Shape => "shape",
308			Self::Signal => "signal",
309			Self::Stereo => "stereo",
310			Self::Stitching => "stitching",
311			Self::StructuredLight => "structured_light",
312			Self::SuperRes => "superres",
313			Self::SurfaceMatching => "surface_matching",
314			Self::Text => "text",
315			Self::Tracking => "tracking",
316			Self::Video => "video",
317			Self::VideoIo => "videoio",
318			Self::VideoStab => "videostab",
319			Self::Viz => "viz",
320			Self::WechatQrCode => "wechat_qrcode",
321			Self::XFeatures2d => "xfeatures2d",
322			Self::XImgProc => "ximgproc",
323			Self::XObjDetect => "xobjdetect",
324			Self::XPhoto => "xphoto",
325			Self::XStereo => "xstereo",
326		}
327	}
328
329	pub fn rust_name(self) -> &'static str {
330		self.opencv_name()
331	}
332}