GMIC compile error with opencv version 4

#1

Hello, I’m trying to compile GMIC on Debian; I have also built opencv from source, it’s version is 4.1.0-dev

During the GMIC compile I get an error:

In file included from gmic.h:185,
from gmic.cpp:1802:
./CImg.h: In member function ‘cimg_library::CImg& cimg_library::CImg::load_camera(unsigned int, unsigned int, unsigned int, unsigned int, bool)’:
./CImg.h:52692:37: error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
captures[camera_index]->set(CV_CAP_PROP_FRAME_WIDTH,capture_width);

When I check the opencv header files I find that videoio.hpp has declared:

CAP_PROP_FRAME_WIDTH =3, //!< Width of the frames in the video stream.

I’m not sure when this was renamed, perhaps in some version 3.x? Can GMIC check for the occurrence of CV_CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_WIDTH?

thanks, John

(G'MIC staff) #2

Hello John,

I’ve made a small change in CImg.h, and I hope this will fix this problem :

Could you check with the latest sources from git ?

#3

Thank you David, that error is fixed.

Now I need to rebuild opencv with some extra modules that gmic cli is looking for:

/usr/bin/ld: cannot find -lopencv_shape
/usr/bin/ld: cannot find -lopencv_superres
/usr/bin/ld: cannot find -lopencv_videostab
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:367: _cli] Error 1
make[1]: Leaving directory ‘/mnt/data/src/gmic/src’
make: *** [Makefile:359: cli] Error 2

However gmic_gimp_qt build had no problems; again, thanks!

1 Like
#4

David,
I rebuilt opencv with the shape, superres and videostab modules. Attempts to build gmic now produce the following:

/usr/bin/ld: gmic_cli.o: in function cimg_library::CImgList<float>::load_video(char const*, unsigned int, unsigned int, unsigned int)': gmic.cpp:(.text._ZN12cimg_library8CImgListIfE10load_videoEPKcjjj[_ZN12cimg_library8CImgListIfE10load_videoEPKcjjj]+0x37a): undefined reference tocv::VideoCapture::VideoCapture(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’
/usr/bin/ld: gmic_cli.o: in function cimg_library::CImg<float>::get_load_camera(unsigned int, unsigned int, unsigned int, unsigned int, bool)': gmic.cpp:(.text._ZN12cimg_library4CImgIfE15get_load_cameraEjjjjb[_ZN12cimg_library4CImgIfE15get_load_cameraEjjjjb]+0x5fa): undefined reference tocv::VideoCapture::VideoCapture(int)’
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:366: _cli] Error 1
make[1]: Leaving directory ‘/mnt/data/src/gmic/src’
make: *** [Makefile:358: cli] Error 2

I wonder if opencv renamed some methods?

(G'MIC staff) #5

Honestly, I don’t know…
OpenCV support in G’MIC has always been a nightmare, whether on Windows, Linux or MacOSX.
There are frequent API changes. I’m not even sure G’MIC can compile with OpenCV 4
(it does with OpenCV 3.x for sure).

#6

I hear you, tough being tied to something you can’t control! Maybe I’ll downgrade my opencv.

#7

Or better yet, compile gmic with ENABLE_OPENCV=OFF !

(G'MIC staff) #8

In that case, if you are using the Makefile, you can do:
make OPENCV_CFLAGS='' OPENCV_LIBS=""

1 Like
#9

ok, thanks!

#10

That worked.

1 Like