Page 1 of 1

EmptyMat()

Posted: Fri Mar 22, 2019, 08:19
by Clue
there is something wrong when i try to run the demo dense.cpp
the error like that
''Severity Code Description Project File Line Suppression State
Error C2664 'DirectGraphicalModels::CKDNode::CKDNode(cv::Mat &,byte,pair_mat_t &,byte,int,std::shared_ptr<_Ty>,std::shared_ptr<_Ty>)': cannot convert argument 1 from 'cv::Mat' to 'cv::Mat &' Project16 e:\dgm-master\modules\dgm\kdnode.h 38''

How can I solve it?

Re: EmptyMat()

Posted: Fri Mar 22, 2019, 16:27
by Creator
Hi, Clue!
Could you please specify which Operating System and which compiler do you use?

Re: EmptyMat()

Posted: Sat Mar 23, 2019, 06:37
by Clue
Compiler is Visual Studio 2017 and Operating System is 64-bit Operating System,x64-based processor Win10
What'more,is this error related to the version of OpenCV? My OpenCv version is 4.0.0

Re: EmptyMat()

Posted: Sat Mar 23, 2019, 22:27
by Creator
This bug is really strange. The thing is that MSVS 2017 and Win 10 are the main development platforms and this problem never appeared before.
I could not reproduce the bug.
However, I have replaced the EmptyMat with std::optional<Mat>. Please update the DGM from GitHub repository. I hope this will fix the problem.

Re: EmptyMat()

Posted: Sun Mar 24, 2019, 12:53
by Clue
I download the file again from github´╝îand restart to compile it.
But these problems still exist.
So maybe these problems are due to the wrong environment?

Re: EmptyMat()

Posted: Sun Mar 24, 2019, 17:04
by Creator
This is very strange.
Does the problem still appears here?

Code: Select all

e:\dgm-master\modules\dgm\kdnode.h   38

Or at another place with EmptyMat?
Did you run CMake as described in the installation guide? If EmptyMat is replaced with the Mat()?

Re: EmptyMat()

Posted: Mon Mar 25, 2019, 02:34
by Clue
Another place with EmptyMat.
It seems to work, the error vanished in the header file ''kdnode.h''.
But it still exit in another header file ''kdgauss.h'',''parallel.h'',''infer.h'',''decode.h'' and ''decodeexact.h''.
By the way, I have runed CMake as described in the installation guide and tried to replaced EmptyMat with the Mat().It doesn't work.

Re: EmptyMat()

Posted: Mon Mar 25, 2019, 22:45
by Creator
I have some ideas, that I can offer to try. Sorry, I can't try it myself because I can't reproduce the problem.
  1. Try to add const before Mat & in the corresponding functions' declaration (and subsequently implementation if needed) for one function and check whether the error for this particular case disappears.
  2. Try to remove the reference & in the corresponding functions' declaration (and subsequently implementation if needed) for one function and check whether the error for this particular case disappears.
  3. Try to replace Mat() with lvalue_cast(Mat()) in that place where error occurs.
  4. Try to re-build OpenCV from the sources using the same Visual Studio compiler.
I really hope that one of these ideas will help. I am really interested why this problem exists.

Re: EmptyMat()

Posted: Wed Mar 27, 2019, 07:19
by Clue
I replace Mat() with lvalue_cast(Mat()) in these head files,those errors have vanished.
Thank you for your help:)