Remerged the 2.4.0 branch

pull/2/head
Andrey Kamaev 13 years ago
parent 77717e1abc
commit 3a1f85d4e8
  1. 2
      3rdparty/ffmpeg/ffopencv.c
  2. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
  3. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
  4. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
  5. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
  6. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
  7. BIN
      3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
  8. BIN
      3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
  9. BIN
      3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
  10. BIN
      3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
  11. BIN
      3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
  12. BIN
      3rdparty/lib/x86/libnative_camera_r2.3.3.so
  13. BIN
      3rdparty/lib/x86/libnative_camera_r3.0.1.so
  14. BIN
      3rdparty/lib/x86/libnative_camera_r4.0.3.so
  15. 2
      doc/conf.py
  16. 75
      modules/androidcamera/camera_wrapper/camera_wrapper.cpp
  17. 1
      modules/calib3d/test/test_chesscorners_timing.cpp
  18. 8
      modules/core/CMakeLists.txt
  19. 6
      modules/gpu/src/cuda/bf_match.cu
  20. 9
      modules/gpu/src/pyrlk.cpp
  21. 4
      modules/highgui/src/cap_ffmpeg.cpp
  22. 2138
      modules/highgui/src/cap_ffmpeg_impl_v2.hpp
  23. 325
      modules/imgproc/doc/planar_subdivisions.rst
  24. 4
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
  25. 9
      modules/java/gen_java.py
  26. 15
      modules/java/src/cpp/converters.cpp
  27. 1
      modules/java/src/cpp/converters.h
  28. 28
      modules/java/src/java/core+MatOfByte.java
  29. 8
      modules/java/src/java/core+MatOfDMatch.java
  30. 28
      modules/java/src/java/core+MatOfDouble.java
  31. 30
      modules/java/src/java/core+MatOfFloat.java
  32. 30
      modules/java/src/java/core+MatOfInt.java
  33. 8
      modules/java/src/java/core+MatOfKeyPoint.java
  34. 8
      modules/java/src/java/core+MatOfPoint.java
  35. 8
      modules/java/src/java/core+MatOfPoint2f.java
  36. 8
      modules/java/src/java/core+MatOfPoint3.java
  37. 8
      modules/java/src/java/core+MatOfPoint3f.java
  38. 8
      modules/java/src/java/core+MatOfRect.java
  39. 84
      modules/legacy/src/em.cpp
  40. 52
      modules/legacy/test/test_em.cpp

@ -1 +1 @@
#include "cap_ffmpeg_impl_v2.hpp"
#include "cap_ffmpeg_impl.hpp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -56,7 +56,7 @@ version_patch = re.search("^W*#\W*define\W+CV_SUBMINOR_VERSION\W+(\d+)\W*$", ver
# The short X.Y version.
version = version_major + '.' + version_minor
# The full version, including alpha/beta/rc tags.
release = version_major + '.' + version_minor + '.' + version_patch + "-beta"
release = version_major + '.' + version_minor + '.' + version_patch
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

@ -49,6 +49,8 @@
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, CAMERA_LOG_TAG, __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, CAMERA_LOG_TAG, __VA_ARGS__))
#include <dlfcn.h>
using namespace android;
void debugShowFPS()
@ -200,17 +202,24 @@ protected:
return strstr(supported_modes, mode) > 0;
}
float getFocusDistance(int focus_distance_type){
if (focus_distance_type >= 0 && focus_distance_type < 3) {
float getFocusDistance(int focus_distance_type)
{
#if !defined(ANDROID_r2_2_0)
if (focus_distance_type >= 0 && focus_distance_type < 3)
{
float focus_distances[3];
const char* output = params.get(CameraParameters::KEY_FOCUS_DISTANCES);
int val_num = CameraHandler::split_float(output, focus_distances, ',', 3);
if(val_num == 3){
if(val_num == 3)
{
return focus_distances[focus_distance_type];
} else {
}
else
{
LOGE("Invalid focus distances.");
}
}
#endif
return -1;
}
@ -299,7 +308,9 @@ const char* CameraHandler::flashModesNames[ANDROID_CAMERA_FLASH_MODES_NUM] =
const char* CameraHandler::focusModesNames[ANDROID_CAMERA_FOCUS_MODES_NUM] =
{
CameraParameters::FOCUS_MODE_AUTO,
#if !defined(ANDROID_r2_2_0)
CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO,
#endif
CameraParameters::FOCUS_MODE_EDOF,
CameraParameters::FOCUS_MODE_FIXED,
CameraParameters::FOCUS_MODE_INFINITY
@ -326,16 +337,60 @@ const char* CameraHandler::antibandingModesNames[ANDROID_CAMERA_ANTIBANDING_MODE
CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, int cameraId, void* userData, CameraParameters* prevCameraParameters)
{
typedef sp<Camera> (*Android22ConnectFuncType)();
typedef sp<Camera> (*Android23ConnectFuncType)(int);
typedef sp<Camera> (*Android3DConnectFuncType)(int, int);
enum {
CAMERA_SUPPORT_MODE_2D = 0x01, /* Camera Sensor supports 2D mode. */
CAMERA_SUPPORT_MODE_3D = 0x02, /* Camera Sensor supports 3D mode. */
CAMERA_SUPPORT_MODE_NONZSL = 0x04, /* Camera Sensor in NON-ZSL mode. */
CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */
};
const char Android22ConnectName[] = "_ZN7android6Camera7connectEv";
const char Android23ConnectName[] = "_ZN7android6Camera7connectEi";
const char Android3DConnectName[] = "_ZN7android6Camera7connectEii";
LOGD("CameraHandler::initCameraConnect(%p, %d, %p, %p)", callback, cameraId, userData, prevCameraParameters);
sp<Camera> camera = 0;
#ifdef ANDROID_r2_2_0
camera = Camera::connect();
#else
/* This is 2.3 or higher. The connect method has cameraID parameter */
camera = Camera::connect(cameraId);
#endif
void* CameraHALHandle = dlopen("libcamera_client.so", RTLD_LAZY);
if (!CameraHALHandle)
{
LOGE("Cannot link to \"libcamera_client.so\"");
return NULL;
}
// reset errors
dlerror();
if (Android22ConnectFuncType Android22Connect = (Android22ConnectFuncType)dlsym(CameraHALHandle, Android22ConnectName))
{
LOGD("Connecting to CameraService v 2.2");
camera = Android22Connect();
}
else if (Android23ConnectFuncType Android23Connect = (Android23ConnectFuncType)dlsym(CameraHALHandle, Android23ConnectName))
{
LOGD("Connecting to CameraService v 2.3");
camera = Android23Connect(cameraId);
}
else if (Android3DConnectFuncType Android3DConnect = (Android3DConnectFuncType)dlsym(CameraHALHandle, Android3DConnectName))
{
LOGD("Connecting to CameraService v 3D");
camera = Android3DConnect(cameraId, CAMERA_SUPPORT_MODE_2D);
}
else
{
dlclose(CameraHALHandle);
LOGE("Cannot connect to CameraService. Connect method was not found!");
return NULL;
}
dlclose(CameraHALHandle);
if ( 0 == camera.get() )
{

@ -75,7 +75,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
sprintf( filepath, "%scameracalibration/", ts->get_data_path().c_str() );
sprintf( filename, "%schessboard_timing_list.dat", filepath );
printf("Reading file %s\n", filename);
CvFileStorage* fs = cvOpenFileStorage( filename, 0, CV_STORAGE_READ );
CvFileNode* board_list = fs ? cvGetFileNodeByName( fs, 0, "boards" ) : 0;

@ -16,13 +16,7 @@ else()
set(cuda_link_libs "")
endif()
set(OPENCV_VERSION_FILE "${opencv_core_BINARY_DIR}/version_string.inc")
add_custom_command(OUTPUT "${OPENCV_VERSION_FILE}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENCV_BUILD_INFO_FILE}" "${OPENCV_VERSION_FILE}"
MAIN_DEPENDENCY "${OPENCV_BUILD_INFO_FILE}"
COMMENT "")
ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs} "${OPENCV_VERSION_FILE}")
ocv_glob_module_sources(SOURCES ${lib_cuda} ${cuda_objs} "${opencv_core_BINARY_DIR}/version_string.inc")
ocv_create_module(${cuda_link_libs})
ocv_add_precompiled_headers(${the_module})

@ -97,7 +97,7 @@ namespace cv { namespace gpu { namespace device
}
template <int BLOCK_SIZE, int MAX_DESC_LEN, typename Dist, typename T, typename Mask>
__device__ void loopUnrolledCached(int queryIdx, const DevMem2D_<T>& query, int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
__device__ void loopUnrolledCached(int queryIdx, const DevMem2D_<T>& query,volatile int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
typename Dist::value_type* s_query, typename Dist::value_type* s_train,
float& bestDistance, int& bestTrainIdx, int& bestImgIdx)
{
@ -253,7 +253,7 @@ namespace cv { namespace gpu { namespace device
// Match Unrolled
template <int BLOCK_SIZE, int MAX_DESC_LEN, typename Dist, typename T, typename Mask>
__device__ void loopUnrolled(int queryIdx, const DevMem2D_<T>& query, int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
__device__ void loopUnrolled(int queryIdx, const DevMem2D_<T>& query,volatile int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
typename Dist::value_type* s_query, typename Dist::value_type* s_train,
float& bestDistance, int& bestTrainIdx, int& bestImgIdx)
{
@ -409,7 +409,7 @@ namespace cv { namespace gpu { namespace device
// Match
template <int BLOCK_SIZE, typename Dist, typename T, typename Mask>
__device__ void loop(int queryIdx, const DevMem2D_<T>& query, int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
__device__ void loop(int queryIdx, const DevMem2D_<T>& query, volatile int imgIdx, const DevMem2D_<T>& train, const Mask& mask,
typename Dist::value_type* s_query, typename Dist::value_type* s_train,
float& bestDistance, int& bestTrainIdx, int& bestImgIdx)
{

@ -126,18 +126,19 @@ void cv::gpu::PyrLKOpticalFlow::buildImagePyramid(const GpuMat& img0, vector<Gpu
namespace
{
void calcPatchSize(cv::Size winSize, int cn, dim3& block, dim3& patch)
void calcPatchSize(cv::Size winSize, int cn, dim3& block, dim3& patch, bool isDeviceArch11)
{
winSize.width *= cn;
if (winSize.width > 32 && winSize.width > 2 * winSize.height)
{
block.x = 32;
block.x = isDeviceArch11 ? 16 : 32;
block.y = 8;
}
else
{
block.x = block.y = 16;
block.x = 16;
block.y = isDeviceArch11 ? 8 : 16;
}
patch.x = (winSize.width + block.x - 1) / block.x;
@ -166,7 +167,7 @@ void cv::gpu::PyrLKOpticalFlow::sparse(const GpuMat& prevImg, const GpuMat& next
const int cn = prevImg.channels();
dim3 block, patch;
calcPatchSize(winSize, cn, block, patch);
calcPatchSize(winSize, cn, block, patch, isDeviceArch11_);
CV_Assert(derivLambda >= 0);
CV_Assert(maxLevel >= 0 && winSize.width > 2 && winSize.height > 2);

@ -42,11 +42,7 @@
#include "precomp.hpp"
#ifdef HAVE_FFMPEG
#ifdef NEW_FFMPEG
#include "cap_ffmpeg_impl_v2.hpp"
#else
#include "cap_ffmpeg_impl.hpp"
#endif
#else
#include "cap_ffmpeg_api.hpp"
#endif

File diff suppressed because it is too large Load Diff

@ -1,325 +0,0 @@
Planar Subdivisions (C API)
============================
.. highlight:: c
CvSubdiv2D
----------
.. ocv:struct:: CvSubdiv2D
Planar subdivision.
::
#define CV_SUBDIV2D_FIELDS() \
CV_GRAPH_FIELDS() \
int quad_edges; \
int is_geometry_valid; \
CvSubdiv2DEdge recent_edge; \
CvPoint2D32f topleft; \
CvPoint2D32f bottomright;
typedef struct CvSubdiv2D
{
CV_SUBDIV2D_FIELDS()
}
CvSubdiv2D;
..
Planar subdivision is the subdivision of a plane into a set of
non-overlapped regions (facets) that cover the whole plane. The above
structure describes a subdivision built on a 2D point set, where the points
are linked together and form a planar graph, which, together with a few
edges connecting the exterior subdivision points (namely, convex hull points)
with infinity, subdivides a plane into facets by its edges.
For every subdivision, there is a dual subdivision in which facets and
points (subdivision vertices) swap their roles. This means that a facet is
treated as a vertex (called a virtual point below) of the dual subdivision and
the original subdivision vertices become facets. In the figure below, the
original subdivision is marked with solid lines and dual subdivision -
with dotted lines.
.. image:: pics/subdiv.png
OpenCV subdivides a plane into triangles using the Delaunay's
algorithm. Subdivision is built iteratively starting from a dummy
triangle that includes all the subdivision points for sure. In this
case, the dual subdivision is a Voronoi diagram of the input 2D point set. The
subdivisions can be used for the 3D piece-wise transformation of a plane,
morphing, fast location of points on the plane, building special graphs
(such as NNG,RNG), and so forth.
CvQuadEdge2D
------------
.. ocv:struct:: CvQuadEdge2D
Quad-edge of a planar subdivision.
::
/* one of edges within quad-edge, lower 2 bits is index (0..3)
and upper bits are quad-edge pointer */
typedef long CvSubdiv2DEdge;
/* quad-edge structure fields */
#define CV_QUADEDGE2D_FIELDS() \
int flags; \
struct CvSubdiv2DPoint* pt[4]; \
CvSubdiv2DEdge next[4];
typedef struct CvQuadEdge2D
{
CV_QUADEDGE2D_FIELDS()
}
CvQuadEdge2D;
..
Quad-edge is a basic element of a subdivision containing four edges (e, eRot, reversed e, and reversed eRot):
.. image:: pics/quadedge.png
CvSubdiv2DPoint
---------------
.. ocv:struct:: CvSubdiv2DPoint
Point of an original or dual subdivision.
::
#define CV_SUBDIV2D_POINT_FIELDS()\
int flags; \
CvSubdiv2DEdge first; \
CvPoint2D32f pt; \
int id;
#define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30)
typedef struct CvSubdiv2DPoint
{
CV_SUBDIV2D_POINT_FIELDS()
}
CvSubdiv2DPoint;
..
* id
This integer can be used to index auxiliary data associated with each vertex of the planar subdivision.
CalcSubdivVoronoi2D
-------------------
Calculates the coordinates of the Voronoi diagram cells.
.. ocv:cfunction:: void cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv )
.. ocv:pyoldfunction:: cv.CalcSubdivVoronoi2D(subdiv)-> None
:param subdiv: Delaunay subdivision, in which all the points are already added.
The function calculates the coordinates
of virtual points. All virtual points corresponding to a vertex of the
original subdivision form (when connected together) a boundary of the Voronoi
cell at that point.
ClearSubdivVoronoi2D
--------------------
Removes all virtual points.
.. ocv:cfunction:: void cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv )
.. ocv:pyoldfunction:: cv.ClearSubdivVoronoi2D(subdiv)-> None
:param subdiv: Delaunay subdivision.
The function removes all of the virtual points. It
is called internally in
:ocv:cfunc:`CalcSubdivVoronoi2D`
if the subdivision
was modified after the previous call to the function.
CreateSubdivDelaunay2D
----------------------
Creates an empty Delaunay triangulation.
.. ocv:cfunction:: CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage )
.. ocv:pyoldfunction:: cv.CreateSubdivDelaunay2D(rect, storage)-> emptyDelaunayTriangulation
:param rect: Rectangle that includes all of the 2D points that are to be added to the subdivision.
:param storage: Container for the subdivision.
The function creates an empty Delaunay
subdivision where 2D points can be added using the function
:ocv:cfunc:`SubdivDelaunay2DInsert`
. All of the points to be added must be within
the specified rectangle, otherwise a runtime error is raised.
Note that the triangulation is a single large triangle that covers the given rectangle. Hence the three vertices of this triangle are outside the rectangle
``rect``
.
FindNearestPoint2D
------------------
Finds the subdivision vertex closest to the given point.
.. ocv:cfunction:: CvSubdiv2DPoint* cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt )
.. ocv:pyoldfunction:: cv.FindNearestPoint2D(subdiv, pt)-> point
:param subdiv: Delaunay or another subdivision.
:param pt: Input point.
The function is another function that
locates the input point within the subdivision. It finds the subdivision vertex that
is the closest to the input point. It is not necessarily one of vertices
of the facet containing the input point, though the facet (located using
:ocv:cfunc:`Subdiv2DLocate`
) is used as a starting
point. The function returns a pointer to the found subdivision vertex.
Subdiv2DEdgeDst
---------------
Returns the edge destination.
.. ocv:cfunction:: CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge )
.. ocv:pyoldfunction:: cv.Subdiv2DEdgeDst(edge)-> point
:param edge: Subdivision edge (not a quad-edge).
The function returns the edge destination. The
returned pointer may be NULL if the edge is from a dual subdivision and
the virtual point coordinates are not calculated yet. The virtual points
can be calculated using the function
:ocv:cfunc:`CalcSubdivVoronoi2D`.
Subdiv2DGetEdge
---------------
Returns one of the edges related to the given edge.
.. ocv:cfunction:: CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type )
.. ocv:pyoldfunction:: cv.Subdiv2DGetEdge(edge, type)-> CvSubdiv2DEdge
:param edge: Subdivision edge (not a quad-edge).
:param type: Parameter specifying which of the related edges to return. The following values are possible:
* **CV_NEXT_AROUND_ORG** next around the edge origin ( ``eOnext`` on the picture below if ``e`` is the input edge)
* **CV_NEXT_AROUND_DST** next around the edge vertex ( ``eDnext`` )
* **CV_PREV_AROUND_ORG** previous around the edge origin (reversed ``eRnext`` )
* **CV_PREV_AROUND_DST** previous around the edge destination (reversed ``eLnext`` )
* **CV_NEXT_AROUND_LEFT** next around the left facet ( ``eLnext`` )
* **CV_NEXT_AROUND_RIGHT** next around the right facet ( ``eRnext`` )
* **CV_PREV_AROUND_LEFT** previous around the left facet (reversed ``eOnext`` )
* **CV_PREV_AROUND_RIGHT** previous around the right facet (reversed ``eDnext`` )
.. image:: pics/quadedge.png
The function returns one of the edges related to the input edge.
Subdiv2DNextEdge
----------------
Returns next edge around the edge origin.
.. ocv:cfunction:: CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge )
.. ocv:pyoldfunction:: cv.Subdiv2DNextEdge(edge)-> CvSubdiv2DEdge
:param edge: Subdivision edge (not a quad-edge).
The function returns the next edge around the edge origin:
``eOnext``
on the picture above if
``e``
is the input edge).
Subdiv2DLocate
--------------
Returns the location of a point within a Delaunay triangulation.
.. ocv:cfunction:: CvSubdiv2DPointLocation cvSubdiv2DLocate( CvSubdiv2D* subdiv, CvPoint2D32f pt, CvSubdiv2DEdge* edge, CvSubdiv2DPoint** vertex=NULL )
.. ocv:pyoldfunction:: cv.Subdiv2DLocate(subdiv, pt) -> (loc, where)
:param subdiv: Delaunay or another subdivision.
:param pt: Point to locate.
:param edge: Output edge that the point belongs to or is located to the right of it.
:param vertex: Optional output vertex double pointer the input point coincides with.
The function locates the input point within the subdivision. There are five cases:
*
The point falls into some facet. The function returns
``CV_PTLOC_INSIDE``
and
``*edge``
will contain one of edges of the facet.
*
The point falls onto the edge. The function returns
``CV_PTLOC_ON_EDGE``
and
``*edge``
will contain this edge.
*
The point coincides with one of the subdivision vertices. The function returns
``CV_PTLOC_VERTEX``
and
``*vertex``
will contain a pointer to the vertex.
*
The point is outside the subdivision reference rectangle. The function returns
``CV_PTLOC_OUTSIDE_RECT``
and no pointers are filled.
*
One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected,
``CV_PTLOC_ERROR``
is returnd.
Subdiv2DRotateEdge
------------------
Returns another edge of the same quad-edge.
.. ocv:cfunction:: CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )
.. ocv:pyoldfunction:: cv.Subdiv2DRotateEdge(edge, rotate)-> CvSubdiv2DEdge
:param edge: Subdivision edge (not a quad-edge).
:param rotate: Parameter specifying which of the edges of the same quad-edge as the input one to return. The following values are possible:
* **0** the input edge ( ``e`` on the picture below if ``e`` is the input edge)
* **1** the rotated edge ( ``eRot`` )
* **2** the reversed edge (reversed ``e`` (in green))
* **3** the reversed rotated edge (reversed ``eRot`` (in green))
The function returns one of the edges of the same quad-edge as the input edge.
SubdivDelaunay2DInsert
----------------------
Inserts a single point into a Delaunay triangulation.
.. ocv:cfunction:: CvSubdiv2DPoint* cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt)
.. ocv:pyoldfunction:: cv.SubdivDelaunay2DInsert(subdiv, pt)-> point
:param subdiv: Delaunay subdivision created by the function :ocv:cfunc:`CreateSubdivDelaunay2D`.
:param pt: Inserted point.
The function inserts a single point into a subdivision and modifies the subdivision topology appropriately. If a point with the same coordinates exists already, no new point is added. The function returns a pointer to the allocated point. No virtual point coordinates are calculated at this stage.

@ -19,8 +19,6 @@ import org.opencv.features2d.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import android.util.Log;
public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
DescriptorMatcher matcher;
@ -173,8 +171,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
Mat query = getQueryDescriptors();
List<MatOfDMatch> matches = new ArrayList<MatOfDMatch>();
matcher.knnMatch(query, train, matches, k);
Log.d("knnMatch", "train = " + train);
Log.d("knnMatch", "query = " + query);
/*
Log.d("knnMatch", "train = " + train);
Log.d("knnMatch", "query = " + query);

@ -173,6 +173,15 @@ missing_consts = \
) # public
}, # Calib3d
"Video":
{
'private' :
(
('CV_LKFLOW_INITIAL_GUESSES', 4 ),
('CV_LKFLOW_GET_MIN_EIGENVALS', 8 ),
) # private
}, # Video
}

@ -413,21 +413,6 @@ void vector_vector_Point2f_to_Mat(vector< vector< Point2f > >& vv_pt, Mat& mat)
vector_Mat_to_Mat(vm, mat);
}
void vector_vector_Point_to_Mat(vector< vector< Point > >& vv_pt, Mat& mat)
{
vector<Mat> vm;
vm.reserve( vv_pt.size() );
for(size_t i=0; i<vv_pt.size(); i++)
{
Mat m;
vector_Point_to_Mat(vv_pt[i], m);
vm.push_back(m);
}
vector_Mat_to_Mat(vm, mat);
}
void vector_vector_Point3f_to_Mat(vector< vector< Point3f > >& vv_pt, Mat& mat)
{
vector<Mat> vm;

@ -68,7 +68,6 @@ void vector_vector_Point_to_Mat(std::vector< std::vector< cv::Point > >& vv_pt,
void Mat_to_vector_vector_Point2f(cv::Mat& mat, std::vector< std::vector< cv::Point2f > >& vv_pt);
void vector_vector_Point2f_to_Mat(std::vector< std::vector< cv::Point2f > >& vv_pt, cv::Mat& mat);
void vector_vector_Point_to_Mat(std::vector< std::vector< cv::Point > >& vv_pt, cv::Mat& mat);
void Mat_to_vector_vector_Point3f(cv::Mat& mat, std::vector< std::vector< cv::Point3f > >& vv_pt);
void vector_vector_Point3f_to_Mat(std::vector< std::vector< cv::Point3f > >& vv_pt, cv::Mat& mat);

@ -6,36 +6,32 @@ import java.util.List;
public class MatOfByte extends Mat {
// 8UC(x)
private static final int _depth = CvType.CV_8U;
private final int _channels;
public MatOfByte(int channels) {
super();
_channels = channels;
}
private static final int _channels = 1;
public MatOfByte() {
this(1);
super();
}
public MatOfByte(int channels, long addr) {
protected MatOfByte(long addr) {
super(addr);
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfByte(int channels, Mat m) {
public static MatOfByte fromNativeAddr(long addr) {
return new MatOfByte(addr);
}
public MatOfByte(Mat m) {
super(m, Range.all());
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfByte(int channels, byte...a) {
public MatOfByte(byte...a) {
super();
_channels = channels;
fromArray(a);
}
@ -53,7 +49,9 @@ public class MatOfByte extends Mat {
}
public byte[] toArray() {
int num = (int) total();
int num = checkVector(_channels, _depth);
if(num < 0)
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
byte[] a = new byte[num * _channels];
if(num == 0)
return a;
@ -64,7 +62,7 @@ public class MatOfByte extends Mat {
public void fromList(List<Byte> lb) {
if(lb==null || lb.size()==0)
return;
Byte ab[] = lb.toArray(null);
Byte ab[] = lb.toArray(new Byte[0]);
byte a[] = new byte[ab.length];
for(int i=0; i<ab.length; i++)
a[i] = ab[i];

@ -14,13 +14,17 @@ public class MatOfDMatch extends Mat {
super();
}
public MatOfDMatch(long addr) {
protected MatOfDMatch(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfDMatch fromNativeAddr(long addr) {
return new MatOfDMatch(addr);
}
public MatOfDMatch(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -68,7 +72,7 @@ public class MatOfDMatch extends Mat {
}
public void fromList(List<DMatch> ldm) {
DMatch adm[] = ldm.toArray(null);
DMatch adm[] = ldm.toArray(new DMatch[0]);
fromArray(adm);
}

@ -6,36 +6,32 @@ import java.util.List;
public class MatOfDouble extends Mat {
// 64FC(x)
private static final int _depth = CvType.CV_64F;
private final int _channels;
public MatOfDouble(int channels) {
super();
_channels = channels;
}
private static final int _channels = 1;
public MatOfDouble() {
this(1);
super();
}
public MatOfDouble(int channels, long addr) {
protected MatOfDouble(long addr) {
super(addr);
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfDouble(int channels, Mat m) {
public static MatOfDouble fromNativeAddr(long addr) {
return new MatOfDouble(addr);
}
public MatOfDouble(Mat m) {
super(m, Range.all());
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfDouble(int channels, double...a) {
public MatOfDouble(double...a) {
super();
_channels = channels;
fromArray(a);
}
@ -53,7 +49,9 @@ public class MatOfDouble extends Mat {
}
public double[] toArray() {
int num = (int) total();
int num = checkVector(_channels, _depth);
if(num < 0)
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
double[] a = new double[num * _channels];
if(num == 0)
return a;
@ -64,7 +62,7 @@ public class MatOfDouble extends Mat {
public void fromList(List<Double> lb) {
if(lb==null || lb.size()==0)
return;
Double ab[] = lb.toArray(null);
Double ab[] = lb.toArray(new Double[0]);
double a[] = new double[ab.length];
for(int i=0; i<ab.length; i++)
a[i] = ab[i];

@ -4,38 +4,34 @@ import java.util.Arrays;
import java.util.List;
public class MatOfFloat extends Mat {
// 32FC(x)
// 32FC1
private static final int _depth = CvType.CV_32F;
private final int _channels;
public MatOfFloat(int channels) {
super();
_channels = channels;
}
private static final int _channels = 1;
public MatOfFloat() {
this(1);
super();
}
public MatOfFloat(int channels, long addr) {
protected MatOfFloat(long addr) {
super(addr);
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfFloat(int channels, Mat m) {
public static MatOfFloat fromNativeAddr(long addr) {
return new MatOfFloat(addr);
}
public MatOfFloat(Mat m) {
super(m, Range.all());
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfFloat(int channels, float...a) {
public MatOfFloat(float...a) {
super();
_channels = channels;
fromArray(a);
}
@ -53,7 +49,9 @@ public class MatOfFloat extends Mat {
}
public float[] toArray() {
int num = (int) total();
int num = checkVector(_channels, _depth);
if(num < 0)
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
float[] a = new float[num * _channels];
if(num == 0)
return a;
@ -64,7 +62,7 @@ public class MatOfFloat extends Mat {
public void fromList(List<Float> lb) {
if(lb==null || lb.size()==0)
return;
Float ab[] = lb.toArray(null);
Float ab[] = lb.toArray(new Float[0]);
float a[] = new float[ab.length];
for(int i=0; i<ab.length; i++)
a[i] = ab[i];

@ -5,38 +5,34 @@ import java.util.List;
public class MatOfInt extends Mat {
// 32SC(x)
// 32SC1
private static final int _depth = CvType.CV_32S;
private final int _channels;
public MatOfInt(int channels) {
super();
_channels = channels;
}
private static final int _channels = 1;
public MatOfInt() {
this(1);
super();
}
public MatOfInt(int channels, long addr) {
protected MatOfInt(long addr) {
super(addr);
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfInt(int channels, Mat m) {
public static MatOfInt fromNativeAddr(long addr) {
return new MatOfInt(addr);
}
public MatOfInt(Mat m) {
super(m, Range.all());
_channels = channels;
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public MatOfInt(int channels, int...a) {
public MatOfInt(int...a) {
super();
_channels = channels;
fromArray(a);
}
@ -54,7 +50,9 @@ public class MatOfInt extends Mat {
}
public int[] toArray() {
int num = (int) total();
int num = checkVector(_channels, _depth);
if(num < 0)
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
int[] a = new int[num * _channels];
if(num == 0)
return a;
@ -65,7 +63,7 @@ public class MatOfInt extends Mat {
public void fromList(List<Integer> lb) {
if(lb==null || lb.size()==0)
return;
Integer ab[] = lb.toArray(null);
Integer ab[] = lb.toArray(new Integer[0]);
int a[] = new int[ab.length];
for(int i=0; i<ab.length; i++)
a[i] = ab[i];

@ -14,13 +14,17 @@ public class MatOfKeyPoint extends Mat {
super();
}
public MatOfKeyPoint(long addr) {
protected MatOfKeyPoint(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfKeyPoint fromNativeAddr(long addr) {
return new MatOfKeyPoint(addr);
}
public MatOfKeyPoint(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -71,7 +75,7 @@ public class MatOfKeyPoint extends Mat {
}
public void fromList(List<KeyPoint> lkp) {
KeyPoint akp[] = lkp.toArray(null);
KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
fromArray(akp);
}

@ -12,13 +12,17 @@ public class MatOfPoint extends Mat {
super();
}
public MatOfPoint(long addr) {
protected MatOfPoint(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfPoint fromNativeAddr(long addr) {
return new MatOfPoint(addr);
}
public MatOfPoint(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -63,7 +67,7 @@ public class MatOfPoint extends Mat {
}
public void fromList(List<Point> lp) {
Point ap[] = lp.toArray(null);
Point ap[] = lp.toArray(new Point[0]);
fromArray(ap);
}

@ -12,13 +12,17 @@ public class MatOfPoint2f extends Mat {
super();
}
public MatOfPoint2f(long addr) {
protected MatOfPoint2f(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfPoint2f fromNativeAddr(long addr) {
return new MatOfPoint2f(addr);
}
public MatOfPoint2f(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -63,7 +67,7 @@ public class MatOfPoint2f extends Mat {
}
public void fromList(List<Point> lp) {
Point ap[] = lp.toArray(null);
Point ap[] = lp.toArray(new Point[0]);
fromArray(ap);
}

@ -12,13 +12,17 @@ public class MatOfPoint3 extends Mat {
super();
}
public MatOfPoint3(long addr) {
protected MatOfPoint3(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfPoint3 fromNativeAddr(long addr) {
return new MatOfPoint3(addr);
}
public MatOfPoint3(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -64,7 +68,7 @@ public class MatOfPoint3 extends Mat {
}
public void fromList(List<Point3> lp) {
Point3 ap[] = lp.toArray(null);
Point3 ap[] = lp.toArray(new Point3[0]);
fromArray(ap);
}

@ -12,13 +12,17 @@ public class MatOfPoint3f extends Mat {
super();
}
public MatOfPoint3f(long addr) {
protected MatOfPoint3f(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfPoint3f fromNativeAddr(long addr) {
return new MatOfPoint3f(addr);
}
public MatOfPoint3f(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -64,7 +68,7 @@ public class MatOfPoint3f extends Mat {
}
public void fromList(List<Point3> lp) {
Point3 ap[] = lp.toArray(null);
Point3 ap[] = lp.toArray(new Point3[0]);
fromArray(ap);
}

@ -13,13 +13,17 @@ public class MatOfRect extends Mat {
super();
}
public MatOfRect(long addr) {
protected MatOfRect(long addr) {
super(addr);
if(checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
//FIXME: do we need release() here?
}
public static MatOfRect fromNativeAddr(long addr) {
return new MatOfRect(addr);
}
public MatOfRect(Mat m) {
super(m, Range.all());
if(checkVector(_channels, _depth) < 0 )
@ -66,7 +70,7 @@ public class MatOfRect extends Mat {
return a;
}
public void fromList(List<Rect> lr) {
Rect ap[] = lr.toArray(null);
Rect ap[] = lr.toArray(new Rect[0]);
fromArray(ap);
}

@ -1,50 +1,50 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright( C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
//(including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort(including negligence or otherwise) arising in any way out of
// the use of this software, even ifadvised of the possibility of such damage.
//
//M*/
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright( C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
//(including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort(including negligence or otherwise) arising in any way out of
// the use of this software, even ifadvised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
using namespace cv;
CvEMParams::CvEMParams() : nclusters(10), cov_mat_type(CvEM::COV_MAT_DIAGONAL),
start_step(CvEM::START_AUTO_STEP), probs(0), weights(0), means(0), covs(0)
start_step(CvEM::START_AUTO_STEP), probs(0), weights(0), means(0), covs(0)
{
term_crit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, FLT_EPSILON );
}
@ -52,8 +52,8 @@ start_step(CvEM::START_AUTO_STEP), probs(0), weights(0), means(0), covs(0)
CvEMParams::CvEMParams( int _nclusters, int _cov_mat_type, int _start_step,
CvTermCriteria _term_crit, const CvMat* _probs,
const CvMat* _weights, const CvMat* _means, const CvMat** _covs ) :
nclusters(_nclusters), cov_mat_type(_cov_mat_type), start_step(_start_step),
probs(_probs), weights(_weights), means(_means), covs(_covs), term_crit(_term_crit)
nclusters(_nclusters), cov_mat_type(_cov_mat_type), start_step(_start_step),
probs(_probs), weights(_weights), means(_means), covs(_covs), term_crit(_term_crit)
{}
CvEM::CvEM() : logLikelihood(DBL_MAX)

@ -45,45 +45,45 @@ using namespace std;
using namespace cv;
static
void defaultDistribs( Mat& means, vector<Mat>& covs )
void defaultDistribs( Mat& means, vector<Mat>& covs, int type=CV_32FC1 )
{
float mp0[] = {0.0f, 0.0f}, cp0[] = {0.67f, 0.0f, 0.0f, 0.67f};
float mp1[] = {5.0f, 0.0f}, cp1[] = {1.0f, 0.0f, 0.0f, 1.0f};
float mp2[] = {1.0f, 5.0f}, cp2[] = {1.0f, 0.0f, 0.0f, 1.0f};
means.create(3, 2, CV_32FC1);
means.create(3, 2, type);
Mat m0( 1, 2, CV_32FC1, mp0 ), c0( 2, 2, CV_32FC1, cp0 );
Mat m1( 1, 2, CV_32FC1, mp1 ), c1( 2, 2, CV_32FC1, cp1 );
Mat m2( 1, 2, CV_32FC1, mp2 ), c2( 2, 2, CV_32FC1, cp2 );
means.resize(3), covs.resize(3);
Mat mr0 = means.row(0);
m0.copyTo(mr0);
c0.copyTo(covs[0]);
m0.convertTo(mr0, type);
c0.convertTo(covs[0], type);
Mat mr1 = means.row(1);
m1.copyTo(mr1);
c1.copyTo(covs[1]);
m1.convertTo(mr1, type);
c1.convertTo(covs[1], type);
Mat mr2 = means.row(2);
m2.copyTo(mr2);
c2.copyTo(covs[2]);
m2.convertTo(mr2, type);
c2.convertTo(covs[2], type);
}
// generate points sets by normal distributions
static
void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat& _means, const vector<Mat>& covs, int labelType )
void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat& _means, const vector<Mat>& covs, int dataType, int labelType )
{
vector<int>::const_iterator sit = sizes.begin();
int total = 0;
for( ; sit != sizes.end(); ++sit )
total += *sit;
assert( _means.rows == (int)sizes.size() && covs.size() == sizes.size() );
assert( !data.empty() && data.rows == total );
assert( data.type() == CV_32FC1 );
CV_Assert( _means.rows == (int)sizes.size() && covs.size() == sizes.size() );
CV_Assert( !data.empty() && data.rows == total );
CV_Assert( data.type() == dataType );
labels.create( data.rows, 1, labelType );
randn( data, Scalar::all(0.0), Scalar::all(1.0) );
randn( data, Scalar::all(-1.0), Scalar::all(1.0) );
vector<Mat> means(sizes.size());
for(int i = 0; i < _means.rows; i++)
means[i] = _means.row(i);
@ -98,7 +98,7 @@ void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat&
assert( cit->rows == data.cols && cit->cols == data.cols );
for( int i = bi; i < ei; i++, p++ )
{
Mat r(1, data.cols, CV_32FC1, data.ptr<float>(i));
Mat r = data.row(i);
r = r * (*cit) + *mit;
if( labelType == CV_32FC1 )
labels.at<float>(p, 0) = (float)l;
@ -129,7 +129,7 @@ int maxIdx( const vector<int>& count )
}
static
bool getLabelsMap( const Mat& labels, const vector<int>& sizes, vector<int>& labelsMap )
bool getLabelsMap( const Mat& labels, const vector<int>& sizes, vector<int>& labelsMap, bool checkClusterUniq=true )
{
size_t total = 0, nclusters = sizes.size();
for(size_t i = 0; i < sizes.size(); i++)
@ -158,21 +158,25 @@ bool getLabelsMap( const Mat& labels, const vector<int>& sizes, vector<int>& lab
startIndex += sizes[clusterIndex];
int cls = maxIdx( count );
CV_Assert( !buzy[cls] );
CV_Assert( !checkClusterUniq || !buzy[cls] );
labelsMap[clusterIndex] = cls;
buzy[cls] = true;
}
if(checkClusterUniq)
{
for(size_t i = 0; i < buzy.size(); i++)
if(!buzy[i])
return false;
}
return true;
}
static
bool calcErr( const Mat& labels, const Mat& origLabels, const vector<int>& sizes, float& err, bool labelsEquivalent = true )
bool calcErr( const Mat& labels, const Mat& origLabels, const vector<int>& sizes, float& err, bool labelsEquivalent, bool checkClusterUniq )
{
err = 0;
CV_Assert( !labels.empty() && !origLabels.empty() );
@ -186,7 +190,7 @@ bool calcErr( const Mat& labels, const Mat& origLabels, const vector<int>& sizes
bool isFlt = labels.type() == CV_32FC1;
if( !labelsEquivalent )
{
if( !getLabelsMap( labels, sizes, labelsMap ) )
if( !getLabelsMap( labels, sizes, labelsMap, checkClusterUniq ) )
return false;
for( int i = 0; i < labels.rows; i++ )
@ -234,7 +238,7 @@ int CV_CvEMTest::runCase( int caseIndex, const CvEMParams& params,
em.train( trainData, Mat(), params, &labels );
// check train error
if( !calcErr( labels, trainLabels, sizes, err , false ) )
if( !calcErr( labels, trainLabels, sizes, err , false, false ) )
{
ts->printf( cvtest::TS::LOG, "Case index %i : Bad output labels.\n", caseIndex );
code = cvtest::TS::FAIL_INVALID_OUTPUT;
@ -252,7 +256,7 @@ int CV_CvEMTest::runCase( int caseIndex, const CvEMParams& params,
Mat sample = testData.row(i);
labels.at<int>(i,0) = (int)em.predict( sample, 0 );
}
if( !calcErr( labels, testLabels, sizes, err, false ) )
if( !calcErr( labels, testLabels, sizes, err, false, false ) )
{
ts->printf( cvtest::TS::LOG, "Case index %i : Bad output labels.\n", caseIndex );
code = cvtest::TS::FAIL_INVALID_OUTPUT;
@ -279,11 +283,11 @@ void CV_CvEMTest::run( int /*start_from*/ )
// train data
Mat trainData( pointsCount, 2, CV_32FC1 ), trainLabels;
vector<int> sizes( sizesArr, sizesArr + sizeof(sizesArr) / sizeof(sizesArr[0]) );
generateData( trainData, trainLabels, sizes, means, covs, CV_32SC1 );
generateData( trainData, trainLabels, sizes, means, covs, CV_32FC1, CV_32SC1 );
// test data
Mat testData( pointsCount, 2, CV_32FC1 ), testLabels;
generateData( testData, testLabels, sizes, means, covs, CV_32SC1 );
generateData( testData, testLabels, sizes, means, covs, CV_32FC1, CV_32SC1 );
CvEMParams params;
params.nclusters = 3;
@ -440,5 +444,5 @@ protected:
}
};
TEST(ML_CvEM, accuracy) { CV_CvEMTest test; test.safe_run(); }
TEST(ML_CvEM, save_load) { CV_CvEMTest_SaveLoad test; test.safe_run(); }
TEST(Legacy_CvEM, accuracy) { CV_CvEMTest test; test.safe_run(); }
TEST(Legacy_CvEM, save_load) { CV_CvEMTest_SaveLoad test; test.safe_run(); }

Loading…
Cancel
Save