Closed ithmz closed 5 years ago
Hi Tsangz,
I have never encountered this specific error before, but I'm guessing you are trying to reference a Mat that is only temporary or at some point dereferenced. Try declaring and initializing a global Mat in your code and passing that in as "I" to verify.
https://github.com/YutaItoh/3D-Eye-Tracker/blob/master/main/pupilFitter.h#L74
The error comes from this Line. Not sure where to declare the gray
variable because gray
is function's parameter
It should be outside of pupilAreaFitRR since that is where the original image comes in. Can you post your main code? (Just the relevant calls)
I haven't called any function from the pupilFitter.h
in my own main.cpp
, just included the .h
file. I think the problem comes from itself, whether the pupilAreaFitRR
or the getDarkPixelBetter
.
Note I only use the pupilFitter.h
and the fit_eclipse.h
file
Ah sorry I did not realize it was a build error. That is quite strange. You are just including the header file without passing any image to the pupilAreaFitRR function correct? It may be a problem with your setup. What version of OpenCV are you running?
I would try to build our entire library using the instructions as-is first, see if that works, and debug from there.
I use the OpenCV 3.0 on macos. Yes, I just include the header file. I also tried to call the function pupilAreaFitRR
same as in the main.cpp
here but still got the same error.
Actually, I just want to try the 2D pupil detection by Jason Orlosky
What compiler?
I'm using cmake build
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Sorry for not getting back to you about this. Were you able to resolve it?
We have not tried to run this code on a non-windows machine, but it should work in theory. One guess would be that the version of OpenCV you are running may have a version compatibility issue with the Apple compiler. I also see the x86_64 prefix for that version, so you might also try forcing a 64-bit compilation if that is possible.
You could also try copying just the "int getDarkestPixelBetter(Mat& I)" function into your code to see what the problem might be with that function alone.
Hope that helps ~
I'm running only the pupilFitter.h file for my current project. When I built the code, it showed the errors:
error: non-const lvalue reference to type 'cv::Mat' cannot bind to a temporary of type 'cv::Mat'
int darkestPixel = getDarkestPixelBetter(gray(cv::Rect(darkestPixelConfirm.x, darkestPixelConfirm.y, size, size))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pupilFitter.h:545:32: note: passing argument to parameter 'I' here
int getDarkestPixelBetter(Mat& I)
at line:77. What is the problem and how do I resolve this? Thanks