RoelofBerg / limereg

Lightweight, derivative based, rigid, 2D Image Registration
http://www.berg-solutions.de/limereg.html
Other
7 stars 5 forks source link

build fail again opencv4 #3

Open yuzibo opened 1 year ago

yuzibo commented 1 year ago

hi, I am looking at the limerge package on Debian and it has RC bug due to fail to build again opencv4. As we all know, only limerge binary file will use opencv, so the workround is to drop limereg binary package on Debian. But I will try to build it again opencv4(I have included cv4's headers), the build log is here:

/usr/include/boost/progress.hpp:23:1: note: ‘#pragma message: This header is deprecated. Use the facilities in <boost/timer/timer.hpp> or <boost/timer/progress_display.hpp> instead.’
   23 | BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp> or <boost/timer/progress_display.hpp>" )
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/timer.hpp:21:1: note: ‘#pragma message: This header is deprecated. Use the facilities in <boost/timer/timer.hpp> instead.’
   21 | BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )
      | ^~~~~~~~~~~~~~~~~~~~~~~
CRegistrationController.cpp: In member function ‘void CRegistrationController::RegisterImage()’:
CRegistrationController.cpp:102:42: error: no matching function for call to ‘_IplImage::_IplImage(cv::Mat&)’
  102 |         imgTmp = cvCloneImage(&(IplImage)img_tmp1);
      |                                          ^~~~~~~~
