Project-10 / DGM

Direct Graphical Models (DGM) C++ library, a cross-platform Conditional Random Fields library, which is optimized for parallel computing and includes modules for feature extraction, classification and visualization.
http://research.project-10.de/dgm/
Other
188 stars 41 forks source link

DGM include error -> densecrf/edgePotentialPotts.h: No such file or directory #21

Closed aliyasineser closed 5 years ago

aliyasineser commented 5 years ago

I changed cmake to accept opencv 3.3.1 only ( OPENCV 3 REQUIRED, instead of 3.4). Without any problem build went okay. For a simple #include program I included "DGM.h" and build. This error came out: `[build] In file included from /usr/local/include/DGM.h:43:0, from /home/aliyasineser/Desktop/columnDetection/modules/module_column/include/module_column.h:6, from /home/aliyasineser/Desktop/columnDetection/modules/module_column/src/module_column.cpp:1: /usr/local/include/DGM/GraphDense.h:6:10: fatal error: densecrf/edgePotentialPotts.h: No such file or directory

include "densecrf/edgePotentialPotts.h"

compilation terminated.`

My Cmake to build: CMakeLists.txt

I tried to locate how 3rdparty libraries included but I am just new to Cmake and build with cmake stuff. Unfortunately I couldn't find that part. I can try to give any info if necessary, these are the things came to my mind.

ereator commented 5 years ago

Probably the source of the error is that you use original DGM CMakeLists.txt file to set up your project, which is not really a "correct" way to do so. Could you please try using the sample CMakeLists.txt file from "Using DGM library with CMake" to set up your project with DGM?

aliyasineser commented 5 years ago

Actually the Cmake I attached is for show how I build the DGM. With the link you sent, I made a basic project and tried to build it. Still I got the same error. The error is again: `[ 50%] Building CXX object CMakeFiles/PROJECT_NAME.dir/main.cpp.o In file included from /usr/local/include/DGM.h:43:0, from /home/aliyasineser/Desktop/example/main.cpp:8: /usr/local/include/DGM/GraphDense.h:6:10: fatal error: densecrf/edgePotentialPotts.h: No such file or directory

include "densecrf/edgePotentialPotts.h"

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. CMakeFiles/PROJECT_NAME.dir/build.make:62: recipe for target 'CMakeFiles/PROJECT_NAME.dir/main.cpp.o' failed make[2]: [CMakeFiles/PROJECT_NAME.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/PROJECT_NAME.dir/all' failed make[1]: [CMakeFiles/PROJECT_NAME.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 `

And I attached the program. I didn't change anything with cmake, just the source name, dgm and opencv version. example.zip

ereator commented 5 years ago

@aliyasineser Thank you very much for committing this issue - it was a bug in the library. Please pull the latest version, now the bug is ought to be fixed.

aliyasineser commented 5 years ago

@ereator thank you. I tried to build library but this time I got the error: /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp: In member function ‘cv::Mat DirectGraphicalModels::CTrainNode::getNodePotentials(const cv::Mat&, const cv::Mat&, float) const’: /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp:46:10: error: ‘word DirectGraphicalModels::ITrain::m_nFeatures’ is private within this context Mat vec(m_nFeatures, 1, CV_8UC1); ^~~~~~~~~~~ In file included from /home/aliyasineser/DGM/modules/DGM/TrainNode.h:5:0, from /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp:1: /home/aliyasineser/DGM/modules/DGM/ITrain.h:41:8: note: declared private here word m_nFeatures; ///< The number of features (length of the feature vector) ^~~~~~~~~~~ /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp: In member function ‘cv::Mat DirectGraphicalModels::CTrainNode::getNodePotentials(const vec_mat_t&, const cv::Mat&, float) const’: /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp:82:10: error: ‘word DirectGraphicalModels::ITrain::m_nFeatures’ is private within this context Mat vec(m_nFeatures, 1, CV_8UC1); ^~~~~~~~~~~ In file included from /home/aliyasineser/DGM/modules/DGM/TrainNode.h:5:0, from /home/aliyasineser/DGM/modules/DGM/TrainNode.cpp:1: /home/aliyasineser/DGM/modules/DGM/ITrain.h:41:8: note: declared private here word m_nFeatures; ///< The number of features (length of the feature vector) ^~~~~~~~~~~ modules/DGM/CMakeFiles/DGM.dir/build.make:974: recipe for target 'modules/DGM/CMakeFiles/DGM.dir/TrainNode.cpp.o' failed make[2]: *** [modules/DGM/CMakeFiles/DGM.dir/TrainNode.cpp.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'modules/DGM/CMakeFiles/DGM.dir/all' failed make[1]: *** [modules/DGM/CMakeFiles/DGM.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2 I solved the problem, changed m_nFeatures from private to public. It can be protected maybe, but since it is a design issue I want to report so you can probably find a better solution for the library. The variable in ITrain.h . And after successful build, I could manage to use and import DGM.h so it means the main problem solved. Thank you. Issue still open due to second problem, it is possible to open second issue if necessary. Thanks

ereator commented 5 years ago

@aliyasineser That's a new bug from yesterday. I have just fixed that: I used the accessor getNumFeatures() instead of m_nFeatures.

aliyasineser commented 5 years ago

Then we can close the issue, DGM is working. Thank you @ereator :+1: