Commit dc0788c8 authored by Andrey Kamaev's avatar Andrey Kamaev

Merge branch 2.4

parents 867ddebe 101e9bd4
...@@ -551,7 +551,11 @@ foreach(m ${OPENCV_MODULES_DISABLED_AUTO}) ...@@ -551,7 +551,11 @@ foreach(m ${OPENCV_MODULES_DISABLED_AUTO})
list(APPEND __mdeps ${d}) list(APPEND __mdeps ${d})
endif() endif()
endforeach() endforeach()
list(APPEND OPENCV_MODULES_DISABLED_AUTO_ST "${m}(deps: ${__mdeps})") if(__mdeps)
list(APPEND OPENCV_MODULES_DISABLED_AUTO_ST "${m}(deps: ${__mdeps})")
else()
list(APPEND OPENCV_MODULES_DISABLED_AUTO_ST "${m}")
endif()
endforeach() endforeach()
string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST "${OPENCV_MODULES_DISABLED_AUTO_ST}") string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST "${OPENCV_MODULES_DISABLED_AUTO_ST}")
......
...@@ -174,6 +174,7 @@ endmacro() ...@@ -174,6 +174,7 @@ endmacro()
# Internal macro; partly disables OpenCV module # Internal macro; partly disables OpenCV module
macro(__ocv_module_turn_off the_module) macro(__ocv_module_turn_off the_module)
list(REMOVE_ITEM OPENCV_MODULES_DISABLED_AUTO "${the_module}")
list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}") list(APPEND OPENCV_MODULES_DISABLED_AUTO "${the_module}")
list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}") list(REMOVE_ITEM OPENCV_MODULES_BUILD "${the_module}")
list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}") list(REMOVE_ITEM OPENCV_MODULES_PUBLIC "${the_module}")
...@@ -193,7 +194,7 @@ macro(__ocv_flatten_module_required_dependencies the_module) ...@@ -193,7 +194,7 @@ macro(__ocv_flatten_module_required_dependencies the_module)
break() break()
elseif(";${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO};" MATCHES ";${__dep};") elseif(";${OPENCV_MODULES_DISABLED_USER};${OPENCV_MODULES_DISABLED_AUTO};" MATCHES ";${__dep};")
__ocv_module_turn_off(${the_module}) # depends on disabled module __ocv_module_turn_off(${the_module}) # depends on disabled module
break() list(APPEND __flattened_deps "${__dep}")
elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};") elseif(";${OPENCV_MODULES_BUILD};" MATCHES ";${__dep};")
if(";${__resolved_deps};" MATCHES ";${__dep};") if(";${__resolved_deps};" MATCHES ";${__dep};")
list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved list(APPEND __flattened_deps "${__dep}") # all dependencies of this module are already resolved
...@@ -262,6 +263,7 @@ macro(__ocv_flatten_module_dependencies) ...@@ -262,6 +263,7 @@ macro(__ocv_flatten_module_dependencies)
foreach(m ${OPENCV_MODULES_BUILD}) foreach(m ${OPENCV_MODULES_BUILD})
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will be built in current configuration") set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will be built in current configuration")
__ocv_flatten_module_required_dependencies(${m}) __ocv_flatten_module_required_dependencies(${m})
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened required dependencies of ${m} module")
endforeach() endforeach()
foreach(m ${OPENCV_MODULES_BUILD}) foreach(m ${OPENCV_MODULES_BUILD})
...@@ -286,7 +288,7 @@ macro(__ocv_flatten_module_dependencies) ...@@ -286,7 +288,7 @@ macro(__ocv_flatten_module_dependencies)
ocv_list_unique(OPENCV_MODULES_BUILD_) ocv_list_unique(OPENCV_MODULES_BUILD_)
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export") set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export")
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD_} CACHE INTERNAL "List of OpenCV modules included into the build") set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD_} CACHE INTERNAL "List of OpenCV modules included into the build")
set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies") set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
endmacro() endmacro()
......
...@@ -16,7 +16,7 @@ Today it is common to have a digital video recording system at your disposal. Th ...@@ -16,7 +16,7 @@ Today it is common to have a digital video recording system at your disposal. Th
The source code The source code
=============== ===============
As a test case where to show off these using OpenCV I've created a small program that reads in two video files and performs a similarity check between them. This is something you could use to check just how well a new video compressing algorithms works. Let there be a reference (original) video like :download:`this small Megamind clip <../../../../samples/cpp/tutorial_code/highgui/video-input-psnr-ssim/video/Megamind.avi>` and :download:`a compressed version of it <../../../../samples/cpp/tutorial_code/highgui/video-input-psnr-ssim/video/Megamind_bugy.avi>`. You may also find the source code and these video file in the :file:`samples/cpp/tutorial_code/highgui/video-input-psnr-ssim/` folder of the OpenCV source library. As a test case where to show off these using OpenCV I've created a small program that reads in two video files and performs a similarity check between them. This is something you could use to check just how well a new video compressing algorithms works. Let there be a reference (original) video like :download:`this small Megamind clip <../../../../samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video/Megamind.avi>` and :download:`a compressed version of it <../../../../samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video/Megamind_bugy.avi>`. You may also find the source code and these video file in the :file:`samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/` folder of the OpenCV source library.
.. literalinclude:: ../../../../samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp .. literalinclude:: ../../../../samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp
:language: cpp :language: cpp
......
...@@ -208,7 +208,7 @@ Retina::getMagno ...@@ -208,7 +208,7 @@ Retina::getMagno
Retina::getParameters Retina::getParameters
+++++++++++++++++++++ +++++++++++++++++++++
.. ocv:function:: struct Retina::RetinaParameters Retina::getParameters() .. ocv:function:: Retina::RetinaParameters Retina::getParameters()
Retrieve the current parameters values in a *Retina::RetinaParameters* structure Retrieve the current parameters values in a *Retina::RetinaParameters* structure
...@@ -325,7 +325,7 @@ Retina::RetinaParameters ...@@ -325,7 +325,7 @@ Retina::RetinaParameters
.. ocv:struct:: Retina::RetinaParameters .. ocv:struct:: Retina::RetinaParameters
This structure merges all the parameters that can be adjusted threw the **Retina::setup()**, **Retina::setupOPLandIPLParvoChannel** and **Retina::setupIPLMagnoChannel** setup methods This structure merges all the parameters that can be adjusted threw the **Retina::setup()**, **Retina::setupOPLandIPLParvoChannel** and **Retina::setupIPLMagnoChannel** setup methods
Parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel. :: Parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel. ::
class RetinaParameters{ class RetinaParameters{
struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters
......
...@@ -115,7 +115,7 @@ class CV_EXPORTS Retina { ...@@ -115,7 +115,7 @@ class CV_EXPORTS Retina {
public: public:
// parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel // parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel
struct RetinaParameters{ struct RetinaParameters{
struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters
OPLandIplParvoParameters():colorMode(true), OPLandIplParvoParameters():colorMode(true),
normaliseOutput(true), normaliseOutput(true),
...@@ -166,14 +166,14 @@ public: ...@@ -166,14 +166,14 @@ public:
virtual ~Retina(); virtual ~Retina();
/** /**
* retreive retina input buffer size * retreive retina input buffer size
*/ */
Size inputSize(); Size inputSize();
/** /**
* retreive retina output buffer size * retreive retina output buffer size
*/ */
Size outputSize(); Size outputSize();
/** /**
* try to open an XML retina parameters file to adjust current retina instance setup * try to open an XML retina parameters file to adjust current retina instance setup
...@@ -190,9 +190,9 @@ public: ...@@ -190,9 +190,9 @@ public:
* => if the xml file does not exist, then default setup is applied * => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid * => warning, Exceptions are thrown if read XML file is not valid
* @param fs : the open Filestorage which contains retina parameters * @param fs : the open Filestorage which contains retina parameters
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/ */
void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true); void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
/** /**
* try to open an XML retina parameters file to adjust current retina instance setup * try to open an XML retina parameters file to adjust current retina instance setup
...@@ -206,7 +206,7 @@ public: ...@@ -206,7 +206,7 @@ public:
/** /**
* @return the current parameters setup * @return the current parameters setup
*/ */
struct Retina::RetinaParameters getParameters(); Retina::RetinaParameters getParameters();
/** /**
* parameters setup display method * parameters setup display method
...@@ -305,17 +305,17 @@ public: ...@@ -305,17 +305,17 @@ public:
*/ */
void clearBuffers(); void clearBuffers();
/** /**
* Activate/desactivate the Magnocellular pathway processing (motion information extraction), by default, it is activated * Activate/desactivate the Magnocellular pathway processing (motion information extraction), by default, it is activated
* @param activate: true if Magnocellular output should be activated, false if not * @param activate: true if Magnocellular output should be activated, false if not
*/ */
void activateMovingContoursProcessing(const bool activate); void activateMovingContoursProcessing(const bool activate);
/** /**
* Activate/desactivate the Parvocellular pathway processing (contours information extraction), by default, it is activated * Activate/desactivate the Parvocellular pathway processing (contours information extraction), by default, it is activated
* @param activate: true if Parvocellular (contours information extraction) output should be activated, false if not * @param activate: true if Parvocellular (contours information extraction) output should be activated, false if not
*/ */
void activateContoursProcessing(const bool activate); void activateContoursProcessing(const bool activate);
protected: protected:
// Parameteres setup members // Parameteres setup members
......
This diff is collapsed.
...@@ -166,6 +166,12 @@ field of the set is the total number of nodes both occupied and free. When an oc ...@@ -166,6 +166,12 @@ field of the set is the total number of nodes both occupied and free. When an oc
``CvSet`` is used to represent graphs (:ocv:struct:`CvGraph`), sparse multi-dimensional arrays (:ocv:struct:`CvSparseMat`), and planar subdivisions (:ocv:struct:`CvSubdiv2D`). ``CvSet`` is used to represent graphs (:ocv:struct:`CvGraph`), sparse multi-dimensional arrays (:ocv:struct:`CvSparseMat`), and planar subdivisions (:ocv:struct:`CvSubdiv2D`).
CvSetElem
---------
.. ocv:struct:: CvSetElem
The structure is represent single element of :ocv:struct:`CvSet`. It consists of two fields: element data pointer and flags.
CvGraph CvGraph
------- -------
...@@ -174,6 +180,24 @@ CvGraph ...@@ -174,6 +180,24 @@ CvGraph
The structure ``CvGraph`` is a base for graphs used in OpenCV 1.x. It inherits from The structure ``CvGraph`` is a base for graphs used in OpenCV 1.x. It inherits from
:ocv:struct:`CvSet`, that is, it is considered as a set of vertices. Besides, it contains another set as a member, a set of graph edges. Graphs in OpenCV are represented using adjacency lists format. :ocv:struct:`CvSet`, that is, it is considered as a set of vertices. Besides, it contains another set as a member, a set of graph edges. Graphs in OpenCV are represented using adjacency lists format.
CvGraphVtx
----------
.. ocv:struct:: CvGraphVtx
The structure represents single vertex in :ocv:struct:`CvGraph`. It consists of two filds: pointer to first edge and flags.
CvGraphEdge
-----------
.. ocv:struct:: CvGraphEdge
The structure represents edge in :ocv:struct:`CvGraph`. Each edge consists of:
- Two pointers to the starting and ending vertices (vtx[0] and vtx[1] respectively);
- Two pointers to next edges for the starting and ending vertices, where
next[0] points to the next edge in the vtx[0] adjacency list and
next[1] points to the next edge in the vtx[1] adjacency list;
- Weight;
- Flags.
CvGraphScanner CvGraphScanner
-------------- --------------
......
...@@ -3241,7 +3241,7 @@ The constructors. ...@@ -3241,7 +3241,7 @@ The constructors.
* **SVD::NO_UV** indicates that only a vector of singular values ``w`` is to be processed, while ``u`` and ``vt`` will be set to empty matrices. * **SVD::NO_UV** indicates that only a vector of singular values ``w`` is to be processed, while ``u`` and ``vt`` will be set to empty matrices.
* **SVD::FULL_UV** when the matrix is not square, by default the algorithm produces ``u`` and ``vt`` matrices of sufficiently large size for the further ``A`` reconstruction; if, however, ``FULL_UV`` flag is specified, ``u`` and ``vt``will be full-size square orthogonal matrices. * **SVD::FULL_UV** when the matrix is not square, by default the algorithm produces ``u`` and ``vt`` matrices of sufficiently large size for the further ``A`` reconstruction; if, however, ``FULL_UV`` flag is specified, ``u`` and ``vt`` will be full-size square orthogonal matrices.
The first constructor initializes an empty ``SVD`` structure. The second constructor initializes an empty ``SVD`` structure and then calls The first constructor initializes an empty ``SVD`` structure. The second constructor initializes an empty ``SVD`` structure and then calls
:ocv:funcx:`SVD::operator()` . :ocv:funcx:`SVD::operator()` .
......
...@@ -113,7 +113,7 @@ Detects keypoints in an image (first variant) or image set (second variant). ...@@ -113,7 +113,7 @@ Detects keypoints in an image (first variant) or image set (second variant).
:param masks: Masks for each input image specifying where to look for keypoints (optional). ``masks[i]`` is a mask for ``images[i]``. :param masks: Masks for each input image specifying where to look for keypoints (optional). ``masks[i]`` is a mask for ``images[i]``.
FeatureDetector::create FeatureDetector::create
--------------------------- -----------------------
Creates a feature detector by its name. Creates a feature detector by its name.
.. ocv:function:: Ptr<FeatureDetector> FeatureDetector::create( const string& detectorType ) .. ocv:function:: Ptr<FeatureDetector> FeatureDetector::create( const string& detectorType )
...@@ -219,8 +219,7 @@ StarFeatureDetector ...@@ -219,8 +219,7 @@ StarFeatureDetector
------------------- -------------------
.. ocv:class:: StarFeatureDetector : public FeatureDetector .. ocv:class:: StarFeatureDetector : public FeatureDetector
Wrapping class for feature detection using the The class implements the keypoint detector introduced by K. Konolige, synonym of ``StarDetector``. ::
:ocv:class:`StarDetector` class. ::
class StarFeatureDetector : public FeatureDetector class StarFeatureDetector : public FeatureDetector
{ {
...@@ -412,7 +411,7 @@ Example of creating ``DynamicAdaptedFeatureDetector`` : :: ...@@ -412,7 +411,7 @@ Example of creating ``DynamicAdaptedFeatureDetector`` : ::
DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector
---------------------------------------------------------------- ------------------------------------------------------------
The constructor The constructor
.. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 ) .. ocv:function:: DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 )
...@@ -484,7 +483,7 @@ Example: :: ...@@ -484,7 +483,7 @@ Example: ::
AdjusterAdapter::good AdjusterAdapter::good
------------------------- ---------------------
Returns false if the detector parameters cannot be adjusted any more. Returns false if the detector parameters cannot be adjusted any more.
.. ocv:function:: bool AdjusterAdapter::good() const .. ocv:function:: bool AdjusterAdapter::good() const
...@@ -497,7 +496,7 @@ Example: :: ...@@ -497,7 +496,7 @@ Example: ::
} }
AdjusterAdapter::create AdjusterAdapter::create
------------------------- -----------------------
Creates an adjuster adapter by name Creates an adjuster adapter by name
.. ocv:function:: Ptr<AdjusterAdapter> AdjusterAdapter::create( const string& detectorType ) .. ocv:function:: Ptr<AdjusterAdapter> AdjusterAdapter::create( const string& detectorType )
...@@ -528,3 +527,23 @@ StarAdjuster ...@@ -528,3 +527,23 @@ StarAdjuster
StarAdjuster(double initial_thresh = 30.0); StarAdjuster(double initial_thresh = 30.0);
... ...
}; };
SurfAdjuster
------------
.. ocv:class:: SurfAdjuster: public AdjusterAdapter
:ocv:class:`AdjusterAdapter` for ``SurfFeatureDetector``. ::
class CV_EXPORTS SurfAdjuster: public AdjusterAdapter
{
public:
SurfAdjuster( double initial_thresh=400.f, double min_thresh=2, double max_thresh=1000 );
virtual void tooFew(int minv, int n_detected);
virtual void tooMany(int maxv, int n_detected);
virtual bool good() const;
virtual Ptr<AdjusterAdapter> clone() const;
...
};
...@@ -6,6 +6,7 @@ Fast Approximate Nearest Neighbor Search ...@@ -6,6 +6,7 @@ Fast Approximate Nearest Neighbor Search
This section documents OpenCV's interface to the FLANN library. FLANN (Fast Library for Approximate Nearest Neighbors) is a library that contains a collection of algorithms optimized for fast nearest neighbor search in large datasets and for high dimensional features. More information about FLANN can be found in [Muja2009]_ . This section documents OpenCV's interface to the FLANN library. FLANN (Fast Library for Approximate Nearest Neighbors) is a library that contains a collection of algorithms optimized for fast nearest neighbor search in large datasets and for high dimensional features. More information about FLANN can be found in [Muja2009]_ .
.. [Muja2009] Marius Muja, David G. Lowe. Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration, 2009
flann::Index\_ flann::Index\_
----------------- -----------------
...@@ -150,7 +151,7 @@ flann::Index_<T>::knnSearch ...@@ -150,7 +151,7 @@ flann::Index_<T>::knnSearch
---------------------------- ----------------------------
Performs a K-nearest neighbor search for a given query point using the index. Performs a K-nearest neighbor search for a given query point using the index.
.. ocv:function:: void flann::Index_<T>::knnSearch(const vector<T>& query, vector<int>& indices, vector<float>& dists, int knn, const SearchParams& params) .. ocv:function:: void flann::Index_<T>::knnSearch(const vector<T>& query, vector<int>& indices, vector<float>& dists, int knn, const SearchParams& params)
.. ocv:function:: void flann::Index_<T>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const SearchParams& params) .. ocv:function:: void flann::Index_<T>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const SearchParams& params)
...@@ -179,9 +180,9 @@ flann::Index_<T>::radiusSearch ...@@ -179,9 +180,9 @@ flann::Index_<T>::radiusSearch
-------------------------------------- --------------------------------------
Performs a radius nearest neighbor search for a given query point. Performs a radius nearest neighbor search for a given query point.
.. ocv:function:: int flann::Index_<T>::radiusSearch(const vector<T>& query, vector<int>& indices, vector<float>& dists, float radius, const SearchParams& params) .. ocv:function:: int flann::Index_<T>::radiusSearch(const vector<T>& query, vector<int>& indices, vector<float>& dists, float radius, const SearchParams& params)
.. ocv:function:: int flann::Index_<T>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, float radius, const SearchParams& params) .. ocv:function:: int flann::Index_<T>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, float radius, const SearchParams& params)
:param query: The query point :param query: The query point
......
...@@ -6,7 +6,7 @@ Initalization and Information ...@@ -6,7 +6,7 @@ Initalization and Information
gpu::getCudaEnabledDeviceCount gpu::getCudaEnabledDeviceCount
---------------------------------- ------------------------------
Returns the number of installed CUDA-enabled devices. Returns the number of installed CUDA-enabled devices.
.. ocv:function:: int gpu::getCudaEnabledDeviceCount() .. ocv:function:: int gpu::getCudaEnabledDeviceCount()
...@@ -16,7 +16,7 @@ Use this function before any other GPU functions calls. If OpenCV is compiled wi ...@@ -16,7 +16,7 @@ Use this function before any other GPU functions calls. If OpenCV is compiled wi
gpu::setDevice gpu::setDevice
------------------ --------------
Sets a device and initializes it for the current thread. Sets a device and initializes it for the current thread.
.. ocv:function:: void gpu::setDevice(int device) .. ocv:function:: void gpu::setDevice(int device)
...@@ -28,7 +28,7 @@ If the call of this function is omitted, a default device is initialized at the ...@@ -28,7 +28,7 @@ If the call of this function is omitted, a default device is initialized at the
gpu::getDevice gpu::getDevice
------------------ --------------
Returns the current device index set by :ocv:func:`gpu::setDevice` or initialized by default. Returns the current device index set by :ocv:func:`gpu::setDevice` or initialized by default.
.. ocv:function:: int gpu::getDevice() .. ocv:function:: int gpu::getDevice()
...@@ -36,7 +36,7 @@ Returns the current device index set by :ocv:func:`gpu::setDevice` or initialize ...@@ -36,7 +36,7 @@ Returns the current device index set by :ocv:func:`gpu::setDevice` or initialize
gpu::resetDevice gpu::resetDevice
------------------ ----------------
Explicitly destroys and cleans up all resources associated with the current device in the current process. Explicitly destroys and cleans up all resources associated with the current device in the current process.
.. ocv:function:: void gpu::resetDevice() .. ocv:function:: void gpu::resetDevice()
...@@ -47,8 +47,7 @@ Any subsequent API call to this device will reinitialize the device. ...@@ -47,8 +47,7 @@ Any subsequent API call to this device will reinitialize the device.
gpu::FeatureSet gpu::FeatureSet
--------------- ---------------
Enumeration providing GPU computing features. ::
Class providing GPU computing features. ::
enum FeatureSet enum FeatureSet
{ {
...@@ -64,7 +63,6 @@ Class providing GPU computing features. :: ...@@ -64,7 +63,6 @@ Class providing GPU computing features. ::
}; };
gpu::TargetArchs gpu::TargetArchs
---------------- ----------------
.. ocv:class:: gpu::TargetArchs .. ocv:class:: gpu::TargetArchs
...@@ -132,7 +130,7 @@ Class providing functionality for querying the specified GPU properties. :: ...@@ -132,7 +130,7 @@ Class providing functionality for querying the specified GPU properties. ::
gpu::DeviceInfo::DeviceInfo gpu::DeviceInfo::DeviceInfo
------------------------------- ---------------------------
The constructors. The constructors.
.. ocv:function:: gpu::DeviceInfo::DeviceInfo() .. ocv:function:: gpu::DeviceInfo::DeviceInfo()
...@@ -146,7 +144,7 @@ Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` ...@@ -146,7 +144,7 @@ Constructs the ``DeviceInfo`` object for the specified device. If ``device_id``
gpu::DeviceInfo::name gpu::DeviceInfo::name
------------------------- ---------------------
Returns the device name. Returns the device name.
.. ocv:function:: string gpu::DeviceInfo::name() const .. ocv:function:: string gpu::DeviceInfo::name() const
...@@ -154,7 +152,7 @@ Returns the device name. ...@@ -154,7 +152,7 @@ Returns the device name.
gpu::DeviceInfo::majorVersion gpu::DeviceInfo::majorVersion
--------------------------------- -----------------------------
Returns the major compute capability version. Returns the major compute capability version.
.. ocv:function:: int gpu::DeviceInfo::majorVersion() .. ocv:function:: int gpu::DeviceInfo::majorVersion()
...@@ -162,7 +160,7 @@ Returns the major compute capability version. ...@@ -162,7 +160,7 @@ Returns the major compute capability version.
gpu::DeviceInfo::minorVersion gpu::DeviceInfo::minorVersion
--------------------------------- -----------------------------
Returns the minor compute capability version. Returns the minor compute capability version.
.. ocv:function:: int gpu::DeviceInfo::minorVersion() .. ocv:function:: int gpu::DeviceInfo::minorVersion()
...@@ -170,7 +168,7 @@ Returns the minor compute capability version. ...@@ -170,7 +168,7 @@ Returns the minor compute capability version.
gpu::DeviceInfo::multiProcessorCount gpu::DeviceInfo::multiProcessorCount
---------------------------------------- ------------------------------------
Returns the number of streaming multiprocessors. Returns the number of streaming multiprocessors.
.. ocv:function:: int gpu::DeviceInfo::multiProcessorCount() .. ocv:function:: int gpu::DeviceInfo::multiProcessorCount()
...@@ -178,7 +176,7 @@ Returns the number of streaming multiprocessors. ...@@ -178,7 +176,7 @@ Returns the number of streaming multiprocessors.
gpu::DeviceInfo::freeMemory gpu::DeviceInfo::freeMemory
------------------------------- ---------------------------
Returns the amount of free memory in bytes. Returns the amount of free memory in bytes.
.. ocv:function:: size_t gpu::DeviceInfo::freeMemory() .. ocv:function:: size_t gpu::DeviceInfo::freeMemory()
...@@ -186,7 +184,7 @@ Returns the amount of free memory in bytes. ...@@ -186,7 +184,7 @@ Returns the amount of free memory in bytes.
gpu::DeviceInfo::totalMemory gpu::DeviceInfo::totalMemory
-------------------------------- ----------------------------
Returns the amount of total memory in bytes. Returns the amount of total memory in bytes.
.. ocv:function:: size_t gpu::DeviceInfo::totalMemory() .. ocv:function:: size_t gpu::DeviceInfo::totalMemory()
...@@ -194,7 +192,7 @@ Returns the amount of total memory in bytes. ...@@ -194,7 +192,7 @@ Returns the amount of total memory in bytes.
gpu::DeviceInfo::supports gpu::DeviceInfo::supports
----------------------------- -------------------------
Provides information on GPU feature support. Provides information on GPU feature support.
.. ocv:function:: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const .. ocv:function:: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const
...@@ -206,7 +204,7 @@ This function returns ``true`` if the device has the specified GPU feature. Othe ...@@ -206,7 +204,7 @@ This function returns ``true`` if the device has the specified GPU feature. Othe
gpu::DeviceInfo::isCompatible gpu::DeviceInfo::isCompatible
--------------------------------- -----------------------------
Checks the GPU module and device compatibility. Checks the GPU module and device compatibility.
.. ocv:function:: bool gpu::DeviceInfo::isCompatible() .. ocv:function:: bool gpu::DeviceInfo::isCompatible()
...@@ -216,7 +214,7 @@ This function returns ``true`` if the GPU module can be run on the specified dev ...@@ -216,7 +214,7 @@ This function returns ``true`` if the GPU module can be run on the specified dev
gpu::DeviceInfo::deviceID gpu::DeviceInfo::deviceID
--------------------------------- -------------------------
Returns system index of the GPU device starting with 0. Returns system index of the GPU device starting with 0.
.. ocv:function:: int gpu::DeviceInfo::deviceID() .. ocv:function:: int gpu::DeviceInfo::deviceID()
...@@ -785,7 +785,7 @@ Constructors. ...@@ -785,7 +785,7 @@ Constructors.
:param fps: Framerate of the created video stream. :param fps: Framerate of the created video stream.
:param params: Encoder parameters. See :ocv:class:`gpu::VideoWriter_GPU::EncoderParams` . :param params: Encoder parameters. See :ocv:struct:`gpu::VideoWriter_GPU::EncoderParams` .
:param format: Surface format of input frames ( ``SF_UYVY`` , ``SF_YUY2`` , ``SF_YV12`` , ``SF_NV12`` , ``SF_IYUV`` , ``SF_BGR`` or ``SF_GRAY``). BGR or gray frames will be converted to YV12 format before encoding, frames with other formats will be used as is. :param format: Surface format of input frames ( ``SF_UYVY`` , ``SF_YUY2`` , ``SF_YV12`` , ``SF_NV12`` , ``SF_IYUV`` , ``SF_BGR`` or ``SF_GRAY``). BGR or gray frames will be converted to YV12 format before encoding, frames with other formats will be used as is.
......
...@@ -295,7 +295,12 @@ endif(ANDROID) ...@@ -295,7 +295,12 @@ endif(ANDROID)
add_dependencies(${lib_target} ${api_target}) add_dependencies(${lib_target} ${api_target})
add_dependencies(${the_module} ${lib_target}) add_dependencies(${the_module} ${lib_target})
#android test project # android test project
if(ANDROID AND BUILD_TESTS) if(ANDROID AND BUILD_TESTS)
add_subdirectory(android_test) add_subdirectory(android_test)
endif() endif()
# Desktop Java test project.
if((NOT ANDROID) AND BUILD_TESTS)
add_subdirectory(java_test)
endif()
package org.opencv.test; package org.opencv.test;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.nio.MappedByteBuffer; import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
...@@ -426,24 +428,19 @@ public class OpenCVTestCase extends TestCase { ...@@ -426,24 +428,19 @@ public class OpenCVTestCase extends TestCase {
} }
protected static String readFile(String path) { protected static String readFile(String path) {
FileInputStream stream = null;
try { try {
stream = new FileInputStream(new File(path)); BufferedReader br = new BufferedReader(new FileReader(path));
FileChannel fc = stream.getChannel(); String line;
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, StringBuffer result = new StringBuffer();
fc.size()); while ((line = br.readLine()) != null) {
return Charset.defaultCharset().decode(bb).toString(); result.append(line);
result.append("\n");
}
return result.toString();
} catch (IOException e) { } catch (IOException e) {
OpenCVTestRunner.Log("Failed to read file \"" + path OpenCVTestRunner.Log("Failed to read file \"" + path
+ "\". Exception is thrown: " + e); + "\". Exception is thrown: " + e);
return null; return null;
} finally {
if (stream != null)
try {
stream.close();
} catch (IOException e) {
OpenCVTestRunner.Log("Exception is thrown: " + e);
}
} }
} }
......
...@@ -77,7 +77,8 @@ public class TermCriteriaTest extends OpenCVTestCase { ...@@ -77,7 +77,8 @@ public class TermCriteriaTest extends OpenCVTestCase {
public void testToString() { public void testToString() {
String actual = tc2.toString(); String actual = tc2.toString();
String expected = "{ type: 2, maxCount: 4, epsilon: 0.001}"; double eps = EPS;
String expected = "{ type: 2, maxCount: 4, epsilon: " + eps + "}";
assertEquals(expected, actual); assertEquals(expected, actual);
} }
......
...@@ -26,10 +26,9 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase { ...@@ -26,10 +26,9 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
extractor = DescriptorExtractor.create(DescriptorExtractor.BRIEF); extractor = DescriptorExtractor.create(DescriptorExtractor.BRIEF);
matSize = 100; matSize = 100;
super.setUp();
} }
public void testComputeListOfMatListOfListOfKeyPointListOfMat() { public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
......
...@@ -80,6 +80,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase { ...@@ -80,6 +80,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
matSize = 100; matSize = 100;
...@@ -90,8 +91,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase { ...@@ -90,8 +91,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
new DMatch(3, 1, 0, 0.48435235f), new DMatch(3, 1, 0, 0.48435235f),
new DMatch(4, 0, 0, 1.0836693f) new DMatch(4, 0, 0, 1.0836693f)
}; };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -65,6 +65,7 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase { ...@@ -65,6 +65,7 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
matSize = 100; matSize = 100;
...@@ -73,7 +74,6 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase { ...@@ -73,7 +74,6 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
new DMatch(1, 2, 0, 42), new DMatch(1, 2, 0, 42),
new DMatch(2, 1, 0, 40), new DMatch(2, 1, 0, 40),
new DMatch(3, 3, 0, 53) }; new DMatch(3, 3, 0, 53) };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -65,6 +65,7 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase { ...@@ -65,6 +65,7 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT);
matSize = 100; matSize = 100;
...@@ -73,7 +74,6 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase { ...@@ -73,7 +74,6 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
new DMatch(1, 2, 0, 42), new DMatch(1, 2, 0, 42),
new DMatch(2, 1, 0, 40), new DMatch(2, 1, 0, 40),
new DMatch(3, 3, 0, 53) }; new DMatch(3, 3, 0, 53) };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -80,6 +80,7 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase { ...@@ -80,6 +80,7 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_L1); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_L1);
matSize = 100; matSize = 100;
...@@ -90,7 +91,6 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase { ...@@ -90,7 +91,6 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
new DMatch(3, 1, 0, 2.6545324f), new DMatch(3, 1, 0, 2.6545324f),
new DMatch(4, 0, 0, 6.1294870f) new DMatch(4, 0, 0, 6.1294870f)
}; };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -85,6 +85,7 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase { ...@@ -85,6 +85,7 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
matSize = 100; matSize = 100;
...@@ -95,8 +96,6 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase { ...@@ -95,8 +96,6 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
new DMatch(3, 1, 0, 0.23459719f), new DMatch(3, 1, 0, 0.23459719f),
new DMatch(4, 0, 0, 1.174339f) new DMatch(4, 0, 0, 1.174339f)
}; };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -35,12 +35,10 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase { ...@@ -35,12 +35,10 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
detector = FeatureDetector.create(FeatureDetector.FAST); detector = FeatureDetector.create(FeatureDetector.FAST);
truth = new KeyPoint[] { new KeyPoint(32, 27, 7, -1, 254, 0, -1), new KeyPoint(27, 32, 7, -1, 254, 0, -1), new KeyPoint(73, 68, 7, -1, 254, 0, -1), truth = new KeyPoint[] { new KeyPoint(32, 27, 7, -1, 254, 0, -1), new KeyPoint(27, 32, 7, -1, 254, 0, -1), new KeyPoint(73, 68, 7, -1, 254, 0, -1),
new KeyPoint(68, 73, 7, -1, 254, 0, -1) }; new KeyPoint(68, 73, 7, -1, 254, 0, -1) };
super.setUp();
} }
public void testCreate() { public void testCreate() {
......
...@@ -154,9 +154,9 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase { ...@@ -154,9 +154,9 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED); matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);
matSize = 100; matSize = 100;
truth = new DMatch[] { truth = new DMatch[] {
new DMatch(0, 0, 0, 1.049694f), new DMatch(0, 0, 0, 1.049694f),
new DMatch(1, 0, 0, 1.0984558f), new DMatch(1, 0, 0, 1.0984558f),
...@@ -164,8 +164,6 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase { ...@@ -164,8 +164,6 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
new DMatch(3, 1, 0, 0.48435235f), new DMatch(3, 1, 0, 0.48435235f),
new DMatch(4, 0, 0, 1.0836693f) new DMatch(4, 0, 0, 1.0836693f)
}; };
super.setUp();
} }
public void testAdd() { public void testAdd() {
......
...@@ -31,10 +31,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase { ...@@ -31,10 +31,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
extractor = DescriptorExtractor.create(DescriptorExtractor.ORB); extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
matSize = 100; matSize = 100;
super.setUp();
} }
public void testComputeListOfMatListOfListOfKeyPointListOfMat() { public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
...@@ -101,7 +100,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase { ...@@ -101,7 +100,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
extractor.write(filename); extractor.write(filename);
String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.ORB</name>\n<WTA_K>2</WTA_K>\n<edgeThreshold>31</edgeThreshold>\n<firstLevel>0</firstLevel>\n<nFeatures>500</nFeatures>\n<nLevels>8</nLevels>\n<patchSize>31</patchSize>\n<scaleFactor>1.2000000476837158e+00</scaleFactor>\n<scoreType>0</scoreType>\n</opencv_storage>\n"; String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.ORB</name>\n<WTA_K>2</WTA_K>\n<edgeThreshold>31</edgeThreshold>\n<firstLevel>0</firstLevel>\n<nFeatures>500</nFeatures>\n<nLevels>8</nLevels>\n<patchSize>31</patchSize>\n<scaleFactor>1.2000000476837158e+00</scaleFactor>\n<scoreType>0</scoreType>\n</opencv_storage>\n";
assertEquals(truth, readFile(filename)); String actual = readFile(filename);
actual = actual.replaceAll("e\\+000", "e+00"); // NOTE: workaround for different platforms double representation
assertEquals(truth, actual);
} }
public void testWriteYml() { public void testWriteYml() {
...@@ -110,7 +111,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase { ...@@ -110,7 +111,9 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
extractor.write(filename); extractor.write(filename);
String truth = "%YAML:1.0\nname: \"Feature2D.ORB\"\nWTA_K: 2\nedgeThreshold: 31\nfirstLevel: 0\nnFeatures: 500\nnLevels: 8\npatchSize: 31\nscaleFactor: 1.2000000476837158e+00\nscoreType: 0\n"; String truth = "%YAML:1.0\nname: \"Feature2D.ORB\"\nWTA_K: 2\nedgeThreshold: 31\nfirstLevel: 0\nnFeatures: 500\nnLevels: 8\npatchSize: 31\nscaleFactor: 1.2000000476837158e+00\nscoreType: 0\n";
assertEquals(truth, readFile(filename)); String actual = readFile(filename);
actual = actual.replaceAll("e\\+000", "e+00"); // NOTE: workaround for different platforms double representation
assertEquals(truth, actual);
} }
} }
...@@ -28,6 +28,7 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase { ...@@ -28,6 +28,7 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
extractor = DescriptorExtractor.create(DescriptorExtractor.SIFT); extractor = DescriptorExtractor.create(DescriptorExtractor.SIFT);
keypoint = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1); keypoint = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
matSize = 100; matSize = 100;
...@@ -44,8 +45,6 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase { ...@@ -44,8 +45,6 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
); );
} }
}; };
super.setUp();
} }
public void testComputeListOfMatListOfListOfKeyPointListOfMat() { public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
...@@ -88,7 +87,9 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase { ...@@ -88,7 +87,9 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
extractor.write(filename); extractor.write(filename);
String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.SIFT</name>\n<contrastThreshold>4.0000000000000001e-02</contrastThreshold>\n<edgeThreshold>10.</edgeThreshold>\n<nFeatures>0</nFeatures>\n<nOctaveLayers>3</nOctaveLayers>\n<sigma>1.6000000000000001e+00</sigma>\n</opencv_storage>\n"; String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.SIFT</name>\n<contrastThreshold>4.0000000000000001e-02</contrastThreshold>\n<edgeThreshold>10.</edgeThreshold>\n<nFeatures>0</nFeatures>\n<nOctaveLayers>3</nOctaveLayers>\n<sigma>1.6000000000000001e+00</sigma>\n</opencv_storage>\n";
assertEquals(truth, readFile(filename)); String actual = readFile(filename);
actual = actual.replaceAll("e([+-])0(\\d\\d)", "e$1$2"); // NOTE: workaround for different platforms double representation
assertEquals(truth, actual);
} }
public void testWriteYml() { public void testWriteYml() {
...@@ -97,7 +98,9 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase { ...@@ -97,7 +98,9 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
extractor.write(filename); extractor.write(filename);
String truth = "%YAML:1.0\nname: \"Feature2D.SIFT\"\ncontrastThreshold: 4.0000000000000001e-02\nedgeThreshold: 10.\nnFeatures: 0\nnOctaveLayers: 3\nsigma: 1.6000000000000001e+00\n"; String truth = "%YAML:1.0\nname: \"Feature2D.SIFT\"\ncontrastThreshold: 4.0000000000000001e-02\nedgeThreshold: 10.\nnFeatures: 0\nnOctaveLayers: 3\nsigma: 1.6000000000000001e+00\n";
assertEquals(truth, readFile(filename)); String actual = readFile(filename);
actual = actual.replaceAll("e([+-])0(\\d\\d)", "e$1$2"); // NOTE: workaround for different platforms double representation
assertEquals(truth, actual);
} }
} }
...@@ -42,22 +42,10 @@ public class STARFeatureDetectorTest extends OpenCVTestCase { ...@@ -42,22 +42,10 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
} }
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
detector = FeatureDetector.create(FeatureDetector.STAR); detector = FeatureDetector.create(FeatureDetector.STAR);
matSize = 200; matSize = 200;
truth = new KeyPoint[] { truth = new KeyPoint[] {
/*
new KeyPoint(95, 80, 22, -1, 31.595734f, 0, -1),
new KeyPoint(105, 80, 22, -1, 31.595734f, 0, -1),
new KeyPoint(80, 95, 22, -1, 31.595734f, 0, -1),
new KeyPoint(120, 95, 22, -1, 31.595734f, 0, -1),
new KeyPoint(100, 100, 8, -1, -219.90825f, 0, -1),
new KeyPoint(80, 105, 22, -1, 31.595734f, 0, -1),
new KeyPoint(120, 105, 22, -1, 31.595734f, 0, -1),
new KeyPoint(95, 120, 22, -1, 31.595734f, 0, -1),
new KeyPoint(105, 120, 22, -1, 31.595734f, 0, -1)
*/
new KeyPoint( 95, 80, 22, -1, 31.5957f, 0, -1), new KeyPoint( 95, 80, 22, -1, 31.5957f, 0, -1),
new KeyPoint(105, 80, 22, -1, 31.5957f, 0, -1), new KeyPoint(105, 80, 22, -1, 31.5957f, 0, -1),
new KeyPoint( 80, 95, 22, -1, 31.5957f, 0, -1), new KeyPoint( 80, 95, 22, -1, 31.5957f, 0, -1),
...@@ -68,8 +56,6 @@ public class STARFeatureDetectorTest extends OpenCVTestCase { ...@@ -68,8 +56,6 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
new KeyPoint( 95, 120, 22, -1, 31.5957f, 0, -1), new KeyPoint( 95, 120, 22, -1, 31.5957f, 0, -1),
new KeyPoint(105, 120, 22, -1, 31.5957f, 0, -1) new KeyPoint(105, 120, 22, -1, 31.5957f, 0, -1)
}; };
super.setUp();
} }
public void testCreate() { public void testCreate() {
......
...@@ -26,10 +26,9 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase { ...@@ -26,10 +26,9 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
extractor = DescriptorExtractor.create(DescriptorExtractor.SURF); extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
matSize = 100; matSize = 100;
super.setUp();
} }
public void testComputeListOfMatListOfListOfKeyPointListOfMat() { public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
......
...@@ -52,18 +52,15 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase { ...@@ -52,18 +52,15 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
detector = FeatureDetector.create(FeatureDetector.SURF); detector = FeatureDetector.create(FeatureDetector.SURF);
matSize = 100; matSize = 100;
truth = new KeyPoint[] { truth = new KeyPoint[] {
new KeyPoint(55.775578f, 55.775578f, 16, 80.245735f, 8617.8633f, 0, -1), new KeyPoint(55.775578f, 55.775578f, 16, 80.245735f, 8617.8633f, 0, -1),
new KeyPoint(44.224422f, 55.775578f, 16, 170.24574f, 8617.8633f, 0, -1), new KeyPoint(44.224422f, 55.775578f, 16, 170.24574f, 8617.8633f, 0, -1),
new KeyPoint(44.224422f, 44.224422f, 16, 260.24573f, 8617.8633f, 0, -1), new KeyPoint(44.224422f, 44.224422f, 16, 260.24573f, 8617.8633f, 0, -1),
new KeyPoint(55.775578f, 44.224422f, 16, 350.24573f, 8617.8633f, 0, -1) new KeyPoint(55.775578f, 44.224422f, 16, 350.24573f, 8617.8633f, 0, -1)
}; };
super.setUp();
} }
public void testCreate() { public void testCreate() {
......
...@@ -219,7 +219,7 @@ void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat) ...@@ -219,7 +219,7 @@ void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat)
for(int i=0; i<mat.rows; i++) for(int i=0; i<mat.rows; i++)
{ {
Vec<int, 2> a = mat.at< Vec<int, 2> >(i, 0); Vec<int, 2> a = mat.at< Vec<int, 2> >(i, 0);
long long addr = (((long long)a[0])<<32) | a[1]; long long addr = (((long long)a[0])<<32) | (a[1]&0xffffffff);
Mat& m = *( (Mat*) addr ); Mat& m = *( (Mat*) addr );
v_mat.push_back(m); v_mat.push_back(m);
} }
......
...@@ -262,7 +262,7 @@ public class Converters { ...@@ -262,7 +262,7 @@ public class Converters {
int[] buff = new int[count * 2]; int[] buff = new int[count * 2];
m.get(0, 0, buff); m.get(0, 0, buff);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
long addr = (((long) buff[i * 2]) << 32) | ((long) buff[i * 2 + 1]); long addr = (((long) buff[i * 2]) << 32) | (((long) buff[i * 2 + 1]) & 0xffffffffL);
mats.add(new Mat(addr)); mats.add(new Mat(addr));
} }
} }
......
ocv_check_dependencies(opencv_java ${OPENCV_MODULE_opencv_java_OPT_DEPS} ${OPENCV_MODULE_opencv_java_REQ_DEPS})
if(NOT OCV_DEPENDENCIES_FOUND OR NOT ANT_EXECUTABLE)
return()
endif()
# TODO: This has the same name as the Android test project. That project should
# probably be renamed.
project(opencv_test_java)
set(opencv_test_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
set(android_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/../android_test")
set(java_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
# get project sources
file(GLOB_RECURSE opencv_test_java_files RELATIVE "${android_source_dir}" "${android_source_dir}/res/*" "${android_source_dir}/src/*")
ocv_list_filterout(opencv_test_java_files ".svn")
ocv_list_filterout(opencv_test_java_files ".*#.*")
# These are the files that need to be updated for pure Java.
ocv_list_filterout(opencv_test_java_files ".*OpenCVTestCase.*")
ocv_list_filterout(opencv_test_java_files ".*OpenCVTestRunner.*")
# These files aren't for desktop Java.
ocv_list_filterout(opencv_test_java_files ".*android.*")
# These are files updated for pure Java.
file(GLOB_RECURSE modified_files RELATIVE "${java_source_dir}" "${java_source_dir}/src/*")
ocv_list_filterout(modified_files ".svn")
ocv_list_filterout(modified_files ".*#.*")
# These are extra jars needed to run the tests.
file(GLOB_RECURSE lib_files RELATIVE "${java_source_dir}" "${java_source_dir}/lib/*")
ocv_list_filterout(lib_files ".svn")
ocv_list_filterout(lib_files ".*#.*")
# copy sources out from the build tree
set(opencv_test_java_file_deps "")
foreach(f ${opencv_test_java_files})
add_custom_command(
OUTPUT "${opencv_test_java_bin_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${android_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
MAIN_DEPENDENCY "${android_source_dir}/${f}"
COMMENT "Copying ${f}")
list(APPEND opencv_test_java_file_deps "${android_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
endforeach()
# Overwrite select Android sources with Java-specific sources.
# Also, copy over the libs we'll need for testing.
foreach(f ${modified_files} ${lib_files})
add_custom_command(
OUTPUT "${opencv_test_java_bin_dir}/${f}"
COMMAND ${CMAKE_COMMAND} -E copy "${java_source_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
MAIN_DEPENDENCY "${java_source_dir}/${f}"
COMMENT "Copying ${f}")
list(APPEND opencv_test_java_file_deps "${java_source_dir}/${f}")
endforeach()
# Copy the OpenCV jar after it has been generated.
add_custom_command(
OUTPUT "${opencv_test_java_bin_dir}/bin/${JAR_NAME}"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/bin/${JAR_NAME}" "${opencv_test_java_bin_dir}/bin/${JAR_NAME}"
COMMENT "Copying the OpenCV jar")
add_custom_target(copy_opencv_jar ALL SOURCES "${opencv_test_java_bin_dir}/bin/${JAR_NAME}")
# ${the_module} is the target for the Java jar.
add_dependencies(copy_opencv_jar ${the_module})
# Copy the ant build file.
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/build.xml" DESTINATION "${opencv_test_java_bin_dir}")
# Create a script for running the Java tests and place it in build/bin.
if(WIN32)
file(WRITE "${CMAKE_BINARY_DIR}/bin/opencv_test_java.cmd" "cd ${opencv_test_java_bin_dir}\nset PATH=${EXECUTABLE_OUTPUT_PATH}/Release;%PATH%\nant -DjavaLibraryPath=${EXECUTABLE_OUTPUT_PATH}/Release buildAndTest")
file(WRITE "${CMAKE_BINARY_DIR}/bin/opencv_test_java_D.cmd" "cd ${opencv_test_java_bin_dir}\nset PATH=${EXECUTABLE_OUTPUT_PATH}/Debug;%PATH%\nant -DjavaLibraryPath=${EXECUTABLE_OUTPUT_PATH}/Debug buildAndTest")
else()
file(WRITE "${CMAKE_BINARY_DIR}/bin/opencv_test_java.sh" "cd ${opencv_test_java_bin_dir};\nant -DjavaLibraryPath=${LIBRARY_OUTPUT_PATH} buildAndTest;\ncd -")
endif()
add_custom_target(${PROJECT_NAME} ALL SOURCES ${opencv_test_java_file_deps})
add_dependencies(opencv_tests ${PROJECT_NAME})
<project>
<path id="master-classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="bin">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="build"/>
<delete dir="testResults"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac sourcepath="" srcdir="src" destdir="build/classes" >
<include name="**/*.java"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="jar">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/opencv-test.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="org.opencv.test.OpenCVTestRunner"/>
</manifest>
</jar>
</target>
<target name="test">
<mkdir dir="testResults"/>
<junit printsummary="false" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
<sysproperty key="java.library.path" path="${javaLibraryPath}"/>
<classpath refid="master-classpath"/>
<classpath>
<pathelement location="build/classes"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="testResults">
<zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
<exclude name="**/*$*.class"/>
</zipfileset>
</batchtest>
</junit>
</target>
<target name="buildAndTest">
<antcall target="compile"/>
<antcall target="jar"/>
<antcall target="test"/>
</target>
</project>
\ No newline at end of file
This diff is collapsed.
package org.opencv.test;
import java.io.File;
import java.io.IOException;
import junit.framework.Assert;
import org.opencv.core.Mat;
public class OpenCVTestRunner {
public static String LENA_PATH = "";
public static String CHESS_PATH = "";
public static String LBPCASCADE_FRONTALFACE_PATH = "";
private static String TAG = "opencv_test_java";
public static String getTempFileName(String extension)
{
if (!extension.startsWith("."))
extension = "." + extension;
try {
File tmp = File.createTempFile("OpenCV", extension);
String path = tmp.getAbsolutePath();
tmp.delete();
return path;
} catch (IOException e) {
Log("Failed to get temp file name. Exception is thrown: " + e);
}
return null;
}
static public void Log(String message) {
System.out.println(TAG + " :: " + message);
}
static public void Log(Mat m) {
System.out.println(TAG + " :: " + m + "\n " + m.dump());
}
public static String getOutputFileName(String name)
{
return getTempFileName(name);
}
}
...@@ -124,7 +124,7 @@ CvBoostTree ...@@ -124,7 +124,7 @@ CvBoostTree
----------- -----------
.. ocv:class:: CvBoostTree : public CvDTree .. ocv:class:: CvBoostTree : public CvDTree
The weak tree classifier, a component of the boosted tree classifier :ocv:class:`CvBoost`, is a derivative of :ocv:class:`CvDTree`. Normally, there is no need to use the weak classifiers directly. However, they can be accessed as elements of the sequence :ocv:member:`CvBoost::weak`, retrieved by :ocv:func:`CvBoost::get_weak_predictors`. The weak tree classifier, a component of the boosted tree classifier :ocv:class:`CvBoost`, is a derivative of :ocv:class:`CvDTree`. Normally, there is no need to use the weak classifiers directly. However, they can be accessed as elements of the sequence ``CvBoost::weak``, retrieved by :ocv:func:`CvBoost::get_weak_predictors`.
.. note:: In case of LogitBoost and Gentle AdaBoost, each weak predictor is a regression tree, rather than a classification tree. Even in case of Discrete AdaBoost and Real AdaBoost, the ``CvBoostTree::predict`` return value (:ocv:member:`CvDTreeNode::value`) is not an output class label. A negative value "votes" for class #0, a positive value - for class #1. The votes are weighted. The weight of each individual tree may be increased or decreased using the method ``CvBoostTree::scale``. .. note:: In case of LogitBoost and Gentle AdaBoost, each weak predictor is a regression tree, rather than a classification tree. Even in case of Discrete AdaBoost and Real AdaBoost, the ``CvBoostTree::predict`` return value (:ocv:member:`CvDTreeNode::value`) is not an output class label. A negative value "votes" for class #0, a positive value - for class #1. The votes are weighted. The weight of each individual tree may be increased or decreased using the method ``CvBoostTree::scale``.
...@@ -233,4 +233,3 @@ CvBoost::get_data ...@@ -233,4 +233,3 @@ CvBoost::get_data
Returns used train data of the boosted tree classifier. Returns used train data of the boosted tree classifier.
.. ocv:function:: const CvDTreeTrainData* CvBoost::get_data() const .. ocv:function:: const CvDTreeTrainData* CvBoost::get_data() const
...@@ -156,7 +156,7 @@ CvStatModel::predict ...@@ -156,7 +156,7 @@ CvStatModel::predict
-------------------- --------------------
Predicts the response for a sample. Predicts the response for a sample.
.. ocv:function:: float CvStatModel::predict( const Mat& sample, <prediction_params> ) const .. ocv:function:: float CvStatModel::predict( const Mat& sample, ... ) const
The method is used to predict the response for a new sample. In case of a classification, the method returns the class label. In case of a regression, the method returns the output function value. The input sample must have as many components as the ``train_data`` passed to ``train`` contains. If the ``var_idx`` parameter is passed to ``train``, it is remembered and then is used to extract only the necessary components from the input sample in the method ``predict``. The method is used to predict the response for a new sample. In case of a classification, the method returns the class label. In case of a regression, the method returns the output function value. The input sample must have as many components as the ``train_data`` passed to ``train`` contains. If the ``var_idx`` parameter is passed to ``train``, it is remembered and then is used to extract only the necessary components from the input sample in the method ``predict``.
......
...@@ -148,7 +148,7 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match ...@@ -148,7 +148,7 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
The class ``BruteForceMatcher_OCL_base`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory. ``BruteForceMatcher_OCL_base`` supports only the ``L1<float>``, ``L2<float>``, and ``Hamming`` distance types. The class ``BruteForceMatcher_OCL_base`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory. ``BruteForceMatcher_OCL_base`` supports only the ``L1<float>``, ``L2<float>``, and ``Hamming`` distance types.
.. seealso:: :ocv:class:`DescriptorMatcher`, :ocv:class:`BruteForceMatcher` .. seealso:: :ocv:class:`DescriptorMatcher`, :ocv:class:`BFMatcher`
......
...@@ -56,7 +56,7 @@ Class providing memory buffers for :ocv:func:`ocl::matchTemplate` function, plus ...@@ -56,7 +56,7 @@ Class providing memory buffers for :ocv:func:`ocl::matchTemplate` function, plus
You can use field `user_block_size` to set specific block size for :ocv:func:`ocl::matchTemplate` function. If you leave its default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed. You can use field `user_block_size` to set specific block size for :ocv:func:`ocl::matchTemplate` function. If you leave its default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed.
ocl::matchTemplate ocl::matchTemplate
---------------------- ------------------
Computes a proximity map for a raster template and an image where the template is searched for. Computes a proximity map for a raster template and an image where the template is searched for.
.. ocv:function:: void ocl::matchTemplate(const oclMat& image, const oclMat& templ, oclMat& result, int method) .. ocv:function:: void ocl::matchTemplate(const oclMat& image, const oclMat& templ, oclMat& result, int method)
...@@ -71,7 +71,7 @@ Computes a proximity map for a raster template and an image where the template i ...@@ -71,7 +71,7 @@ Computes a proximity map for a raster template and an image where the template i
:param method: Specifies the way to compare the template with the image. :param method: Specifies the way to compare the template with the image.
:param buf: Optional buffer to avoid extra memory allocations and to adjust some specific parameters. See :ocv:class:`ocl::MatchTemplateBuf`. :param buf: Optional buffer to avoid extra memory allocations and to adjust some specific parameters. See :ocv:struct:`ocl::MatchTemplateBuf`.
The following methods are supported for the ``CV_8U`` depth images for now: The following methods are supported for the ``CV_8U`` depth images for now:
......
...@@ -221,6 +221,7 @@ Implementation of the camera parameters refinement algorithm which minimizes sum ...@@ -221,6 +221,7 @@ Implementation of the camera parameters refinement algorithm which minimizes sum
detail::WaveCorrectKind detail::WaveCorrectKind
----------------------- -----------------------
.. ocv:class:: detail::WaveCorrectKind
Wave correction kind. :: Wave correction kind. ::
......
...@@ -287,7 +287,7 @@ The function finds all of the motion segments and marks them in ``segmask`` with ...@@ -287,7 +287,7 @@ The function finds all of the motion segments and marks them in ``segmask`` with
CamShift CamShift
------------ --------
Finds an object center, size, and orientation. Finds an object center, size, and orientation.
.. ocv:function:: RotatedRect CamShift( InputArray probImage, Rect& window, TermCriteria criteria ) .. ocv:function:: RotatedRect CamShift( InputArray probImage, Rect& window, TermCriteria criteria )
...@@ -316,7 +316,7 @@ See the OpenCV sample ``camshiftdemo.c`` that tracks colored objects. ...@@ -316,7 +316,7 @@ See the OpenCV sample ``camshiftdemo.c`` that tracks colored objects.
meanShift meanShift
------------- ---------
Finds an object on a back projection image. Finds an object on a back projection image.
.. ocv:function:: int meanShift( InputArray probImage, Rect& window, TermCriteria criteria ) .. ocv:function:: int meanShift( InputArray probImage, Rect& window, TermCriteria criteria )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment