(solved)Surface matching example: Error opening input file

When trying to run the ‘ppf_load_match.py’ from opencv-contrib example files from here

I receive an error at:

pc = cv.ppf_match_3d.loadPLYSimple("data/%s.ply" % modelname, 1)

The error:
OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-u4kjpz2z\opencv_contrib\modules\surface_matching\src\ppf_helpers.cpp:81: error: (-2:Unspecified error) in function ‘cv::ppf_match_3d::loadPLYSimple’

Error opening input file: data/parasaurolophus_6700.ply

It doesn’t matter which ply files i try or where i put them, i always get this error.

What am i missing ? Thanks in advance!

it DOES matter, where you put it.
the sample assumes, data is a subfolder of the one, where you start the script
so either start your script here or hack the sample code

1 Like

Indeed it does matter, i changed the loadSimplePLY argument to fit the path of the files whenever i changed their location. However i only tried the path relative to the python file. But your tip of using the absolute path did work!
The code ended up like so :

pc = cv.ppf_match_3d.loadPLYSimple(r'C:\Users\Stormholt\Documents\GitHub\opencv_contrib\modules\surface_matching\samples\data\parasaurolophus_6700.ply', 1)

Thank you for your help!

1 Like