I've created the EdgeBoxes.cpp Example DLL for LabVIEW using OpenCV. I'm trying to open the model file in the DLL but all I get is an assertion fail. I also created VI's for morphology, Corner detection, hough transformation but never got any error messages like that.
I tried:
Every path combination using Forward slashes or back slashes. Putting every file into the same Folder(also in C:). (LabVIEW VI, DLL, ModelFile) To open it in LabVIEW first with "Open/Create/Replace.vi" To open the extracted model.yml file instead of model.yml.gz That's the point where I'm clueless:
string filename = "C:\model.yml.gz" Ptr<structurededgedetection> pDollar; = createStructuredEdgeDetection(filename); Error Message I'm receiving:
Error -1002 occurred at OpenCV(4.0.1-dev) C:\OpenCV\opencv_contrib-master\modules\ximgproc\src\structured_edge_detection.cpp:432: error: (-215:Assertion failed) modelFile.isOpened() in function 'cv::ximgproc::StructuredEdgeDetectionImpl::StructuredEdgeDetectionImpl'
I tried to read the file with ifstream and it seems like I can acess the file without any Problems (Code below). So the reason why it won't work seems to be in context with OpenCV?
std::ifstream is(filename, std::ifstream::binary);
is.seekg(0, is.end); int length = is.tellg(); is.seekg(0, is.beg);
char * buffer = new char[length];
is.read(buffer, length); is.close(); delete[] buffer; // buffer contains the entire file Update: 2
Now I tried to open the file like OpenCV does after calling:
createStructuredEdgeDetection(filename); After that OpenCV tries to open the file with: See Row 431 https://github.com/opencv/opencv_contrib/blob/master/modules/ximgproc/src/structured_edge_detection.cpp
cv::FileStorage modelFile(filename, FileStorage::READ) Why does it work with
ifstream::binary
Do I have to recompile the "structured_edge_detection.cpp or cv::Filestorage with cmake?
Thanks for looking into this with me.