aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-08-29 07:03:01 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-09-05 06:25:06 +0700
commit22e3b97b1ccad996e3ecfe36111c7913945b3249 (patch)
treeaaea1dc7bec5ed6bfc5e1010702f765e2f329bdb /graphics
parent5351e58392ddb69fef5f337b30437ef22756201e (diff)
graphics/digikam: Patched against opencv 3.0.0.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'graphics')
-rw-r--r--graphics/digikam/digikam.SlackBuild7
-rw-r--r--graphics/digikam/libkface.patch258
-rw-r--r--graphics/digikam/opencv.patch121
3 files changed, 385 insertions, 1 deletions
diff --git a/graphics/digikam/digikam.SlackBuild b/graphics/digikam/digikam.SlackBuild
index f8f0bfed5554..7a0f9a7e5d4f 100644
--- a/graphics/digikam/digikam.SlackBuild
+++ b/graphics/digikam/digikam.SlackBuild
@@ -25,7 +25,7 @@
PRGNAM=digikam
VERSION=${VERSION:-4.12.0}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -66,6 +66,10 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+patch -p1 < $CWD/opencv.patch
+cd extra/libkface
+patch -p1 < $CWD/libkface.patch
+cd ../..
mkdir -p build
cd build
cmake \
@@ -81,6 +85,7 @@ cd build
-DDIGIKAMSC_COMPILE_LIBKVKONTAKTE=ON \
-DDIGIKAMSC_COMPILE_LIBKFACE=ON \
-DDIGIKAMSC_COMPILE_DOC=OFF \
+ -DCMAKE_CXX_FLAGS:STRING="$(/usr/bin/Magick++-config --libs)" \
-DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=$PKG
diff --git a/graphics/digikam/libkface.patch b/graphics/digikam/libkface.patch
new file mode 100644
index 000000000000..e943bc5d2e87
--- /dev/null
+++ b/graphics/digikam/libkface.patch
@@ -0,0 +1,258 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4e83c8b..e399a25 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -30,7 +30,7 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=${LIBKFACE_AREA_CODE_GENERAL})
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+ include(MacroOpenCV)
+-DETECT_OPENCV(2.4.9 core highgui objdetect contrib legacy imgproc)
++DETECT_OPENCV(2.4.9 core highgui objdetect face legacy imgproc)
+
+ include_directories(${OpenCV_INCLUDE_DIRS})
+
+diff --git a/cmake/modules/modules_opencv/FindOpenCV.cmake b/cmake/modules/modules_opencv/FindOpenCV.cmake
+index 7580b32..6d3da76 100644
+--- a/cmake/modules/modules_opencv/FindOpenCV.cmake
++++ b/cmake/modules/modules_opencv/FindOpenCV.cmake
+@@ -173,7 +173,6 @@ find_library(OpenCV_ML_LIBRARY
+ find_library(OpenCV_TRS_LIBRARY
+ NAMES trs
+ PATHS ${OpenCV_ROOT_DIR} PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
+-
+ #
+ # Logic selecting required libs and headers
+ #
+diff --git a/libkface/detection/opencvfacedetector.cpp b/libkface/detection/opencvfacedetector.cpp
+index 7c420ae..28edeea 100644
+--- a/libkface/detection/opencvfacedetector.cpp
++++ b/libkface/detection/opencvfacedetector.cpp
+@@ -138,11 +138,12 @@ public:
+ {
+ // This is a HACK which may break any time. Work around the fact that getOriginalWindowSize()
+ // always returns (0,0) and we need these values.
++/*
+ if (oldCascade)
+ {
+ return oldCascade->orig_window_size;
+ }
+-
++*/
+ return cv::Size(0, 0);
+ }
+
+diff --git a/libkface/libopencv.h.cmake.in b/libkface/libopencv.h.cmake.in
+index 0a1a958..e70fc0c 100644
+--- a/libkface/libopencv.h.cmake.in
++++ b/libkface/libopencv.h.cmake.in
+@@ -51,13 +51,11 @@
+ #define OPENCV_VERSION OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
+ #define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION >= OPENCV_MAKE_VERSION(major,minor,patch) )
+
+-#include <opencv2/core/core.hpp>
+-#include <opencv2/core/internal.hpp>
+-#include <opencv2/contrib/contrib.hpp>
++#include <opencv2/face/facerec.hpp>
++#include <opencv2/core.hpp>
+
+ // for old-style code
+ #include <opencv2/opencv.hpp>
+-#include <opencv2/legacy/compat.hpp>
+ #include <opencv2/highgui/highgui_c.h>
+ #include <opencv/cvaux.h>
+
+diff --git a/libkface/recognition-opencv-lbph/facerec_borrowed.cpp b/libkface/recognition-opencv-lbph/facerec_borrowed.cpp
+index 935a3d0..11aee02 100644
+--- a/libkface/recognition-opencv-lbph/facerec_borrowed.cpp
++++ b/libkface/recognition-opencv-lbph/facerec_borrowed.cpp
+@@ -531,14 +531,5 @@ Ptr<LBPHFaceRecognizer> LBPHFaceRecognizer::create(int radius, int neighbors, in
+ return ptr;
+ }
+
+-CV_INIT_ALGORITHM(LBPHFaceRecognizer, "FaceRecognizer.LBPH-KFaceIface",
+- obj.info()->addParam(obj, "radius", obj.m_radius);
+- obj.info()->addParam(obj, "neighbors", obj.m_neighbors);
+- obj.info()->addParam(obj, "grid_x", obj.m_grid_x);
+- obj.info()->addParam(obj, "grid_y", obj.m_grid_y);
+- obj.info()->addParam(obj, "threshold", obj.m_threshold);
+- obj.info()->addParam(obj, "histograms", obj.m_histograms); // modification: Make Read/Write
+- obj.info()->addParam(obj, "labels", obj.m_labels); // modification: Make Read/Write
+- obj.info()->addParam(obj, "statistic", obj.m_statisticsMode)); // modification: Add parameter
+
+ } // namespace KFaceIface
+diff --git a/libkface/recognition-opencv-lbph/facerec_borrowed.h b/libkface/recognition-opencv-lbph/facerec_borrowed.h
+index dd1ab16..22b14ac 100644
+--- a/libkface/recognition-opencv-lbph/facerec_borrowed.h
++++ b/libkface/recognition-opencv-lbph/facerec_borrowed.h
+@@ -45,7 +45,7 @@
+ namespace KFaceIface
+ {
+
+-class LBPHFaceRecognizer : public cv::FaceRecognizer
++class LBPHFaceRecognizer : public cv::face::FaceRecognizer
+ {
+ public:
+
+@@ -99,8 +99,8 @@ public:
+
+ ~LBPHFaceRecognizer() {}
+
+- using cv::FaceRecognizer::save;
+- using cv::FaceRecognizer::load;
++ using cv::face::FaceRecognizer::save;
++ using cv::face::FaceRecognizer::load;
+
+ static cv::Ptr<LBPHFaceRecognizer> create(int radius=1, int neighbors=8, int grid_x=8, int grid_y=8, double threshold = DBL_MAX, PredictionStatistics statistics = NearestNeighbor);
+
+@@ -139,13 +139,31 @@ public:
+ /**
+ * Getter functions.
+ */
+- int neighbors() const { return m_neighbors; }
+- int radius() const { return m_radius; }
+- int grid_x() const { return m_grid_x; }
+- int grid_y() const { return m_grid_y; }
++ int getNeighbors() const { return m_neighbors; }
++ void setNeighbors(int _neighbors) { m_neighbors = _neighbors; }
++
++ int getRadius() const { return m_radius; }
++ void setRadius(int radius) { m_radius = radius; }
++
++ int getGrid_x() const { return m_grid_x; }
++ void setGrid_x(int _grid_x) { m_grid_x = _grid_x; }
++
++ int getGrid_y() const { return m_grid_y; }
++ void setGrid_y(int _grid_y) { m_grid_y = _grid_y; }
++
++
++ double getThreshold() const { return m_threshold; }
++ void setThreshold(double _threshold) { m_threshold = _threshold; }
++
++ void setHistograms(std::vector<cv::Mat> _histograms) { m_histograms = _histograms; }
++ std::vector<cv::Mat> getHistograms() const { return m_histograms; }
++
++ void setLabels(cv::Mat _labels) { m_labels = _labels; }
++ cv::Mat getLabels() const { return m_labels; }
++
++ void setStatistic(int _statistic) { m_statisticsMode = _statistic; }
++ int getStatistic() const { return m_statisticsMode; }
+
+- // NOTE: Implementation done through CV_INIT_ALGORITHM macro from OpenCV.
+- cv::AlgorithmInfo* info() const;
+
+ private:
+
+diff --git a/libkface/recognition-opencv-lbph/lbphfacemodel.cpp b/libkface/recognition-opencv-lbph/lbphfacemodel.cpp
+index af8c6a5..75c5863 100644
+--- a/libkface/recognition-opencv-lbph/lbphfacemodel.cpp
++++ b/libkface/recognition-opencv-lbph/lbphfacemodel.cpp
+@@ -61,7 +61,7 @@ LBPHFaceModel::LBPHFaceModel()
+ : cv::Ptr<LBPHFaceRecognizer>(LBPHFaceRecognizer::create()),
+ databaseId(0)
+ {
+- ptr()->set("threshold", 100.0);
++ ptr()->setThreshold(100.0);
+ }
+
+ LBPHFaceModel::~LBPHFaceModel()
+@@ -70,7 +70,7 @@ LBPHFaceModel::~LBPHFaceModel()
+
+ LBPHFaceRecognizer* LBPHFaceModel::ptr()
+ {
+- LBPHFaceRecognizer* const ptr = cv::Ptr<LBPHFaceRecognizer>::operator KFaceIface::LBPHFaceRecognizer*();
++ LBPHFaceRecognizer* const ptr = get();
+
+ if (!ptr)
+ kWarning() << "LBPHFaceRecognizer pointer is null";
+@@ -80,7 +80,7 @@ LBPHFaceRecognizer* LBPHFaceModel::ptr()
+
+ const LBPHFaceRecognizer* LBPHFaceModel::ptr() const
+ {
+- const LBPHFaceRecognizer* const ptr = cv::Ptr<LBPHFaceRecognizer>::operator const KFaceIface::LBPHFaceRecognizer*();
++ const LBPHFaceRecognizer* const ptr = get();
+
+ if (!ptr)
+ kWarning() << "LBPHFaceRecognizer pointer is null";
+@@ -90,47 +90,47 @@ const LBPHFaceRecognizer* LBPHFaceModel::ptr() const
+
+ int LBPHFaceModel::radius() const
+ {
+- return ptr()->get<int>("radius");
++ return ptr()->getRadius();
+ }
+
+ void LBPHFaceModel::setRadius(int radius)
+ {
+- ptr()->set("radius", radius);
++ ptr()->setRadius(radius);
+ }
+
+ int LBPHFaceModel::neighbors() const
+ {
+- return ptr()->get<int>("neighbors");
++ return ptr()->getNeighbors();
+ }
+
+ void LBPHFaceModel::setNeighbors(int neighbors)
+ {
+- ptr()->set("neighbors", neighbors);
++ ptr()->setNeighbors(neighbors);
+ }
+
+ int LBPHFaceModel::gridX() const
+ {
+- return ptr()->get<int>("grid_x");
++ return ptr()->getGrid_x();
+ }
+
+ void LBPHFaceModel::setGridX(int grid_x)
+ {
+- ptr()->set("grid_x", grid_x);
++ ptr()->setGrid_x(grid_x);
+ }
+
+ int LBPHFaceModel::gridY() const
+ {
+- return ptr()->get<int>("grid_y");
++ return ptr()->getGrid_y();
+ }
+
+ void LBPHFaceModel::setGridY(int grid_y)
+ {
+- ptr()->set("grid_y", grid_y);
++ ptr()->setGrid_y(grid_y);
+ }
+
+ OpenCVMatData LBPHFaceModel::histogramData(int index) const
+ {
+- return OpenCVMatData(ptr()->get<std::vector<cv::Mat> >("histograms").at(index));
++ return OpenCVMatData(ptr()->getHistograms().at(index));
+ }
+
+ QList<LBPHistogramMetadata> LBPHFaceModel::histogramMetadata() const
+@@ -168,12 +168,12 @@ void LBPHFaceModel::setHistograms(const QList<OpenCVMatData>& histograms, const
+ m_histogramMetadata << metadata;
+ }
+
+- std::vector<cv::Mat> currentHistograms = ptr()->get<std::vector<cv::Mat> >("histograms");
+- cv::Mat currentLabels = ptr()->get<cv::Mat>("labels");
++ std::vector<cv::Mat> currentHistograms = ptr()->getHistograms();
++ cv::Mat currentLabels = ptr()->getLabels();
+ currentHistograms.insert(currentHistograms.end(), newHistograms.begin(), newHistograms.end());
+ currentLabels.push_back(newLabels);
+- ptr()->set("histograms", currentHistograms);
+- ptr()->set("labels", currentLabels);
++ ptr()->setHistograms(currentHistograms);
++ ptr()->setLabels(currentLabels);
+
+ /*
+ //Most cumbersome and inefficient way through a file storage which we were forced to use if we used standard OpenCV
+@@ -215,7 +215,7 @@ void LBPHFaceModel::update(const std::vector<cv::Mat>& images, const std::vector
+
+ // Update local information
+ // We assume new labels are simply appended
+- cv::Mat currentLabels = ptr()->get<cv::Mat>("labels");
++ cv::Mat currentLabels = ptr()->getLabels();
+
+ for (int i = m_histogramMetadata.size() ; i < currentLabels.rows ; i++)
+ {
diff --git a/graphics/digikam/opencv.patch b/graphics/digikam/opencv.patch
new file mode 100644
index 000000000000..029f5cdc4de2
--- /dev/null
+++ b/graphics/digikam/opencv.patch
@@ -0,0 +1,121 @@
+diff -up digikam-4.12.0/core/app/utils/libopencv.h.opencv3 digikam-4.12.0/core/app/utils/libopencv.h
+--- digikam-4.12.0/core/app/utils/libopencv.h.opencv3 2015-08-18 15:32:24.635326685 +0200
++++ digikam-4.12.0/core/app/utils/libopencv.h 2015-08-18 16:51:00.716761209 +0200
+@@ -46,17 +46,19 @@
+
+ #define OPENCV_MAKE_VERSION(major,minor,patch) (((major) << 16) | ((minor) << 8) | (patch))
+ #define OPENCV_VERSION OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
+-#define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION >= OPENCV_MAKE_VERSION(major,minor,patch) )
++#define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION < OPENCV_MAKE_VERSION(major,minor,patch) )
+
+-#if OPENCV_TEST_VERSION(2,3,0)
++#if OPENCV_TEST_VERSION(2,5,0)
+ # include <opencv2/opencv.hpp>
+ # include <opencv2/legacy/compat.hpp>
+ # include <opencv/cvaux.h>
++# include <opencv2/imgproc/imgproc.hpp>
+ #else
+ # include <opencv/cv.h>
+ # include <opencv/cvaux.h>
+ # include <opencv/cxcore.h>
+ # include <opencv/highgui.h>
++# include <opencv2/imgproc.hpp>
+ #endif
+
+ // Restore warnings
+diff -up digikam-4.12.0/core/libs/database/imgqsort/imgqsort.cpp.opencv3 digikam-4.12.0/core/libs/database/imgqsort/imgqsort.cpp
+--- digikam-4.12.0/core/libs/database/imgqsort/imgqsort.cpp.opencv3 2015-08-18 17:17:24.003431310 +0200
++++ digikam-4.12.0/core/libs/database/imgqsort/imgqsort.cpp 2015-08-18 17:25:14.761703338 +0200
+@@ -284,8 +284,8 @@ void ImgQSort::readImage() const
+ mixer.startFilterDirectly();
+
+ d->image.putImageData(mixer.getTargetImage().bits());
+- d->src = cvCreateMat(d->image.numPixels(), 3, CV_8UC3); // Create a matrix containing the pixel values of original image
+- d->src_gray = cvCreateMat(d->image.numPixels(), 1, CV_8UC1); // Create a matrix containing the pixel values of grayscaled image
++ d->src = Mat(d->image.numPixels(), 3, CV_8UC3); // Create a matrix containing the pixel values of original image
++ d->src_gray = Mat(d->image.numPixels(), 1, CV_8UC1); // Create a matrix containing the pixel values of grayscaled image
+
+ if (d->imq.detectNoise)
+ {
+@@ -660,7 +660,7 @@ int ImgQSort::compressiondetector() cons
+ int countblocks = 0;
+ int number_of_blocks = 0;
+ int sum = 0;
+- vector<int> average_bottom, average_middle, average_top;
++ std::vector<int> average_bottom, average_middle, average_top;
+
+ // Go through 8 blocks at a time horizontally
+ // iterating through columns.
+@@ -797,7 +797,7 @@ int ImgQSort::compressiondetector() cons
+ int ImgQSort::exposureamount() const
+ {
+ /// Separate the image in 3 places ( B, G and R )
+- vector<Mat> bgr_planes;
++ std::vector<Mat> bgr_planes;
+ split(d->src, bgr_planes);
+
+ /// Establish the number of bins
+diff -up digikam-4.12.0/core/libs/database/imgqsort/imgqsort.h.opencv3 digikam-4.12.0/core/libs/database/imgqsort/imgqsort.h
+--- digikam-4.12.0/core/libs/database/imgqsort/imgqsort.h.opencv3 2015-08-18 17:17:54.923383497 +0200
++++ digikam-4.12.0/core/libs/database/imgqsort/imgqsort.h 2015-08-18 17:27:54.225449446 +0200
+@@ -25,6 +25,10 @@
+ #ifndef IMGQSORT_H
+ #define IMGQSORT_H
+
++// Global includes
++
++#include <vector>
++
+ // Local includes
+
+ #include "dimg.h"
+diff -up digikam-4.12.0/extra/kipi-plugins/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp.opencv3 digikam-4.12.0/extra/kipi-plugins/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp
+--- digikam-4.12.0/extra/kipi-plugins/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp.opencv3 2015-08-18 16:06:08.240514617 +0200
++++ digikam-4.12.0/extra/kipi-plugins/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp 2015-08-18 16:19:07.774476511 +0200
+@@ -89,6 +89,13 @@ const QString HaarClassifierLocator::Pri
+ const QString HaarClassifierLocator::Private::configClassifierEntry("Classifier");
+
+ // --------------------------------------------------------
++#if !(OPENCV_TEST_VERSION(2,5,0))
++static void cvFillImage( CvArr* mat, double color)
++{
++ cvSet( mat, cvColorToScalar(color, cvGetElemType(mat)), 0);
++}
++#endif
++
+
+ int HaarClassifierLocator::findPossibleEyes(double csf, int ngf, const char* classifierFile)
+ {
+diff -up digikam-4.12.0/extra/kipi-plugins/removeredeyes/plugin/libopencv.h.opencv3 digikam-4.12.0/extra/kipi-plugins/removeredeyes/plugin/libopencv.h
+--- digikam-4.12.0/extra/kipi-plugins/removeredeyes/plugin/libopencv.h.opencv3 2015-08-18 13:43:10.380772123 +0200
++++ digikam-4.12.0/extra/kipi-plugins/removeredeyes/plugin/libopencv.h 2015-08-18 14:18:27.999977347 +0200
+@@ -53,12 +53,13 @@
+
+ #define OPENCV_MAKE_VERSION(major,minor,patch) (((major) << 16) | ((minor) << 8) | (patch))
+ #define OPENCV_VERSION OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
+-#define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION >= OPENCV_MAKE_VERSION(major,minor,patch) )
++#define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION < OPENCV_MAKE_VERSION(major,minor,patch) )
+
+-#if OPENCV_TEST_VERSION(2,3,0)
++#include <opencv2/core/core_c.h>
++
++#if OPENCV_TEST_VERSION(2,5,0)
+ #include <opencv2/opencv.hpp>
+ #include <opencv2/highgui/highgui_c.h>
+-#include <opencv2/core/core_c.h>
+ #include <opencv2/legacy/compat.hpp>
+ #include <opencv/cvaux.h>
+ #else
+diff -up digikam-4.12.0/extra/kipi-plugins/removeredeyes/test/CMakeLists.txt.opencv3 digikam-4.12.0/extra/kipi-plugins/removeredeyes/test/CMakeLists.txt
+--- digikam-4.12.0/extra/kipi-plugins/removeredeyes/test/CMakeLists.txt.opencv3 2015-08-18 15:08:31.973733608 +0200
++++ digikam-4.12.0/extra/kipi-plugins/removeredeyes/test/CMakeLists.txt 2015-08-18 15:22:40.113991709 +0200
+@@ -4,7 +4,7 @@
+ # Redistribution and use is allowed according to the terms of the BSD license.
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+-if(NOT WIN32)
++if(NOT WIN32 AND (${OpenCV_VERSION} VERSION_LESS 3.0.0))
+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../plugin
+ ${CMAKE_CURRENT_SOURCE_DIR}/../libcvblobs
+