In file included from /usr/include/opencv4/opencv2/core/core_c.h:48,
                 from /usr/include/opencv4/opencv2/imgproc/types_c.h:46,
                 from /usr/include/opencv4/opencv2/imgproc/imgproc_c.h:46,
                 from stdafx.h:109:
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘_IplImage::_IplImage()’
  327 | _IplImage
      | ^~~~~~~~~
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   candidate expects 0 arguments, 1 provided
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(const _IplImage&)’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘const _IplImage&’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(_IplImage&&)’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘_IplImage&&’
CRegistrationController.cpp:111:88: error: no matching function for call to ‘_IplImage::_IplImage(cv::Mat)’
  111 |         imgRef = new IplImage(cv::imread(m_sRFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE));
      |                                                                                        ^
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘_IplImage::_IplImage()’
  327 | _IplImage
      | ^~~~~~~~~
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   candidate expects 0 arguments, 1 provided
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(const _IplImage&)’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘const _IplImage&’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(_IplImage&&)’
/usr/include/opencv4/opencv2/core/types_c.h:327:1: note:   no known conversion for argument 1 from ‘cv::Mat’ to ‘_IplImage&&’
make[3]: *** [Makefile:584: limereg-CRegistrationController.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/<<PKGBUILDDIR>>/exe'
make[2]: *** [Makefile:512: all-recursive] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
make[1]: *** [Makefile:421: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j16 returned exit code 2
make: *** [debian/rules:11: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
--------------------------------------------------------------------------------

Because there is no cvLoadimage in cv4, so I try to switch to cvCloneImage or imread, but it fails. yeah, I am not familiar with cv4 program, so have you a look at this? thanks

RoelofBerg commented 1 year ago

Hi,

oh, limereg, that’s long ago. I didn’t write code anymore since 5 years and switched from Linux to Mac.

I wonder if anybody is really using Limereg. The alternative would be dropping it.

I‘ll have a look.

Best regards, Roelof

Von meinem Mobiltelefon gesendet.

Am 31.10.2022 um 10:40 schrieb vimer @.***>:

 hi, I am looking at the limerge package on Debian and it has RC bug due to fail to build again opencv4. As we all know, only limerge binary file will use opencv, so the workround is to drop limereg binary package on Debian. But I will try to build it again opencv4(I have included cv4's headers), the build log is here:

/usr/include/boost/progress.hpp:23:1: note: ‘#pragma message: This header is deprecated. Use the facilities in <boost/timer/timer.hpp> or <boost/timer/progress_display.hpp> instead.’ 23 | BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp> or <boost/timer/progress_display.hpp>" ) | ^~~~~~~ /usr/include/boost/timer.hpp:21:1: note: ‘#pragma message: This header is deprecated. Use the facilities in <boost/timer/timer.hpp> instead.’ 21 | BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" ) | ^~~~~~~ CRegistrationController.cpp: In member function ‘void CRegistrationController::RegisterImage()’: CRegistrationController.cpp:102:42: error: no matching function for call to ‘_IplImage::_IplImage(cv::Mat&)’ 102 | imgTmp = cvCloneImage(&(IplImage)img_tmp1); | ^~~~ In file included from /usr/include/opencv4/opencv2/core/core_c.h:48, from /usr/include/opencv4/opencv2/imgproc/types_c.h:46, from /usr/include/opencv4/opencv2/imgproc/imgproc_c.h:46, from stdafx.h:109: /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘_IplImage::_IplImage()’ 327 | _IplImage | ^~~~~ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate expects 0 arguments, 1 provided /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(const _IplImage&)’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: no known conversion for argument 1 from ‘cv::Mat’ to ‘const _IplImage&’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(_IplImage&&)’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: no known conversion for argument 1 from ‘cv::Mat’ to ‘_IplImage&&’ CRegistrationController.cpp:111:88: error: no matching function for call to ‘_IplImage::_IplImage(cv::Mat)’ 111 | imgRef = new IplImage(cv::imread(m_sRFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE)); | ^ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘_IplImage::_IplImage()’ 327 | _IplImage | ^~~~~ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate expects 0 arguments, 1 provided /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(const _IplImage&)’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: no known conversion for argument 1 from ‘cv::Mat’ to ‘const _IplImage&’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: candidate: ‘constexpr _IplImage::_IplImage(_IplImage&&)’ /usr/include/opencv4/opencv2/core/types_c.h:327:1: note: no known conversion for argument 1 from ‘cv::Mat’ to ‘_IplImage&&’ make[3]: [Makefile:584: limereg-CRegistrationController.o] Error 1 make[3]: Waiting for unfinished jobs.... make[3]: Leaving directory '/<>/exe' make[2]: [Makefile:512: all-recursive] Error 1 make[2]: Leaving directory '/<>' make[1]: [Makefile:421: all] Error 2 make[1]: Leaving directory '/<>' dh_auto_build: error: make -j16 returned exit code 2 make: *** [debian/rules:11: build] Error 25 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

Because there is no cvLoadimage in cv4, so I try to switch to cvCloneImage or imread, but it fails. yeah, I am not familiar with cv4 program, so have you a look at this? thanks

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

yuzibo commented 1 year ago

many thanks. I put my basic patches to here and hope it helps:

diff -Nru limereg-1.4.1/debian/patches/fix-opencv4-ftbfs.patch limereg-1.4.1/debian/patches/fix-opencv4-ftbfs.patch
--- limereg-1.4.1/debian/patches/fix-opencv4-ftbfs.patch        1970-01-01 07:30:00.000000000 +0730
+++ limereg-1.4.1/debian/patches/fix-opencv4-ftbfs.patch        2018-09-07 21:07:08.000000000 +0800
@@ -0,0 +1,70 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -43,12 +43,12 @@
+
+ HAVE_OPENCV=false
+ HAVE_OPENCV3=false
+-PKG_CHECK_MODULES(OPENCV, opencv >= 2.3.1, [HAVE_OPENCV=true], [true])
++PKG_CHECK_MODULES(OPENCV, opencv4 >= 2.3.1, [HAVE_OPENCV=true], [true])
+ if test x$HAVE_OPENCV = xfalse; then
+   AC_MSG_WARN([*** opencv >= 2.3.1 not found - Cannot build the command line tool, which relies on OpenCV. Only the library will be built, because the lib has no dependency to OpenCV. http://opencvlibrary.sourceforge.net ***])
+   AC_DEFINE([HAVE_OPENCV],[0],[Define to 1 if you have OpenCV >= 2.3.1])
+ else
+-  OPENCV_CFLAGS="$OPENCV_CFLAGS -DOPENCV_PREFIX=`pkg-config opencv --variable=prefix`"
++  OPENCV_CFLAGS="$OPENCV_CFLAGS -DOPENCV_PREFIX=`pkg-config opencv4 --variable=prefix`"
+   #OPENCV_INCLUDE=pkg-config opencv --variable=includedir_old
+   AC_DEFINE([HAVE_OPENCV],[1],[Define to 1 if you have OpenCV >= 2.3.1])
+   # OpenCV 3.x check
+--- a/exe/CRegistrationController.cpp
++++ b/exe/CRegistrationController.cpp
+@@ -96,8 +96,10 @@
+ {
+       // load template image
+       // ToDo: This class is too big. Refactor out an image class containing all image handling (maybe outlayering OpenCV) (and possibly also the cmdline param stuff at the bottom of this file).
+-      IplImage* imgTmp = 0;
+-      imgTmp=cvLoadImage(m_sTFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
++      IplImage* imgTmp = 0;
++      cv::Mat img_tmp1;
++      img_tmp1 = cv::imread(m_sTFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
++      imgTmp = cvCloneImage(&(IplImage)img_tmp1);
+       if(!CheckImage(imgTmp, m_sTFilename))
+               exit(0);
+       uint32_t iyDim = imgTmp->height;
+@@ -106,7 +108,7 @@
+
+       // load reference image
+       IplImage* imgRef = 0;
+-      imgRef=cvLoadImage(m_sRFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE);
++      imgRef = new IplImage(cv::imread(m_sRFilename.c_str(), CV_LOAD_IMAGE_GRAYSCALE));
+       if(!CheckImage(imgRef, m_sRFilename, ixDim, iyDim))
+               exit(0);
+       t_pixel* pixelBytesRef = (t_pixel *)imgRef->imageData;
+@@ -226,8 +228,9 @@
+
+         if(0<m_sSaveTransImage.size())
+         {
++                      cv::Mat img_tmp2;
+             printf("Saving result to file '%s'.\n", m_sSaveTransImage.c_str());
+-            int iRetval = cvSaveImage(m_sSaveTransImage.c_str(), imgTmpTrns);
++            int iRetval = cv::imwrite(m_sSaveTransImage.c_str(), img_tmp2);
+             /*if(0!=iRetval)
+             {
+                 printf("ERROR, CANNOT SAVE IMAGE, CHECK FILENAME.\n");
+--- a/exe/stdafx.h
++++ b/exe/stdafx.h
+@@ -103,8 +103,13 @@
+
+ //OpenCV (image processing library, only used for loading and displaying/storing the images. If you don't like it it should be just a matter of one hour to get rid of it - if you have
+ //an image in- and output alternative readyly available)
+-#include <cv.h>
+-#include <highgui.h>
++#include <opencv2/imgproc/imgproc.hpp>
++#include <opencv2/core/core.hpp>
++#include <opencv2/opencv.hpp>
++#include <opencv2/imgproc/imgproc_c.h>
++#include <opencv2/imgproc/types_c.h>
++#include <opencv2/highgui/highgui_c.h>
++#include <opencv2/imgcodecs/legacy/constants_c.h>
+
+ //Commonly used application headers
+ #include "limereg_common.h"