Issues compiling ofxCv under linux on OF_10.1


#1

trying to compile the examples i get this issue

home/jacos/OF/libs/glm/include/glm/detail/type_vec4.hpp:19:9: note: ‘glm::i16vec4’ {aka ‘struct glm::tvec4<short int, (glm::precision)0>’} declared here
  struct tvec4
         ^~~~~
In file included from /home/jacos/OF/addons/ofxCv/src/ofxCv.h:10,
                 from /home/jacos/OF/addons/ofxCv/example-blur/src/ofApp.h:4,
                 from /home/jacos/OF/addons/ofxCv/example-blur/src/main.cpp:1:
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Wrappers.h: In function ‘void ofxCv::copyGray(const S&, D&)’:
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Wrappers.h:194:36: error: ‘CV_RGBA2GRAY’ was not declared in this scope
             convertColor(src, dst, CV_RGBA2GRAY);
                                    ^~~~~~~~~~~~
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Wrappers.h:194:36: note: suggested alternative: ‘GL_RGBA2_EXT’
             convertColor(src, dst, CV_RGBA2GRAY);
                                    ^~~~~~~~~~~~
                                    GL_RGBA2_EXT
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Wrappers.h:196:36: error: ‘CV_RGB2GRAY’ was not declared in this scope
             convertColor(src, dst, CV_RGB2GRAY);
                                    ^~~~~~~~~~~
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Wrappers.h:196:36: note: suggested alternative: ‘CV_RGB’
             convertColor(src, dst, CV_RGB2GRAY);
                                    ^~~~~~~~~~~
                                    CV_RGB
In file included from /home/jacos/OF/addons/ofxCv/src/ofxCv.h:23,
                 from /home/jacos/OF/addons/ofxCv/example-blur/src/ofApp.h:4,
                 from /home/jacos/OF/addons/ofxCv/example-blur/src/main.cpp:1:
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Tracker.h: In member function ‘virtual const std::vector<unsigned int>& ofxCv::RectTracker::track(const std::vector<cv::Rect_<int> >&)’:
/home/jacos/OF/addons/ofxCv/libs/ofxCv/include/ofxCv/Tracker.h:326:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<unsigned int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    for(int i = 0; i < labels.size(); i++) {
                   ~~^~~~~~~~~~~~~~~
make[1]: *** [/home/jacos/OF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:217: obj/linux64/Release/src/main.o] Error 1
make[1]: Leaving directory '/home/jacos/OF/addons/ofxCv/example-blur'
make: *** [/home/jacos/OF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2

any idea ??


#2

Th version of openCv libs included with OF has changed, that is why you get these errors. If you revert to an earlier version of OF (or even just an earlier version of the libs), it will work with ofxCV.


#3

Also you can just use the nightly builds which already has support for opencv 4


#4

thanks @arturo , im using the nightly vs from like 2 week ago and open cv examples work fines just the ofxCv examples are the ones i can compile at the moment


#5

oh i see, yes ofxCv is probably not working yet with opencv 4


#6

Hi, I bumped into this same issue. There is a missing header file. A dirty and fast fix is to add to addons/ofxCv/libs/ofxCv/include/ofxCv/Utilities.h the following line

#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/calib3d/calib3d_c.h"

just bellow the other #include statements.

(edited: The include statement previously posted was wrong. The current one is correct)
Hope this helps.


#7

Can you send a PR to ofxCv with this change?


#8

sure


#9

PR made here https://github.com/kylemcdonald/ofxCv/pull/262


#10

applying this fix get me clear of the other error but now i get this
** ^~~~~
/

home/jacos/OF/addons/ofxCv/libs/ofxCv/src/Wrappers.cpp: In function ‘std::vector<cv::Vec<int, 4> > ofxCv::convexityDefects(const std::vector<cv::Point_<int> >&)’:
/home/jacos/OF/addons/ofxCv/libs/ofxCv/src/Wrappers.cpp:63:21: error: ‘cvConvexityDefects’ was not declared in this scope
    CvSeq* defects = cvConvexityDefects(&contourMat, &hullMat, storage);
                     ^~~~~~~~~~~~~~~~~~
/home/jacos/OF/addons/ofxCv/libs/ofxCv/src/Wrappers.cpp:63:21: note: suggested alternative: ‘convexityDefects’
    CvSeq* defects = cvConvexityDefects(&contourMat, &hullMat, storage);
                     ^~~~~~~~~~~~~~~~~~
                     convexityDefects
make[1]: *** [/home/jacos/OF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:354: /home/jacos/OF/addons/obj/linux64/Release/ofxCv/libs/ofxCv/src/Wrappers.o] Error 1
make[1]: Leaving directory '/home/jacos/OF/addons/ofxCv/example-background'
make: *** [/home/jacos/OF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2**

looks like something else is missing


#11

hi. which fix did you apply? I edited this post


#13

hey , the last one the one you just edited


#14

I tested on the current github master (which should be also the latest nightly build) with the latest version of ofxCv on mac os and it worked with those changes I made. Which version are you using?


#15

im using a nightly build from a couple days ago and my ofxCv vs is from 2 days ago but im on linux manjaro i can get the new new vs and tested there


#16

does it work if you add to ofxCv/libs/ofxCv/src/Wrappers.cpp the following line?

 #include "opencv2/imgproc/imgproc_c.h"

add it bellow the other include statemets


#17

yeah!!! that one work !!! what happen? i don’t get it
its is missing that 3 lines of includes ?


#18

that’s odd because that is one of the other lines already included and Wrappers.cpp should get that as an include too.
did you clean before rebuilding? some times that’s the issue
can you remove this line just added and leave as the other post I made and clean before building?


#19

ok , sorry i got it was my bad
it works with the first fix i wasn’t adding this line to utilities.h
#include "opencv2/imgproc/imgproc_c.h"