Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to access OpenCV data root directory?

I would like to access


from OpenCV distribution, but in a platform-independent way, e.g. in Python

os.path.join(cv2.OPENCV_DATA_DIR, "haarcascades", "haarcascade_frontalface_default.xml")

Can I? How do I get a reliable OPENCV_DATA_DIR equivalent? My question is basically the same to what this StackOverflow user is asking.

For example, Qt has QCoreApplication::libraryPaths(). The correct paths are determined at compile / install time, so it should be possible to make them available to the user.