Control: tags -1 + patch
Dear maintainer,
I've prepared a patch fixing this issue, please consider incorporating
it. Please ignore this message if you already have a working patch.
Regards,
Aron
Description: Fix FTBFS with OpenCV 5
OpenCV 5 renamed its pkg-config module from opencv4 to opencv5 with no
compatibility shim, so the "PKGCONFIG += opencv4" lookup in src.pro
fails during configure ("Project ERROR: opencv4 development package not
found"), aborting the build before compilation is reached. Prefer
opencv5 and fall back to opencv4, so the package continues to build
against OpenCV 4.10 (current sid) as well as OpenCV 5 (experimental).
.
Once configure succeeds, the build also needs two source-level fixes
for OpenCV 5:
.
- <opencv2/imgproc/imgproc_c.h> (the legacy OpenCV 1.x C API) no longer
exists in OpenCV 5, so drop the include and use the modern cv::
namespaced enum constants (cv::COLOR_RGB2HSV, cv::COLOR_HSV2RGB,
cv::NORM_MINMAX) instead of the old CV_* macros that header provided;
these enums are available unchanged in OpenCV 4.10.
- getRotationMatrix2D() moved from imgproc to the new geometry module in
OpenCV 5, so pull in <opencv2/geometry.hpp> when building against it.
That header does not exist in OpenCV 4.10, so the include is guarded
by CV_VERSION_MAJOR.
Author: Aron Xu <[email protected]>
Bug-Debian: https://bugs.debian.org/1147676
Forwarded: no
Last-Update: 2026-09-30
Index: kylin-scanner/src/embelish.cpp
===================================================================
--- kylin-scanner.orig/src/embelish.cpp
+++ kylin-scanner/src/embelish.cpp
@@ -278,7 +278,7 @@ void psHslCV(Mat src, Mat &dst)
Mat temp;
temp.create(src.rows, src.cols, src.type());
- cvtColor(src, temp, CV_RGB2HSV);
+ cvtColor(src, temp, cv::COLOR_RGB2HSV);
int i, j;
Size size = src.size();
@@ -316,7 +316,7 @@ void psHslCV(Mat src, Mat &dst)
}
}
- cvtColor(temp, dst, CV_HSV2RGB);
+ cvtColor(temp, dst, cv::COLOR_HSV2RGB);
if (temp.empty())
temp.release();
}
@@ -528,7 +528,7 @@ void psLogarithmCV(Mat src, Mat &dst)
}
}
//归一化到0~255
- normalize(imageLog, imageLog, 0, 255, CV_MINMAX);
+ normalize(imageLog, imageLog, 0, 255, cv::NORM_MINMAX);
//转换成8bit图像显示
convertScaleAbs(imageLog, imageLog);
@@ -556,7 +556,7 @@ void psGammaCV(Mat src, Mat &dst)
}
}
//归一化到0~255
- normalize(imageGamma, imageGamma, 0, 255, CV_MINMAX);
+ normalize(imageGamma, imageGamma, 0, 255, cv::NORM_MINMAX);
//转换成8bit图像显示
convertScaleAbs(imageGamma, imageGamma);
dst = imageGamma.clone();
Index: kylin-scanner/src/embelish.h
===================================================================
--- kylin-scanner.orig/src/embelish.h
+++ kylin-scanner/src/embelish.h
@@ -29,7 +29,6 @@
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
-#include <opencv2/imgproc/imgproc_c.h>
using namespace cv;
using namespace std;
Index: kylin-scanner/src/rectify.cpp
===================================================================
--- kylin-scanner.orig/src/rectify.cpp
+++ kylin-scanner/src/rectify.cpp
@@ -17,6 +17,10 @@
*/
#include "rectify.h"
+#if CV_VERSION_MAJOR >= 5
+#include <opencv2/geometry.hpp>
+#endif
+
//度数转换
double DegreeTrans(double theta)
{
Index: kylin-scanner/src/src.pro
===================================================================
--- kylin-scanner.orig/src/src.pro
+++ kylin-scanner/src/src.pro
@@ -27,8 +27,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += link_pkgconfig \
C++11
PKGCONFIG += gio-2.0 \
- gio-unix-2.0 \
- opencv4
+ gio-unix-2.0
+packagesExist(opencv5) {
+ PKGCONFIG += opencv5
+} else {
+ PKGCONFIG += opencv4
+}
LIBS +=-lleptonica
LIBS +=-ltesseract