diff --git a/modules/ximgproc/CMakeLists.txt b/modules/ximgproc/CMakeLists.txt index c984652afd0..b2a33f3c345 100644 --- a/modules/ximgproc/CMakeLists.txt +++ b/modules/ximgproc/CMakeLists.txt @@ -1,2 +1,2 @@ set(the_description "Extended image processing module. It includes edge-aware filters and etc.") -ocv_define_module(ximgproc opencv_core opencv_imgproc opencv_calib3d opencv_imgcodecs opencv_video WRAP python java objc js) +ocv_define_module(ximgproc opencv_core opencv_imgproc opencv_calib3d opencv_video OPTIONAL opencv_imgcodecs WRAP python java objc js) diff --git a/modules/ximgproc/src/disparity_filters.cpp b/modules/ximgproc/src/disparity_filters.cpp index 505fde6b8d1..e8efccddcee 100644 --- a/modules/ximgproc/src/disparity_filters.cpp +++ b/modules/ximgproc/src/disparity_filters.cpp @@ -36,10 +36,13 @@ #include "precomp.hpp" #include "opencv2/ximgproc/disparity_filter.hpp" -#include "opencv2/imgcodecs.hpp" #include #include +#ifdef HAVE_OPENCV_IMGCODECS +# include "opencv2/imgcodecs.hpp" +#endif + namespace cv { namespace ximgproc { @@ -492,8 +495,9 @@ Ptr createDisparityWLSFilterGeneric(bool use_confidence) #define UNKNOWN_DISPARITY 16320 -int readGT(String src_path,OutputArray dst) +int readGT(String src_path, OutputArray dst) { +#ifdef HAVE_OPENCV_IMGCODECS Mat src = imread(src_path,IMREAD_UNCHANGED); dst.create(src.rows,src.cols,CV_16S); Mat& dstMat = dst.getMatRef(); @@ -525,6 +529,9 @@ int readGT(String src_path,OutputArray dst) } else return 1; +#else + CV_Error(Error::StsNotImplemented, "The requested function/feature is not implemented"); +#endif } double computeMSE(InputArray GT, InputArray src, Rect ROI)