[][src]Function opencv::core::find_file

pub fn find_file(
    relative_path: &str,
    required: bool,
    silent_mode: bool
) -> Result<String>

Try to find requested data file

Search directories:

  1. Directories passed via addSamplesDataSearchPath()
  2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
  3. OPENCV_SAMPLES_DATA_PATH environment variable If parameter value is not empty and nothing is found then stop searching.
  4. 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)
  5. Scan <source>/{,data,samples/data} directories if build directory is detected or the current directory is in source tree.
  6. Scan <install>/share/OpenCV directory if install directory is detected.

@see cv::utils::findDataFile

Parameters

  • relative_path: Relative path to data file
  • required: Specify "file not found" handling. If true, function prints information message and raises cv::Exception. If false, function returns empty result
  • silentMode: Disables messages

Returns

Returns path (absolute or relative to the current directory) or empty string if file is not found

C++ default parameters

  • required: true
  • silent_mode: false