Commit 7d7312a9 authored by Alexander Alekhin's avatar Alexander Alekhin
Browse files

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 3e9ebc4b 94d1b9bc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -555,8 +555,8 @@ private:
        plane = Ptr<PlaneBase>(new PlaneABC(plane_grid.m_(y, x), n, (int)index_plane,
			(float)sensor_error_a_, (float)sensor_error_b_, (float)sensor_error_c_));

      Mat_<unsigned char> plane_mask = Mat_<unsigned char>::zeros(points3d.rows / block_size_,
                                                                          points3d.cols / block_size_);
      Mat_<unsigned char> plane_mask = Mat_<unsigned char>::zeros(divUp(points3d.rows, block_size_),
                                                                  divUp(points3d.cols, block_size_));
      std::set<TileQueue::PlaneTile> neighboring_tiles;
      neighboring_tiles.insert(front_tile);
      plane_queue.remove(front_tile.y_, front_tile.x_);
+11 −0
Original line number Diff line number Diff line
@@ -441,4 +441,15 @@ TEST(Rgbd_Plane, compute)
  test.safe_run();
}

TEST(Rgbd_Plane, regression_2309_valgrind_check)
{
    Mat points(640, 480, CV_32FC3, Scalar::all(0));
    rgbd::RgbdPlane plane_detector;
    plane_detector.setBlockSize(9);  // Note, 640%9 is 1 and 480%9 is 3

    Mat mask;
    std::vector<cv::Vec4f> planes;
    plane_detector(points, mask, planes);  // Will corrupt memory; valgrind gets triggered
}

}} // namespace
+17 −14
Original line number Diff line number Diff line
@@ -29,26 +29,29 @@ protected:
    {
        for(int k = 0; k < nbrTextBoxes; k++)
        {
            float x_min = buffer[k*nCol + 3]*inputShape.width;
            float y_min = buffer[k*nCol + 4]*inputShape.height;
            float confidence_ = buffer[k*nCol + 2];
            if (confidence_ <= FLT_EPSILON) continue;

            float x_max = buffer[k*nCol + 5]*inputShape.width;
            float y_max = buffer[k*nCol + 6]*inputShape.height;
            float x_min_f = buffer[k*nCol + 3]*inputShape.width;
            float y_min_f = buffer[k*nCol + 4]*inputShape.height;

            CV_CheckLT(x_min, x_max, "");
            CV_CheckLT(y_min, y_max, "");
            float x_max_f = buffer[k*nCol + 5]*inputShape.width;
            float y_max_f = buffer[k*nCol + 6]*inputShape.height;

            x_min = std::max(0.f, x_min);
            y_min = std::max(0.f, y_min);
            int x_min = cvRound(std::max(0.f, x_min_f));
            int y_min = cvRound(std::max(0.f, y_min_f));

            x_max = std::min(inputShape.width - 1.f,  x_max);
            y_max = std::min(inputShape.height - 1.f,  y_max);
            int x_max = std::min(inputShape.width - 1,  cvRound(x_max_f));
            int y_max = std::min(inputShape.height - 1,  cvRound(y_max_f));

            int wd = cvRound(x_max - x_min);
            int ht = cvRound(y_max - y_min);
            if (x_min >= x_max) continue;
            if (y_min >= y_max) continue;

            Bbox.push_back(Rect(cvRound(x_min), cvRound(y_min), wd, ht));
            confidence.push_back(buffer[k*nCol + 2]);
            int wd = x_max - x_min;
            int ht = y_max - y_min;

            Bbox.push_back(Rect(x_min, y_min, wd, ht));
            confidence.push_back(confidence_);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -107,6 +107,8 @@
#include <stdarg.h>
#include <opencv2/core/hal/hal.hpp>

#include <opencv2/core/utils/tls.hpp>

namespace cv
{
namespace xfeatures2d
@@ -709,7 +711,7 @@ void SIFT_Impl::findScaleSpaceExtrema( const std::vector<Mat>& gauss_pyr, const
    const int threshold = cvFloor(0.5 * contrastThreshold / nOctaveLayers * 255 * SIFT_FIXPT_SCALE);

    keypoints.clear();
    TLSData<std::vector<KeyPoint> > tls_kpts_struct;
    TLSDataAccumulator<std::vector<KeyPoint> > tls_kpts_struct;

    for( int o = 0; o < nOctaves; o++ )
        for( int i = 1; i <= nOctaveLayers; i++ )