mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 19:44:14 +08:00
Merge pull request #2349 from alalek:fix_contrib_2346
This commit is contained in:
@@ -37,16 +37,24 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
|
#include "precomp.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "precomp.hpp"
|
|
||||||
|
|
||||||
#include "advanced_types.hpp"
|
#include "advanced_types.hpp"
|
||||||
|
|
||||||
|
#ifdef CV_CXX11
|
||||||
|
#define CV_USE_PARALLEL_PREDICT_EDGES_1 1
|
||||||
|
#define CV_USE_PARALLEL_PREDICT_EDGES_2 0 //1, see https://github.com/opencv/opencv_contrib/issues/2346
|
||||||
|
#else
|
||||||
|
#define CV_USE_PARALLEL_PREDICT_EDGES_1 0
|
||||||
|
#define CV_USE_PARALLEL_PREDICT_EDGES_2 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/********************* Helper functions *********************/
|
/********************* Helper functions *********************/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -730,7 +738,7 @@ protected:
|
|||||||
}
|
}
|
||||||
// lookup tables for mapping linear index to offset pairs
|
// lookup tables for mapping linear index to offset pairs
|
||||||
|
|
||||||
#ifdef CV_CXX11
|
#if CV_USE_PARALLEL_PREDICT_EDGES_1
|
||||||
parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
|
parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
|
||||||
#else
|
#else
|
||||||
const cv::Range range(0, height);
|
const cv::Range range(0, height);
|
||||||
@@ -779,7 +787,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CV_CXX11
|
#if CV_USE_PARALLEL_PREDICT_EDGES_1
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -788,8 +796,10 @@ protected:
|
|||||||
dstM.setTo(0);
|
dstM.setTo(0);
|
||||||
|
|
||||||
float step = 2.0f * CV_SQR(stride) / CV_SQR(ipSize) / nTreesEval;
|
float step = 2.0f * CV_SQR(stride) / CV_SQR(ipSize) / nTreesEval;
|
||||||
#ifdef CV_CXX11
|
#if CV_USE_PARALLEL_PREDICT_EDGES_2
|
||||||
parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
|
parallel_for_(cv::Range(0, height), [&](const cv::Range& range)
|
||||||
|
#elif CV_USE_PARALLEL_PREDICT_EDGES_1
|
||||||
|
const cv::Range range(0, height);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
for(int i = range.start; i < range.end; ++i)
|
for(int i = range.start; i < range.end; ++i)
|
||||||
@@ -814,7 +824,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CV_CXX11
|
#if CV_USE_PARALLEL_PREDICT_EDGES_2
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace opencv_test { namespace {
|
namespace opencv_test { namespace {
|
||||||
|
|
||||||
TEST(ximpgroc_Edgeboxes, regression)
|
TEST(ximgproc_Edgeboxes, regression)
|
||||||
{
|
{
|
||||||
//Testing Edgeboxes implementation by asking for one proposal
|
//Testing Edgeboxes implementation by asking for one proposal
|
||||||
//on a simple test image from the PASCAL VOC 2012 dataset.
|
//on a simple test image from the PASCAL VOC 2012 dataset.
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace opencv_test { namespace {
|
namespace opencv_test { namespace {
|
||||||
|
|
||||||
TEST(ximpgroc_StructuredEdgeDetection, regression)
|
TEST(ximgproc_StructuredEdgeDetection, regression)
|
||||||
{
|
{
|
||||||
cv::String subfolder = "cv/ximgproc/";
|
cv::String subfolder = "cv/ximgproc/";
|
||||||
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder;
|
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder;
|
||||||
|
@@ -18,7 +18,7 @@ static int createTestImage(Mat& src)
|
|||||||
return src_pixels;
|
return src_pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ximpgroc_Thinning, simple_ZHANGSUEN)
|
TEST(ximgproc_Thinning, simple_ZHANGSUEN)
|
||||||
{
|
{
|
||||||
Mat src;
|
Mat src;
|
||||||
int src_pixels = createTestImage(src);
|
int src_pixels = createTestImage(src);
|
||||||
@@ -33,7 +33,7 @@ TEST(ximpgroc_Thinning, simple_ZHANGSUEN)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ximpgroc_Thinning, simple_GUOHALL)
|
TEST(ximgproc_Thinning, simple_GUOHALL)
|
||||||
{
|
{
|
||||||
Mat src;
|
Mat src;
|
||||||
int src_pixels = createTestImage(src);
|
int src_pixels = createTestImage(src);
|
||||||
|
@@ -103,7 +103,7 @@ Training pipeline
|
|||||||
|
|
||||||
-# The final step is converting trained model from Matlab binary format to YAML which you can use
|
-# The final step is converting trained model from Matlab binary format to YAML which you can use
|
||||||
with our ocv::StructuredEdgeDetection. For this purpose run
|
with our ocv::StructuredEdgeDetection. For this purpose run
|
||||||
opencv_contrib/ximpgroc/tutorials/scripts/modelConvert(model, "model.yml")
|
opencv_contrib/ximgproc/tutorials/scripts/modelConvert(model, "model.yml")
|
||||||
|
|
||||||
How to use your model
|
How to use your model
|
||||||
---------------------
|
---------------------
|
||||||
|
Reference in New Issue
Block a user