mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-16 22:35:51 +08:00
added namespace ximgproc
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#ifndef __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__
|
#ifndef __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__
|
||||||
#define __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__
|
#define __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* structured_edge_detection.hpp
|
* structured_edge_detection.hpp
|
||||||
@@ -57,7 +58,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
namespace ximgproc
|
||||||
|
{
|
||||||
/*! \class RFFeatureGetter
|
/*! \class RFFeatureGetter
|
||||||
Helper class for training part of [P. Dollar and C. L. Zitnick. Structured Forests for Fast Edge Detection, 2013].
|
Helper class for training part of [P. Dollar and C. L. Zitnick. Structured Forests for Fast Edge Detection, 2013].
|
||||||
*/
|
*/
|
||||||
@@ -120,5 +122,6 @@ CV_EXPORTS_W Ptr<StructuredEdgeDetection> createStructuredEdgeDetection(const St
|
|||||||
const RFFeatureGetter *howToGetFeatures = NULL);
|
const RFFeatureGetter *howToGetFeatures = NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif /* __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__ */
|
#endif /* __OPENCV_STRUCTURED_EDGE_DETECTION_HPP__ */
|
@@ -1,10 +1,9 @@
|
|||||||
#include "opencv2/ximpgroc/structured_edge_detection.hpp"
|
#include <opencv2/ximgproc.hpp>
|
||||||
|
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
#include "opencv2/highgui.hpp"
|
#include "opencv2/highgui.hpp"
|
||||||
|
|
||||||
#include "opencv2/core/utility.hpp"
|
#include "opencv2/core/utility.hpp"
|
||||||
#include "opencv2/imgproc/types_c.h"
|
|
||||||
|
using namespace cv;
|
||||||
|
using namespace cv::ximgproc;
|
||||||
|
|
||||||
const char* keys =
|
const char* keys =
|
||||||
{
|
{
|
||||||
@@ -49,8 +48,8 @@ int main( int argc, const char** argv )
|
|||||||
|
|
||||||
cv::Mat edges(image.size(), image.type());
|
cv::Mat edges(image.size(), image.type());
|
||||||
|
|
||||||
cv::Ptr<cv::StructuredEdgeDetection> pDollar =
|
cv::Ptr<StructuredEdgeDetection> pDollar =
|
||||||
cv::createStructuredEdgeDetection(modelFilename);
|
createStructuredEdgeDetection(modelFilename);
|
||||||
pDollar->detectEdges(image, edges);
|
pDollar->detectEdges(image, edges);
|
||||||
|
|
||||||
if ( outFilename == "" )
|
if ( outFilename == "" )
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#ifndef __ADVANCED_TYPES_HPP__
|
#ifndef __ADVANCED_TYPES_HPP__
|
||||||
#define __ADVANCED_TYPES_HPP__
|
#define __ADVANCED_TYPES_HPP__
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <opencv2/core.hpp>
|
#include <opencv2/core.hpp>
|
||||||
|
|
||||||
@@ -69,6 +70,8 @@ typedef cv::Mat NChannelsMat;
|
|||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
namespace ximgproc
|
||||||
|
{
|
||||||
|
|
||||||
template <typename _Tp, typename _Tp2> inline
|
template <typename _Tp, typename _Tp2> inline
|
||||||
cv::Size_<_Tp> operator * (const _Tp2 &x, const cv::Size_<_Tp> &sz)
|
cv::Size_<_Tp> operator * (const _Tp2 &x, const cv::Size_<_Tp> &sz)
|
||||||
@@ -83,5 +86,6 @@ template <typename _Tp, typename _Tp2> inline
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // cv
|
} // cv
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif /* __ADVANCED_TYPES_HPP__ */
|
#endif /* __ADVANCED_TYPES_HPP__ */
|
@@ -43,17 +43,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "opencv2/ximpgroc/structured_edge_detection.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
#include "opencv2/imgproc.hpp"
|
|
||||||
|
|
||||||
#include "opencv2/core.hpp"
|
|
||||||
#include "opencv2/core/core_c.h"
|
|
||||||
|
|
||||||
#include "advanced_types.hpp"
|
#include "advanced_types.hpp"
|
||||||
#include "opencv2/core/types.hpp"
|
|
||||||
#include "opencv2/core/types_c.h"
|
|
||||||
|
|
||||||
|
|
||||||
/********************* Helper functions *********************/
|
/********************* Helper functions *********************/
|
||||||
|
|
||||||
@@ -196,7 +188,7 @@ static void gradientHist(const cv::Mat &src, cv::Mat &magnitude, cv::Mat &histog
|
|||||||
|
|
||||||
magnitude.create( src.size(), cv::DataType<float>::type );
|
magnitude.create( src.size(), cv::DataType<float>::type );
|
||||||
phase.create( src.size(), cv::DataType<float>::type );
|
phase.create( src.size(), cv::DataType<float>::type );
|
||||||
histogram.create( src.size()/float(pSize),
|
histogram.create( cv::Size(src.size().width/float(pSize), src.size().height/float(pSize)) ,
|
||||||
CV_MAKETYPE(cv::DataType<float>::type, nBins) );
|
CV_MAKETYPE(cv::DataType<float>::type, nBins) );
|
||||||
|
|
||||||
histogram.setTo(0);
|
histogram.setTo(0);
|
||||||
@@ -258,6 +250,8 @@ static void gradientHist(const cv::Mat &src, cv::Mat &magnitude, cv::Mat &histog
|
|||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
namespace ximgproc
|
||||||
|
{
|
||||||
|
|
||||||
class RFFeatureGetterImpl : public RFFeatureGetter
|
class RFFeatureGetterImpl : public RFFeatureGetter
|
||||||
{
|
{
|
||||||
@@ -325,12 +319,15 @@ Ptr<RFFeatureGetter> createRFFeatureGetter()
|
|||||||
return makePtr<RFFeatureGetterImpl>();
|
return makePtr<RFFeatureGetterImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********************* StructuredEdgeDetection class *********************/
|
/********************* StructuredEdgeDetection class *********************/
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
namespace ximgproc
|
||||||
|
{
|
||||||
|
|
||||||
class StructuredEdgeDetectionImpl : public StructuredEdgeDetection
|
class StructuredEdgeDetectionImpl : public StructuredEdgeDetection
|
||||||
{
|
{
|
||||||
@@ -692,3 +689,4 @@ Ptr<StructuredEdgeDetection> createStructuredEdgeDetection(const String &model,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -10,8 +10,8 @@ TEST(ximpgroc_StructuredEdgeDetection, regression)
|
|||||||
float threshold = 0.01f;
|
float threshold = 0.01f;
|
||||||
|
|
||||||
cv::String modelName = dir + "model.yml.gz";
|
cv::String modelName = dir + "model.yml.gz";
|
||||||
cv::Ptr<cv::StructuredEdgeDetection> pDollar =
|
cv::Ptr<cv::ximgproc::StructuredEdgeDetection> pDollar =
|
||||||
cv::createStructuredEdgeDetection(modelName);
|
cv::ximgproc::createStructuredEdgeDetection(modelName);
|
||||||
|
|
||||||
for (int i = 0; i < nTests; ++i)
|
for (int i = 0; i < nTests; ++i)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user