Comparar commits
220 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| d8a4d3a2eb | |||
| 3e1586a1c6 | |||
| fa2cd93ecf | |||
| 11c7053b0f | |||
| 8752414718 | |||
| 3509018bd6 | |||
| 1966e7cea9 | |||
| 2b31055914 | |||
| b5dbe9e04b | |||
| c962a9d61c | |||
| adb2040980 | |||
| 14ee306b9e | |||
| df136339ff | |||
| bd9d3dd561 | |||
| 9ce9fc3361 | |||
| 3ff1620086 | |||
| 8db6d9f9b2 | |||
| 368bac7af6 | |||
| 19ceab13f2 | |||
| 790f53f12a | |||
| f7f194e5dd | |||
| eab7603096 | |||
| 838961a289 | |||
| fb568755a1 | |||
| 0bbd768d9d | |||
| f20af817d4 | |||
| 34a390fbc2 | |||
| 059bf1d9e5 | |||
| 773616ee04 | |||
| 429ab8ebee | |||
| d39e73365c | |||
| f8801cfdb8 | |||
| fc1d38ced8 | |||
| a13db7c8fa | |||
| 6b09345232 | |||
| 41154b30de | |||
| 5ac8444c22 | |||
| 70c1b700d9 | |||
| 19b88a17bf | |||
| 81acc5e73e | |||
| 26cb0ce1d5 | |||
| 20641b4a0b | |||
| 51663f5612 | |||
| 2cfd635e9e | |||
| 7537521f53 | |||
| 7c43daccba | |||
| 38904c9a11 | |||
| 094d7c4926 | |||
| 37a754621a | |||
| bef34093aa | |||
| d5ead208b7 | |||
| 935f973575 | |||
| 7539156109 | |||
| a4239f972b | |||
| 10aec14a4d | |||
| 1253c2101b | |||
| 8fe4ab280b | |||
| dda3b534ad | |||
| 1c025be068 | |||
| 514f1fae95 | |||
| 8a2de2ecca | |||
| d45ce086c1 | |||
| 6f892b10ff | |||
| 16a11cfb27 | |||
| 1b0297d92b | |||
| 75fba08042 | |||
| 4c5593b633 | |||
| 06f6f74e61 | |||
| 59aa516ca5 | |||
| 0537747f79 | |||
| ddc9be9170 | |||
| fbc91c5ee9 | |||
| 901dc3b878 | |||
| a19cc6cb64 | |||
| 514e97223c | |||
| d650efc069 | |||
| 96a4a7b339 | |||
| bd314bf955 | |||
| 2427c03625 | |||
| 7a8bd31657 | |||
| fd759223fa | |||
| 923698d700 | |||
| 8a4f35704a | |||
| 2509b7954e | |||
| d764af5318 | |||
| 6b23cb5b02 | |||
| b8f5fcf3f9 | |||
| 623a02c69f | |||
| c1541c9e79 | |||
| 70a4de20d7 | |||
| 9631cb6de9 | |||
| f6283432ff | |||
| 8ac3ddf421 | |||
| 60b59eeb73 | |||
| cf00349b5b | |||
| b8283edfca | |||
| b197ec9413 | |||
| 78e16a906b | |||
| 4037a4f227 | |||
| e69d2c1bb1 | |||
| 5c77784ac9 | |||
| 0a90a36a1f | |||
| c47190ef90 | |||
| 198cd1a40d | |||
| 4746a710bb | |||
| 3e55d705cc | |||
| 56f791679b | |||
| 68d1110cde | |||
| e08b075db0 | |||
| 66221a32b9 | |||
| c0456df611 | |||
| 85f92fabbd | |||
| 239704f986 | |||
| 7973594a01 | |||
| f70d63e4c9 | |||
| 26d3a1a036 | |||
| 04d293d2c4 | |||
| cdf4e4e0b5 | |||
| e3f450cffb | |||
| 8b99a1e850 | |||
| 7703b63cae | |||
| 4fd1960425 | |||
| 3f927abb4d | |||
| 83cefcb92a | |||
| 327d9f274b | |||
| 0e1717c14c | |||
| f5ded41016 | |||
| 2b106db02f | |||
| 13bb236ad5 | |||
| 8f6f9c3e58 | |||
| 0a698bf145 | |||
| cc237b7aba | |||
| f95ff0a352 | |||
| 4e2ec7b97d | |||
| 2e79dde357 | |||
| cebf109d39 | |||
| 428fb72625 | |||
| 3b7acf2657 | |||
| 01f8645bc8 | |||
| be88b20154 | |||
| 84da6ca265 | |||
| 19b3064706 | |||
| 8e944cfe70 | |||
| fe76b2116a | |||
| b8de81749c | |||
| 1b7c5b201d | |||
| 98915e06bc | |||
| 3bdd9626f3 | |||
| 15f4292a1f | |||
| ee7c74ceeb | |||
| af7c614438 | |||
| 411629a57d | |||
| 54ea5bbac7 | |||
| 28e0d3d771 | |||
| 9007a02302 | |||
| fb326a58fc | |||
| f1873bbca1 | |||
| 6770c04073 | |||
| c38e4f9639 | |||
| 376993be4c | |||
| df6bce372b | |||
| 185059959b | |||
| 1e2fb6de30 | |||
| 3314bc94b6 | |||
| 0bf7350615 | |||
| f02ce90559 | |||
| b8e3d3f791 | |||
| 96121a66c5 | |||
| a81efdbb25 | |||
| d6e0ef2710 | |||
| dee584ee15 | |||
| 834705490e | |||
| ef4eadd5d3 | |||
| 46e423d217 | |||
| 6773914144 | |||
| 8af626d295 | |||
| eda6360fa3 | |||
| 93120775cd | |||
| 405227d531 | |||
| daedc6f454 | |||
| eff53e95f9 | |||
| 3727168b50 | |||
| e4dee5b372 | |||
| 1f421fce01 | |||
| 05d9375759 | |||
| 73b34e3f85 | |||
| 50579d2524 | |||
| 5beb887247 | |||
| 3cc9502c90 | |||
| 8b0fc04d93 | |||
| 581a3e444d | |||
| 5e02b20482 | |||
| 33ae64201c | |||
| a57030a0cd | |||
| eba6754b06 | |||
| 8b57893e40 | |||
| 4248f82211 | |||
| 0ac61240c5 | |||
| 5852a913a8 | |||
| 800d53f76b | |||
| 0be2752366 | |||
| 0fb629915f | |||
| 9a0d06247a | |||
| 760b718981 | |||
| 99a00d3dd9 | |||
| befcbf56fe | |||
| f0de1a08b8 | |||
| 07db81a4bb | |||
| 2c38be079e | |||
| e9edfd1c54 | |||
| 641bb7ac6b | |||
| c88fa27b1d | |||
| 114579c33b | |||
| fa15769f39 | |||
| 56d943388d | |||
| 5304e9f259 | |||
| 0b1df62215 | |||
| 3b0108e4c1 | |||
| e1b2f593d6 | |||
| d57a7008f1 |
@@ -4,6 +4,5 @@
|
||||
.*.swp
|
||||
.DS_Store
|
||||
.sw[a-z]
|
||||
/modules/refman.rst
|
||||
tags
|
||||
tegra/
|
||||
|
||||
externo
+1
-1
@@ -1,2 +1,2 @@
|
||||
set path=c:\dev\msys32\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -liconv -lws2_32
|
||||
set path=c:\dev\msys32\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lws2_32
|
||||
set path=c:\dev\msys64\bin;%path% & gcc -m64 -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lws2_32
|
||||
BIN
Arquivo binário não exibido.
+2
-2
@@ -92,7 +92,7 @@ extern "C" {
|
||||
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated))
|
||||
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
|
||||
#endif
|
||||
#elif _WIN32
|
||||
#elif defined(_WIN32)
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
|
||||
#define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
|
||||
#define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
|
||||
@@ -454,7 +454,7 @@ typedef unsigned int cl_GLenum;
|
||||
/* Define alignment keys */
|
||||
#if defined( __GNUC__ )
|
||||
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
|
||||
#elif defined( _WIN32) && (_MSC_VER)
|
||||
#elif defined( _WIN32) && defined(_MSC_VER)
|
||||
/* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
|
||||
/* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
|
||||
/* #include <crtdefs.h> */
|
||||
|
||||
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
@@ -42,6 +42,7 @@
|
||||
#include <ImfRgbaFile.h>
|
||||
#include <ImfStandardAttributes.h>
|
||||
#include <Iex.h>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
using namespace std;
|
||||
using namespace Imath;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Iex.h"
|
||||
#include <ImfMisc.h>
|
||||
#include <ImfChannelList.h>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <map>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "ImathMatrixAlgo.h"
|
||||
#include <cmath>
|
||||
#include <algorithm> // for std::max()
|
||||
|
||||
#if defined(OPENEXR_DLL)
|
||||
#define EXPORT_CONST __declspec(dllexport)
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
diff --git a/3rdparty/openexr/IlmImf/ImfAcesFile.cpp b/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
|
||||
index de4bf83..9418b9d 100644
|
||||
--- a/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
|
||||
+++ b/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <ImfRgbaFile.h>
|
||||
#include <ImfStandardAttributes.h>
|
||||
#include <Iex.h>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
using namespace std;
|
||||
using namespace Imath;
|
||||
diff --git a/3rdparty/openexr/IlmImf/ImfOutputFile.cpp b/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
|
||||
index 8831ec9..e69b92b 100644
|
||||
--- a/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
|
||||
+++ b/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
diff --git a/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp b/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
|
||||
index f7a12a3..5d8b522 100644
|
||||
--- a/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
|
||||
+++ b/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
diff --git a/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp b/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
|
||||
index 57f52f1..9588e78 100644
|
||||
--- a/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
|
||||
+++ b/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Iex.h"
|
||||
#include <ImfMisc.h>
|
||||
#include <ImfChannelList.h>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
diff --git a/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp b/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
|
||||
index 0882106..0bc3cb3 100644
|
||||
--- a/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
|
||||
+++ b/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <map>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
|
||||
namespace Imf {
|
||||
diff --git a/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp b/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
|
||||
index f0d2ed6..7ddc649 100644
|
||||
--- a/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
|
||||
+++ b/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "ImathMatrixAlgo.h"
|
||||
#include <cmath>
|
||||
+#include <algorithm> // for std::max()
|
||||
|
||||
#if defined(OPENEXR_DLL)
|
||||
#define EXPORT_CONST __declspec(dllexport)
|
||||
+4
-4
@@ -127,9 +127,9 @@ endif()
|
||||
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
|
||||
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
|
||||
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON)
|
||||
OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 )
|
||||
@@ -160,7 +160,7 @@ OCV_OPTION(WITH_DSHOW "Build HighGUI with DirectShow support" ON
|
||||
OCV_OPTION(WITH_MSMF "Build HighGUI with Media Foundation support" OFF IF WIN32 )
|
||||
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "HOGfeatures.h"
|
||||
#include "cascadeclassifier.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
CvHOGFeatureParams::CvHOGFeatureParams()
|
||||
{
|
||||
|
||||
@@ -20,33 +20,33 @@ class CvHOGEvaluator : public CvFeatureEvaluator
|
||||
public:
|
||||
virtual ~CvHOGEvaluator() {}
|
||||
virtual void init(const CvFeatureParams *_featureParams,
|
||||
int _maxSampleCount, Size _winSize );
|
||||
virtual void setImage(const Mat& img, uchar clsLabel, int idx);
|
||||
int _maxSampleCount, cv::Size _winSize );
|
||||
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx);
|
||||
virtual float operator()(int varIdx, int sampleIdx) const;
|
||||
virtual void writeFeatures( FileStorage &fs, const Mat& featureMap ) const;
|
||||
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
protected:
|
||||
virtual void generateFeatures();
|
||||
virtual void integralHistogram(const Mat &img, vector<Mat> &histogram, Mat &norm, int nbins) const;
|
||||
virtual void integralHistogram(const cv::Mat &img, std::vector<cv::Mat> &histogram, cv::Mat &norm, int nbins) const;
|
||||
class Feature
|
||||
{
|
||||
public:
|
||||
Feature();
|
||||
Feature( int offset, int x, int y, int cellW, int cellH );
|
||||
float calc( const vector<Mat> &_hists, const Mat &_normSum, size_t y, int featComponent ) const;
|
||||
void write( FileStorage &fs ) const;
|
||||
void write( FileStorage &fs, int varIdx ) const;
|
||||
float calc( const std::vector<cv::Mat> &_hists, const cv::Mat &_normSum, size_t y, int featComponent ) const;
|
||||
void write( cv::FileStorage &fs ) const;
|
||||
void write( cv::FileStorage &fs, int varIdx ) const;
|
||||
|
||||
Rect rect[N_CELLS]; //cells
|
||||
cv::Rect rect[N_CELLS]; //cells
|
||||
|
||||
struct
|
||||
{
|
||||
int p0, p1, p2, p3;
|
||||
} fastRect[N_CELLS];
|
||||
};
|
||||
vector<Feature> features;
|
||||
std::vector<Feature> features;
|
||||
|
||||
Mat normSum; //for nomalization calculation (L1 or L2)
|
||||
vector<Mat> hist;
|
||||
cv::Mat normSum; //for nomalization calculation (L1 or L2)
|
||||
std::vector<cv::Mat> hist;
|
||||
};
|
||||
|
||||
inline float CvHOGEvaluator::operator()(int varIdx, int sampleIdx) const
|
||||
@@ -57,7 +57,7 @@ inline float CvHOGEvaluator::operator()(int varIdx, int sampleIdx) const
|
||||
return features[featureIdx].calc( hist, normSum, sampleIdx, componentIdx);
|
||||
}
|
||||
|
||||
inline float CvHOGEvaluator::Feature::calc( const vector<Mat>& _hists, const Mat& _normSum, size_t y, int featComponent ) const
|
||||
inline float CvHOGEvaluator::Feature::calc( const std::vector<cv::Mat>& _hists, const cv::Mat& _normSum, size_t y, int featComponent ) const
|
||||
{
|
||||
float normFactor;
|
||||
float res;
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/core/internal.hpp"
|
||||
|
||||
using cv::Size;
|
||||
using cv::Mat;
|
||||
using cv::Point;
|
||||
using cv::FileStorage;
|
||||
using cv::Rect;
|
||||
using cv::Ptr;
|
||||
using cv::FileNode;
|
||||
using cv::Mat_;
|
||||
using cv::Range;
|
||||
using cv::FileNodeIterator;
|
||||
using cv::ParallelLoopBody;
|
||||
|
||||
|
||||
#include "boost.h"
|
||||
#include "cascadeclassifier.h"
|
||||
#include <queue>
|
||||
@@ -160,10 +173,10 @@ CvCascadeBoostParams::CvCascadeBoostParams( int _boostType,
|
||||
|
||||
void CvCascadeBoostParams::write( FileStorage &fs ) const
|
||||
{
|
||||
String boostTypeStr = boost_type == CvBoost::DISCRETE ? CC_DISCRETE_BOOST :
|
||||
string boostTypeStr = boost_type == CvBoost::DISCRETE ? CC_DISCRETE_BOOST :
|
||||
boost_type == CvBoost::REAL ? CC_REAL_BOOST :
|
||||
boost_type == CvBoost::LOGIT ? CC_LOGIT_BOOST :
|
||||
boost_type == CvBoost::GENTLE ? CC_GENTLE_BOOST : String();
|
||||
boost_type == CvBoost::GENTLE ? CC_GENTLE_BOOST : string();
|
||||
CV_Assert( !boostTypeStr.empty() );
|
||||
fs << CC_BOOST_TYPE << boostTypeStr;
|
||||
fs << CC_MINHITRATE << minHitRate;
|
||||
@@ -175,7 +188,7 @@ void CvCascadeBoostParams::write( FileStorage &fs ) const
|
||||
|
||||
bool CvCascadeBoostParams::read( const FileNode &node )
|
||||
{
|
||||
String boostTypeStr;
|
||||
string boostTypeStr;
|
||||
FileNode rnode = node[CC_BOOST_TYPE];
|
||||
rnode >> boostTypeStr;
|
||||
boost_type = !boostTypeStr.compare( CC_DISCRETE_BOOST ) ? CvBoost::DISCRETE :
|
||||
@@ -213,10 +226,10 @@ void CvCascadeBoostParams::printDefaults() const
|
||||
|
||||
void CvCascadeBoostParams::printAttrs() const
|
||||
{
|
||||
String boostTypeStr = boost_type == CvBoost::DISCRETE ? CC_DISCRETE_BOOST :
|
||||
string boostTypeStr = boost_type == CvBoost::DISCRETE ? CC_DISCRETE_BOOST :
|
||||
boost_type == CvBoost::REAL ? CC_REAL_BOOST :
|
||||
boost_type == CvBoost::LOGIT ? CC_LOGIT_BOOST :
|
||||
boost_type == CvBoost::GENTLE ? CC_GENTLE_BOOST : String();
|
||||
boost_type == CvBoost::GENTLE ? CC_GENTLE_BOOST : string();
|
||||
CV_Assert( !boostTypeStr.empty() );
|
||||
cout << "boostType: " << boostTypeStr << endl;
|
||||
cout << "minHitRate: " << minHitRate << endl;
|
||||
@@ -226,7 +239,7 @@ void CvCascadeBoostParams::printAttrs() const
|
||||
cout << "maxWeakCount: " << weak_count << endl;
|
||||
}
|
||||
|
||||
bool CvCascadeBoostParams::scanAttr( const String prmName, const String val)
|
||||
bool CvCascadeBoostParams::scanAttr( const string prmName, const string val)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
|
||||
+10
-10
@@ -13,11 +13,11 @@ struct CvCascadeBoostParams : CvBoostParams
|
||||
CvCascadeBoostParams( int _boostType, float _minHitRate, float _maxFalseAlarm,
|
||||
double _weightTrimRate, int _maxDepth, int _maxWeakCount );
|
||||
virtual ~CvCascadeBoostParams() {}
|
||||
void write( FileStorage &fs ) const;
|
||||
bool read( const FileNode &node );
|
||||
void write( cv::FileStorage &fs ) const;
|
||||
bool read( const cv::FileNode &node );
|
||||
virtual void printDefaults() const;
|
||||
virtual void printAttrs() const;
|
||||
virtual bool scanAttr( const String prmName, const String val);
|
||||
virtual bool scanAttr( const std::string prmName, const std::string val);
|
||||
};
|
||||
|
||||
struct CvCascadeBoostTrainData : CvDTreeTrainData
|
||||
@@ -45,7 +45,7 @@ struct CvCascadeBoostTrainData : CvDTreeTrainData
|
||||
virtual void free_train_data();
|
||||
|
||||
const CvFeatureEvaluator* featureEvaluator;
|
||||
Mat valCache; // precalculated feature values (CV_32FC1)
|
||||
cv::Mat valCache; // precalculated feature values (CV_32FC1)
|
||||
CvMat _resp; // for casting
|
||||
int numPrecalcVal, numPrecalcIdx;
|
||||
};
|
||||
@@ -54,9 +54,9 @@ class CvCascadeBoostTree : public CvBoostTree
|
||||
{
|
||||
public:
|
||||
virtual CvDTreeNode* predict( int sampleIdx ) const;
|
||||
void write( FileStorage &fs, const Mat& featureMap );
|
||||
void read( const FileNode &node, CvBoost* _ensemble, CvDTreeTrainData* _data );
|
||||
void markFeaturesInMap( Mat& featureMap );
|
||||
void write( cv::FileStorage &fs, const cv::Mat& featureMap );
|
||||
void read( const cv::FileNode &node, CvBoost* _ensemble, CvDTreeTrainData* _data );
|
||||
void markFeaturesInMap( cv::Mat& featureMap );
|
||||
protected:
|
||||
virtual void split_node_data( CvDTreeNode* n );
|
||||
};
|
||||
@@ -70,10 +70,10 @@ public:
|
||||
virtual float predict( int sampleIdx, bool returnSum = false ) const;
|
||||
|
||||
float getThreshold() const { return threshold; }
|
||||
void write( FileStorage &fs, const Mat& featureMap ) const;
|
||||
bool read( const FileNode &node, const CvFeatureEvaluator* _featureEvaluator,
|
||||
void write( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
bool read( const cv::FileNode &node, const CvFeatureEvaluator* _featureEvaluator,
|
||||
const CvCascadeBoostParams& _params );
|
||||
void markUsedFeaturesInMap( Mat& featureMap );
|
||||
void markUsedFeaturesInMap( cv::Mat& featureMap );
|
||||
protected:
|
||||
virtual bool set_params( const CvBoostParams& _params );
|
||||
virtual void update_weights( CvBoostTree* tree );
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <queue>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
static const char* stageTypes[] = { CC_BOOST };
|
||||
static const char* featureTypes[] = { CC_HAAR, CC_LBP, CC_HOG };
|
||||
@@ -24,10 +25,10 @@ CvCascadeParams::CvCascadeParams( int _stageType, int _featureType ) : stageType
|
||||
|
||||
void CvCascadeParams::write( FileStorage &fs ) const
|
||||
{
|
||||
String stageTypeStr = stageType == BOOST ? CC_BOOST : String();
|
||||
string stageTypeStr = stageType == BOOST ? CC_BOOST : string();
|
||||
CV_Assert( !stageTypeStr.empty() );
|
||||
fs << CC_STAGE_TYPE << stageTypeStr;
|
||||
String featureTypeStr = featureType == CvFeatureParams::HAAR ? CC_HAAR :
|
||||
string featureTypeStr = featureType == CvFeatureParams::HAAR ? CC_HAAR :
|
||||
featureType == CvFeatureParams::LBP ? CC_LBP :
|
||||
featureType == CvFeatureParams::HOG ? CC_HOG :
|
||||
0;
|
||||
@@ -41,7 +42,7 @@ bool CvCascadeParams::read( const FileNode &node )
|
||||
{
|
||||
if ( node.empty() )
|
||||
return false;
|
||||
String stageTypeStr, featureTypeStr;
|
||||
string stageTypeStr, featureTypeStr;
|
||||
FileNode rnode = node[CC_STAGE_TYPE];
|
||||
if ( !rnode.isString() )
|
||||
return false;
|
||||
@@ -96,7 +97,7 @@ void CvCascadeParams::printAttrs() const
|
||||
cout << "sampleHeight: " << winSize.height << endl;
|
||||
}
|
||||
|
||||
bool CvCascadeParams::scanAttr( const String prmName, const String val )
|
||||
bool CvCascadeParams::scanAttr( const string prmName, const string val )
|
||||
{
|
||||
bool res = true;
|
||||
if( !prmName.compare( "-stageType" ) )
|
||||
@@ -126,9 +127,9 @@ bool CvCascadeParams::scanAttr( const String prmName, const String val )
|
||||
|
||||
//---------------------------- CascadeClassifier --------------------------------------
|
||||
|
||||
bool CvCascadeClassifier::train( const String _cascadeDirName,
|
||||
const String _posFilename,
|
||||
const String _negFilename,
|
||||
bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
const string _posFilename,
|
||||
const string _negFilename,
|
||||
int _numPos, int _numNeg,
|
||||
int _precalcValBufSize, int _precalcIdxBufSize,
|
||||
int _numStages,
|
||||
@@ -137,6 +138,9 @@ bool CvCascadeClassifier::train( const String _cascadeDirName,
|
||||
const CvCascadeBoostParams& _stageParams,
|
||||
bool baseFormatSave )
|
||||
{
|
||||
// Start recording clock ticks for training time output
|
||||
const clock_t begin_time = clock();
|
||||
|
||||
if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() )
|
||||
CV_Error( CV_StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" );
|
||||
|
||||
@@ -247,6 +251,14 @@ bool CvCascadeClassifier::train( const String _cascadeDirName,
|
||||
fs << FileStorage::getDefaultObjectName(stageFilename) << "{";
|
||||
tempStage->write( fs, Mat() );
|
||||
fs << "}";
|
||||
|
||||
// Output training time up till now
|
||||
float seconds = float( clock () - begin_time ) / CLOCKS_PER_SEC;
|
||||
int days = int(seconds) / 60 / 60 / 24;
|
||||
int hours = (int(seconds) / 60 / 60) % 24;
|
||||
int minutes = (int(seconds) / 60) % 60;
|
||||
int seconds_left = int(seconds) % 60;
|
||||
cout << "Training until now has taken " << days << " days " << hours << " hours " << minutes << " minutes " << seconds_left <<" seconds." << endl;
|
||||
}
|
||||
|
||||
if(stageClassifiers.size() == 0)
|
||||
@@ -310,6 +322,7 @@ int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositiv
|
||||
if( predict( i ) == 1.0F )
|
||||
{
|
||||
getcount++;
|
||||
printf("%s current samples: %d\r", isPositive ? "POS":"NEG", getcount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -399,7 +412,7 @@ bool CvCascadeClassifier::readStages( const FileNode &node)
|
||||
#define ICV_HAAR_PARENT_NAME "parent"
|
||||
#define ICV_HAAR_NEXT_NAME "next"
|
||||
|
||||
void CvCascadeClassifier::save( const String filename, bool baseFormat )
|
||||
void CvCascadeClassifier::save( const string filename, bool baseFormat )
|
||||
{
|
||||
FileStorage fs( filename, FileStorage::WRITE );
|
||||
|
||||
@@ -491,7 +504,7 @@ void CvCascadeClassifier::save( const String filename, bool baseFormat )
|
||||
fs << "}";
|
||||
}
|
||||
|
||||
bool CvCascadeClassifier::load( const String cascadeDirName )
|
||||
bool CvCascadeClassifier::load( const string cascadeDirName )
|
||||
{
|
||||
FileStorage fs( cascadeDirName + CC_PARAMS_FILENAME, FileStorage::READ );
|
||||
if ( !fs.isOpened() )
|
||||
|
||||
@@ -72,24 +72,24 @@ public:
|
||||
|
||||
CvCascadeParams();
|
||||
CvCascadeParams( int _stageType, int _featureType );
|
||||
void write( FileStorage &fs ) const;
|
||||
bool read( const FileNode &node );
|
||||
void write( cv::FileStorage &fs ) const;
|
||||
bool read( const cv::FileNode &node );
|
||||
|
||||
void printDefaults() const;
|
||||
void printAttrs() const;
|
||||
bool scanAttr( const String prmName, const String val );
|
||||
bool scanAttr( const std::string prmName, const std::string val );
|
||||
|
||||
int stageType;
|
||||
int featureType;
|
||||
Size winSize;
|
||||
cv::Size winSize;
|
||||
};
|
||||
|
||||
class CvCascadeClassifier
|
||||
{
|
||||
public:
|
||||
bool train( const String _cascadeDirName,
|
||||
const String _posFilename,
|
||||
const String _negFilename,
|
||||
bool train( const std::string _cascadeDirName,
|
||||
const std::string _posFilename,
|
||||
const std::string _negFilename,
|
||||
int _numPos, int _numNeg,
|
||||
int _precalcValBufSize, int _precalcIdxBufSize,
|
||||
int _numStages,
|
||||
@@ -99,25 +99,25 @@ public:
|
||||
bool baseFormatSave = false );
|
||||
private:
|
||||
int predict( int sampleIdx );
|
||||
void save( const String cascadeDirName, bool baseFormat = false );
|
||||
bool load( const String cascadeDirName );
|
||||
void save( const std::string cascadeDirName, bool baseFormat = false );
|
||||
bool load( const std::string cascadeDirName );
|
||||
bool updateTrainingSet( double& acceptanceRatio );
|
||||
int fillPassedSamples( int first, int count, bool isPositive, int64& consumed );
|
||||
|
||||
void writeParams( FileStorage &fs ) const;
|
||||
void writeStages( FileStorage &fs, const Mat& featureMap ) const;
|
||||
void writeFeatures( FileStorage &fs, const Mat& featureMap ) const;
|
||||
bool readParams( const FileNode &node );
|
||||
bool readStages( const FileNode &node );
|
||||
void writeParams( cv::FileStorage &fs ) const;
|
||||
void writeStages( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
bool readParams( const cv::FileNode &node );
|
||||
bool readStages( const cv::FileNode &node );
|
||||
|
||||
void getUsedFeaturesIdxMap( Mat& featureMap );
|
||||
void getUsedFeaturesIdxMap( cv::Mat& featureMap );
|
||||
|
||||
CvCascadeParams cascadeParams;
|
||||
Ptr<CvFeatureParams> featureParams;
|
||||
Ptr<CvCascadeBoostParams> stageParams;
|
||||
cv::Ptr<CvFeatureParams> featureParams;
|
||||
cv::Ptr<CvCascadeBoostParams> stageParams;
|
||||
|
||||
Ptr<CvFeatureEvaluator> featureEvaluator;
|
||||
vector< Ptr<CvCascadeBoost> > stageClassifiers;
|
||||
cv::Ptr<CvFeatureEvaluator> featureEvaluator;
|
||||
std::vector< cv::Ptr<CvCascadeBoost> > stageClassifiers;
|
||||
CvCascadeImageReader imgReader;
|
||||
int numStages, curNumSamples;
|
||||
int numPos, numNeg;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "cascadeclassifier.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
float calcNormFactor( const Mat& sum, const Mat& sqSum )
|
||||
{
|
||||
@@ -24,7 +25,7 @@ CvParams::CvParams() : name( "params" ) {}
|
||||
void CvParams::printDefaults() const
|
||||
{ cout << "--" << name << "--" << endl; }
|
||||
void CvParams::printAttrs() const {}
|
||||
bool CvParams::scanAttr( const String, const String ) { return false; }
|
||||
bool CvParams::scanAttr( const string, const string ) { return false; }
|
||||
|
||||
|
||||
//---------------------------- FeatureParams --------------------------------------
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "cascadeclassifier.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
CvHaarFeatureParams::CvHaarFeatureParams() : mode(BASIC)
|
||||
{
|
||||
@@ -25,9 +26,9 @@ void CvHaarFeatureParams::init( const CvFeatureParams& fp )
|
||||
void CvHaarFeatureParams::write( FileStorage &fs ) const
|
||||
{
|
||||
CvFeatureParams::write( fs );
|
||||
String modeStr = mode == BASIC ? CC_MODE_BASIC :
|
||||
string modeStr = mode == BASIC ? CC_MODE_BASIC :
|
||||
mode == CORE ? CC_MODE_CORE :
|
||||
mode == ALL ? CC_MODE_ALL : String();
|
||||
mode == ALL ? CC_MODE_ALL : string();
|
||||
CV_Assert( !modeStr.empty() );
|
||||
fs << CC_MODE << modeStr;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ bool CvHaarFeatureParams::read( const FileNode &node )
|
||||
FileNode rnode = node[CC_MODE];
|
||||
if( !rnode.isString() )
|
||||
return false;
|
||||
String modeStr;
|
||||
string modeStr;
|
||||
rnode >> modeStr;
|
||||
mode = !modeStr.compare( CC_MODE_BASIC ) ? BASIC :
|
||||
!modeStr.compare( CC_MODE_CORE ) ? CORE :
|
||||
@@ -58,13 +59,13 @@ void CvHaarFeatureParams::printDefaults() const
|
||||
void CvHaarFeatureParams::printAttrs() const
|
||||
{
|
||||
CvFeatureParams::printAttrs();
|
||||
String mode_str = mode == BASIC ? CC_MODE_BASIC :
|
||||
string mode_str = mode == BASIC ? CC_MODE_BASIC :
|
||||
mode == CORE ? CC_MODE_CORE :
|
||||
mode == ALL ? CC_MODE_ALL : 0;
|
||||
cout << "mode: " << mode_str << endl;
|
||||
}
|
||||
|
||||
bool CvHaarFeatureParams::scanAttr( const String prmName, const String val)
|
||||
bool CvHaarFeatureParams::scanAttr( const string prmName, const string val)
|
||||
{
|
||||
if ( !CvFeatureParams::scanAttr( prmName, val ) )
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@ public:
|
||||
CvHaarFeatureParams( int _mode );
|
||||
|
||||
virtual void init( const CvFeatureParams& fp );
|
||||
virtual void write( FileStorage &fs ) const;
|
||||
virtual bool read( const FileNode &node );
|
||||
virtual void write( cv::FileStorage &fs ) const;
|
||||
virtual bool read( const cv::FileNode &node );
|
||||
|
||||
virtual void printDefaults() const;
|
||||
virtual void printAttrs() const;
|
||||
virtual bool scanAttr( const String prm, const String val);
|
||||
virtual bool scanAttr( const std::string prm, const std::string val);
|
||||
|
||||
int mode;
|
||||
};
|
||||
@@ -32,11 +32,11 @@ class CvHaarEvaluator : public CvFeatureEvaluator
|
||||
{
|
||||
public:
|
||||
virtual void init(const CvFeatureParams *_featureParams,
|
||||
int _maxSampleCount, Size _winSize );
|
||||
virtual void setImage(const Mat& img, uchar clsLabel, int idx);
|
||||
int _maxSampleCount, cv::Size _winSize );
|
||||
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx);
|
||||
virtual float operator()(int featureIdx, int sampleIdx) const;
|
||||
virtual void writeFeatures( FileStorage &fs, const Mat& featureMap ) const;
|
||||
void writeFeature( FileStorage &fs, int fi ) const; // for old file fornat
|
||||
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
void writeFeature( cv::FileStorage &fs, int fi ) const; // for old file fornat
|
||||
protected:
|
||||
virtual void generateFeatures();
|
||||
|
||||
@@ -48,13 +48,13 @@ protected:
|
||||
int x0, int y0, int w0, int h0, float wt0,
|
||||
int x1, int y1, int w1, int h1, float wt1,
|
||||
int x2 = 0, int y2 = 0, int w2 = 0, int h2 = 0, float wt2 = 0.0F );
|
||||
float calc( const Mat &sum, const Mat &tilted, size_t y) const;
|
||||
void write( FileStorage &fs ) const;
|
||||
float calc( const cv::Mat &sum, const cv::Mat &tilted, size_t y) const;
|
||||
void write( cv::FileStorage &fs ) const;
|
||||
|
||||
bool tilted;
|
||||
struct
|
||||
{
|
||||
Rect r;
|
||||
cv::Rect r;
|
||||
float weight;
|
||||
} rect[CV_HAAR_FEATURE_MAX];
|
||||
|
||||
@@ -64,10 +64,10 @@ protected:
|
||||
} fastRect[CV_HAAR_FEATURE_MAX];
|
||||
};
|
||||
|
||||
vector<Feature> features;
|
||||
Mat sum; /* sum images (each row represents image) */
|
||||
Mat tilted; /* tilted sum images (each row represents image) */
|
||||
Mat normfactor; /* normalization factor */
|
||||
std::vector<Feature> features;
|
||||
cv::Mat sum; /* sum images (each row represents image) */
|
||||
cv::Mat tilted; /* tilted sum images (each row represents image) */
|
||||
cv::Mat normfactor; /* normalization factor */
|
||||
};
|
||||
|
||||
inline float CvHaarEvaluator::operator()(int featureIdx, int sampleIdx) const
|
||||
@@ -76,7 +76,7 @@ inline float CvHaarEvaluator::operator()(int featureIdx, int sampleIdx) const
|
||||
return !nf ? 0.0f : (features[featureIdx].calc( sum, tilted, sampleIdx)/nf);
|
||||
}
|
||||
|
||||
inline float CvHaarEvaluator::Feature::calc( const Mat &_sum, const Mat &_tilted, size_t y) const
|
||||
inline float CvHaarEvaluator::Feature::calc( const cv::Mat &_sum, const cv::Mat &_tilted, size_t y) const
|
||||
{
|
||||
const int* img = tilted ? _tilted.ptr<int>((int)y) : _sum.ptr<int>((int)y);
|
||||
float ret = rect[0].weight * (img[fastRect[0].p0] - img[fastRect[0].p1] - img[fastRect[0].p2] + img[fastRect[0].p3] ) +
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
bool CvCascadeImageReader::create( const String _posFilename, const String _negFilename, Size _winSize )
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
bool CvCascadeImageReader::create( const string _posFilename, const string _negFilename, Size _winSize )
|
||||
{
|
||||
return posReader.create(_posFilename) && negReader.create(_negFilename, _winSize);
|
||||
}
|
||||
@@ -22,21 +25,21 @@ CvCascadeImageReader::NegReader::NegReader()
|
||||
stepFactor = 0.5F;
|
||||
}
|
||||
|
||||
bool CvCascadeImageReader::NegReader::create( const String _filename, Size _winSize )
|
||||
bool CvCascadeImageReader::NegReader::create( const string _filename, Size _winSize )
|
||||
{
|
||||
String dirname, str;
|
||||
string dirname, str;
|
||||
std::ifstream file(_filename.c_str());
|
||||
if ( !file.is_open() )
|
||||
return false;
|
||||
|
||||
size_t pos = _filename.rfind('\\');
|
||||
char dlmrt = '\\';
|
||||
if (pos == String::npos)
|
||||
if (pos == string::npos)
|
||||
{
|
||||
pos = _filename.rfind('/');
|
||||
dlmrt = '/';
|
||||
}
|
||||
dirname = pos == String::npos ? "" : _filename.substr(0, pos) + dlmrt;
|
||||
dirname = pos == string::npos ? "" : _filename.substr(0, pos) + dlmrt;
|
||||
while( !file.eof() )
|
||||
{
|
||||
std::getline(file, str);
|
||||
@@ -64,8 +67,8 @@ bool CvCascadeImageReader::NegReader::nextImg()
|
||||
round = round % (winSize.width * winSize.height);
|
||||
last %= count;
|
||||
|
||||
_offset.x = min( (int)round % winSize.width, src.cols - winSize.width );
|
||||
_offset.y = min( (int)round / winSize.width, src.rows - winSize.height );
|
||||
_offset.x = std::min( (int)round % winSize.width, src.cols - winSize.width );
|
||||
_offset.y = std::min( (int)round / winSize.width, src.rows - winSize.height );
|
||||
if( !src.empty() && src.type() == CV_8UC1
|
||||
&& offset.x >= 0 && offset.y >= 0 )
|
||||
break;
|
||||
@@ -126,7 +129,7 @@ CvCascadeImageReader::PosReader::PosReader()
|
||||
vec = 0;
|
||||
}
|
||||
|
||||
bool CvCascadeImageReader::PosReader::create( const String _filename )
|
||||
bool CvCascadeImageReader::PosReader::create( const string _filename )
|
||||
{
|
||||
if ( file )
|
||||
fclose( file );
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
#include "highgui.h"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
|
||||
class CvCascadeImageReader
|
||||
{
|
||||
public:
|
||||
bool create( const String _posFilename, const String _negFilename, Size _winSize );
|
||||
bool create( const std::string _posFilename, const std::string _negFilename, cv::Size _winSize );
|
||||
void restart() { posReader.restart(); }
|
||||
bool getNeg(Mat &_img) { return negReader.get( _img ); }
|
||||
bool getPos(Mat &_img) { return posReader.get( _img ); }
|
||||
bool getNeg(cv::Mat &_img) { return negReader.get( _img ); }
|
||||
bool getPos(cv::Mat &_img) { return posReader.get( _img ); }
|
||||
|
||||
private:
|
||||
class PosReader
|
||||
@@ -19,8 +19,8 @@ private:
|
||||
public:
|
||||
PosReader();
|
||||
virtual ~PosReader();
|
||||
bool create( const String _filename );
|
||||
bool get( Mat &_img );
|
||||
bool create( const std::string _filename );
|
||||
bool get( cv::Mat &_img );
|
||||
void restart();
|
||||
|
||||
short* vec;
|
||||
@@ -35,18 +35,18 @@ private:
|
||||
{
|
||||
public:
|
||||
NegReader();
|
||||
bool create( const String _filename, Size _winSize );
|
||||
bool get( Mat& _img );
|
||||
bool create( const std::string _filename, cv::Size _winSize );
|
||||
bool get( cv::Mat& _img );
|
||||
bool nextImg();
|
||||
|
||||
Mat src, img;
|
||||
vector<String> imgFilenames;
|
||||
Point offset, point;
|
||||
cv::Mat src, img;
|
||||
std::vector<std::string> imgFilenames;
|
||||
cv::Point offset, point;
|
||||
float scale;
|
||||
float scaleFactor;
|
||||
float stepFactor;
|
||||
size_t last, round;
|
||||
Size winSize;
|
||||
cv::Size winSize;
|
||||
} negReader;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "lbpfeatures.h"
|
||||
#include "cascadeclassifier.h"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
CvLBPFeatureParams::CvLBPFeatureParams()
|
||||
{
|
||||
maxCatCount = 256;
|
||||
|
||||
@@ -15,11 +15,11 @@ class CvLBPEvaluator : public CvFeatureEvaluator
|
||||
public:
|
||||
virtual ~CvLBPEvaluator() {}
|
||||
virtual void init(const CvFeatureParams *_featureParams,
|
||||
int _maxSampleCount, Size _winSize );
|
||||
virtual void setImage(const Mat& img, uchar clsLabel, int idx);
|
||||
int _maxSampleCount, cv::Size _winSize );
|
||||
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx);
|
||||
virtual float operator()(int featureIdx, int sampleIdx) const
|
||||
{ return (float)features[featureIdx].calc( sum, sampleIdx); }
|
||||
virtual void writeFeatures( FileStorage &fs, const Mat& featureMap ) const;
|
||||
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
|
||||
protected:
|
||||
virtual void generateFeatures();
|
||||
|
||||
@@ -28,18 +28,18 @@ protected:
|
||||
public:
|
||||
Feature();
|
||||
Feature( int offset, int x, int y, int _block_w, int _block_h );
|
||||
uchar calc( const Mat& _sum, size_t y ) const;
|
||||
void write( FileStorage &fs ) const;
|
||||
uchar calc( const cv::Mat& _sum, size_t y ) const;
|
||||
void write( cv::FileStorage &fs ) const;
|
||||
|
||||
Rect rect;
|
||||
cv::Rect rect;
|
||||
int p[16];
|
||||
};
|
||||
vector<Feature> features;
|
||||
std::vector<Feature> features;
|
||||
|
||||
Mat sum;
|
||||
cv::Mat sum;
|
||||
};
|
||||
|
||||
inline uchar CvLBPEvaluator::Feature::calc(const Mat &_sum, size_t y) const
|
||||
inline uchar CvLBPEvaluator::Feature::calc(const cv::Mat &_sum, size_t y) const
|
||||
{
|
||||
const int* psum = _sum.ptr<int>((int)y);
|
||||
int cval = psum[p[5]] - psum[p[6]] - psum[p[9]] + psum[p[10]];
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
#include "cascadeclassifier.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
CvCascadeClassifier classifier;
|
||||
String cascadeDirName, vecName, bgName;
|
||||
string cascadeDirName, vecName, bgName;
|
||||
int numPos = 2000;
|
||||
int numNeg = 1000;
|
||||
int numStages = 20;
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
(p3) = (rect).x + (rect).width - (rect).height \
|
||||
+ (step) * ((rect).y + (rect).width + (rect).height);
|
||||
|
||||
float calcNormFactor( const Mat& sum, const Mat& sqSum );
|
||||
float calcNormFactor( const cv::Mat& sum, const cv::Mat& sqSum );
|
||||
|
||||
template<class Feature>
|
||||
void _writeFeatures( const vector<Feature> features, FileStorage &fs, const Mat& featureMap )
|
||||
void _writeFeatures( const std::vector<Feature> features, cv::FileStorage &fs, const cv::Mat& featureMap )
|
||||
{
|
||||
fs << FEATURES << "[";
|
||||
const Mat_<int>& featureMap_ = (const Mat_<int>&)featureMap;
|
||||
const cv::Mat_<int>& featureMap_ = (const cv::Mat_<int>&)featureMap;
|
||||
for ( int fi = 0; fi < featureMap.cols; fi++ )
|
||||
if ( featureMap_(0, fi) >= 0 )
|
||||
{
|
||||
@@ -53,13 +53,13 @@ public:
|
||||
CvParams();
|
||||
virtual ~CvParams() {}
|
||||
// from|to file
|
||||
virtual void write( FileStorage &fs ) const = 0;
|
||||
virtual bool read( const FileNode &node ) = 0;
|
||||
virtual void write( cv::FileStorage &fs ) const = 0;
|
||||
virtual bool read( const cv::FileNode &node ) = 0;
|
||||
// from|to screen
|
||||
virtual void printDefaults() const;
|
||||
virtual void printAttrs() const;
|
||||
virtual bool scanAttr( const String prmName, const String val );
|
||||
String name;
|
||||
virtual bool scanAttr( const std::string prmName, const std::string val );
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class CvFeatureParams : public CvParams
|
||||
@@ -68,9 +68,9 @@ public:
|
||||
enum { HAAR = 0, LBP = 1, HOG = 2 };
|
||||
CvFeatureParams();
|
||||
virtual void init( const CvFeatureParams& fp );
|
||||
virtual void write( FileStorage &fs ) const;
|
||||
virtual bool read( const FileNode &node );
|
||||
static Ptr<CvFeatureParams> create( int featureType );
|
||||
virtual void write( cv::FileStorage &fs ) const;
|
||||
virtual bool read( const cv::FileNode &node );
|
||||
static cv::Ptr<CvFeatureParams> create( int featureType );
|
||||
int maxCatCount; // 0 in case of numerical features
|
||||
int featSize; // 1 in case of simple features (HAAR, LBP) and N_BINS(9)*N_CELLS(4) in case of Dalal's HOG features
|
||||
};
|
||||
@@ -80,25 +80,25 @@ class CvFeatureEvaluator
|
||||
public:
|
||||
virtual ~CvFeatureEvaluator() {}
|
||||
virtual void init(const CvFeatureParams *_featureParams,
|
||||
int _maxSampleCount, Size _winSize );
|
||||
virtual void setImage(const Mat& img, uchar clsLabel, int idx);
|
||||
virtual void writeFeatures( FileStorage &fs, const Mat& featureMap ) const = 0;
|
||||
int _maxSampleCount, cv::Size _winSize );
|
||||
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx);
|
||||
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const = 0;
|
||||
virtual float operator()(int featureIdx, int sampleIdx) const = 0;
|
||||
static Ptr<CvFeatureEvaluator> create(int type);
|
||||
static cv::Ptr<CvFeatureEvaluator> create(int type);
|
||||
|
||||
int getNumFeatures() const { return numFeatures; }
|
||||
int getMaxCatCount() const { return featureParams->maxCatCount; }
|
||||
int getFeatureSize() const { return featureParams->featSize; }
|
||||
const Mat& getCls() const { return cls; }
|
||||
const cv::Mat& getCls() const { return cls; }
|
||||
float getCls(int si) const { return cls.at<float>(si, 0); }
|
||||
protected:
|
||||
virtual void generateFeatures() = 0;
|
||||
|
||||
int npos, nneg;
|
||||
int numFeatures;
|
||||
Size winSize;
|
||||
cv::Size winSize;
|
||||
CvFeatureParams *featureParams;
|
||||
Mat cls;
|
||||
cv::Mat cls;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -759,11 +759,15 @@ endif()
|
||||
set(CUDA_VERSION_STRING "${CUDA_VERSION}")
|
||||
|
||||
# Support for arm cross compilation with CUDA 5.5
|
||||
if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
|
||||
set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.")
|
||||
else()
|
||||
set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.")
|
||||
set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}")
|
||||
if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||
if(ANDROID AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi")
|
||||
set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi")
|
||||
elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
|
||||
set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
|
||||
endif()
|
||||
endif()
|
||||
set(CUDA_TOOLKIT_TARGET_DIR "${__cuda_toolkit_target_dir_initial}" CACHE PATH "Toolkit target location.")
|
||||
mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
|
||||
|
||||
# Target CPU architecture
|
||||
|
||||
@@ -183,9 +183,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG")
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
|
||||
if(BUILD_WITH_DEBUG_INFO)
|
||||
set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -ggdb3")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
||||
@@ -77,6 +77,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc10)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
@@ -90,12 +90,17 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED __cuda_arch_bin)
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
if(ANDROID)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
else()
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
else()
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
|
||||
endif()
|
||||
set(__cuda_arch_ptx "3.0")
|
||||
endif()
|
||||
set(__cuda_arch_ptx "3.0")
|
||||
endif()
|
||||
|
||||
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
|
||||
@@ -147,6 +152,11 @@ if(CUDA_FOUND)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA})
|
||||
set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}")
|
||||
|
||||
if(ANDROID)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xptxas;-dlcm=ca")
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-target-os-variant=Android")
|
||||
endif()
|
||||
|
||||
message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}")
|
||||
|
||||
OCV_OPTION(CUDA_FAST_MATH "Enable --use_fast_math for CUDA compiler " OFF)
|
||||
@@ -169,6 +179,14 @@ if(CUDA_FOUND)
|
||||
|
||||
# we remove -Wsign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler
|
||||
# but NVCC uses C compiler by default
|
||||
string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -frtti because it's used for C++ compiler
|
||||
# but NVCC uses C compiler by default
|
||||
string(REPLACE "-frtti" "" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
|
||||
@@ -136,6 +136,8 @@ if(MSVC)
|
||||
set(OpenCV_RUNTIME vc10)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(OpenCV_RUNTIME vc11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OpenCV_RUNTIME vc12)
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
||||
@@ -23,7 +23,7 @@ if(WIN32)
|
||||
if(EXISTS ${XIMEA_PATH})
|
||||
set(XIMEA_FOUND 1)
|
||||
# set LIB folders
|
||||
if(CMAKE_CL_64)
|
||||
if(X86_64)
|
||||
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x64")
|
||||
else()
|
||||
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
|
||||
|
||||
@@ -134,11 +134,11 @@ if(WIN32)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}/lib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}/lib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
else()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}/staticlib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}/staticlib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib")
|
||||
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake)
|
||||
endif()
|
||||
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# platform-specific config file
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.cmake" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/cvconfig.h.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# opencv_modules.hpp based on actual modules list
|
||||
|
||||
@@ -76,7 +76,9 @@ if(INSTALL_TO_MANGLED_PATHS)
|
||||
else()
|
||||
set(OPENCV_PC_FILE_NAME opencv.pc)
|
||||
endif()
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}" @ONLY IMMEDIATE)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv-XXX.pc.in"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME}"
|
||||
@ONLY IMMEDIATE)
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig)
|
||||
|
||||
@@ -41,7 +41,9 @@ if(ANDROID)
|
||||
string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake)
|
||||
if(NOT TARGET opencv_core)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${modules_file_suffix}.cmake)
|
||||
endif()
|
||||
|
||||
# TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)
|
||||
|
||||
@@ -179,6 +181,10 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
||||
set(${__cvcomponent}_FOUND "${__cvcomponent}_FOUND-NOTFOUND")
|
||||
else()
|
||||
list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent})
|
||||
# Not using list(APPEND) here, because OpenCV_LIBS may not exist yet.
|
||||
# Also not clearing OpenCV_LIBS anywhere, so that multiple calls
|
||||
# to find_package(OpenCV) with different component lists add up.
|
||||
set(OpenCV_LIBS ${OpenCV_LIBS} "${__cvcomponent}")
|
||||
#indicate that module is found
|
||||
string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
||||
set(${__cvcomponent}_FOUND 1)
|
||||
@@ -195,8 +201,6 @@ else()
|
||||
set(OpenCV_LIB_SUFFIX "")
|
||||
endif()
|
||||
|
||||
SET(OpenCV_LIBS "${OpenCV_LIB_COMPONENTS}")
|
||||
|
||||
foreach(__opttype OPT DBG)
|
||||
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
|
||||
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
|
||||
|
||||
+62
-40
@@ -2,9 +2,6 @@
|
||||
# CMake file for OpenCV docs
|
||||
#
|
||||
|
||||
file(GLOB FILES_TEX *.tex *.sty *.bib)
|
||||
file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
|
||||
|
||||
if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
|
||||
project(opencv_docs)
|
||||
@@ -23,59 +20,84 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
set(OPTIONAL_DOC_LIST "")
|
||||
|
||||
|
||||
set(OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy)
|
||||
|
||||
# build lists of modules to be documented
|
||||
set(OPENCV2_MODULES "")
|
||||
set(OPENCV_MODULES "")
|
||||
set(BASE_MODULES "")
|
||||
set(EXTRA_MODULES "")
|
||||
|
||||
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
|
||||
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
|
||||
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
|
||||
list(APPEND OPENCV2_MODULES ${mod})
|
||||
list(APPEND BASE_MODULES ${mod})
|
||||
else()
|
||||
list(APPEND OPENCV_MODULES ${mod})
|
||||
list(APPEND EXTRA_MODULES ${mod})
|
||||
endif()
|
||||
endforeach()
|
||||
list(REMOVE_ITEM OPENCV2_MODULES ${OPENCV2_BASE_MODULES})
|
||||
ocv_list_sort(OPENCV2_MODULES)
|
||||
ocv_list_sort(OPENCV_MODULES)
|
||||
|
||||
set(FIXED_ORDER_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy)
|
||||
|
||||
list(REMOVE_ITEM BASE_MODULES ${FIXED_ORDER_MODULES})
|
||||
|
||||
ocv_list_sort(BASE_MODULES)
|
||||
ocv_list_sort(EXTRA_MODULES)
|
||||
|
||||
set(BASE_MODULES ${FIXED_ORDER_MODULES} ${BASE_MODULES})
|
||||
|
||||
# build lists of documentation files and generate table of contents for reference manual
|
||||
set(OPENCV_FILES_REF "")
|
||||
set(OPENCV_FILES_REF_PICT "")
|
||||
|
||||
set(DOC_FAKE_ROOT "${CMAKE_CURRENT_BINARY_DIR}/fake-root")
|
||||
set(DOC_FAKE_ROOT_FILES "")
|
||||
|
||||
function(ocv_doc_add_file_to_fake_root source destination)
|
||||
add_custom_command(
|
||||
OUTPUT "${DOC_FAKE_ROOT}/${destination}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${source}" "${DOC_FAKE_ROOT}/${destination}"
|
||||
DEPENDS "${source}"
|
||||
COMMENT "Copying ${destination} to fake root..."
|
||||
VERBATIM
|
||||
)
|
||||
list(APPEND DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT}/${destination}")
|
||||
set(DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT_FILES}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(ocv_doc_add_to_fake_root source)
|
||||
if(ARGC GREATER 1)
|
||||
set(destination "${ARGV1}")
|
||||
else()
|
||||
file(RELATIVE_PATH destination "${OpenCV_SOURCE_DIR}" "${source}")
|
||||
endif()
|
||||
|
||||
if(IS_DIRECTORY "${source}")
|
||||
file(GLOB_RECURSE files RELATIVE "${source}" "${source}/*")
|
||||
|
||||
foreach(file ${files})
|
||||
ocv_doc_add_file_to_fake_root("${source}/${file}" "${destination}/${file}")
|
||||
endforeach()
|
||||
else()
|
||||
ocv_doc_add_file_to_fake_root("${source}" "${destination}")
|
||||
endif()
|
||||
|
||||
set(DOC_FAKE_ROOT_FILES "${DOC_FAKE_ROOT_FILES}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
set(OPENCV_REFMAN_TOC "")
|
||||
|
||||
foreach(mod ${OPENCV2_BASE_MODULES} ${OPENCV2_MODULES} ${OPENCV_MODULES})
|
||||
file(GLOB_RECURSE _OPENCV_FILES_REF "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.rst")
|
||||
file(GLOB_RECURSE _OPENCV_FILES_REF_PICT "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.png" "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.jpg")
|
||||
list(APPEND OPENCV_FILES_REF ${_OPENCV_FILES_REF})
|
||||
list(APPEND OPENCV_FILES_REF_PICT ${_OPENCV_FILES_REF_PICT})
|
||||
|
||||
set(toc_file "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst")
|
||||
if(EXISTS "${toc_file}")
|
||||
file(RELATIVE_PATH toc_file "${OpenCV_SOURCE_DIR}/modules" "${toc_file}")
|
||||
set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${toc_file}\n")
|
||||
foreach(mod ${BASE_MODULES} ${EXTRA_MODULES})
|
||||
if(EXISTS "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst")
|
||||
ocv_doc_add_to_fake_root("${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc" modules/${mod}/doc)
|
||||
set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${mod}/doc/${mod}.rst\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE _OPENCV_FILES_REF "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.rst")
|
||||
file(GLOB_RECURSE _OPENCV_FILES_REF_PICT "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.png" "${OpenCV_SOURCE_DIR}/platforms/android/service/doc/*.jpg")
|
||||
list(APPEND OPENCV_FILES_REF ${_OPENCV_FILES_REF})
|
||||
list(APPEND OPENCV_FILES_REF_PICT ${_OPENCV_FILES_REF_PICT})
|
||||
configure_file("${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${DOC_FAKE_ROOT}/modules/refman.rst" @ONLY)
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${OpenCV_SOURCE_DIR}/modules/refman.rst" IMMEDIATE @ONLY)
|
||||
|
||||
file(GLOB_RECURSE OPENCV_FILES_UG user_guide/*.rst)
|
||||
file(GLOB_RECURSE OPENCV_FILES_TUT tutorials/*.rst)
|
||||
file(GLOB_RECURSE OPENCV_FILES_TUT_PICT tutorials/*.png tutorials/*.jpg)
|
||||
|
||||
set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
|
||||
${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
|
||||
ocv_doc_add_to_fake_root("${OpenCV_SOURCE_DIR}/index.rst")
|
||||
ocv_doc_add_to_fake_root("${OpenCV_SOURCE_DIR}/doc")
|
||||
ocv_doc_add_to_fake_root("${OpenCV_SOURCE_DIR}/platforms/android")
|
||||
ocv_doc_add_to_fake_root("${OpenCV_SOURCE_DIR}/samples")
|
||||
|
||||
if(PDFLATEX_COMPILER)
|
||||
add_custom_target(docs
|
||||
COMMAND ${SPHINX_BUILD} -b latex -c ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. .
|
||||
COMMAND ${SPHINX_BUILD} -b latex -c "${CMAKE_CURRENT_SOURCE_DIR}" "${DOC_FAKE_ROOT}" .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/doc/opencv1/pics
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/patch_refman_latex.py" opencv2refman.tex
|
||||
@@ -95,7 +117,7 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Generating opencv_cheatsheet.pdf"
|
||||
COMMAND ${PDFLATEX_COMPILER} -interaction=batchmode "${CMAKE_CURRENT_SOURCE_DIR}/opencv_cheatsheet.tex"
|
||||
COMMAND ${PDFLATEX_COMPILER} -interaction=batchmode "${CMAKE_CURRENT_SOURCE_DIR}/opencv_cheatsheet.tex"
|
||||
DEPENDS ${OPENCV_DOC_DEPS}
|
||||
DEPENDS ${DOC_FAKE_ROOT_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating the PDF Manuals"
|
||||
)
|
||||
@@ -109,9 +131,9 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
endif()
|
||||
|
||||
add_custom_target(html_docs
|
||||
COMMAND ${SPHINX_BUILD} -b html -c ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ./_html
|
||||
COMMAND "${SPHINX_BUILD}" -b html -c "${CMAKE_CURRENT_SOURCE_DIR}" "${DOC_FAKE_ROOT}" ./_html
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS ${OPENCV_DOC_DEPS}
|
||||
DEPENDS ${DOC_FAKE_ROOT_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating Online Documentation"
|
||||
)
|
||||
|
||||
@@ -437,7 +437,7 @@ Example. Decimate image by factor of $\sqrt{2}$:\\
|
||||
\texttt{\href{http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html\#watershed}{watershed()}},
|
||||
\texttt{\href{http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html\#grabcut}{grabCut()}}
|
||||
& marker-based image segmentation algorithms.
|
||||
See the samples \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/watershed.cpp}{watershed.cpp}} and \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/grabcut.cpp}{grabcut.cpp}}.
|
||||
See the samples \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/watershed.cpp}{watershed.cpp}} and \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/grabcut.cpp}{grabcut.cpp}}.
|
||||
|
||||
\end{tabular}
|
||||
|
||||
@@ -465,7 +465,7 @@ Example. Compute Hue-Saturation histogram of an image:\\
|
||||
\end{tabbing}
|
||||
|
||||
\subsection{Contours}
|
||||
See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/contours2.cpp}{contours2.cpp}} and \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/squares.cpp}{squares.cpp}}
|
||||
See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/contours2.cpp}{contours2.cpp}} and \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/squares.cpp}{squares.cpp}}
|
||||
samples on what are the contours and how to use them.
|
||||
|
||||
\section{Data I/O}
|
||||
@@ -559,7 +559,7 @@ samples on what are the contours and how to use them.
|
||||
|
||||
\end{tabular}
|
||||
|
||||
See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/camshiftdemo.cpp}{camshiftdemo.cpp}} and other \href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/}{OpenCV samples} on how to use the GUI functions.
|
||||
See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/camshiftdemo.cpp}{camshiftdemo.cpp}} and other \href{https://github.com/Itseez/opencv/tree/master/samples/}{OpenCV samples} on how to use the GUI functions.
|
||||
|
||||
\section{Camera Calibration, Pose Estimation and Depth Estimation}
|
||||
|
||||
@@ -586,10 +586,10 @@ See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/ma
|
||||
|
||||
\end{tabular}
|
||||
|
||||
To calibrate a camera, you can use \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/calibration.cpp}{calibration.cpp}} or
|
||||
\texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/stereo\_calib.cpp}{stereo\_calib.cpp}} samples.
|
||||
To calibrate a camera, you can use \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/calibration.cpp}{calibration.cpp}} or
|
||||
\texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/stereo\_calib.cpp}{stereo\_calib.cpp}} samples.
|
||||
To get the disparity maps and the point clouds, use
|
||||
\texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/stereo\_match.cpp}{stereo\_match.cpp}} sample.
|
||||
\texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/stereo\_match.cpp}{stereo\_match.cpp}} sample.
|
||||
|
||||
\section{Object Detection}
|
||||
|
||||
@@ -597,9 +597,9 @@ To get the disparity maps and the point clouds, use
|
||||
@{}p{\linewidth-\the\MyLen}@{}}
|
||||
\texttt{\href{http://docs.opencv.org/modules/imgproc/doc/object_detection.html\#matchtemplate}{matchTemplate}} & Compute proximity map for given template.\\
|
||||
|
||||
\texttt{\href{http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html\#cascadeclassifier}{CascadeClassifier}} & Viola's Cascade of Boosted classifiers using Haar or LBP features. Suits for detecting faces, facial features and some other objects without diverse textures. See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/c/facedetect.cpp}{facedetect.cpp}}\\
|
||||
\texttt{\href{http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html\#cascadeclassifier}{CascadeClassifier}} & Viola's Cascade of Boosted classifiers using Haar or LBP features. Suits for detecting faces, facial features and some other objects without diverse textures. See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/c/facedetect.cpp}{facedetect.cpp}}\\
|
||||
|
||||
\texttt{{HOGDescriptor}} & N. Dalal's object detector using Histogram-of-Oriented-Gradients (HOG) features. Suits for detecting people, cars and other objects with well-defined silhouettes. See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/peopledetect.cpp}{peopledetect.cpp}}\\
|
||||
\texttt{{HOGDescriptor}} & N. Dalal's object detector using Histogram-of-Oriented-Gradients (HOG) features. Suits for detecting people, cars and other objects with well-defined silhouettes. See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/peopledetect.cpp}{peopledetect.cpp}}\\
|
||||
|
||||
\end{tabular}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ Scalar
|
||||
|
||||
Code
|
||||
=====
|
||||
* This code is in your OpenCV sample folder. Otherwise you can grab it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp>`_
|
||||
* This code is in your OpenCV sample folder. Otherwise you can grab it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp>`_
|
||||
|
||||
Explanation
|
||||
=============
|
||||
|
||||
@@ -23,7 +23,7 @@ Theory
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/features2D/SURF_descriptor.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/features2D/SURF_descriptor.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -19,97 +19,10 @@ Theory
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/features2D/SURF_FlannMatcher.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/features2D/SURF_FlannMatcher.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
void readme();
|
||||
|
||||
/** @function main */
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if( argc != 3 )
|
||||
{ readme(); return -1; }
|
||||
|
||||
Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
|
||||
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
||||
|
||||
if( !img_1.data || !img_2.data )
|
||||
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
|
||||
|
||||
//-- Step 1: Detect the keypoints using SURF Detector
|
||||
int minHessian = 400;
|
||||
|
||||
SurfFeatureDetector detector( minHessian );
|
||||
|
||||
std::vector<KeyPoint> keypoints_1, keypoints_2;
|
||||
|
||||
detector.detect( img_1, keypoints_1 );
|
||||
detector.detect( img_2, keypoints_2 );
|
||||
|
||||
//-- Step 2: Calculate descriptors (feature vectors)
|
||||
SurfDescriptorExtractor extractor;
|
||||
|
||||
Mat descriptors_1, descriptors_2;
|
||||
|
||||
extractor.compute( img_1, keypoints_1, descriptors_1 );
|
||||
extractor.compute( img_2, keypoints_2, descriptors_2 );
|
||||
|
||||
//-- Step 3: Matching descriptor vectors using FLANN matcher
|
||||
FlannBasedMatcher matcher;
|
||||
std::vector< DMatch > matches;
|
||||
matcher.match( descriptors_1, descriptors_2, matches );
|
||||
|
||||
double max_dist = 0; double min_dist = 100;
|
||||
|
||||
//-- Quick calculation of max and min distances between keypoints
|
||||
for( int i = 0; i < descriptors_1.rows; i++ )
|
||||
{ double dist = matches[i].distance;
|
||||
if( dist < min_dist ) min_dist = dist;
|
||||
if( dist > max_dist ) max_dist = dist;
|
||||
}
|
||||
|
||||
printf("-- Max dist : %f \n", max_dist );
|
||||
printf("-- Min dist : %f \n", min_dist );
|
||||
|
||||
//-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist )
|
||||
//-- PS.- radiusMatch can also be used here.
|
||||
std::vector< DMatch > good_matches;
|
||||
|
||||
for( int i = 0; i < descriptors_1.rows; i++ )
|
||||
{ if( matches[i].distance <= 2*min_dist )
|
||||
{ good_matches.push_back( matches[i]); }
|
||||
}
|
||||
|
||||
//-- Draw only "good" matches
|
||||
Mat img_matches;
|
||||
drawMatches( img_1, keypoints_1, img_2, keypoints_2,
|
||||
good_matches, img_matches, Scalar::all(-1), Scalar::all(-1),
|
||||
vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
|
||||
|
||||
//-- Show detected matches
|
||||
imshow( "Good Matches", img_matches );
|
||||
|
||||
for( int i = 0; i < good_matches.size(); i++ )
|
||||
{ printf( "-- Good Match [%d] Keypoint 1: %d -- Keypoint 2: %d \n", i, good_matches[i].queryIdx, good_matches[i].trainIdx ); }
|
||||
|
||||
waitKey(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @function readme */
|
||||
void readme()
|
||||
{ std::cout << " Usage: ./SURF_FlannMatcher <img1> <img2>" << std::endl; }
|
||||
.. literalinclude:: ../../../../samples/cpp/tutorial_code/features2D/SURF_FlannMatcher.cpp
|
||||
:language: cpp
|
||||
|
||||
Explanation
|
||||
============
|
||||
|
||||
@@ -19,7 +19,7 @@ Theory
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ Theory
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp>`_
|
||||
|
||||
.. literalinclude:: ../../../../../samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp
|
||||
:language: cpp
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ Theory
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ How does it work?
|
||||
Code
|
||||
====
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ Erosion
|
||||
Code
|
||||
======
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ Code
|
||||
* Applies 4 different kinds of filters (explained in Theory) and show the filtered images sequentially
|
||||
|
||||
* **Downloadable code**:
|
||||
Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp>`_
|
||||
Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp>`_
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ Code
|
||||
|
||||
* **Downloadable code**:
|
||||
|
||||
a. Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp>`_ for the basic version (explained in this tutorial).
|
||||
b. For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the skin area) you can check the `improved demo <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp>`_
|
||||
c. ...or you can always check out the classical `camshiftdemo <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/camshiftdemo.cpp>`_ in samples.
|
||||
a. Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp>`_ for the basic version (explained in this tutorial).
|
||||
b. For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the skin area) you can check the `improved demo <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp>`_
|
||||
c. ...or you can always check out the classical `camshiftdemo <https://github.com/Itseez/opencv/tree/master/samples/cpp/camshiftdemo.cpp>`_ in samples.
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ Code
|
||||
* Plot the three histograms in a window
|
||||
|
||||
* **Downloadable code**:
|
||||
Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp>`_
|
||||
Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp>`_
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ Code
|
||||
* Display the numerical matching parameters obtained.
|
||||
|
||||
* **Downloadable code**:
|
||||
Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp>`_
|
||||
Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp>`_
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ Code
|
||||
* Display the source and equalized images in a window.
|
||||
|
||||
* **Downloadable code**:
|
||||
Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp>`_
|
||||
Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp>`_
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ Code
|
||||
* Draw a rectangle around the area corresponding to the highest match
|
||||
|
||||
* **Downloadable code**:
|
||||
Click `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp>`_
|
||||
Click `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp>`_
|
||||
|
||||
* **Code at glance:**
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Code
|
||||
* Applies the *Canny Detector* and generates a **mask** (bright lines representing the edges on a black background).
|
||||
* Applies the mask obtained on the original image and display it in a window.
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Code
|
||||
The user chooses either option by pressing 'c' (constant) or 'r' (replicate)
|
||||
* The program finishes when the user presses 'ESC'
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp>`_
|
||||
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@@ -72,7 +72,7 @@ Code
|
||||
|
||||
* The filter output (with each kernel) will be shown during 500 milliseconds
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp>`_
|
||||
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
@@ -40,9 +40,9 @@ Code
|
||||
* Display the detected circle in a window.
|
||||
|
||||
.. |TutorialHoughCirclesSimpleDownload| replace:: here
|
||||
.. _TutorialHoughCirclesSimpleDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/houghcircles.cpp
|
||||
.. _TutorialHoughCirclesSimpleDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/houghcircles.cpp
|
||||
.. |TutorialHoughCirclesFancyDownload| replace:: here
|
||||
.. _TutorialHoughCirclesFancyDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
|
||||
.. _TutorialHoughCirclesFancyDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
|
||||
|
||||
#. The sample code that we will explain can be downloaded from |TutorialHoughCirclesSimpleDownload|_. A slightly fancier version (which shows both Hough standard and probabilistic with trackbars for changing the threshold values) can be found |TutorialHoughCirclesFancyDownload|_.
|
||||
|
||||
|
||||
@@ -89,9 +89,9 @@ Code
|
||||
======
|
||||
|
||||
.. |TutorialHoughLinesSimpleDownload| replace:: here
|
||||
.. _TutorialHoughLinesSimpleDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/houghlines.cpp
|
||||
.. _TutorialHoughLinesSimpleDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/houghlines.cpp
|
||||
.. |TutorialHoughLinesFancyDownload| replace:: here
|
||||
.. _TutorialHoughLinesFancyDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
|
||||
.. _TutorialHoughLinesFancyDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
|
||||
|
||||
|
||||
#. **What does this program do?**
|
||||
|
||||
@@ -55,7 +55,7 @@ Code
|
||||
* Applies a Laplacian operator to the grayscale image and stores the output image
|
||||
* Display the result in a window
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ Code
|
||||
* Each second, apply 1 of 4 different remapping processes to the image and display them indefinitely in a window.
|
||||
* Wait for the user to exit the program
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ Code
|
||||
|
||||
* Applies the *Sobel Operator* and generates as output an image with the detected *edges* bright on a darker background.
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ How do we get an Affine Transformation?
|
||||
|
||||
a. We know both :math:`X` and `T` and we also know that they are related. Then our job is to find :math:`M`
|
||||
|
||||
b. We know :math:`M` and :math:'X`. To obtain :math:`T` we only need to apply :math:`T = M \cdot X`. Our information for :math:`M` may be explicit (i.e. have the 2-by-3 matrix) or it can come as a geometric relation between points.
|
||||
b. We know :math:`M` and :math:`X`. To obtain :math:`T` we only need to apply :math:`T = M \cdot X`. Our information for :math:`M` may be explicit (i.e. have the 2-by-3 matrix) or it can come as a geometric relation between points.
|
||||
|
||||
2. Let's explain a little bit better (b). Since :math:`M` relates 02 images, we can analyze the simplest case in which it relates three points in both images. Look at the figure below:
|
||||
|
||||
@@ -93,7 +93,7 @@ Code
|
||||
* Applies a Rotation to the image after being transformed. This rotation is with respect to the image center
|
||||
* Waits until the user exits the program
|
||||
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp>`_
|
||||
#. The tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ Black Hat
|
||||
Code
|
||||
======
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from `here <http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp>`_
|
||||
This tutorial code's is shown lines below. You can also download it from `here <https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp>`_
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário