remove filepng little-endian, reactivate sift in opencv
authorGood Guy <[email protected]>
Wed, 25 Mar 2020 04:28:37 +0000 (22:28 -0600)
committerGood Guy <[email protected]>
Wed, 25 Mar 2020 04:28:37 +0000 (22:28 -0600)
cinelerra-5.1/cinelerra/filepng.C
cinelerra-5.1/opencv_build
cinelerra-5.1/plugins/findobj/findobj.h
cinelerra-5.1/thirdparty/src/opencv-20200306.tgz.patch1 [new file with mode: 0644]

index 4df95f1e3fa41dd7a163d202650cfd07c803f632..3b28e0eac5fa145ee8c99b7adc21cf4c9b688d6f 100644 (file)
@@ -228,9 +228,6 @@ int FilePNG::write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit)
                        png_set_IHDR(png_ptr, info_ptr, asset->width, asset->height, asset->png_depth,
                                asset->png_use_alpha ?  PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB,
                                PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
-// does not work (gg 2020/03/17 libpng16 fc31)
-                       if( asset->png_depth == 16 && BC_Resources::little_endian )
-                               png_set_swap(png_ptr);
                        png_write_info(png_ptr, info_ptr);
                        png_write_image(png_ptr, output_frame->get_rows());
                        png_write_end(png_ptr, info_ptr);
index fd029027d8303ac084fe81d37b5fc91405f88019..736e1d90290a09571dd6f019d2192e0799674e53 100644 (file)
@@ -64,6 +64,8 @@ $(srcdir)/$(opencv_tar):
 $(opencv).src: $(srcdir)/$(opencv_tar)
        cd $(blddir) && rm -rf opencv opencv_contrib opencv.*
        tar -C $(blddir) -xzf $(srcdir)/$(opencv_tar);
+       $(foreach pch,$(sort $(wildcard $(srcdir)/$(opencv_tar).patch*)),\
+               patch -d $(blddir) -p1 < $(pch);)
        touch $@
 else
 $(error src not git/tar)
@@ -88,7 +90,7 @@ $(opencv)/build: $(opencv).src
 LFLAGS += -Wl,--start-group
 LFLAGS += $(shell find $(opencv_prefix)/lib* -name "libopencv_*.a" 2> /dev/null)
 #opencv4 breaks SIFT/SURF findobj
-LFLAGS += $(shell find $(opencv_prefix)/lib64/opencv4/3rdparty/lib* -name "lib*.a" 2> /dev/null)
+LFLAGS += $(shell find $(opencv_prefix)/lib*/opencv4/3rdparty/lib* -name "lib*.a" 2> /dev/null)
 LFLAGS += $(shell find $(opencv_prefix)/share/OpenCV/3rdparty/lib* -name "lib*.a" 2> /dev/null)
 LFLAGS += -Wl,--end-group
 else ifeq ($(bld),dyn)
index 2f4f45b2086c1628c43525f7e7b8e8a0f5c65d78..2bea44af050f53b1822d72b1d873f94a5db405ba 100644 (file)
@@ -64,8 +64,8 @@ using namespace cv::xfeatures2d;
 using namespace cvflann;
 
 // enabled detectors
-// _SIFT/_SURF are broken in v4, although they work in v3, no upgrade
-//#define _SIFT
+#define _SIFT
+// _SURF broken in v4, although works in v3 (patented)
 //#define _SURF
 #define _ORB
 #define _AKAZE
diff --git a/cinelerra-5.1/thirdparty/src/opencv-20200306.tgz.patch1 b/cinelerra-5.1/thirdparty/src/opencv-20200306.tgz.patch1
new file mode 100644 (file)
index 0000000..7bcbe60
--- /dev/null
@@ -0,0 +1,159 @@
+diff -ruN a/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp b/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp
+--- a/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp       2019-12-19 04:02:03.000000000 -0700
++++ b/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp       2020-03-24 17:09:02.143528875 -0600
+@@ -50,40 +50,6 @@
+ namespace xfeatures2d
+ {
+-//! @addtogroup xfeatures2d_nonfree
+-//! @{
+-
+-/** @brief Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform
+-(SIFT) algorithm by D. Lowe @cite Lowe04 .
+- */
+-class CV_EXPORTS_W SIFT : public Feature2D
+-{
+-public:
+-    /**
+-    @param nfeatures The number of best features to retain. The features are ranked by their scores
+-    (measured in SIFT algorithm as the local contrast)
+-
+-    @param nOctaveLayers The number of layers in each octave. 3 is the value used in D. Lowe paper. The
+-    number of octaves is computed automatically from the image resolution.
+-
+-    @param contrastThreshold The contrast threshold used to filter out weak features in semi-uniform
+-    (low-contrast) regions. The larger the threshold, the less features are produced by the detector.
+-
+-    @param edgeThreshold The threshold used to filter out edge-like features. Note that the its meaning
+-    is different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are
+-    filtered out (more features are retained).
+-
+-    @param sigma The sigma of the Gaussian applied to the input image at the octave \#0. If your image
+-    is captured with a weak camera with soft lenses, you might want to reduce the number.
+-     */
+-    CV_WRAP static Ptr<SIFT> create( int nfeatures = 0, int nOctaveLayers = 3,
+-                                    double contrastThreshold = 0.04, double edgeThreshold = 10,
+-                                    double sigma = 1.6);
+-};
+-
+-typedef SIFT SiftFeatureDetector;
+-typedef SIFT SiftDescriptorExtractor;
+-
+ /** @brief Class for extracting Speeded Up Robust Features from an image @cite Bay06 .
+ The algorithm parameters:
+diff -ruN a/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp b/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
+--- a/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp       2019-12-19 04:02:03.000000000 -0700
++++ b/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp       2020-03-24 17:09:02.143528875 -0600
+@@ -67,6 +67,39 @@
+ namespace xfeatures2d
+ {
++
++/** @brief Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform
++(SIFT) algorithm by D. Lowe @cite Lowe04 .
++*/
++class CV_EXPORTS_W SIFT : public Feature2D
++{
++public:
++    /**
++    @param nfeatures The number of best features to retain. The features are ranked by their scores
++    (measured in SIFT algorithm as the local contrast)
++
++    @param nOctaveLayers The number of layers in each octave. 3 is the value used in D. Lowe paper. The
++    number of octaves is computed automatically from the image resolution.
++
++    @param contrastThreshold The contrast threshold used to filter out weak features in semi-uniform
++    (low-contrast) regions. The larger the threshold, the less features are produced by the detector.
++
++    @param edgeThreshold The threshold used to filter out edge-like features. Note that the its meaning
++    is different from the contrastThreshold, i.e. the larger the edgeThreshold, the less features are
++    filtered out (more features are retained).
++
++    @param sigma The sigma of the Gaussian applied to the input image at the octave \#0. If your image
++    is captured with a weak camera with soft lenses, you might want to reduce the number.
++    */
++    CV_WRAP static Ptr<SIFT> create(int nfeatures = 0, int nOctaveLayers = 3,
++        double contrastThreshold = 0.04, double edgeThreshold = 10,
++        double sigma = 1.6);
++};
++
++typedef SIFT SiftFeatureDetector;
++typedef SIFT SiftDescriptorExtractor;
++
++
+ //! @addtogroup xfeatures2d_experiment
+ //! @{
+diff -ruN a/opencv_contrib/modules/xfeatures2d/src/sift.cpp b/opencv_contrib/modules/xfeatures2d/src/sift.cpp
+--- a/opencv_contrib/modules/xfeatures2d/src/sift.cpp  2019-12-19 04:02:03.000000000 -0700
++++ b/opencv_contrib/modules/xfeatures2d/src/sift.cpp  2020-03-24 17:09:07.164676799 -0600
+@@ -114,8 +114,6 @@
+ namespace xfeatures2d
+ {
+-#ifdef OPENCV_ENABLE_NONFREE
+-
+ /*!
+  SIFT implementation.
+@@ -1202,14 +1200,5 @@
+     }
+ }
+-#else // ! #ifdef OPENCV_ENABLE_NONFREE
+-Ptr<SIFT> SIFT::create( int, int, double, double, double )
+-{
+-    CV_Error(Error::StsNotImplemented,
+-        "This algorithm is patented and is excluded in this configuration; "
+-        "Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library");
+-}
+-#endif
+-
+ }
+ }
+diff -ruN a/opencv_contrib/modules/xfeatures2d/test/test_features2d.cpp b/opencv_contrib/modules/xfeatures2d/test/test_features2d.cpp
+--- a/opencv_contrib/modules/xfeatures2d/test/test_features2d.cpp      2019-12-19 04:02:03.000000000 -0700
++++ b/opencv_contrib/modules/xfeatures2d/test/test_features2d.cpp      2020-03-24 17:09:07.165676829 -0600
+@@ -94,7 +94,6 @@
+ /*
+  * Descriptors
+  */
+-#ifdef OPENCV_ENABLE_NONFREE
+ TEST( Features2d_DescriptorExtractor_SIFT, regression )
+ {
+     CV_DescriptorExtractorTest<L1<float> > test( "descriptor-sift", 1.0f,
+@@ -102,6 +101,7 @@
+     test.safe_run();
+ }
++#ifdef OPENCV_ENABLE_NONFREE
+ TEST( Features2d_DescriptorExtractor_SURF, regression )
+ {
+ #ifdef HAVE_OPENCL
+@@ -375,8 +375,9 @@
+     Ptr<Feature2D> f2d;
+ };
+-#ifdef OPENCV_ENABLE_NONFREE
+ TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80, SIFT::create()); test.safe_run(); }
++
++#ifdef OPENCV_ENABLE_NONFREE
+ TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80, SURF::create()); test.safe_run(); }
+ #endif
+@@ -441,13 +442,13 @@
+     Ptr<FeatureDetector> featureDetector_;
+ };
+-#ifdef OPENCV_ENABLE_NONFREE
+ TEST(Features2d_SIFT_using_mask, regression)
+ {
+     FeatureDetectorUsingMaskTest test(SIFT::create());
+     test.safe_run();
+ }
++#ifdef OPENCV_ENABLE_NONFREE
+ TEST(DISABLED_Features2d_SURF_using_mask, regression)
+ {
+     FeatureDetectorUsingMaskTest test(SURF::create());