1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
2pub enum SupportedModule {
3 ThreeD,
5 AlphaMat,
7 Aruco,
9 ArucoDetector,
11 Barcode,
13 BgSegm,
15 Bioinspired,
17 Calib,
19 Calib3d,
21 CannOps,
25 CCalib,
27 Core,
31 CudaArithm,
33 CudaBgSegm,
35 CudaCodec,
37 CudaFeatures2d,
39 CudaFilters,
41 CudaImgProc,
43 CudaLegacy,
45 CudaObjDetect,
47 CudaOptFlow,
49 CudaStereo,
51 CudaWarping,
53 CuDev,
57 Cvv,
59 Dnn,
61 DnnSuperRes,
63 Dpm,
65 Face,
67 Features,
69 Features2d,
71 Flann,
73 Freetype,
75 Fuzzy,
77 Gapi,
79 Hdf,
81 Hfs,
83 HighGui,
85 ImgHash,
87 ImgCodecs,
89 ImgProc,
91 IntensityTransform,
93 LineDescriptor,
95 Mcc,
97 Ml,
99 ObjDetect,
101 OptFlow,
103 Ovis,
105 PhaseUnwrapping,
107 Photo,
109 Plot,
111 Quality,
113 Rapid,
115 Rgbd,
117 Saliency,
119 Sfm,
121 Shape,
123 Signal,
125 Stereo,
127 Stitching,
129 StructuredLight,
131 SuperRes,
133 SurfaceMatching,
135 Text,
137 Tracking,
139 Video,
141 VideoIo,
143 VideoStab,
145 Viz,
147 WechatQrCode,
149 XFeatures2d,
151 XImgProc,
153 XObjDetect,
155 XPhoto,
157 XStereo,
159}
160
161impl SupportedModule {
162 pub fn try_from_opencv_name(name: &str) -> Option<Self> {
163 match name {
164 "3d" => Some(Self::ThreeD),
165 "alphamat" => Some(Self::AlphaMat),
166 "aruco" => Some(Self::Aruco),
167 "aruco_detector" => Some(Self::ArucoDetector),
168 "barcode" => Some(Self::Barcode),
169 "bgsegm" => Some(Self::BgSegm),
170 "bioinspired" => Some(Self::Bioinspired),
171 "calib" => Some(Self::Calib),
172 "calib3d" => Some(Self::Calib3d),
173 "cannops" => Some(Self::CannOps),
174 "ccalib" => Some(Self::CCalib),
175 "core" => Some(Self::Core),
176 "cudaarithm" => Some(Self::CudaArithm),
177 "cudabgsegm" => Some(Self::CudaBgSegm),
178 "cudacodec" => Some(Self::CudaCodec),
179 "cudafeatures2d" => Some(Self::CudaFeatures2d),
180 "cudafilters" => Some(Self::CudaFilters),
181 "cudaimgproc" => Some(Self::CudaImgProc),
182 "cudalegacy" => Some(Self::CudaLegacy),
183 "cudaobjdetect" => Some(Self::CudaObjDetect),
184 "cudaoptflow" => Some(Self::CudaOptFlow),
185 "cudastereo" => Some(Self::CudaStereo),
186 "cudawarping" => Some(Self::CudaWarping),
187 "cudev" => Some(Self::CuDev),
188 "cvv" => Some(Self::Cvv),
189 "dnn" => Some(Self::Dnn),
190 "dnn_superres" => Some(Self::DnnSuperRes),
191 "dpm" => Some(Self::Dpm),
192 "face" => Some(Self::Face),
193 "features" => Some(Self::Features),
194 "features2d" => Some(Self::Features2d),
195 "flann" => Some(Self::Flann),
196 "freetype" => Some(Self::Freetype),
197 "fuzzy" => Some(Self::Fuzzy),
198 "gapi" => Some(Self::Gapi),
199 "hdf" => Some(Self::Hdf),
200 "hfs" => Some(Self::Hfs),
201 "highgui" => Some(Self::HighGui),
202 "img_hash" => Some(Self::ImgHash),
203 "imgcodecs" => Some(Self::ImgCodecs),
204 "imgproc" => Some(Self::ImgProc),
205 "intensity_transform" => Some(Self::IntensityTransform),
206 "line_descriptor" => Some(Self::LineDescriptor),
207 "mcc" => Some(Self::Mcc),
208 "ml" => Some(Self::Ml),
209 "objdetect" => Some(Self::ObjDetect),
210 "optflow" => Some(Self::OptFlow),
211 "ovis" => Some(Self::Ovis),
212 "phase_unwrapping" => Some(Self::PhaseUnwrapping),
213 "photo" => Some(Self::Photo),
214 "plot" => Some(Self::Plot),
215 "quality" => Some(Self::Quality),
216 "rapid" => Some(Self::Rapid),
217 "rgbd" => Some(Self::Rgbd),
218 "saliency" => Some(Self::Saliency),
219 "sfm" => Some(Self::Sfm),
220 "shape" => Some(Self::Shape),
221 "signal" => Some(Self::Signal),
222 "stereo" => Some(Self::Stereo),
223 "stitching" => Some(Self::Stitching),
224 "structured_light" => Some(Self::StructuredLight),
225 "superres" => Some(Self::SuperRes),
226 "surface_matching" => Some(Self::SurfaceMatching),
227 "text" => Some(Self::Text),
228 "tracking" => Some(Self::Tracking),
229 "video" => Some(Self::Video),
230 "videoio" => Some(Self::VideoIo),
231 "videostab" => Some(Self::VideoStab),
232 "viz" => Some(Self::Viz),
233 "wechat_qrcode" => Some(Self::WechatQrCode),
234 "xfeatures2d" => Some(Self::XFeatures2d),
235 "ximgproc" => Some(Self::XImgProc),
236 "xobjdetect" => Some(Self::XObjDetect),
237 "xphoto" => Some(Self::XPhoto),
238 "xstereo" => Some(Self::XStereo),
239 _ => None,
240 }
241 }
242
243 pub fn opencv_name(self) -> &'static str {
244 match self {
245 Self::ThreeD => "3d",
246 Self::AlphaMat => "alphamat",
247 Self::Aruco => "aruco",
248 Self::ArucoDetector => "aruco_detector",
249 Self::Barcode => "barcode",
250 Self::BgSegm => "bgsegm",
251 Self::Bioinspired => "bioinspired",
252 Self::Calib => "calib",
253 Self::Calib3d => "calib3d",
254 Self::CannOps => "cannops",
255 Self::CCalib => "ccalib",
256 Self::Core => "core",
257 Self::CudaArithm => "cudaarithm",
258 Self::CudaBgSegm => "cudabgsegm",
259 Self::CudaCodec => "cudacodec",
260 Self::CudaFeatures2d => "cudafeatures2d",
261 Self::CudaFilters => "cudafilters",
262 Self::CudaImgProc => "cudaimgproc",
263 Self::CudaLegacy => "cudalegacy",
264 Self::CudaObjDetect => "cudaobjdetect",
265 Self::CudaOptFlow => "cudaoptflow",
266 Self::CudaStereo => "cudastereo",
267 Self::CudaWarping => "cudawarping",
268 Self::CuDev => "cudev",
269 Self::Cvv => "cvv",
270 Self::Dnn => "dnn",
271 Self::DnnSuperRes => "dnn_superres",
272 Self::Dpm => "dpm",
273 Self::Face => "face",
274 Self::Features => "features",
275 Self::Features2d => "features2d",
276 Self::Flann => "flann",
277 Self::Freetype => "freetype",
278 Self::Fuzzy => "fuzzy",
279 Self::Gapi => "gapi",
280 Self::Hdf => "hdf",
281 Self::Hfs => "hfs",
282 Self::HighGui => "highgui",
283 Self::ImgHash => "img_hash",
284 Self::ImgCodecs => "imgcodecs",
285 Self::ImgProc => "imgproc",
286 Self::IntensityTransform => "intensity_transform",
287 Self::LineDescriptor => "line_descriptor",
288 Self::Mcc => "mcc",
289 Self::Ml => "ml",
290 Self::ObjDetect => "objdetect",
291 Self::OptFlow => "optflow",
292 Self::Ovis => "ovis",
293 Self::PhaseUnwrapping => "phase_unwrapping",
294 Self::Photo => "photo",
295 Self::Plot => "plot",
296 Self::Quality => "quality",
297 Self::Rapid => "rapid",
298 Self::Rgbd => "rgbd",
299 Self::Saliency => "saliency",
300 Self::Sfm => "sfm",
301 Self::Shape => "shape",
302 Self::Signal => "signal",
303 Self::Stereo => "stereo",
304 Self::Stitching => "stitching",
305 Self::StructuredLight => "structured_light",
306 Self::SuperRes => "superres",
307 Self::SurfaceMatching => "surface_matching",
308 Self::Text => "text",
309 Self::Tracking => "tracking",
310 Self::Video => "video",
311 Self::VideoIo => "videoio",
312 Self::VideoStab => "videostab",
313 Self::Viz => "viz",
314 Self::WechatQrCode => "wechat_qrcode",
315 Self::XFeatures2d => "xfeatures2d",
316 Self::XImgProc => "ximgproc",
317 Self::XObjDetect => "xobjdetect",
318 Self::XPhoto => "xphoto",
319 Self::XStereo => "xstereo",
320 }
321 }
322
323 pub fn rust_safe_name(self) -> &'static str {
324 match self {
325 Self::ThreeD => "mod_3d",
326 _ => self.opencv_name(),
327 }
328 }
329}