samples_findFile
import { samples_findFile } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
This section describes utility functions for OpenCV samples.
Note: Implementation of these utilities is not thread-safe.
Try to find requested data file
Search directories:
- Directories passed via
addSamplesDataSearchPath() - OPENCV_SAMPLES_DATA_PATH_HINT environment variable
- OPENCV_SAMPLES_DATA_PATH environment variable If parameter value is not empty and nothing is found then stop searching.
- Detects build/install path based on: a. current working directory (CWD) b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
- Scan
<source>/{,data,samples/data}directories if build directory is detected or the current directory is in source tree. - Scan
<install>/share/OpenCVdirectory if install directory is detected.
See: cv::utils::findDataFile
samples_findFile(relative_path: EmbindString, required: boolean, silentMode: boolean): string;3 available overloads
samples_findFile(relative_path: EmbindString): string;samples_findFile(relative_path: EmbindString, required: boolean): string;samples_findFile(relative_path: EmbindString, required: boolean, silentMode: boolean): string;relative_pathRelative path to data file
requiredSpecify "file not found" handling. If true, function prints information message and raises cv::Exception. If false, function returns empty result
silentModeDisables messages
Returns path (absolute or relative to the current directory) or empty string if file is not found
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.