merged the trunk r8735:8766, r8769, r8777:8780, r8790 and r8800:8811

This commit is contained in:
Marina Kolpakova 2012-06-28 17:07:17 +00:00
parent b156e2f7ed
commit 162f9fd7ea
61 changed files with 2738 additions and 1726 deletions

View File

@ -8,6 +8,7 @@ project(${ZLIB_LIBRARY} C)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(CheckTypeSize)
#
# Check for fseeko
@ -27,6 +28,14 @@ if(MSVC)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
#
# Check to see if we have large file support
#
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein"
"${CMAKE_CURRENT_BINARY_DIR}/zconf.h" @ONLY)
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")

View File

@ -116,14 +116,14 @@ OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON)
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_IMAGEIO "ImageIO support for OS X" OFF IF APPLE)
OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT IOS AND NOT APPLE) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_PNG "Include PNG support" ON IF (NOT IOS) )
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
@ -131,10 +131,10 @@ OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF WIN32 )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID AND NOT IOS) )
# OpenCV build components
@ -149,8 +149,14 @@ OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests"
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(BUILD_ANDROID_SERVICE "TBD" OFF IF ANDROID )
OCV_OPTION(BUILD_ANDROID_PACKAGE "TBD" OFF IF ANDROID )
OCV_OPTION(BUILD_ANDROID_SERVICE "TBD" OFF IF ANDROID AND ANDROID_USE_STLPORT AND ANDROID_SOURCE_TREE )
if(DEFINED BUILD_opencv_nonfree AND NOT BUILD_opencv_nonfree)
OCV_OPTION(BUILD_ANDROID_PACKAGE "TBD" OFF IF ANDROID )
else()
unset(BUILD_ANDROID_PACKAGE CACHE)
endif()
# 3rd party libs
OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR IOS OR APPLE )
@ -332,15 +338,6 @@ if(UNIX)
endif()
endif()
#
# Check to see if we have large file support (needed by zlib)
#
include(CheckTypeSize)
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
include(cmake/OpenCVPCHSupport.cmake REQUIRED)
include(cmake/OpenCVModule.cmake REQUIRED)
@ -530,7 +527,7 @@ if(ANDROID)
endif()
status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO)
status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
status(" Build service:" BUILD_ANDROID_SERVICE THEN YES ELSE NO)
status(" Google Play package:" BUILD_ANDROID_PACKAGE THEN YES ELSE NO)
endif()
# ========================== GUI ==========================

View File

@ -2,14 +2,13 @@ set(engine OpenCVEngine)
set(JNI_LIB_NAME ${engine} ${engine}_jni)
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON)
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/bin_${ANDROID_ARCH_NAME}/system/lib")
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin_${ANDROID_ARCH_NAME}/system/lib")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
include_directories(jni/BinderComponent jni/include "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
include_directories(jni/BinderComponent jni/include)
include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
add_library(${engine} SHARED ${engine_files})
target_link_libraries(${engine} z binder log utils)

View File

@ -215,7 +215,7 @@ macro(add_android_project target path)
project(${target})
set(android_proj_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
# get project sources
file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*")
ocv_list_filterout(android_proj_files ".svn")
@ -278,8 +278,6 @@ macro(add_android_project target path)
get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
endif()
else()
unset(JNI_LIB_NAME)
endif()
# build java part
@ -302,6 +300,8 @@ macro(add_android_project target path)
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
endif()
unset(JNI_LIB_NAME)
add_custom_target(${target} ALL SOURCES "${android_proj_bin_dir}/bin/${target}-debug.apk" )
if(NOT android_proj_IGNORE_JAVA)
add_dependencies(${target} opencv_java)

View File

@ -30,7 +30,11 @@ if(PYTHON_EXECUTABLE)
endif()
if(NOT ANDROID AND NOT IOS)
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
if(CMAKE_VERSION VERSION_GREATER 2.8.8)
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
else()
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
endif()
# cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
set(PYTHONLIBS_FOUND ON)

View File

@ -7,11 +7,11 @@ if(BUILD_ZLIB)
ocv_clear_vars(ZLIB_FOUND)
else()
include(FindZLIB)
if(ZLIB_VERSION_STRING)
#cmake 2.8.2 bug - it fails to determine zlib version
unset(ZLIB_VERSION_STRING CACHE)
endif()
if(ZLIB_FOUND)
if(ZLIB_VERSION_STRING)
#cmake 2.8.2 bug - it fails to determine zlib version
unset(ZLIB_VERSION_STRING CACHE)
endif()
ocv_parse_header2(ZLIB "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_VERSION "")
endif()
if(ZLIB_FOUND AND ANDROID)

View File

@ -8,6 +8,7 @@
# XIMEA_LIBRARY_DIR - XIMEA libraries folder
#
# Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
# Updated: 25 June 2012 by Igor Kuzmin (parafin@ximea.com)
#
set(XIMEA_FOUND)
@ -20,10 +21,16 @@ if(WIN32)
if(EXISTS XIMEA_PATH)
set(XIMEA_FOUND 1)
# set LIB folders
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}\\x86")
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
else()
set(XIMEA_FOUND 0)
endif()
else()
if(EXISTS /opt/XIMEA)
set(XIMEA_FOUND 1)
# set folders
set(XIMEA_PATH /opt/XIMEA/include)
else()
set(XIMEA_FOUND 0)
endif()

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -2366,7 +2366,8 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
// calculate global Z rotation
cvCrossProduct(&t,&uu,&ww);
double nw = cvNorm(&ww, 0, CV_L2);
cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
if (nw > 0.0)
cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
cvRodrigues2(&ww, &wR);
// apply to both views

View File

@ -54,7 +54,7 @@ protected:
Mat intrinsic_matrix_;
Mat distortion_coeffs_;
Size image_size_;
void run(int);
void generateIntrinsicParams();
};
@ -66,14 +66,14 @@ int calcDistance(const vector<Point2f>& set1, const vector<Point2f>& set2, doubl
{
return 0;
}
std::vector<int> indices;
double sum_dist = 0.0;
for(size_t i = 0; i < set1.size(); i++)
{
double min_dist = std::numeric_limits<double>::max();
int min_idx = -1;
for(int j = 0; j < (int)set2.size(); j++)
{
double dist = norm(set1[i] - set2[j]);
@ -83,33 +83,33 @@ int calcDistance(const vector<Point2f>& set1, const vector<Point2f>& set2, doubl
min_dist = dist;
}
}
// check validity of min_idx
if(min_idx == -1)
{
return 0;
}
std::vector<int>::iterator it = std::find(indices.begin(), indices.end(), min_idx);
if(it != indices.end())
if(it != indices.end())
{
// there are two points in set1 corresponding to the same point in set2
return 0;
}
indices.push_back(min_idx);
// printf("dist %d = %f\n", (int)i, min_dist);
sum_dist += min_dist*min_dist;
}
mean_dist = sqrt(sum_dist/set1.size());
// printf("sum_dist = %f, set1.size() = %d, mean_dist = %f\n", sum_dist, (int)set1.size(), mean_dist);
return 1;
}
CV_ChessboardSubpixelTest::CV_ChessboardSubpixelTest() :
intrinsic_matrix_(Size(3, 3), CV_64FC1), distortion_coeffs_(Size(1, 4), CV_64FC1),
intrinsic_matrix_(Size(3, 3), CV_64FC1), distortion_coeffs_(Size(1, 4), CV_64FC1),
image_size_(640, 480)
{
}
@ -121,13 +121,13 @@ void CV_ChessboardSubpixelTest::run( int )
int progress = 0;
RNG& rng = ts->get_rng();
const int runs_count = 20;
const int max_pattern_size = 8;
const int min_pattern_size = 5;
Mat bg(image_size_, CV_8UC1);
bg = Scalar(0);
double sum_dist = 0.0;
int count = 0;
for(int i = 0; i < runs_count; i++)
@ -144,13 +144,13 @@ void CV_ChessboardSubpixelTest::run( int )
pattern_size = Size(pattern_width, pattern_height);
}
ChessBoardGenerator gen_chessboard(Size(pattern_size.width + 1, pattern_size.height + 1));
// generates intrinsic camera and distortion matrices
generateIntrinsicParams();
vector<Point2f> corners;
Mat chessboard_image = gen_chessboard(bg, intrinsic_matrix_, distortion_coeffs_, corners);
Mat chessboard_image = gen_chessboard(bg, intrinsic_matrix_, distortion_coeffs_, corners);
vector<Point2f> test_corners;
bool result = findChessboardCorners(chessboard_image, pattern_size, test_corners, 15);
if(!result)
@ -158,47 +158,47 @@ void CV_ChessboardSubpixelTest::run( int )
#if 0
ts->printf(cvtest::TS::LOG, "Warning: chessboard was not detected! Writing image to test.jpg\n");
ts->printf(cvtest::TS::LOG, "Size = %d, %d\n", pattern_size.width, pattern_size.height);
ts->printf(cvtest::TS::LOG, "Intrinsic params: fx = %f, fy = %f, cx = %f, cy = %f\n",
intrinsic_matrix_.at<double>(0, 0), intrinsic_matrix_.at<double>(1, 1),
ts->printf(cvtest::TS::LOG, "Intrinsic params: fx = %f, fy = %f, cx = %f, cy = %f\n",
intrinsic_matrix_.at<double>(0, 0), intrinsic_matrix_.at<double>(1, 1),
intrinsic_matrix_.at<double>(0, 2), intrinsic_matrix_.at<double>(1, 2));
ts->printf(cvtest::TS::LOG, "Distortion matrix: %f, %f, %f, %f, %f\n",
ts->printf(cvtest::TS::LOG, "Distortion matrix: %f, %f, %f, %f, %f\n",
distortion_coeffs_.at<double>(0, 0), distortion_coeffs_.at<double>(0, 1),
distortion_coeffs_.at<double>(0, 2), distortion_coeffs_.at<double>(0, 3),
distortion_coeffs_.at<double>(0, 2), distortion_coeffs_.at<double>(0, 3),
distortion_coeffs_.at<double>(0, 4));
imwrite("test.jpg", chessboard_image);
#endif
continue;
}
double dist1 = 0.0;
int ret = calcDistance(corners, test_corners, dist1);
if(ret == 0)
{
ts->printf(cvtest::TS::LOG, "findChessboardCorners returns invalid corner coordinates!\n");
code = cvtest::TS::FAIL_INVALID_OUTPUT;
break;
break;
}
IplImage chessboard_image_header = chessboard_image;
cvFindCornerSubPix(&chessboard_image_header, (CvPoint2D32f*)&test_corners[0],
cvFindCornerSubPix(&chessboard_image_header, (CvPoint2D32f*)&test_corners[0],
(int)test_corners.size(), cvSize(3, 3), cvSize(1, 1), cvTermCriteria(CV_TERMCRIT_EPS|CV_TERMCRIT_ITER,300,0.1));
find4QuadCornerSubpix(chessboard_image, test_corners, Size(5, 5));
double dist2 = 0.0;
ret = calcDistance(corners, test_corners, dist2);
if(ret == 0)
{
ts->printf(cvtest::TS::LOG, "findCornerSubpix returns invalid corner coordinates!\n");
code = cvtest::TS::FAIL_INVALID_OUTPUT;
break;
break;
}
ts->printf(cvtest::TS::LOG, "Error after findChessboardCorners: %f, after findCornerSubPix: %f\n",
ts->printf(cvtest::TS::LOG, "Error after findChessboardCorners: %f, after findCornerSubPix: %f\n",
dist1, dist2);
sum_dist += dist2;
count++;
const double max_reduce_factor = 0.8;
if(dist1 < dist2*max_reduce_factor)
{
@ -206,33 +206,33 @@ void CV_ChessboardSubpixelTest::run( int )
code = cvtest::TS::FAIL_INVALID_OUTPUT;
break;
}
progress = update_progress( progress, i-1, runs_count, 0 );
}
sum_dist /= count;
ts->printf(cvtest::TS::LOG, "Average error after findCornerSubpix: %f\n", sum_dist);
ts->printf(cvtest::TS::LOG, "Average error after findCornerSubpix: %f\n", sum_dist);
if( code < 0 )
ts->set_failed_test_info( code );
}
void CV_ChessboardSubpixelTest::generateIntrinsicParams()
{
RNG& rng = ts->get_rng();
const double max_focus_length = 1000.0;
const double max_focus_diff = 5.0;
double fx = cvtest::randReal(rng)*max_focus_length;
double fy = fx + cvtest::randReal(rng)*max_focus_diff;
double cx = image_size_.width/2;
double cy = image_size_.height/2;
double k1 = 0.5*cvtest::randReal(rng);
double k2 = 0.05*cvtest::randReal(rng);
double p1 = 0.05*cvtest::randReal(rng);
double p2 = 0.05*cvtest::randReal(rng);
double k3 = 0.0;
intrinsic_matrix_ = (Mat_<double>(3, 3) << fx, 0.0, cx, 0.0, fy, cy, 0.0, 0.0, 1.0);
distortion_coeffs_ = (Mat_<double>(1, 5) << k1, k2, p1, p2, k3);
}

View File

@ -1 +1 @@
ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_ml opencv_video opencv_objdetect)
ocv_define_module(contrib opencv_imgproc opencv_calib3d opencv_features2d opencv_ml opencv_video opencv_objdetect OPTIONAL opencv_highgui)

View File

@ -44,7 +44,10 @@
//
#include "precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
#include <iostream>
#include <queue>
@ -907,13 +910,16 @@ void ChamferMatcher::Template::show() const
}
}
circle(templ_color,Point(center.x + pad, center.y + pad),1,CV_RGB(0,255,0));
#ifdef HAVE_OPENCV_HIGHGUI
namedWindow("templ",1);
imshow("templ",templ_color);
cvWaitKey(0);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without GUI support");
#endif
templ_color.release();
}

View File

@ -39,10 +39,16 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#define SHOW_DEBUG_IMAGES 0
#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#if SHOW_DEBUG_IMAGES
# include "opencv2/highgui/highgui.hpp"
#endif
#include "precomp.hpp"
#include <iostream>
@ -58,7 +64,6 @@
#include <limits>
#define SHOW_DEBUG_IMAGES 0
using namespace cv;
inline static

View File

@ -588,11 +588,11 @@ GetSetElem
----------
Finds a set element by its index.
.. ocv:cfunction:: CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
.. ocv:cfunction:: CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
:param set_header: Set
:param index: Index of the set element within a sequence
:param idx: Index of the set element within a sequence
The function finds a set element by its index. The function returns the pointer to it or 0 if the index is invalid or the corresponding node is free. The function supports negative indices as it uses
:ocv:cfunc:`GetSeqElem`

View File

@ -167,7 +167,7 @@ The constructors.
* **FileStorage::WRITE** Open the file for writing.
* **FileStorage::APPEND** Open the file for appending.
* **FileStorage::MEMORY** Read data from ``source`` or write data to the internal buffer (which is returned by ``FileStorage::release``)
:param encoding: Encoding of the file. Note that UTF-16 XML encoding is not supported currently and you should use 8-bit encoding instead of it.

View File

@ -1491,7 +1491,9 @@ void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const
void MatOp_GEMM::transpose(const MatExpr& e, MatExpr& res) const
{
res = e;
res.flags ^= CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T;
res.flags = (!(e.flags & CV_GEMM_A_T) ? CV_GEMM_B_T : 0) |
(!(e.flags & CV_GEMM_B_T) ? CV_GEMM_A_T : 0) |
(!(e.flags & CV_GEMM_C_T) ? CV_GEMM_C_T : 0);
swap(res.a, res.b);
}

View File

@ -473,20 +473,59 @@ string format( const char* fmt, ... )
string tempfile( const char* suffix )
{
char buf[L_tmpnam];
char* name = 0;
#ifdef ANDROID
strcpy(buf, "/sdcard/__opencv_temp_XXXXXX");
name = mktemp(buf);
#else
name = tmpnam(buf);
#endif
if (*name == '\\')
++name;
string n(name);
if (suffix != 0)
n += (n[n.size()-1] == '.' && suffix[0] == '.' ? suffix + 1 : suffix);
return n;
#if defined WIN32 || defined _WIN32
char temp_dir[MAX_PATH + 1] = { 0 };
char temp_file[MAX_PATH + 1] = { 0 };
::GetTempPathA(sizeof(temp_dir), temp_dir);
if(0 == ::GetTempFileNameA(temp_dir, "__opencv_temp.", 0, temp_file))
return string();
string name = temp_file;
if(suffix)
{
if (suffix[0] != '.')
return name + "." + suffix;
else
return name + suffix;
}
else
return name;
# else
# ifdef ANDROID
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX";
# else
char defaultTemplate[] = "/tmp/__opencv_temp.XXXXXX";
# endif
string fname;
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
if(temp_dir == 0 || temp_dir[0] == 0)
fname = defaultTemplate;
else
{
fname = temp_dir;
char ech = fname[fname.size() - 1];
if(ech != '/' && ech != '\\')
fname += "/";
fname += "__opencv_temp.XXXXXX";
}
const int fd = mkstemp((char*)fname.c_str());
if(fd == -1) return "";
close(fd);
remove(fname.c_str());
if(suffix)
{
if (suffix[0] != '.')
fname = fname + "." + suffix;
else
fname += suffix;
}
return fname;
# endif
}
static CvErrorCallback customErrorCallback = 0;

View File

@ -27,23 +27,23 @@ struct BaseElemWiseOp
minval = depth < CV_32S ? cvtest::getMinVal(depth) : depth == CV_32S ? -1000000 : -1000.;
maxval = depth < CV_32S ? cvtest::getMaxVal(depth) : depth == CV_32S ? 1000000 : 1000.;
}
virtual void getRandomSize(RNG& rng, vector<int>& size)
{
cvtest::randomSize(rng, 2, ARITHM_MAX_NDIMS, cvtest::ARITHM_MAX_SIZE_LOG, size);
}
virtual int getRandomType(RNG& rng)
{
return cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1,
ninputs > 1 ? ARITHM_MAX_CHANNELS : 4);
}
virtual double getMaxErr(int depth) { return depth < CV_32F ? 1 : depth == CV_32F ? 1e-5 : 1e-12; }
virtual double getMaxErr(int depth) { return depth < CV_32F ? 1 : depth == CV_32F ? 1e-5 : 1e-12; }
virtual void generateScalars(int depth, RNG& rng)
{
const double m = 3.;
if( !(flags & FIX_ALPHA) )
{
alpha = exp(rng.uniform(-0.5, 0.1)*m*2*CV_LOG2);
@ -54,7 +54,7 @@ struct BaseElemWiseOp
beta = exp(rng.uniform(-0.5, 0.1)*m*2*CV_LOG2);
beta *= rng.uniform(0, 2) ? 1 : -1;
}
if( !(flags & FIX_GAMMA) )
{
for( int i = 0; i < 4; i++ )
@ -65,25 +65,25 @@ struct BaseElemWiseOp
if( flags & REAL_GAMMA )
gamma = Scalar::all(gamma[0]);
}
if( depth == CV_32F )
{
Mat fl, db;
db = Mat(1, 1, CV_64F, &alpha);
db.convertTo(fl, CV_32F);
fl.convertTo(db, CV_64F);
db = Mat(1, 1, CV_64F, &beta);
db.convertTo(fl, CV_32F);
fl.convertTo(db, CV_64F);
db = Mat(1, 4, CV_64F, &gamma[0]);
db.convertTo(fl, CV_32F);
fl.convertTo(db, CV_64F);
}
}
int ninputs;
int flags;
double alpha;
@ -98,7 +98,7 @@ struct BaseAddOp : public BaseElemWiseOp
{
BaseAddOp(int _ninputs, int _flags, double _alpha, double _beta, Scalar _gamma=Scalar::all(0))
: BaseElemWiseOp(_ninputs, _flags, _alpha, _beta, _gamma) {}
void refop(const vector<Mat>& src, Mat& dst, const Mat& mask)
{
Mat temp;
@ -214,7 +214,7 @@ struct MulOp : public BaseElemWiseOp
{
return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
}
};
};
struct DivOp : public BaseElemWiseOp
{
@ -231,7 +231,7 @@ struct DivOp : public BaseElemWiseOp
{
return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
}
};
};
struct RecipOp : public BaseElemWiseOp
{
@ -248,8 +248,8 @@ struct RecipOp : public BaseElemWiseOp
{
return depth <= CV_32S ? 2 : depth < CV_64F ? 1e-5 : 1e-12;
}
};
};
struct AbsDiffOp : public BaseAddOp
{
AbsDiffOp() : BaseAddOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, -1, Scalar::all(0)) {};
@ -354,7 +354,7 @@ struct MinOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct MaxOp : public BaseElemWiseOp
{
@ -371,7 +371,7 @@ struct MaxOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct MinSOp : public BaseElemWiseOp
{
@ -388,7 +388,7 @@ struct MinSOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct MaxSOp : public BaseElemWiseOp
{
@ -406,7 +406,7 @@ struct MaxSOp : public BaseElemWiseOp
return 0;
}
};
struct CmpOp : public BaseElemWiseOp
{
CmpOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@ -427,7 +427,7 @@ struct CmpOp : public BaseElemWiseOp
{
return cvtest::randomType(rng, DEPTH_MASK_ALL_BUT_8S, 1, 1);
}
double getMaxErr(int)
{
return 0;
@ -462,9 +462,9 @@ struct CmpSOp : public BaseElemWiseOp
return 0;
}
int cmpop;
};
};
struct CopyOp : public BaseElemWiseOp
{
CopyOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK, 1, 1, Scalar::all(0)) {};
@ -487,7 +487,7 @@ struct CopyOp : public BaseElemWiseOp
int cmpop;
};
struct SetOp : public BaseElemWiseOp
{
SetOp() : BaseElemWiseOp(0, FIX_ALPHA+FIX_BETA+SUPPORT_MASK, 1, 1, Scalar::all(0)) {};
@ -507,7 +507,7 @@ struct SetOp : public BaseElemWiseOp
{
return 0;
}
};
};
template<typename _Tp, typename _WTp> static void
inRangeS_(const _Tp* src, const _WTp* a, const _WTp* b, uchar* dst, size_t total, int cn)
@ -547,7 +547,7 @@ template<typename _Tp> static void inRange_(const _Tp* src, const _Tp* a, const
}
}
}
static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
{
@ -556,19 +556,19 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
dst.create( src.dims, &src.size[0], CV_8U );
const Mat *arrays[]={&src, &lb, &rb, &dst, 0};
Mat planes[4];
NAryMatIterator it(arrays, planes);
size_t total = planes[0].total();
size_t i, nplanes = it.nplanes;
int depth = src.depth(), cn = src.channels();
int depth = src.depth(), cn = src.channels();
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
const uchar* aptr = planes[1].data;
const uchar* bptr = planes[2].data;
uchar* dptr = planes[3].data;
switch( depth )
{
case CV_8U:
@ -604,21 +604,21 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
dst.create( src.dims, &src.size[0], CV_8U );
const Mat *arrays[]={&src, &dst, 0};
Mat planes[2];
NAryMatIterator it(arrays, planes);
size_t total = planes[0].total();
size_t i, nplanes = it.nplanes;
int depth = src.depth(), cn = src.channels();
int depth = src.depth(), cn = src.channels();
union { double d[4]; float f[4]; int i[4];} lbuf, rbuf;
int wtype = CV_MAKETYPE(depth <= CV_32S ? CV_32S : depth, cn);
scalarToRawData(lb, lbuf.d, wtype, cn);
scalarToRawData(rb, rbuf.d, wtype, cn);
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
switch( depth )
{
case CV_8U:
@ -647,8 +647,8 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
}
}
}
struct InRangeSOp : public BaseElemWiseOp
{
InRangeSOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA, 1, 1, Scalar::all(0)) {};
@ -676,9 +676,9 @@ struct InRangeSOp : public BaseElemWiseOp
}
}
Scalar gamma1;
};
};
struct InRangeOp : public BaseElemWiseOp
{
InRangeOp() : BaseElemWiseOp(3, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@ -687,7 +687,7 @@ struct InRangeOp : public BaseElemWiseOp
Mat lb, rb;
cvtest::min(src[1], src[2], lb);
cvtest::max(src[1], src[2], rb);
cv::inRange(src[0], lb, rb, dst);
}
void refop(const vector<Mat>& src, Mat& dst, const Mat&)
@ -695,16 +695,16 @@ struct InRangeOp : public BaseElemWiseOp
Mat lb, rb;
cvtest::min(src[1], src[2], lb);
cvtest::max(src[1], src[2], rb);
cvtest::inRange(src[0], lb, rb, dst);
}
double getMaxErr(int)
{
return 0;
}
};
};
struct ConvertScaleOp : public BaseElemWiseOp
{
ConvertScaleOp() : BaseElemWiseOp(1, FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)), ddepth(0) { };
@ -739,7 +739,7 @@ struct ConvertScaleOp : public BaseElemWiseOp
int ddepth;
};
struct ConvertScaleAbsOp : public BaseElemWiseOp
{
ConvertScaleAbsOp() : BaseElemWiseOp(1, FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)) {};
@ -767,13 +767,13 @@ struct ConvertScaleAbsOp : public BaseElemWiseOp
}
};
static void flip(const Mat& src, Mat& dst, int flipcode)
{
CV_Assert(src.dims == 2);
dst.create(src.size(), src.type());
int i, j, k, esz = (int)src.elemSize(), width = src.cols*esz;
for( i = 0; i < dst.rows; i++ )
{
const uchar* sptr = src.ptr(flipcode == 1 ? i : dst.rows - i - 1);
@ -796,7 +796,7 @@ static void setIdentity(Mat& dst, const Scalar& s)
double buf[4];
scalarToRawData(s, buf, dst.type(), 0);
int i, k, esz = (int)dst.elemSize(), width = dst.cols*esz;
for( i = 0; i < dst.rows; i++ )
{
uchar* dptr = dst.ptr(i);
@ -807,7 +807,7 @@ static void setIdentity(Mat& dst, const Scalar& s)
}
}
struct FlipOp : public BaseElemWiseOp
{
FlipOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@ -853,8 +853,8 @@ struct TransposeOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct SetIdentityOp : public BaseElemWiseOp
{
SetIdentityOp() : BaseElemWiseOp(0, FIX_ALPHA+FIX_BETA, 1, 1, Scalar::all(0)) {};
@ -874,7 +874,7 @@ struct SetIdentityOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct SetZeroOp : public BaseElemWiseOp
{
@ -893,23 +893,23 @@ struct SetZeroOp : public BaseElemWiseOp
}
};
static void exp(const Mat& src, Mat& dst)
{
dst.create( src.dims, &src.size[0], src.type() );
const Mat *arrays[]={&src, &dst, 0};
Mat planes[2];
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total()*src.channels();
size_t i, nplanes = it.nplanes;
int depth = src.depth();
int depth = src.depth();
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
if( depth == CV_32F )
{
for( j = 0; j < total; j++ )
@ -920,7 +920,7 @@ static void exp(const Mat& src, Mat& dst)
for( j = 0; j < total; j++ )
((double*)dptr)[j] = std::exp(((const double*)sptr)[j]);
}
}
}
}
static void log(const Mat& src, Mat& dst)
@ -928,17 +928,17 @@ static void log(const Mat& src, Mat& dst)
dst.create( src.dims, &src.size[0], src.type() );
const Mat *arrays[]={&src, &dst, 0};
Mat planes[2];
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total()*src.channels();
size_t i, nplanes = it.nplanes;
int depth = src.depth();
int depth = src.depth();
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
if( depth == CV_32F )
{
for( j = 0; j < total; j++ )
@ -949,9 +949,9 @@ static void log(const Mat& src, Mat& dst)
for( j = 0; j < total; j++ )
((double*)dptr)[j] = std::log(fabs(((const double*)sptr)[j]));
}
}
}
}
}
struct ExpOp : public BaseElemWiseOp
{
ExpOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
@ -976,7 +976,7 @@ struct ExpOp : public BaseElemWiseOp
{
return depth == CV_32F ? 1e-5 : 1e-12;
}
};
};
struct LogOp : public BaseElemWiseOp
@ -1018,13 +1018,13 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
mangle.create( mx.dims, &mx.size[0], mx.type() );
const Mat *arrays[]={&mx, &my, &mmag, &mangle, 0};
Mat planes[4];
NAryMatIterator it(arrays, planes);
size_t j, total = planes[0].total();
size_t i, nplanes = it.nplanes;
int depth = mx.depth();
int depth = mx.depth();
double scale = angleInDegrees ? 180/CV_PI : 1;
for( i = 0; i < nplanes; i++, ++it )
{
if( depth == CV_32F )
@ -1033,7 +1033,7 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
const float* yptr = (const float*)planes[1].data;
float* mptr = (float*)planes[2].data;
float* aptr = (float*)planes[3].data;
for( j = 0; j < total; j++ )
{
mptr[j] = std::sqrt(xptr[j]*xptr[j] + yptr[j]*yptr[j]);
@ -1048,7 +1048,7 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
const double* yptr = (const double*)planes[1].data;
double* mptr = (double*)planes[2].data;
double* aptr = (double*)planes[3].data;
for( j = 0; j < total; j++ )
{
mptr[j] = std::sqrt(xptr[j]*xptr[j] + yptr[j]*yptr[j]);
@ -1059,8 +1059,8 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
}
}
}
struct CartToPolarToCartOp : public BaseElemWiseOp
{
CartToPolarToCartOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0))
@ -1075,10 +1075,10 @@ struct CartToPolarToCartOp : public BaseElemWiseOp
void op(const vector<Mat>& src, Mat& dst, const Mat&)
{
Mat mag, angle, x, y;
cv::cartToPolar(src[0], src[1], mag, angle, angleInDegrees);
cv::polarToCart(mag, angle, x, y, angleInDegrees);
Mat msrc[] = {mag, angle, x, y};
int pairs[] = {0, 0, 1, 1, 2, 2, 3, 3};
dst.create(src[0].dims, src[0].size, CV_MAKETYPE(src[0].depth(), 4));
@ -1103,8 +1103,8 @@ struct CartToPolarToCartOp : public BaseElemWiseOp
}
bool angleInDegrees;
};
struct MeanOp : public BaseElemWiseOp
{
MeanOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK+SCALAR_OUTPUT, 1, 1, Scalar::all(0))
@ -1125,7 +1125,7 @@ struct MeanOp : public BaseElemWiseOp
{
return 1e-6;
}
};
};
struct SumOp : public BaseElemWiseOp
@ -1148,9 +1148,9 @@ struct SumOp : public BaseElemWiseOp
{
return 1e-5;
}
};
};
struct CountNonZeroOp : public BaseElemWiseOp
{
CountNonZeroOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SCALAR_OUTPUT+SUPPORT_MASK, 1, 1, Scalar::all(0))
@ -1181,9 +1181,9 @@ struct CountNonZeroOp : public BaseElemWiseOp
{
return 0;
}
};
};
struct MeanStdDevOp : public BaseElemWiseOp
{
Scalar sqmeanRef;
@ -1206,13 +1206,13 @@ struct MeanStdDevOp : public BaseElemWiseOp
cvtest::multiply(temp, temp, temp);
Scalar mean = cvtest::mean(src[0], mask);
Scalar sqmean = cvtest::mean(temp, mask);
sqmeanRef = sqmean;
cn = temp.channels();
for( int c = 0; c < 4; c++ )
sqmean[c] = std::sqrt(std::max(sqmean[c] - mean[c]*mean[c], 0.));
sqmean[c] = std::sqrt(std::max(sqmean[c] - mean[c]*mean[c], 0.));
dst.create(1, 2, CV_64FC4);
dst.at<Scalar>(0,0) = mean;
dst.at<Scalar>(0,1) = sqmean;
@ -1225,9 +1225,9 @@ struct MeanStdDevOp : public BaseElemWiseOp
err = std::max(err, sqmeanRef[i]);
return 3e-7 * err;
}
};
};
struct NormOp : public BaseElemWiseOp
{
NormOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK+SCALAR_OUTPUT, 1, 1, Scalar::all(0))
@ -1272,7 +1272,7 @@ struct NormOp : public BaseElemWiseOp
return 1e-6;
}
int normType;
};
};
struct MinMaxLocOp : public BaseElemWiseOp
@ -1290,7 +1290,7 @@ struct MinMaxLocOp : public BaseElemWiseOp
{
int i, ndims = (int)minidx.size();
dst.create(1, ndims*2 + 2, CV_64FC1);
for( i = 0; i < ndims; i++ )
{
dst.at<double>(0,i) = minidx[i];
@ -1319,9 +1319,9 @@ struct MinMaxLocOp : public BaseElemWiseOp
{
return 0;
}
};
};
}
typedef Ptr<cvtest::BaseElemWiseOp> ElemWiseOpPtr;
@ -1330,7 +1330,7 @@ class ElemWiseTest : public ::testing::TestWithParam<ElemWiseOpPtr> {};
TEST_P(ElemWiseTest, accuracy)
{
ElemWiseOpPtr op = GetParam();
int testIdx = 0;
RNG rng((uint64)cvtest::ARITHM_RNG_SEED);
for( testIdx = 0; testIdx < cvtest::ARITHM_NTESTS; testIdx++ )
@ -1340,7 +1340,7 @@ TEST_P(ElemWiseTest, accuracy)
int type = op->getRandomType(rng);
int depth = CV_MAT_DEPTH(type);
bool haveMask = (op->flags & cvtest::BaseElemWiseOp::SUPPORT_MASK) != 0 && rng.uniform(0, 4) == 0;
double minval=0, maxval=0;
op->getValueRange(depth, minval, maxval);
int i, ninputs = op->ninputs;
@ -1350,7 +1350,7 @@ TEST_P(ElemWiseTest, accuracy)
Mat dst0, dst, mask;
if( haveMask )
mask = cvtest::randomMat(rng, size, CV_8U, 0, 2, true);
if( (haveMask || ninputs == 0) && !(op->flags & cvtest::BaseElemWiseOp::SCALAR_OUTPUT))
{
dst0 = cvtest::randomMat(rng, size, type, minval, maxval, false);
@ -1358,17 +1358,17 @@ TEST_P(ElemWiseTest, accuracy)
cvtest::copy(dst, dst0);
}
op->generateScalars(depth, rng);
op->refop(src, dst0, mask);
op->op(src, dst, mask);
double maxErr = op->getMaxErr(depth);
vector<int> pos;
ASSERT_PRED_FORMAT2(cvtest::MatComparator(maxErr, op->context), dst0, dst) << "\nsrc[0] ~ " << cvtest::MatInfo(!src.empty() ? src[0] : Mat()) << "\ntestCase #" << testIdx << "\n";
ASSERT_PRED_FORMAT2(cvtest::MatComparator(maxErr, op->context), dst0, dst) << "\nsrc[0] ~ " << cvtest::MatInfo(!src.empty() ? src[0] : Mat()) << "\ntestCase #" << testIdx << "\n";
}
}
INSTANTIATE_TEST_CASE_P(Core_Copy, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::CopyOp)));
INSTANTIATE_TEST_CASE_P(Core_Set, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetOp)));
INSTANTIATE_TEST_CASE_P(Core_SetZero, ElemWiseTest, ::testing::Values(ElemWiseOpPtr(new cvtest::SetZeroOp)));
@ -1429,7 +1429,7 @@ class CV_ArithmMaskTest : public cvtest::BaseTest
{
public:
CV_ArithmMaskTest() {}
~CV_ArithmMaskTest() {}
~CV_ArithmMaskTest() {}
protected:
void run(int)
{
@ -1441,7 +1441,7 @@ protected:
for( int iter = 0; iter < 100; iter++ )
{
//ts->printf(cvtest::TS::LOG, ".");
ts->update_context(this, iter, true);
int k, dims = rng.uniform(1, MAX_DIM+1), p = 1;
int depth = rng.uniform(CV_8U, CV_64F+1);
@ -1459,15 +1459,15 @@ protected:
Mat mask(dims, sizes, CV_8U);
Mat mask1;
Mat c, d;
rng.fill(a, RNG::UNIFORM, 0, 100);
rng.fill(b, RNG::UNIFORM, 0, 100);
// [-2,2) range means that the each generated random number
// will be one of -2, -1, 0, 1. Saturated to [0,255], it will become
// 0, 0, 0, 1 => the mask will be filled by ~25%.
rng.fill(mask, RNG::UNIFORM, -2, 2);
a.convertTo(a1, depth1);
b.convertTo(b1, depth1);
// invert the mask
@ -1504,7 +1504,7 @@ protected:
d.convertTo(d1, depth);
CV_Assert( norm(c, d1, CV_C) <= DBL_EPSILON );
}
Mat_<uchar> tmpSrc(100,100);
tmpSrc = 124;
Mat_<uchar> tmpMask(100,100);

View File

@ -31,7 +31,7 @@ static SparseMat cvTsGetRandomSparseMat(int dims, const int* sz, int type,
else
*(double*)ptr = saturate_cast<double>(val);
}
return m;
}
@ -40,11 +40,11 @@ static bool cvTsCheckSparse(const CvSparseMat* m1, const CvSparseMat* m2, double
CvSparseMatIterator it1;
CvSparseNode* node1;
int depth = CV_MAT_DEPTH(m1->type);
if( m1->heap->active_count != m2->heap->active_count ||
m1->dims != m2->dims || CV_MAT_TYPE(m1->type) != CV_MAT_TYPE(m2->type) )
return false;
for( node1 = cvInitSparseMatIterator( m1, &it1 );
node1 != 0; node1 = cvGetNextSparseNode( &it1 ))
{
@ -75,7 +75,7 @@ static bool cvTsCheckSparse(const CvSparseMat* m1, const CvSparseMat* m2, double
else if( fabs(*(double*)v1 - *(double*)v2) > eps*(fabs(*(double*)v2) + 1) )
return false;
}
return true;
}
@ -94,27 +94,27 @@ protected:
test_case_count = 4;
int progress = 0;
MemStorage storage(cvCreateMemStorage(0));
for( int idx = 0; idx < test_case_count; idx++ )
{
ts->update_context( this, idx, false );
progress = update_progress( progress, idx, test_case_count, 0 );
cvClearMemStorage(storage);
bool mem = (idx % 4) >= 2;
string filename = tempfile(idx % 2 ? ".yml" : ".xml");
FileStorage fs(filename, FileStorage::WRITE + (mem ? FileStorage::MEMORY : 0));
int test_int = (int)cvtest::randInt(rng);
double test_real = (cvtest::randInt(rng)%2?1:-1)*exp(cvtest::randReal(rng)*18-9);
string test_string = "vw wv23424rt\"&amp;&lt;&gt;&amp;&apos;@#$@$%$%&%IJUKYILFD@#$@%$&*&() ";
int depth = cvtest::randInt(rng) % (CV_64F+1);
int cn = cvtest::randInt(rng) % 4 + 1;
Mat test_mat(cvtest::randInt(rng)%30+1, cvtest::randInt(rng)%30+1, CV_MAKETYPE(depth, cn));
rng0.fill(test_mat, CV_RAND_UNI, Scalar::all(ranges[depth][0]), Scalar::all(ranges[depth][1]));
if( depth >= CV_32F )
{
@ -123,11 +123,11 @@ protected:
rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
multiply(test_mat, test_mat_scale, test_mat);
}
CvSeq* seq = cvCreateSeq(test_mat.type(), (int)sizeof(CvSeq),
(int)test_mat.elemSize(), storage);
cvSeqPushMulti(seq, test_mat.data, test_mat.cols*test_mat.rows);
cvSeqPushMulti(seq, test_mat.data, test_mat.cols*test_mat.rows);
CvGraph* graph = cvCreateGraph( CV_ORIENTED_GRAPH,
sizeof(CvGraph), sizeof(CvGraphVtx),
sizeof(CvGraphEdge), storage );
@ -141,12 +141,12 @@ protected:
cvGraphAddEdge(graph, edges[i][0], edges[i][1], 0, &edge);
edge->weight = (float)(i+1);
}
depth = cvtest::randInt(rng) % (CV_64F+1);
cn = cvtest::randInt(rng) % 4 + 1;
int sz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1};
MatND test_mat_nd(3, sz, CV_MAKETYPE(depth, cn));
rng0.fill(test_mat_nd, CV_RAND_UNI, Scalar::all(ranges[depth][0]), Scalar::all(ranges[depth][1]));
if( depth >= CV_32F )
{
@ -155,44 +155,44 @@ protected:
rng0.fill(test_mat_scale, CV_RAND_UNI, Scalar::all(-1), Scalar::all(1));
multiply(test_mat_nd, test_mat_scale, test_mat_nd);
}
int ssz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1,
cvtest::randInt(rng)%10+1,cvtest::randInt(rng)%10+1};
SparseMat test_sparse_mat = cvTsGetRandomSparseMat(4, ssz, cvtest::randInt(rng)%(CV_64F+1),
cvtest::randInt(rng) % 10000, 0, 100, rng);
fs << "test_int" << test_int << "test_real" << test_real << "test_string" << test_string;
fs << "test_mat" << test_mat;
fs << "test_mat_nd" << test_mat_nd;
fs << "test_sparse_mat" << test_sparse_mat;
fs << "test_list" << "[" << 0.0000000000001 << 2 << CV_PI << -3435345 << "2-502 2-029 3egegeg" <<
"{:" << "month" << 12 << "day" << 31 << "year" << 1969 << "}" << "]";
fs << "test_map" << "{" << "x" << 1 << "y" << 2 << "width" << 100 << "height" << 200 << "lbp" << "[:";
const uchar arr[] = {0, 1, 1, 0, 1, 1, 0, 1};
fs.writeRaw("u", arr, (int)(sizeof(arr)/sizeof(arr[0])));
fs << "]" << "}";
cvWriteComment(*fs, "test comment", 0);
fs.writeObj("test_seq", seq);
fs.writeObj("test_graph",graph);
CvGraph* graph2 = (CvGraph*)cvClone(graph);
string content = fs.releaseAndGetString();
if(!fs.open(mem ? content : filename, FileStorage::READ + (mem ? FileStorage::MEMORY : 0)))
{
ts->printf( cvtest::TS::LOG, "filename %s can not be read\n", !mem ? filename.c_str() : content.c_str());
ts->set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
return;
}
int real_int = (int)fs["test_int"];
double real_real = (double)fs["test_real"];
string real_string = (string)fs["test_string"];
if( real_int != test_int ||
fabs(real_real - test_real) > DBL_EPSILON*(fabs(test_real)+1) ||
real_string != test_string )
@ -201,7 +201,7 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
CvMat* m = (CvMat*)fs["test_mat"].readObj();
CvMat _test_mat = test_mat;
double max_diff = 0;
@ -209,7 +209,7 @@ protected:
cvReshape(m, &stub1, 1, 0);
cvReshape(&_test_mat, &_test_stub1, 1, 0);
vector<int> pt;
if( !m || !CV_IS_MAT(m) || m->rows != test_mat.rows || m->cols != test_mat.cols ||
cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
{
@ -221,26 +221,26 @@ protected:
}
if( m && CV_IS_MAT(m))
cvReleaseMat(&m);
CvMatND* m_nd = (CvMatND*)fs["test_mat_nd"].readObj();
CvMatND _test_mat_nd = test_mat_nd;
if( !m_nd || !CV_IS_MATND(m_nd) )
{
ts->printf( cvtest::TS::LOG, "the read nd-matrix is not correct\n" );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
CvMat stub, _test_stub;
cvGetMat(m_nd, &stub, 0, 1);
cvGetMat(&_test_mat_nd, &_test_stub, 0, 1);
cvReshape(&stub, &stub1, 1, 0);
cvReshape(&_test_stub, &_test_stub1, 1, 0);
if( !CV_ARE_TYPES_EQ(&stub, &_test_stub) ||
!CV_ARE_SIZES_EQ(&stub, &_test_stub) ||
//cvNorm(&stub, &_test_stub, CV_L2) != 0 )
//cvNorm(&stub, &_test_stub, CV_L2) != 0 )
cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
{
ts->printf( cvtest::TS::LOG, "readObj method: the read nd matrix is not correct: (%.20g vs %.20g) vs at (%d,%d)\n",
@ -249,16 +249,16 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
MatND mat_nd2;
fs["test_mat_nd"] >> mat_nd2;
CvMatND m_nd2 = mat_nd2;
cvGetMat(&m_nd2, &stub, 0, 1);
cvReshape(&stub, &stub1, 1, 0);
if( !CV_ARE_TYPES_EQ(&stub, &_test_stub) ||
!CV_ARE_SIZES_EQ(&stub, &_test_stub) ||
//cvNorm(&stub, &_test_stub, CV_L2) != 0 )
//cvNorm(&stub, &_test_stub, CV_L2) != 0 )
cvtest::cmpEps( Mat(&stub1), Mat(&_test_stub1), &max_diff, 0, &pt, true) < 0 )
{
ts->printf( cvtest::TS::LOG, "C++ method: the read nd matrix is not correct: (%.20g vs %.20g) vs at (%d,%d)\n",
@ -267,16 +267,16 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
cvRelease((void**)&m_nd);
Ptr<CvSparseMat> m_s = (CvSparseMat*)fs["test_sparse_mat"].readObj();
Ptr<CvSparseMat> _test_sparse_ = (CvSparseMat*)test_sparse_mat;
Ptr<CvSparseMat> _test_sparse = (CvSparseMat*)cvClone(_test_sparse_);
SparseMat m_s2;
fs["test_sparse_mat"] >> m_s2;
Ptr<CvSparseMat> _m_s2 = (CvSparseMat*)m_s2;
if( !m_s || !CV_IS_SPARSE_MAT(m_s) ||
!cvTsCheckSparse(m_s, _test_sparse,0) ||
!cvTsCheckSparse(_m_s2, _test_sparse,0))
@ -285,7 +285,7 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
FileNode tl = fs["test_list"];
if( tl.type() != FileNode::SEQ || tl.size() != 6 ||
fabs((double)tl[0] - 0.0000000000001) >= DBL_EPSILON ||
@ -302,15 +302,15 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
FileNode tm = fs["test_map"];
FileNode tm_lbp = tm["lbp"];
int real_x = (int)tm["x"];
int real_y = (int)tm["y"];
int real_width = (int)tm["width"];
int real_height = (int)tm["height"];
int real_lbp_val = 0;
FileNodeIterator it;
it = tm_lbp.begin();
@ -332,7 +332,7 @@ protected:
real_lbp_val |= (int)*it2 << 4;
it2 += -1;
CV_Assert( it == it2 );
if( tm.type() != FileNode::MAP || tm.size() != 5 ||
real_x != 1 ||
real_y != 2 ||
@ -346,7 +346,7 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
CvGraph* graph3 = (CvGraph*)fs["test_graph"].readObj();
if(graph2->active_count != vcount || graph3->active_count != vcount ||
graph2->edges->active_count != ecount || graph3->edges->active_count != ecount)
@ -355,7 +355,7 @@ protected:
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
for( i = 0; i < ecount; i++ )
{
CvGraphEdge* edge2 = cvFindGraphEdge(graph2, edges[i][0], edges[i][1]);
@ -368,7 +368,7 @@ protected:
return;
}
}
fs.release();
if( !mem )
remove(filename.c_str());
@ -383,13 +383,14 @@ class CV_MiscIOTest : public cvtest::BaseTest
{
public:
CV_MiscIOTest() {}
~CV_MiscIOTest() {}
~CV_MiscIOTest() {}
protected:
void run(int)
{
try
{
FileStorage fs("test.xml", FileStorage::WRITE);
string fname = cv::tempfile(".xml");
FileStorage fs(fname, FileStorage::WRITE);
vector<int> mi, mi2, mi3, mi4;
vector<Mat> mv, mv2, mv3, mv4;
Mat m(10, 9, CV_32F);
@ -403,7 +404,7 @@ protected:
fs << "mv3" << mv3;
fs << "empty" << empty;
fs.release();
fs.open("test.xml", FileStorage::READ);
fs.open(fname, FileStorage::READ);
fs["mi"] >> mi2;
fs["mv"] >> mv2;
fs["mi3"] >> mi4;
@ -429,7 +430,7 @@ TEST(Core_InputOutput, misc) { CV_MiscIOTest test; test.safe_run(); }
{
public:
CV_BigMatrixIOTest() {}
~CV_BigMatrixIOTest() {}
~CV_BigMatrixIOTest() {}
protected:
void run(int)
{
@ -439,7 +440,7 @@ protected:
int N = 1000, M = 1200000;
Mat mat(M, N, CV_32F);
rng.fill(mat, RNG::UNIFORM, 0, 1);
FileStorage fs("test.xml", FileStorage::WRITE);
FileStorage fs(cv::tempfile(".xml"), FileStorage::WRITE);
fs << "mat" << mat;
fs.release();
}

View File

@ -749,7 +749,22 @@ bool CV_OperationsTest::TestTemplateMat()
if (Mat3i(1, 1).channels() != 3) throw test_excep();
if (Mat3w(1, 1).channels() != 3) throw test_excep();
if (Mat3s(1, 1).channels() != 3) throw test_excep();
vector<Mat_<float> > mvf, mvf2;
Mat_<Vec2f> mf2;
mvf.push_back(Mat_<float>::ones(4, 3));
mvf.push_back(Mat_<float>::zeros(4, 3));
merge(mvf, mf2);
split(mf2, mvf2);
CV_Assert( norm(mvf2[0], mvf[0], CV_C) == 0 &&
norm(mvf2[1], mvf[1], CV_C) == 0 );
{
Mat a(2,2,CV_32F,1.f);
Mat b(1,2,CV_32F,1.f);
Mat c = (a*b.t()).t();
CV_Assert( norm(c, CV_L1) == 4. );
}
}
catch (const test_excep& e)
{

View File

@ -94,9 +94,9 @@ Finds keypoints in an image and computes their descriptors
:param useProvidedKeypoints: If it is true, then the method will use the provided vector of keypoints instead of detecting them.
FREAK
FREAK
-----
.. ocv:class:: FREAK
.. ocv:class:: FREAK : public DescriptorExtractor
Class implementing the FREAK (*Fast Retina Keypoint*) keypoint descriptor, described in [AOV12]_. The algorithm propose a novel keypoint descriptor inspired by the human visual system and more precisely the retina, coined Fast Retina Key- point (FREAK). A cascade of binary strings is computed by efficiently comparing image intensities over a retinal sampling pattern. FREAKs are in general faster to compute with lower memory load and also more robust than SIFT, SURF or BRISK. They are competitive alternatives to existing keypoints in particular for embedded applications.
@ -106,12 +106,12 @@ FREAK::FREAK
------------
The FREAK constructor
.. ocv:function:: FREAK::FREAK(bool orientationNormalized = true, bool scaleNormalized = true, float patternScale = 22.0f, int nbOctave = 4, const vector<int>& selectedPairs = vector<int>())
.. ocv:function:: FREAK::FREAK( bool orientationNormalized=true, bool scaleNormalized=true, float patternScale=22.0f, int nOctaves=4, const vector<int>& selectedPairs=vector<int>() )
:param orientationNormalized: Enable orientation normalization.
:param scaleNormalized: Enable scale normalization.
:param patternScale: Scaling of the description pattern.
:param nbOctave: Number of octaves covered by the detected keypoints.
:param nOctaves: Number of octaves covered by the detected keypoints.
:param selectedPairs: (Optional) user defined selected pairs indexes,
FREAK::selectPairs
@ -126,4 +126,3 @@ We notice that for keypoint matching applications, image content has little effe
:param keypoints: Set of detected keypoints
:param corrThresh: Correlation threshold.
:param verbose: Prints pair selection informations.

View File

@ -328,7 +328,7 @@ public:
float patternScale = 22.0f,
int nOctaves = 4,
const vector<int>& selectedPairs = vector<int>());
FREAK( const FREAK& rhs );
FREAK( const FREAK& rhs );
FREAK& operator=( const FREAK& );
virtual ~FREAK();
@ -349,51 +349,51 @@ public:
vector<int> selectPairs( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints,
const double corrThresh = 0.7, bool verbose = true );
AlgorithmInfo* info() const;
AlgorithmInfo* info() const;
enum
{
NB_SCALES = 64, NB_PAIRS = 512, NB_ORIENPAIRS = 45
};
enum
{
NB_SCALES = 64, NB_PAIRS = 512, NB_ORIENPAIRS = 45
};
protected:
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
void buildPattern();
uchar meanIntensity( const Mat& image, const Mat& integral, const float kp_x, const float kp_y,
void buildPattern();
uchar meanIntensity( const Mat& image, const Mat& integral, const float kp_x, const float kp_y,
const unsigned int scale, const unsigned int rot, const unsigned int point ) const;
bool orientationNormalized; //true if the orientation is normalized, false otherwise
bool orientationNormalized; //true if the orientation is normalized, false otherwise
bool scaleNormalized; //true if the scale is normalized, false otherwise
double patternScale; //scaling of the pattern
int nOctaves; //number of octaves
bool extAll; // true if all pairs need to be extracted for pairs selection
double patternScale0;
int nOctaves0;
vector<int> selectedPairs0;
struct PatternPoint
{
float x; // x coordinate relative to center
float y; // x coordinate relative to center
float sigma; // Gaussian smoothing sigma
};
struct PatternPoint
{
float x; // x coordinate relative to center
float y; // x coordinate relative to center
float sigma; // Gaussian smoothing sigma
};
struct DescriptionPair
{
uchar i; // index of the first point
uchar j; // index of the second point
};
struct DescriptionPair
{
uchar i; // index of the first point
uchar j; // index of the second point
};
struct OrientationPair
{
uchar i; // index of the first point
uchar j; // index of the second point
int weight_dx; // dx/(norm_sq))*4096
int weight_dy; // dy/(norm_sq))*4096
};
vector<PatternPoint> patternLookup; // look-up table for the pattern points (position+sigma of all points at all scales and orientation)
struct OrientationPair
{
uchar i; // index of the first point
uchar j; // index of the second point
int weight_dx; // dx/(norm_sq))*4096
int weight_dy; // dy/(norm_sq))*4096
};
vector<PatternPoint> patternLookup; // look-up table for the pattern points (position+sigma of all points at all scales and orientation)
int patternSizes[NB_SCALES]; // size of the pattern at a specific scale (used to check if a point is within image boundaries)
DescriptionPair descriptionPairs[NB_PAIRS];
OrientationPair orientationPairs[NB_ORIENPAIRS];
@ -603,7 +603,7 @@ public:
// TODO implement read/write
virtual bool empty() const;
AlgorithmInfo* info() const;
protected:
@ -641,8 +641,8 @@ protected:
class CV_EXPORTS AdjusterAdapter: public FeatureDetector
{
public:
/** pure virtual interface
*/
/** pure virtual interface
*/
virtual ~AdjusterAdapter() {}
/** too few features were detected so, adjust the detector params accordingly
* \param min the minimum number of desired features
@ -682,7 +682,7 @@ public:
/** \param adjuster an AdjusterAdapter that will do the detection and parameter adjustment
* \param max_features the maximum desired number of features
* \param max_iters the maximum number of times to try to adjust the feature detector params
* for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
* for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
* \param min_features the minimum desired features
*/
DynamicAdaptedFeatureDetector( const Ptr<AdjusterAdapter>& adjuster, int min_features=400, int max_features=500, int max_iters=5 );
@ -693,8 +693,8 @@ protected:
virtual void detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
private:
DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&);
DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&);
int escape_iters_;
int min_features_, max_features_;
@ -792,7 +792,7 @@ public:
virtual bool empty() const;
protected:
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
virtual void computeImpl( const Mat& image, vector<KeyPoint>& keypoints, Mat& descriptors ) const;
Ptr<DescriptorExtractor> descriptorExtractor;
};
@ -962,7 +962,7 @@ class CV_EXPORTS_W DescriptorMatcher : public Algorithm
public:
virtual ~DescriptorMatcher();
/*
/*
* Add descriptors to train descriptor collection.
* descriptors Descriptors to add. Each descriptors[i] is a descriptors set from one image.
*/
@ -1078,7 +1078,7 @@ protected:
static bool isMaskedOut( const vector<Mat>& masks, int queryIdx );
static Mat clone_op( Mat m ) { return m.clone(); }
void checkMasks( const vector<Mat>& masks, int queryDescriptorsCount ) const;
void checkMasks( const vector<Mat>& masks, int queryDescriptorsCount ) const;
// Collection of descriptors from train images.
vector<Mat> trainDescCollection;

View File

@ -48,8 +48,8 @@ class CV_FastTest : public cvtest::BaseTest
{
public:
CV_FastTest();
~CV_FastTest();
protected:
~CV_FastTest();
protected:
void run(int);
};
@ -58,13 +58,13 @@ CV_FastTest::~CV_FastTest() {}
void CV_FastTest::run( int )
{
Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");
Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.jpg");
Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");
Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.jpg");
string xml = string(ts->get_data_path()) + "fast/result.xml";
if (image1.empty() || image2.empty())
{
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
return;
}
@ -73,20 +73,20 @@ void CV_FastTest::run( int )
cvtColor(image2, gray2, CV_BGR2GRAY);
vector<KeyPoint> keypoints1;
vector<KeyPoint> keypoints2;
vector<KeyPoint> keypoints2;
FAST(gray1, keypoints1, 30);
FAST(gray2, keypoints2, 30);
for(size_t i = 0; i < keypoints1.size(); ++i)
{
const KeyPoint& kp = keypoints1[i];
cv::circle(image1, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
cv::circle(image1, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
}
for(size_t i = 0; i < keypoints2.size(); ++i)
{
const KeyPoint& kp = keypoints2[i];
cv::circle(image2, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
cv::circle(image2, kp.pt, cvRound(kp.size/2), CV_RGB(255, 0, 0));
}
Mat kps1(1, (int)(keypoints1.size() * sizeof(KeyPoint)), CV_8U, &keypoints1[0]);
@ -99,14 +99,14 @@ void CV_FastTest::run( int )
fs << "exp_kps1" << kps1;
fs << "exp_kps2" << kps2;
fs.release();
}
}
if (!fs.isOpened())
fs.open(xml, FileStorage::READ);
Mat exp_kps1, exp_kps2;
Mat exp_kps1, exp_kps2;
read( fs["exp_kps1"], exp_kps1, Mat() );
read( fs["exp_kps2"], exp_kps2, Mat() );
read( fs["exp_kps2"], exp_kps2, Mat() );
fs.release();
if ( 0 != norm(exp_kps1, kps1, NORM_L2) || 0 != norm(exp_kps2, kps2, NORM_L2))
@ -114,7 +114,7 @@ void CV_FastTest::run( int )
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
return;
}
/* cv::namedWindow("Img1"); cv::imshow("Img1", image1);
cv::namedWindow("Img2"); cv::imshow("Img2", image2);
cv::waitKey(0);*/

View File

@ -50,8 +50,8 @@ using namespace cv;
class CV_MserTest : public cvtest::BaseTest
{
public:
CV_MserTest();
protected:
CV_MserTest();
protected:
void run(int);
int LoadBoxes(const char* path, vector<CvBox2D>& boxes);
int SaveBoxes(const char* path, const vector<CvBox2D>& boxes);
@ -71,7 +71,7 @@ int CV_MserTest::LoadBoxes(const char* path, vector<CvBox2D>& boxes)
{
return 0;
}
while (!feof(f))
{
CvBox2D box;
@ -175,12 +175,12 @@ void CV_MserTest::run(int)
{
RotatedRect box = fitEllipse(msers[i]);
box.angle=(float)CV_PI/2-box.angle;
boxes.push_back(box);
boxes.push_back(box);
}
string boxes_path = string(ts->get_data_path()) + "mser/boxes.txt";
string calc_boxes_path = string(ts->get_data_path()) + "mser/boxes.calc.txt";
if (!LoadBoxes(boxes_path.c_str(),boxes_orig))
{
SaveBoxes(boxes_path.c_str(),boxes);

View File

@ -128,7 +128,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
randu( desc, Scalar(minValue), Scalar(maxValue) );
createModel( desc );
tempCode = checkGetPoins( desc );
if( tempCode != cvtest::TS::OK )
{
@ -149,9 +149,9 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
ts->printf( cvtest::TS::LOG, "bad accuracy of Find \n" );
code = tempCode;
}
releaseModel();
ts->set_failed_test_info( code );
}
@ -398,7 +398,7 @@ void CV_FlannSavedIndexTest::createModel(const cv::Mat &data)
}
string filename = tempfile();
index->save( filename );
createIndex( data, SavedIndexParams(filename.c_str()));
remove( filename.c_str() );
}

View File

@ -21,10 +21,10 @@ GPU_PERF_TEST_1(BroxOpticalFlow, cv::gpu::DeviceInfo)
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u;
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
d_flow(frame0, frame1, u, v);
@ -58,12 +58,12 @@ GPU_PERF_TEST_1(InterpolateFrames, cv::gpu::DeviceInfo)
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat fu, fv;
cv::gpu::GpuMat fu, fv;
cv::gpu::GpuMat bu, bv;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
d_flow(frame0, frame1, fu, fv);
d_flow(frame1, frame0, bu, bv);
@ -101,9 +101,9 @@ GPU_PERF_TEST_1(CreateOpticalFlowNeedleMap, cv::gpu::DeviceInfo)
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u, v;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
d_flow(frame0, frame1, u, v);
cv::gpu::GpuMat vertex, colors;
@ -127,7 +127,7 @@ GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, MinDistance)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
double minDistance = GET_PARAM(1);
cv::Mat image_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
@ -233,7 +233,7 @@ GPU_PERF_TEST(PyrLKOpticalFlowDense, cv::gpu::DeviceInfo, WinSize, Levels, Iters
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u;
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
cv::gpu::PyrLKOpticalFlow pyrLK;

View File

@ -43,7 +43,7 @@
#include "precomp.hpp"
#if !defined (HAVE_CUDA)
cv::gpu::HOGDescriptor::HOGDescriptor(Size, Size, Size, Size, int, double, double, bool, int) { throw_nogpu(); }
size_t cv::gpu::HOGDescriptor::getDescriptorSize() const { throw_nogpu(); return 0; }
size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const { throw_nogpu(); return 0; }
@ -60,35 +60,35 @@ std::vector<float> cv::gpu::HOGDescriptor::getPeopleDetector64x128() { throw_nog
#else
namespace cv { namespace gpu { namespace device
namespace cv { namespace gpu { namespace device
{
namespace hog
namespace hog
{
void set_up_constants(int nbins, int block_stride_x, int block_stride_y,
void set_up_constants(int nbins, int block_stride_x, int block_stride_y,
int nblocks_win_x, int nblocks_win_y);
void compute_hists(int nbins, int block_stride_x, int blovck_stride_y,
int height, int width, const cv::gpu::DevMem2Df& grad,
int height, int width, const cv::gpu::DevMem2Df& grad,
const cv::gpu::DevMem2Db& qangle, float sigma, float* block_hists);
void normalize_hists(int nbins, int block_stride_x, int block_stride_y,
void normalize_hists(int nbins, int block_stride_x, int block_stride_y,
int height, int width, float* block_hists, float threshold);
void classify_hists(int win_height, int win_width, int block_stride_y,
int block_stride_x, int win_stride_y, int win_stride_x, int height,
int width, float* block_hists, float* coefs, float free_coef,
void classify_hists(int win_height, int win_width, int block_stride_y,
int block_stride_x, int win_stride_y, int win_stride_x, int height,
int width, float* block_hists, float* coefs, float free_coef,
float threshold, unsigned char* labels);
void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y, int block_stride_x,
int win_stride_y, int win_stride_x, int height, int width, float* block_hists,
void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y, int block_stride_x,
int win_stride_y, int win_stride_x, int height, int width, float* block_hists,
cv::gpu::DevMem2Df descriptors);
void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, int block_stride_x,
int win_stride_y, int win_stride_x, int height, int width, float* block_hists,
void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, int block_stride_x,
int win_stride_y, int win_stride_x, int height, int width, float* block_hists,
cv::gpu::DevMem2Df descriptors);
void compute_gradients_8UC1(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,
void compute_gradients_8UC1(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,
float angle_scale, cv::gpu::DevMem2Df grad, cv::gpu::DevMem2Db qangle, bool correct_gamma);
void compute_gradients_8UC4(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,
void compute_gradients_8UC4(int nbins, int height, int width, const cv::gpu::DevMem2Db& img,
float angle_scale, cv::gpu::DevMem2Df grad, cv::gpu::DevMem2Db qangle, bool correct_gamma);
void resize_8UC1(const cv::gpu::DevMem2Db& src, cv::gpu::DevMem2Db dst);
@ -97,7 +97,7 @@ namespace cv { namespace gpu { namespace device
}}}
using namespace ::cv::gpu::device;
cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_, Size cell_size_,
int nbins_, double win_sigma_, double threshold_L2hys_, bool gamma_correction_, int nlevels_)
: win_size(win_size_),
@ -110,7 +110,7 @@ cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size blo
gamma_correction(gamma_correction_),
nlevels(nlevels_)
{
CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 &&
CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 &&
(win_size.height - block_size.height) % block_stride.height == 0);
CV_Assert(block_size.width % cell_size.width == 0 && block_size.height % cell_size.height == 0);
@ -124,14 +124,14 @@ cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size blo
cv::Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride);
hog::set_up_constants(nbins, block_stride.width, block_stride.height, blocks_per_win.width, blocks_per_win.height);
}
}
size_t cv::gpu::HOGDescriptor::getDescriptorSize() const
{
return numPartsWithin(win_size, block_size, block_stride).area() * getBlockHistogramSize();
}
size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const
size_t cv::gpu::HOGDescriptor::getBlockHistogramSize() const
{
Size cells_per_block = Size(block_size.width / cell_size.width, block_size.height / cell_size.height);
return (size_t)(nbins * cells_per_block.area());
@ -167,7 +167,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
this->detector.upload(Mat(detector_reordered).reshape(1, 1));
size_t descriptor_size = getDescriptorSize();
size_t descriptor_size = getDescriptorSize();
free_coef = _detector.size() > descriptor_size ? _detector[descriptor_size] : 0;
CV_Assert(checkDetectorSize());
@ -175,25 +175,25 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(const Size& sz, int type, GpuMat& buf)
{
if (buf.empty() || buf.type() != type)
buf.create(sz, type);
else
if (buf.cols < sz.width || buf.rows < sz.height)
buf.create(std::max(buf.rows, sz.height), std::max(buf.cols, sz.width), type);
if (buf.empty() || buf.type() != type)
buf.create(sz, type);
else
if (buf.cols < sz.width || buf.rows < sz.height)
buf.create(std::max(buf.rows, sz.height), std::max(buf.cols, sz.width), type);
return buf(Rect(Point(0,0), sz));
return buf(Rect(Point(0,0), sz));
}
cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(int rows, int cols, int type, GpuMat& buf)
{
return getBuffer(Size(cols, rows), type, buf);
{
return getBuffer(Size(cols, rows), type, buf);
}
void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, GpuMat& _qangle)
{
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
// grad.create(img.size(), CV_32FC2);
_grad = getBuffer(img.size(), CV_32FC2, grad_buf);
@ -201,8 +201,8 @@ void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, G
_qangle = getBuffer(img.size(), CV_8UC2, qangle_buf);
float angleScale = (float)(nbins / CV_PI);
switch (img.type())
{
switch (img.type())
{
case CV_8UC1:
hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);
break;
@ -220,13 +220,13 @@ void cv::gpu::HOGDescriptor::computeBlockHistograms(const GpuMat& img)
size_t block_hist_size = getBlockHistogramSize();
Size blocks_per_img = numPartsWithin(img.size(), block_size, block_stride);
// block_hists.create(1, block_hist_size * blocks_per_img.area(), CV_32F);
block_hists = getBuffer(1, static_cast<int>(block_hist_size * blocks_per_img.area()), CV_32F, block_hists_buf);
hog::compute_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,
grad, qangle, (float)getWinSigma(), block_hists.ptr<float>());
// block_hists.create(1, block_hist_size * blocks_per_img.area(), CV_32F);
block_hists = getBuffer(1, static_cast<int>(block_hist_size * blocks_per_img.area()), CV_32F, block_hists_buf);
hog::normalize_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,
hog::compute_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,
grad, qangle, (float)getWinSigma(), block_hists.ptr<float>());
hog::normalize_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols,
block_hists.ptr<float>(), (float)threshold_L2hys);
}
@ -246,11 +246,11 @@ void cv::gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride,
switch (descr_format)
{
case DESCR_FORMAT_ROW_BY_ROW:
hog::extract_descrs_by_rows(win_size.height, win_size.width, block_stride.height, block_stride.width,
hog::extract_descrs_by_rows(win_size.height, win_size.width, block_stride.height, block_stride.width,
win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(), descriptors);
break;
case DESCR_FORMAT_COL_BY_COL:
hog::extract_descrs_by_cols(win_size.height, win_size.width, block_stride.height, block_stride.width,
hog::extract_descrs_by_cols(win_size.height, win_size.width, block_stride.height, block_stride.width,
win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(), descriptors);
break;
default:
@ -277,10 +277,10 @@ void cv::gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& hits, doub
Size wins_per_img = numPartsWithin(img.size(), win_size, win_stride);
// labels.create(1, wins_per_img.area(), CV_8U);
labels = getBuffer(1, wins_per_img.area(), CV_8U, labels_buf);
labels = getBuffer(1, wins_per_img.area(), CV_8U, labels_buf);
hog::classify_hists(win_size.height, win_size.width, block_stride.height, block_stride.width,
win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(),
hog::classify_hists(win_size.height, win_size.width, block_stride.height, block_stride.width,
win_stride.height, win_stride.width, img.rows, img.cols, block_hists.ptr<float>(),
detector.ptr<float>(), (float)free_coef, (float)hit_threshold, labels.ptr());
labels.download(labels_host);
@ -289,18 +289,18 @@ void cv::gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& hits, doub
{
int y = i / wins_per_img.width;
int x = i - wins_per_img.width * y;
if (vec[i])
if (vec[i])
hits.push_back(Point(x * win_stride.width, y * win_stride.height));
}
}
void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold,
Size win_stride, Size padding, double scale0, int group_threshold)
void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold,
Size win_stride, Size padding, double scale0, int group_threshold)
{
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
vector<double> level_scale;
double scale = 1.;
@ -309,35 +309,35 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
for (levels = 0; levels < nlevels; levels++)
{
level_scale.push_back(scale);
if (cvRound(img.cols/scale) < win_size.width ||
if (cvRound(img.cols/scale) < win_size.width ||
cvRound(img.rows/scale) < win_size.height || scale0 <= 1)
break;
scale *= scale0;
}
levels = std::max(levels, 1);
level_scale.resize(levels);
image_scales.resize(levels);
image_scales.resize(levels);
std::vector<Rect> all_candidates;
std::vector<Rect> all_candidates;
vector<Point> locations;
for (size_t i = 0; i < level_scale.size(); i++)
{
double _scale = level_scale[i];
Size sz(cvRound(img.cols / _scale), cvRound(img.rows / _scale));
scale = level_scale[i];
Size sz(cvRound(img.cols / scale), cvRound(img.rows / scale));
GpuMat smaller_img;
if (sz == img.size())
smaller_img = img;
else
{
{
image_scales[i].create(sz, img.type());
switch (img.type())
{
switch (img.type())
{
case CV_8UC1: hog::resize_8UC1(img, image_scales[i]); break;
case CV_8UC4: hog::resize_8UC4(img, image_scales[i]); break;
}
smaller_img = image_scales[i];
smaller_img = image_scales[i];
}
detect(smaller_img, locations, hit_threshold, win_stride, padding);
@ -346,16 +346,16 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale, scaled_win_size));
}
found_locations.assign(all_candidates.begin(), all_candidates.end());
found_locations.assign(all_candidates.begin(), all_candidates.end());
groupRectangles(found_locations, group_threshold, 0.2/*magic number copied from CPU version*/);
}
int cv::gpu::HOGDescriptor::numPartsWithin(int size, int part_size, int stride)
int cv::gpu::HOGDescriptor::numPartsWithin(int size, int part_size, int stride)
{
return (size - part_size + stride) / stride;
}
cv::Size cv::gpu::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size, cv::Size stride)
cv::Size cv::gpu::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size, cv::Size stride)
{
return Size(numPartsWithin(size.width, part_size.width, stride.width), numPartsWithin(size.height, part_size.height, stride.height));
}
@ -368,336 +368,336 @@ std::vector<float> cv::gpu::HOGDescriptor::getDefaultPeopleDetector()
std::vector<float> cv::gpu::HOGDescriptor::getPeopleDetector48x96()
{
static const float detector[] = {
0.294350f, -0.098796f, -0.129522f, 0.078753f, 0.387527f, 0.261529f,
0.145939f, 0.061520f, 0.328699f, 0.227148f, -0.066467f, -0.086723f,
0.047559f, 0.106714f, 0.037897f, 0.111461f, -0.024406f, 0.304769f,
0.254676f, -0.069235f, 0.082566f, 0.147260f, 0.326969f, 0.148888f,
0.055270f, -0.087985f, 0.261720f, 0.143442f, 0.026812f, 0.238212f,
0.194020f, 0.056341f, -0.025854f, -0.034444f, -0.156631f, 0.205174f,
0.089008f, -0.139811f, -0.100147f, -0.037830f, -0.029230f, -0.055641f,
0.033248f, -0.016512f, 0.155244f, 0.247315f, -0.124694f, -0.048414f,
-0.062219f, 0.193683f, 0.004574f, 0.055089f, 0.093565f, 0.167712f,
0.167581f, 0.018895f, 0.215258f, 0.122609f, 0.090520f, -0.067219f,
-0.049029f, -0.099615f, 0.241804f, -0.094893f, -0.176248f, 0.001727f,
-0.134473f, 0.104442f, 0.050942f, 0.081165f, 0.072156f, 0.121646f,
0.002656f, -0.297974f, -0.133587f, -0.060121f, -0.092515f, -0.048974f,
-0.084754f, -0.180111f, -0.038590f, 0.086283f, -0.134636f, -0.107249f,
0.132890f, 0.141556f, 0.249425f, 0.130273f, -0.030031f, 0.073212f,
-0.008155f, 0.019931f, 0.071688f, 0.000300f, -0.019525f, -0.021725f,
-0.040993f, -0.086841f, 0.070124f, 0.240033f, 0.265350f, 0.043208f,
0.166754f, 0.091453f, 0.060916f, -0.036972f, -0.091043f, 0.079873f,
0.219781f, 0.158102f, -0.140618f, -0.043016f, 0.124802f, 0.093668f,
0.103208f, 0.094872f, 0.080541f, 0.137711f, 0.160566f, -0.169231f,
0.013983f, 0.309508f, -0.004217f, -0.057200f, -0.064489f, 0.014066f,
0.361009f, 0.251328f, -0.080983f, -0.044183f, 0.061436f, -0.037381f,
-0.078786f, 0.030993f, 0.066314f, 0.037683f, 0.152325f, -0.091683f,
0.070203f, 0.217856f, 0.036435f, -0.076462f, 0.006254f, -0.094431f,
0.154829f, -0.023038f, -0.196961f, -0.024594f, 0.178465f, -0.050139f,
-0.045932f, -0.000965f, 0.109112f, 0.046165f, -0.159373f, -0.008713f,
0.041307f, 0.097129f, -0.057211f, -0.064599f, 0.077165f, 0.176167f,
0.138322f, 0.065753f, -0.104950f, 0.017933f, 0.136255f, -0.011598f,
0.047007f, 0.080550f, 0.068619f, 0.084661f, -0.035493f, -0.091314f,
-0.041411f, 0.060971f, -0.101912f, -0.079870f, -0.085977f, -0.022686f,
0.079788f, -0.098064f, -0.054603f, 0.040383f, 0.300794f, 0.128603f,
0.094844f, 0.047407f, 0.101825f, 0.061832f, -0.162160f, -0.204553f,
-0.035165f, 0.101450f, -0.016641f, -0.027140f, -0.134392f, -0.008743f,
0.102331f, 0.114853f, 0.009644f, 0.062823f, 0.237339f, 0.167843f,
0.053066f, -0.012592f, 0.043158f, 0.002305f, 0.065001f, -0.038929f,
-0.020356f, 0.152343f, 0.043469f, -0.029967f, -0.042948f, 0.032481f,
0.068488f, -0.110840f, -0.111083f, 0.111980f, -0.002072f, -0.005562f,
0.082926f, 0.006635f, -0.108153f, 0.024242f, -0.086464f, -0.189884f,
-0.017492f, 0.191456f, -0.007683f, -0.128769f, -0.038017f, -0.132380f,
0.091926f, 0.079696f, -0.106728f, -0.007656f, 0.172744f, 0.011576f,
0.009883f, 0.083258f, -0.026516f, 0.145534f, 0.153924f, -0.130290f,
-0.108945f, 0.124490f, -0.003186f, -0.100485f, 0.015024f, -0.060512f,
0.026288f, -0.086713f, -0.169012f, 0.076517f, 0.215778f, 0.043701f,
-0.131642f, -0.012585f, -0.045181f, -0.118183f, -0.241544f, -0.167293f,
-0.020107f, -0.019917f, -0.101827f, -0.107096f, -0.010503f, 0.044938f,
0.189680f, 0.217119f, -0.046086f, 0.044508f, 0.199716f, -0.036004f,
-0.148927f, 0.013355f, -0.078279f, 0.030451f, 0.056301f, -0.024609f,
0.083224f, 0.099533f, -0.039432f, -0.138880f, 0.005482f, -0.024120f,
-0.140468f, -0.066381f, -0.017057f, 0.009260f, -0.058004f, -0.028486f,
-0.061610f, 0.007483f, -0.158309f, -0.150687f, -0.044595f, -0.105121f,
-0.045763f, -0.006618f, -0.024419f, -0.117713f, -0.119366f, -0.175941f,
-0.071542f, 0.119027f, 0.111362f, 0.043080f, 0.034889f, 0.093003f,
0.007842f, 0.057368f, -0.108834f, -0.079968f, 0.230959f, 0.020205f,
0.011470f, 0.098877f, 0.101310f, -0.030215f, -0.018018f, -0.059552f,
-0.106157f, 0.021866f, -0.036471f, 0.080051f, 0.041165f, -0.082101f,
0.117726f, 0.030961f, -0.054763f, -0.084102f, -0.185778f, -0.061305f,
-0.038089f, -0.110728f, -0.264010f, 0.076675f, -0.077111f, -0.137644f,
0.036232f, 0.277995f, 0.019116f, 0.107738f, 0.144003f, 0.080304f,
0.215036f, 0.228897f, 0.072713f, 0.077773f, 0.120168f, 0.075324f,
0.062730f, 0.122478f, -0.049008f, 0.164912f, 0.162450f, 0.041246f,
0.009891f, -0.097827f, -0.038700f, -0.023027f, -0.120020f, 0.203364f,
0.248474f, 0.149810f, -0.036276f, -0.082814f, -0.090343f, -0.027143f,
-0.075689f, -0.320310f, -0.000500f, -0.143334f, -0.065077f, -0.186936f,
0.129372f, 0.116431f, 0.181699f, 0.170436f, 0.418854f, 0.460045f,
0.333719f, 0.230515f, 0.047822f, -0.044954f, -0.068086f, 0.140179f,
-0.044821f, 0.085550f, 0.092483f, -0.107296f, -0.130670f, -0.206629f,
0.114601f, -0.317869f, -0.076663f, 0.038680f, 0.212753f, -0.016059f,
-0.126526f, -0.163602f, 0.210154f, 0.099887f, -0.126366f, 0.118453f,
0.019309f, -0.021611f, -0.096499f, -0.111809f, -0.200489f, 0.142854f,
0.228840f, -0.353346f, -0.179151f, 0.116834f, 0.252389f, -0.031728f,
-0.188135f, -0.158998f, 0.386523f, 0.122315f, 0.209944f, 0.394023f,
0.359030f, 0.260717f, 0.170335f, 0.013683f, -0.142596f, -0.026138f,
-0.011878f, -0.150519f, 0.047159f, -0.107062f, -0.147347f, -0.187689f,
-0.186027f, -0.208048f, 0.058468f, -0.073026f, -0.236556f, -0.079788f,
-0.146216f, -0.058563f, -0.101361f, -0.071294f, -0.071093f, 0.116919f,
0.234304f, 0.306781f, 0.321866f, 0.240000f, 0.073261f, -0.012173f,
0.026479f, 0.050173f, 0.166127f, 0.228955f, 0.061905f, 0.156460f,
0.205990f, 0.120672f, 0.037350f, 0.167884f, 0.290099f, 0.420900f,
-0.012601f, 0.189839f, 0.306378f, 0.118383f, -0.095598f, -0.072360f,
-0.132496f, -0.224259f, -0.126021f, 0.022714f, 0.284039f, 0.051369f,
-0.000927f, -0.058735f, -0.083354f, -0.141254f, -0.187578f, -0.202669f,
0.048902f, 0.246597f, 0.441863f, 0.342519f, 0.066979f, 0.215286f,
0.188191f, -0.072240f, -0.208142f, -0.030196f, 0.178141f, 0.136985f,
-0.043374f, -0.181098f, 0.091815f, 0.116177f, -0.126690f, -0.386625f,
0.368165f, 0.269149f, -0.088042f, -0.028823f, 0.092961f, 0.024099f,
0.046112f, 0.176756f, 0.135849f, 0.124955f, 0.195467f, -0.037218f,
0.167217f, 0.188938f, 0.053528f, -0.066561f, 0.133721f, -0.070565f,
0.115898f, 0.152435f, -0.116993f, -0.110592f, -0.179005f, 0.026668f,
0.080530f, 0.075084f, -0.070401f, 0.012497f, 0.021849f, -0.139764f,
-0.022020f, -0.096301f, -0.064954f, -0.127446f, -0.013806f, -0.108315f,
0.156285f, 0.149867f, -0.011382f, 0.064532f, 0.029168f, 0.027393f,
0.069716f, 0.153735f, 0.038459f, 0.230714f, 0.253840f, 0.059522f,
-0.045053f, 0.014083f, 0.071103f, 0.068747f, 0.095887f, 0.005832f,
0.144887f, 0.026357f, -0.067359f, -0.044151f, -0.123283f, -0.019911f,
0.005318f, 0.109208f, -0.003201f, -0.021734f, 0.142025f, -0.066907f,
-0.120070f, -0.188639f, 0.012472f, -0.048704f, -0.012366f, -0.184828f,
0.168591f, 0.267166f, 0.058208f, -0.044101f, 0.033500f, 0.178558f,
0.104550f, 0.122418f, 0.080177f, 0.173246f, 0.298537f, 0.064173f,
0.053397f, 0.174341f, 0.230984f, 0.117025f, 0.166242f, 0.227781f,
0.120623f, 0.176952f, -0.011393f, -0.086483f, -0.008270f, 0.051700f,
-0.153369f, -0.058837f, -0.057639f, -0.060115f, 0.026349f, -0.160745f,
-0.037894f, -0.048575f, 0.041052f, -0.022112f, 0.060365f, 0.051906f,
0.162657f, 0.138519f, -0.050185f, -0.005938f, 0.071301f, 0.127686f,
0.062342f, 0.144400f, 0.072600f, 0.198436f, 0.246219f, -0.078185f,
-0.036169f, 0.075934f, 0.047328f, -0.013601f, 0.087205f, 0.019900f,
0.022606f, -0.015365f, -0.092506f, 0.075275f, -0.116375f, 0.050500f,
0.045118f, 0.166567f, 0.072073f, 0.060371f, 0.131747f, -0.169863f,
-0.039352f, -0.047486f, -0.039797f, -0.204312f, 0.021710f, 0.129443f,
-0.021173f, 0.173416f, -0.070794f, -0.063986f, 0.069689f, -0.064099f,
-0.123201f, -0.017372f, -0.206870f, 0.065863f, 0.113226f, 0.024707f,
-0.071341f, -0.066964f, -0.098278f, -0.062927f, 0.075840f, 0.014716f,
0.019378f, 0.132699f, -0.074191f, -0.089557f, -0.078446f, -0.197488f,
-0.173665f, 0.052583f, 0.044361f, 0.113549f, 0.098492f, 0.077379f,
-0.011146f, -0.192593f, -0.164435f, 0.045568f, 0.205699f, 0.049187f,
-0.082281f, 0.134874f, 0.185499f, 0.034968f, -0.119561f, -0.112372f,
-0.115091f, -0.054042f, -0.183816f, -0.078100f, 0.190695f, 0.091617f,
0.004257f, -0.041135f, -0.061453f, -0.141592f, -0.194809f, -0.120638f,
0.020168f, 0.109672f, 0.067398f, -0.015238f, -0.239145f, -0.264671f,
-0.185176f, 0.050472f, 0.020793f, 0.035678f, 0.022839f, -0.052055f,
-0.127968f, -0.113049f, -0.228416f, -0.258281f, -0.053437f, 0.076424f,
0.061450f, 0.237478f, 0.003618f, -0.055865f, -0.108087f, -0.028937f,
0.045585f, 0.052829f, -0.001471f, 0.022826f, 0.059565f, -0.104430f,
-0.077266f, -0.211882f, -0.212078f, 0.028074f, 0.075846f, 0.016265f,
0.161879f, 0.134477f, 0.008935f, -0.048041f, 0.074692f, 0.004928f,
-0.025156f, 0.192874f, 0.074410f, 0.308732f, 0.267400f, 0.094208f,
-0.005251f, 0.042041f, -0.032148f, 0.015588f, 0.252869f, 0.175302f,
0.022892f, 0.081673f, 0.063208f, 0.162626f, 0.194426f, 0.233890f,
0.262292f, 0.186930f, 0.084079f, -0.286388f, -0.213034f, -0.048867f,
-0.207669f, -0.170050f, 0.011673f, -0.092958f, -0.192786f, -0.273536f,
0.230904f, 0.266732f, 0.320519f, 0.297155f, 0.548169f, 0.304922f,
0.132687f, 0.247333f, 0.212488f, -0.271472f, -0.142105f, -0.002627f,
-0.119215f, 0.128383f, 0.100079f, -0.057490f, -0.121902f, -0.228892f,
0.202292f, -0.399795f, -0.371326f, -0.095836f, -0.063626f, -0.161375f,
-0.311180f, -0.294797f, 0.242122f, 0.011788f, 0.095573f, 0.322523f,
0.511840f, 0.322880f, 0.313259f, 0.173331f, 0.002542f, -0.029802f,
0.324766f, -0.326170f, -0.340547f, -0.138288f, -0.002963f, -0.114060f,
-0.377312f, -0.442570f, 0.212446f, -0.007759f, -0.011576f, 0.169711f,
0.308689f, 0.317348f, 0.539390f, 0.332845f, 0.057331f, -0.068180f,
0.101994f, 0.266995f, 0.209570f, 0.355730f, 0.091635f, 0.170238f,
0.125215f, 0.274154f, 0.070223f, 0.025515f, 0.049946f, -0.000550f,
0.043715f, -0.141843f, 0.020844f, 0.129871f, 0.256588f, 0.105015f,
0.148339f, 0.170682f, 0.028792f, 0.074037f, 0.160042f, 0.405137f,
0.246187f, 0.352160f, 0.168951f, 0.222263f, 0.264439f, 0.065945f,
0.021963f, -0.075084f, 0.093105f, 0.027318f, 0.098864f, 0.057566f,
-0.080282f, 0.185032f, 0.314419f, 0.333727f, 0.125798f, 0.294919f,
0.386002f, 0.217619f, -0.183517f, -0.278622f, -0.002342f, -0.027821f,
-0.134266f, -0.331843f, -0.008296f, 0.124564f, 0.053712f, -0.369016f,
-0.095036f, 0.209381f, 0.423760f, 0.371760f, 0.106397f, 0.369408f,
0.485608f, 0.231201f, -0.138685f, -0.349208f, -0.070083f, 0.028991f,
-0.081630f, -0.395992f, -0.146791f, -0.027354f, 0.063396f, -0.272484f,
0.058299f, 0.338207f, 0.110767f, -0.052642f, -0.233848f, -0.027448f,
0.030328f, 0.155572f, -0.093826f, 0.019331f, 0.120638f, 0.006292f,
-0.106083f, -0.236290f, -0.140933f, -0.088067f, -0.025138f, -0.208395f,
-0.025502f, 0.144192f, -0.048353f, -0.106144f, -0.305121f, -0.114147f,
0.090963f, 0.327727f, 0.035606f, -0.093779f, 0.002651f, -0.171081f,
-0.188131f, -0.216571f, -0.209101f, -0.054402f, 0.157147f, -0.057127f,
0.066584f, 0.008988f, 0.041191f, 0.034456f, -0.078255f, 0.052099f,
-0.022239f, 0.066981f, -0.117520f, -0.072637f, 0.062512f, 0.037570f,
-0.057544f, -0.312359f, 0.034357f, -0.031549f, 0.002566f, -0.207375f,
-0.070654f, -0.018786f, -0.044815f, -0.012814f, -0.076320f, 0.078183f,
0.023877f, 0.117078f, 0.022292f, -0.205424f, -0.060430f, -0.017296f,
-0.004827f, -0.321036f, -0.092155f, 0.038837f, 0.073190f, -0.067513f,
0.026521f, 0.171945f, 0.087318f, 0.034495f, -0.034089f, 0.154410f,
-0.061431f, 0.007435f, -0.111094f, -0.095976f, 0.014741f, -0.132324f,
-0.029517f, -0.192160f, 0.098667f, 0.020762f, 0.177050f, -0.064510f,
-0.054437f, -0.058678f, -0.001858f, 0.167602f, 0.015735f, 0.054338f,
0.016477f, 0.186381f, -0.010667f, 0.054692f, 0.126742f, 0.013140f,
0.090353f, -0.133608f, -0.018017f, -0.152619f, 0.027600f, -0.138700f,
-0.050274f, 0.045141f, -0.118731f, 0.094797f, -0.167605f, 0.097461f,
-0.009131f, 0.199920f, -0.052976f, 0.158194f, 0.178568f, -0.107600f,
0.009671f, -0.084072f, -0.040258f, -0.205673f, 0.102891f, 0.223511f,
0.042699f, 0.118548f, -0.021274f, 0.110997f, -0.155121f, 0.027696f,
-0.149968f, 0.051552f, -0.129219f, 0.173524f, 0.073972f, -0.189045f,
-0.034523f, -0.106655f, -0.011843f, -0.197381f, 0.219413f, 0.183197f,
-0.054920f, 0.144955f, 0.036517f, -0.085412f, -0.229070f, -0.143710f,
-0.049486f, 0.156634f, -0.008673f, -0.064778f, 0.082344f, 0.145673f,
0.002912f, -0.210121f, -0.116564f, 0.078425f, 0.220908f, -0.067594f,
0.048610f, 0.084912f, -0.066202f, -0.112515f, -0.217767f, -0.082640f,
-0.017414f, 0.230265f, -0.070735f, 0.066073f, 0.215256f, 0.071157f,
-0.087220f, -0.202235f, -0.011918f, 0.099562f, 0.174716f, -0.063845f,
-0.121055f, 0.014367f, 0.132709f, -0.005060f, -0.244606f, -0.179693f,
-0.134690f, 0.023239f, -0.193116f, -0.076975f, -0.021164f, -0.001938f,
-0.163799f, -0.111437f, -0.210362f, -0.166376f, 0.034754f, 0.010036f,
-0.021917f, 0.068014f, -0.086893f, -0.251746f, -0.267171f, 0.037383f,
0.003966f, 0.033571f, -0.151506f, 0.025437f, -0.020626f, -0.308454f,
-0.343143f, -0.092263f, -0.026261f, -0.028345f, 0.036036f, 0.035169f,
0.129470f, 0.122205f, 0.015661f, -0.070612f, -0.094333f, -0.066055f,
-0.041083f, 0.159146f, 0.073184f, 0.110044f, 0.174471f, 0.078069f,
-0.014881f, 0.008116f, 0.013209f, 0.075857f, 0.195605f, 0.062714f,
0.067955f, 0.056544f, -0.153908f, -0.141749f, -0.072550f, 0.033523f,
-0.024665f, 0.134487f, 0.079076f, 0.133562f, 0.227130f, 0.018054f,
0.004928f, 0.169162f, 0.065152f, 0.072160f, 0.131631f, 0.096303f,
0.054288f, 0.106256f, 0.114632f, 0.119038f, 0.515200f, 0.247429f,
0.199134f, 0.211957f, 0.127558f, -0.294684f, -0.194890f, -0.049988f,
-0.112247f, -0.008122f, -0.006176f, 0.037035f, -0.110881f, -0.249989f,
0.152434f, 0.234621f, 0.153340f, 0.349283f, 0.683049f, 0.157174f,
0.124844f, 0.099136f, 0.064407f, -0.248400f, -0.155323f, -0.026498f,
-0.023450f, 0.049051f, -0.114187f, 0.007195f, -0.176825f, -0.376926f,
0.366159f, -0.179938f, -0.148508f, 0.006043f, 0.170048f, 0.097866f,
-0.102658f, -0.260430f, 0.248868f, 0.037019f, -0.118111f, 0.078176f,
0.194171f, 0.211328f, 0.368612f, 0.361213f, 0.130013f, 0.094650f,
0.227396f, -0.178058f, -0.114782f, -0.008093f, 0.231080f, -0.011843f,
-0.097917f, -0.325788f, 0.141879f, 0.119738f, -0.230427f, -0.117419f,
-0.114153f, 0.037903f, 0.116383f, 0.218773f, -0.101884f, 0.059466f,
0.119255f, 0.010874f, -0.031449f, 0.045996f, 0.119931f, 0.273760f,
0.311700f, 0.261794f, 0.194809f, 0.339829f, 0.239449f, 0.064140f,
0.077597f, 0.098996f, 0.143534f, 0.184602f, 0.037507f, 0.225494f,
0.096142f, -0.147370f, -0.207833f, -0.174742f, -0.086391f, -0.038942f,
0.159577f, -0.088492f, -0.000989f, 0.108154f, -0.025890f, -0.072713f,
0.025997f, -0.006803f, -0.086879f, -0.011290f, -0.269200f, -0.103450f,
-0.124910f, -0.116340f, 0.141459f, 0.208800f, 0.042268f, 0.265034f,
0.516474f, 0.217591f, -0.018843f, -0.313328f, -0.168363f, 0.047129f,
0.090480f, -0.109852f, -0.018761f, 0.210669f, 0.281269f, -0.043591f,
-0.034147f, -0.237772f, -0.134843f, -0.072481f, -0.103831f, 0.038355f,
0.308619f, 0.148023f, -0.045867f, -0.123950f, -0.210860f, -0.064973f,
-0.036308f, -0.046731f, -0.022099f, 0.095776f, 0.409423f, 0.060635f,
-0.065196f, 0.051828f, 0.027981f, -0.009609f, -0.137681f, -0.095011f,
-0.019045f, 0.177278f, 0.009759f, -0.092119f, -0.016958f, -0.133860f,
-0.118421f, -0.032039f, -0.006214f, -0.084541f, 0.063971f, -0.073642f,
0.165676f, 0.110443f, 0.044131f, 0.046568f, 0.053292f, -0.055466f,
0.015512f, 0.371947f, 0.232102f, -0.016923f, 0.103979f, -0.091758f,
0.005907f, 0.209100f, 0.157433f, 0.030518f, 0.250366f, 0.062322f,
0.036720f, 0.094676f, 0.017306f, -0.010328f, -0.079012f, 0.016781f,
-0.112435f, 0.061795f, 0.042543f, -0.126799f, -0.009975f, -0.056760f,
0.046424f, -0.194712f, -0.139399f, -0.037731f, 0.157989f, -0.016261f,
0.123345f, 0.230563f, 0.083300f, -0.016392f, 0.059567f, -0.016035f,
-0.064767f, 0.231945f, 0.156629f, 0.034602f, 0.145628f, 0.041315f,
0.034535f, 0.019967f, -0.089188f, -0.012091f, 0.307857f, 0.211405f,
-0.025091f, -0.148249f, -0.129384f, 0.063536f, -0.068603f, -0.067941f,
-0.035104f, 0.210832f, 0.063810f, 0.062764f, -0.089889f, -0.030554f,
0.014791f, -0.053362f, -0.037818f, -0.196640f, 0.008388f, -0.082654f,
0.143056f, 0.064221f, 0.069795f, 0.191040f, 0.097321f, -0.028679f,
0.075794f, 0.313154f, 0.086240f, 0.207643f, 0.017809f, 0.122867f,
0.224586f, 0.167403f, -0.023884f, 0.047434f, 0.344091f, 0.187745f,
0.136177f, 0.141738f, 0.063799f, 0.045233f, -0.077342f, -0.003525f,
-0.165041f, -0.025616f, -0.073745f, 0.164439f, 0.011200f, -0.145896f,
-0.027954f, -0.061987f, -0.039874f, -0.142775f, 0.151042f, -0.038238f,
0.053152f, 0.078615f, 0.086061f, 0.100593f, 0.128046f, -0.071006f,
-0.116558f, 0.208445f, 0.051086f, 0.076843f, 0.023191f, -0.084781f,
-0.011790f, 0.147807f, -0.048554f, -0.113932f, 0.283322f, 0.190934f,
0.092789f, 0.033018f, -0.142428f, -0.142480f, -0.099023f, -0.041020f,
-0.042760f, 0.203295f, -0.053475f, 0.042424f, 0.222839f, -0.019167f,
-0.133176f, -0.276216f, -0.031998f, 0.117290f, 0.177827f, -0.059973f,
-0.064744f, -0.117040f, -0.155482f, -0.099531f, 0.164121f, -0.026682f,
-0.093810f, 0.238993f, -0.006506f, 0.007830f, 0.065819f, -0.203643f,
-0.100925f, -0.053652f, -0.130770f, 0.026277f, 0.131796f, 0.032742f,
0.127186f, 0.116694f, -0.161122f, -0.279773f, -0.252515f, -0.002638f,
0.042812f, 0.096776f, -0.123280f, 0.064858f, -0.010455f, -0.219760f,
-0.239331f, -0.104363f, -0.058022f, -0.053584f, 0.025611f, 0.005129f,
-0.100418f, -0.045712f, -0.194418f, -0.126366f, -0.030530f, 0.051168f,
0.215959f, 0.172402f, -0.054700f, -0.185995f, -0.278360f, -0.193693f,
-0.040309f, 0.003735f, -0.007770f, 0.123556f, 0.190179f, -0.077315f,
0.117403f, 0.212942f, 0.012160f, 0.000113f, 0.027331f, 0.040202f,
0.033293f, 0.219438f, 0.184174f, 0.259349f, 0.311206f, 0.082547f,
-0.047875f, -0.078417f, 0.010746f, 0.082620f, 0.311931f, 0.307605f,
0.003863f, 0.021405f, -0.026388f, -0.019572f, 0.020582f, -0.059353f,
0.025199f, 0.261319f, 0.086316f, 0.143614f, 0.107780f, 0.003900f,
-0.188397f, -0.038563f, -0.106045f, -0.125154f, -0.010509f, 0.054021f,
0.242130f, 0.279152f, 0.215546f, 0.346995f, 0.440856f, 0.237452f,
0.234154f, 0.301646f, 0.168929f, -0.208358f, -0.126848f, 0.010260f,
0.121018f, -0.062975f, -0.052848f, 0.050341f, -0.061103f, -0.266482f,
0.107186f, 0.140221f, 0.280065f, 0.287889f, 0.373198f, 0.151596f,
0.013593f, 0.115616f, 0.014616f, -0.281710f, -0.237597f, -0.117305f,
-0.000034f, -0.136739f, -0.196275f, -0.095225f, -0.125310f, -0.250514f,
0.236804f, -0.071805f, -0.037421f, 0.048230f, 0.321596f, 0.063632f,
0.024039f, -0.029133f, 0.230983f, 0.160593f, -0.154355f, -0.013086f,
-0.079929f, 0.094692f, 0.160391f, 0.180239f, 0.053895f, 0.100759f,
0.288631f, 0.038191f, 0.181692f, 0.229682f, 0.440166f, 0.063401f,
0.006273f, 0.020865f, 0.338695f, 0.256244f, -0.043927f, 0.115617f,
0.003296f, 0.173965f, 0.021318f, -0.040936f, -0.118932f, 0.182380f,
0.235922f, -0.053233f, -0.015053f, -0.101057f, 0.095341f, 0.051111f,
0.161831f, 0.032614f, 0.159496f, 0.072375f, 0.025089f, 0.023748f,
0.029151f, 0.161284f, -0.117717f, -0.036191f, -0.176822f, -0.162006f,
0.226542f, -0.078329f, 0.043079f, -0.119172f, 0.054614f, -0.101365f,
-0.064541f, -0.115304f, 0.135170f, 0.298872f, 0.098060f, 0.089428f,
-0.007497f, 0.110391f, -0.028824f, 0.020835f, -0.036804f, 0.125411f,
0.192105f, -0.048931f, 0.003086f, -0.010681f, 0.074698f, -0.016263f,
0.096063f, 0.060267f, -0.007277f, 0.139139f, -0.080635f, 0.036628f,
0.086058f, 0.131979f, 0.085707f, 0.025301f, 0.226094f, 0.194759f,
0.042193f, -0.157846f, -0.068402f, -0.141450f, -0.112659f, -0.076305f,
-0.069085f, -0.114332f, -0.102005f, 0.132193f, -0.067042f, 0.106643f,
0.198964f, 0.171616f, 0.167237f, -0.033730f, -0.026755f, 0.083621f,
0.149459f, -0.002799f, -0.000318f, 0.011753f, 0.065889f, -0.089375f,
-0.049610f, 0.224579f, 0.216548f, -0.034908f, -0.017851f, -0.088144f,
0.007530f, 0.240268f, 0.073270f, 0.013263f, 0.175323f, 0.012082f,
0.093993f, 0.015282f, 0.105854f, 0.107990f, 0.077798f, -0.096166f,
-0.079607f, 0.177820f, 0.142392f, 0.033337f, -0.078100f, -0.081616f,
-0.046993f, 0.139459f, 0.020272f, -0.123161f, 0.175269f, 0.105217f,
0.057328f, 0.080909f, -0.012612f, -0.097081f, 0.082060f, -0.096716f,
-0.063921f, 0.201884f, 0.128166f, -0.035051f, -0.032227f, -0.068139f,
-0.115915f, 0.095080f, -0.086007f, -0.067543f, 0.030776f, 0.032712f,
0.088937f, 0.054336f, -0.039329f, -0.114022f, 0.171672f, -0.112321f,
-0.217646f, 0.065186f, 0.060223f, 0.192174f, 0.055580f, -0.131107f,
-0.144338f, 0.056730f, -0.034707f, -0.081616f, -0.135298f, -0.000614f,
0.087189f, 0.014614f, 0.067709f, 0.107689f, 0.225780f, 0.084361f,
-0.008544f, 0.051649f, -0.048369f, -0.037739f, -0.060710f, 0.002654f,
0.016935f, 0.085563f, -0.015961f, -0.019265f, 0.111788f, 0.062376f,
0.202019f, 0.047713f, 0.042261f, 0.069716f, 0.242913f, 0.021052f,
-0.072812f, -0.155920f, -0.026436f, 0.035621f, -0.079300f, -0.028787f,
-0.048329f, 0.084718f, -0.060565f, -0.083750f, -0.164075f, -0.040742f,
-0.086219f, 0.015271f, -0.005204f, -0.016038f, 0.045816f, -0.050433f,
-0.077652f, 0.117109f, 0.009611f, -0.009045f, -0.008634f, -0.055373f,
-0.085968f, 0.028527f, -0.054736f, -0.168089f, 0.175839f, 0.071205f,
-0.023603f, 0.037907f, -0.004561f, -0.022634f, 0.123831f, 0.094469f,
-0.072920f, -0.133642f, -0.014032f, -0.142754f, -0.026999f, -0.199409f,
0.013268f, 0.226989f, 0.048650f, -0.170988f, -0.050141f, 0.007880f,
0.061880f, 0.019078f, -0.043578f, -0.038139f, 0.134814f, 0.054097f,
-0.081670f, 0.176838f, 0.047920f, -0.038176f, 0.050406f, -0.107181f,
-0.036279f, 0.027060f, 0.081594f, -0.002820f, 0.090507f, -0.033338f,
-0.059571f, 0.013404f, -0.099860f, 0.073371f, 0.342805f, 0.098305f,
-0.150910f, -0.020822f, -0.056960f, 0.046262f, -0.043413f, -0.149405f,
-0.129105f, -0.010899f, -0.014229f, -0.179949f, -0.113044f, -0.049468f,
-0.065513f, 0.090269f, -0.011919f, 0.087846f, 0.095796f, 0.146127f,
0.101599f, 0.078066f, -0.084348f, -0.100002f, -0.020134f, -0.050169f,
0.062122f, 0.014640f, 0.019143f, 0.036543f, 0.180924f, -0.013976f,
-0.066768f, -0.001090f, -0.070419f, -0.004839f, -0.001504f, 0.034483f,
-0.044954f, -0.050336f, -0.088638f, -0.174782f, -0.116082f, -0.205507f,
0.015587f, -0.042839f, -0.096879f, -0.144097f, -0.050268f, -0.196796f,
0.109639f, 0.271411f, 0.173732f, 0.108070f, 0.156437f, 0.124255f,
0.097242f, 0.238693f, 0.083941f, 0.109105f, 0.223940f, 0.267188f,
0.027385f, 0.025819f, 0.125070f, 0.093738f, 0.040353f, 0.038645f,
-0.012730f, 0.144063f, 0.052931f, -0.009138f, 0.084193f, 0.160272f,
-0.041366f, 0.011951f, -0.121446f, -0.106713f, -0.047566f, 0.047984f,
-0.255224f, -0.076116f, 0.098685f, -0.150845f, -0.171513f, -0.156590f,
0.058331f, 0.187493f, 0.413018f, 0.554265f, 0.372242f, 0.237943f,
0.124571f, 0.110829f, 0.010322f, -0.174477f, -0.067627f, -0.001979f,
0.142913f, 0.040597f, 0.019907f, 0.025963f, -0.043585f, -0.120732f,
0.099937f, 0.091059f, 0.247307f, 0.204226f, -0.042753f, -0.068580f,
-0.119002f, 0.026722f, 0.034853f, -0.060934f, -0.025054f, -0.093026f,
-0.035372f, -0.233209f, -0.049869f, -0.039151f, -0.022279f, -0.065380f,
0.294350f, -0.098796f, -0.129522f, 0.078753f, 0.387527f, 0.261529f,
0.145939f, 0.061520f, 0.328699f, 0.227148f, -0.066467f, -0.086723f,
0.047559f, 0.106714f, 0.037897f, 0.111461f, -0.024406f, 0.304769f,
0.254676f, -0.069235f, 0.082566f, 0.147260f, 0.326969f, 0.148888f,
0.055270f, -0.087985f, 0.261720f, 0.143442f, 0.026812f, 0.238212f,
0.194020f, 0.056341f, -0.025854f, -0.034444f, -0.156631f, 0.205174f,
0.089008f, -0.139811f, -0.100147f, -0.037830f, -0.029230f, -0.055641f,
0.033248f, -0.016512f, 0.155244f, 0.247315f, -0.124694f, -0.048414f,
-0.062219f, 0.193683f, 0.004574f, 0.055089f, 0.093565f, 0.167712f,
0.167581f, 0.018895f, 0.215258f, 0.122609f, 0.090520f, -0.067219f,
-0.049029f, -0.099615f, 0.241804f, -0.094893f, -0.176248f, 0.001727f,
-0.134473f, 0.104442f, 0.050942f, 0.081165f, 0.072156f, 0.121646f,
0.002656f, -0.297974f, -0.133587f, -0.060121f, -0.092515f, -0.048974f,
-0.084754f, -0.180111f, -0.038590f, 0.086283f, -0.134636f, -0.107249f,
0.132890f, 0.141556f, 0.249425f, 0.130273f, -0.030031f, 0.073212f,
-0.008155f, 0.019931f, 0.071688f, 0.000300f, -0.019525f, -0.021725f,
-0.040993f, -0.086841f, 0.070124f, 0.240033f, 0.265350f, 0.043208f,
0.166754f, 0.091453f, 0.060916f, -0.036972f, -0.091043f, 0.079873f,
0.219781f, 0.158102f, -0.140618f, -0.043016f, 0.124802f, 0.093668f,
0.103208f, 0.094872f, 0.080541f, 0.137711f, 0.160566f, -0.169231f,
0.013983f, 0.309508f, -0.004217f, -0.057200f, -0.064489f, 0.014066f,
0.361009f, 0.251328f, -0.080983f, -0.044183f, 0.061436f, -0.037381f,
-0.078786f, 0.030993f, 0.066314f, 0.037683f, 0.152325f, -0.091683f,
0.070203f, 0.217856f, 0.036435f, -0.076462f, 0.006254f, -0.094431f,
0.154829f, -0.023038f, -0.196961f, -0.024594f, 0.178465f, -0.050139f,
-0.045932f, -0.000965f, 0.109112f, 0.046165f, -0.159373f, -0.008713f,
0.041307f, 0.097129f, -0.057211f, -0.064599f, 0.077165f, 0.176167f,
0.138322f, 0.065753f, -0.104950f, 0.017933f, 0.136255f, -0.011598f,
0.047007f, 0.080550f, 0.068619f, 0.084661f, -0.035493f, -0.091314f,
-0.041411f, 0.060971f, -0.101912f, -0.079870f, -0.085977f, -0.022686f,
0.079788f, -0.098064f, -0.054603f, 0.040383f, 0.300794f, 0.128603f,
0.094844f, 0.047407f, 0.101825f, 0.061832f, -0.162160f, -0.204553f,
-0.035165f, 0.101450f, -0.016641f, -0.027140f, -0.134392f, -0.008743f,
0.102331f, 0.114853f, 0.009644f, 0.062823f, 0.237339f, 0.167843f,
0.053066f, -0.012592f, 0.043158f, 0.002305f, 0.065001f, -0.038929f,
-0.020356f, 0.152343f, 0.043469f, -0.029967f, -0.042948f, 0.032481f,
0.068488f, -0.110840f, -0.111083f, 0.111980f, -0.002072f, -0.005562f,
0.082926f, 0.006635f, -0.108153f, 0.024242f, -0.086464f, -0.189884f,
-0.017492f, 0.191456f, -0.007683f, -0.128769f, -0.038017f, -0.132380f,
0.091926f, 0.079696f, -0.106728f, -0.007656f, 0.172744f, 0.011576f,
0.009883f, 0.083258f, -0.026516f, 0.145534f, 0.153924f, -0.130290f,
-0.108945f, 0.124490f, -0.003186f, -0.100485f, 0.015024f, -0.060512f,
0.026288f, -0.086713f, -0.169012f, 0.076517f, 0.215778f, 0.043701f,
-0.131642f, -0.012585f, -0.045181f, -0.118183f, -0.241544f, -0.167293f,
-0.020107f, -0.019917f, -0.101827f, -0.107096f, -0.010503f, 0.044938f,
0.189680f, 0.217119f, -0.046086f, 0.044508f, 0.199716f, -0.036004f,
-0.148927f, 0.013355f, -0.078279f, 0.030451f, 0.056301f, -0.024609f,
0.083224f, 0.099533f, -0.039432f, -0.138880f, 0.005482f, -0.024120f,
-0.140468f, -0.066381f, -0.017057f, 0.009260f, -0.058004f, -0.028486f,
-0.061610f, 0.007483f, -0.158309f, -0.150687f, -0.044595f, -0.105121f,
-0.045763f, -0.006618f, -0.024419f, -0.117713f, -0.119366f, -0.175941f,
-0.071542f, 0.119027f, 0.111362f, 0.043080f, 0.034889f, 0.093003f,
0.007842f, 0.057368f, -0.108834f, -0.079968f, 0.230959f, 0.020205f,
0.011470f, 0.098877f, 0.101310f, -0.030215f, -0.018018f, -0.059552f,
-0.106157f, 0.021866f, -0.036471f, 0.080051f, 0.041165f, -0.082101f,
0.117726f, 0.030961f, -0.054763f, -0.084102f, -0.185778f, -0.061305f,
-0.038089f, -0.110728f, -0.264010f, 0.076675f, -0.077111f, -0.137644f,
0.036232f, 0.277995f, 0.019116f, 0.107738f, 0.144003f, 0.080304f,
0.215036f, 0.228897f, 0.072713f, 0.077773f, 0.120168f, 0.075324f,
0.062730f, 0.122478f, -0.049008f, 0.164912f, 0.162450f, 0.041246f,
0.009891f, -0.097827f, -0.038700f, -0.023027f, -0.120020f, 0.203364f,
0.248474f, 0.149810f, -0.036276f, -0.082814f, -0.090343f, -0.027143f,
-0.075689f, -0.320310f, -0.000500f, -0.143334f, -0.065077f, -0.186936f,
0.129372f, 0.116431f, 0.181699f, 0.170436f, 0.418854f, 0.460045f,
0.333719f, 0.230515f, 0.047822f, -0.044954f, -0.068086f, 0.140179f,
-0.044821f, 0.085550f, 0.092483f, -0.107296f, -0.130670f, -0.206629f,
0.114601f, -0.317869f, -0.076663f, 0.038680f, 0.212753f, -0.016059f,
-0.126526f, -0.163602f, 0.210154f, 0.099887f, -0.126366f, 0.118453f,
0.019309f, -0.021611f, -0.096499f, -0.111809f, -0.200489f, 0.142854f,
0.228840f, -0.353346f, -0.179151f, 0.116834f, 0.252389f, -0.031728f,
-0.188135f, -0.158998f, 0.386523f, 0.122315f, 0.209944f, 0.394023f,
0.359030f, 0.260717f, 0.170335f, 0.013683f, -0.142596f, -0.026138f,
-0.011878f, -0.150519f, 0.047159f, -0.107062f, -0.147347f, -0.187689f,
-0.186027f, -0.208048f, 0.058468f, -0.073026f, -0.236556f, -0.079788f,
-0.146216f, -0.058563f, -0.101361f, -0.071294f, -0.071093f, 0.116919f,
0.234304f, 0.306781f, 0.321866f, 0.240000f, 0.073261f, -0.012173f,
0.026479f, 0.050173f, 0.166127f, 0.228955f, 0.061905f, 0.156460f,
0.205990f, 0.120672f, 0.037350f, 0.167884f, 0.290099f, 0.420900f,
-0.012601f, 0.189839f, 0.306378f, 0.118383f, -0.095598f, -0.072360f,
-0.132496f, -0.224259f, -0.126021f, 0.022714f, 0.284039f, 0.051369f,
-0.000927f, -0.058735f, -0.083354f, -0.141254f, -0.187578f, -0.202669f,
0.048902f, 0.246597f, 0.441863f, 0.342519f, 0.066979f, 0.215286f,
0.188191f, -0.072240f, -0.208142f, -0.030196f, 0.178141f, 0.136985f,
-0.043374f, -0.181098f, 0.091815f, 0.116177f, -0.126690f, -0.386625f,
0.368165f, 0.269149f, -0.088042f, -0.028823f, 0.092961f, 0.024099f,
0.046112f, 0.176756f, 0.135849f, 0.124955f, 0.195467f, -0.037218f,
0.167217f, 0.188938f, 0.053528f, -0.066561f, 0.133721f, -0.070565f,
0.115898f, 0.152435f, -0.116993f, -0.110592f, -0.179005f, 0.026668f,
0.080530f, 0.075084f, -0.070401f, 0.012497f, 0.021849f, -0.139764f,
-0.022020f, -0.096301f, -0.064954f, -0.127446f, -0.013806f, -0.108315f,
0.156285f, 0.149867f, -0.011382f, 0.064532f, 0.029168f, 0.027393f,
0.069716f, 0.153735f, 0.038459f, 0.230714f, 0.253840f, 0.059522f,
-0.045053f, 0.014083f, 0.071103f, 0.068747f, 0.095887f, 0.005832f,
0.144887f, 0.026357f, -0.067359f, -0.044151f, -0.123283f, -0.019911f,
0.005318f, 0.109208f, -0.003201f, -0.021734f, 0.142025f, -0.066907f,
-0.120070f, -0.188639f, 0.012472f, -0.048704f, -0.012366f, -0.184828f,
0.168591f, 0.267166f, 0.058208f, -0.044101f, 0.033500f, 0.178558f,
0.104550f, 0.122418f, 0.080177f, 0.173246f, 0.298537f, 0.064173f,
0.053397f, 0.174341f, 0.230984f, 0.117025f, 0.166242f, 0.227781f,
0.120623f, 0.176952f, -0.011393f, -0.086483f, -0.008270f, 0.051700f,
-0.153369f, -0.058837f, -0.057639f, -0.060115f, 0.026349f, -0.160745f,
-0.037894f, -0.048575f, 0.041052f, -0.022112f, 0.060365f, 0.051906f,
0.162657f, 0.138519f, -0.050185f, -0.005938f, 0.071301f, 0.127686f,
0.062342f, 0.144400f, 0.072600f, 0.198436f, 0.246219f, -0.078185f,
-0.036169f, 0.075934f, 0.047328f, -0.013601f, 0.087205f, 0.019900f,
0.022606f, -0.015365f, -0.092506f, 0.075275f, -0.116375f, 0.050500f,
0.045118f, 0.166567f, 0.072073f, 0.060371f, 0.131747f, -0.169863f,
-0.039352f, -0.047486f, -0.039797f, -0.204312f, 0.021710f, 0.129443f,
-0.021173f, 0.173416f, -0.070794f, -0.063986f, 0.069689f, -0.064099f,
-0.123201f, -0.017372f, -0.206870f, 0.065863f, 0.113226f, 0.024707f,
-0.071341f, -0.066964f, -0.098278f, -0.062927f, 0.075840f, 0.014716f,
0.019378f, 0.132699f, -0.074191f, -0.089557f, -0.078446f, -0.197488f,
-0.173665f, 0.052583f, 0.044361f, 0.113549f, 0.098492f, 0.077379f,
-0.011146f, -0.192593f, -0.164435f, 0.045568f, 0.205699f, 0.049187f,
-0.082281f, 0.134874f, 0.185499f, 0.034968f, -0.119561f, -0.112372f,
-0.115091f, -0.054042f, -0.183816f, -0.078100f, 0.190695f, 0.091617f,
0.004257f, -0.041135f, -0.061453f, -0.141592f, -0.194809f, -0.120638f,
0.020168f, 0.109672f, 0.067398f, -0.015238f, -0.239145f, -0.264671f,
-0.185176f, 0.050472f, 0.020793f, 0.035678f, 0.022839f, -0.052055f,
-0.127968f, -0.113049f, -0.228416f, -0.258281f, -0.053437f, 0.076424f,
0.061450f, 0.237478f, 0.003618f, -0.055865f, -0.108087f, -0.028937f,
0.045585f, 0.052829f, -0.001471f, 0.022826f, 0.059565f, -0.104430f,
-0.077266f, -0.211882f, -0.212078f, 0.028074f, 0.075846f, 0.016265f,
0.161879f, 0.134477f, 0.008935f, -0.048041f, 0.074692f, 0.004928f,
-0.025156f, 0.192874f, 0.074410f, 0.308732f, 0.267400f, 0.094208f,
-0.005251f, 0.042041f, -0.032148f, 0.015588f, 0.252869f, 0.175302f,
0.022892f, 0.081673f, 0.063208f, 0.162626f, 0.194426f, 0.233890f,
0.262292f, 0.186930f, 0.084079f, -0.286388f, -0.213034f, -0.048867f,
-0.207669f, -0.170050f, 0.011673f, -0.092958f, -0.192786f, -0.273536f,
0.230904f, 0.266732f, 0.320519f, 0.297155f, 0.548169f, 0.304922f,
0.132687f, 0.247333f, 0.212488f, -0.271472f, -0.142105f, -0.002627f,
-0.119215f, 0.128383f, 0.100079f, -0.057490f, -0.121902f, -0.228892f,
0.202292f, -0.399795f, -0.371326f, -0.095836f, -0.063626f, -0.161375f,
-0.311180f, -0.294797f, 0.242122f, 0.011788f, 0.095573f, 0.322523f,
0.511840f, 0.322880f, 0.313259f, 0.173331f, 0.002542f, -0.029802f,
0.324766f, -0.326170f, -0.340547f, -0.138288f, -0.002963f, -0.114060f,
-0.377312f, -0.442570f, 0.212446f, -0.007759f, -0.011576f, 0.169711f,
0.308689f, 0.317348f, 0.539390f, 0.332845f, 0.057331f, -0.068180f,
0.101994f, 0.266995f, 0.209570f, 0.355730f, 0.091635f, 0.170238f,
0.125215f, 0.274154f, 0.070223f, 0.025515f, 0.049946f, -0.000550f,
0.043715f, -0.141843f, 0.020844f, 0.129871f, 0.256588f, 0.105015f,
0.148339f, 0.170682f, 0.028792f, 0.074037f, 0.160042f, 0.405137f,
0.246187f, 0.352160f, 0.168951f, 0.222263f, 0.264439f, 0.065945f,
0.021963f, -0.075084f, 0.093105f, 0.027318f, 0.098864f, 0.057566f,
-0.080282f, 0.185032f, 0.314419f, 0.333727f, 0.125798f, 0.294919f,
0.386002f, 0.217619f, -0.183517f, -0.278622f, -0.002342f, -0.027821f,
-0.134266f, -0.331843f, -0.008296f, 0.124564f, 0.053712f, -0.369016f,
-0.095036f, 0.209381f, 0.423760f, 0.371760f, 0.106397f, 0.369408f,
0.485608f, 0.231201f, -0.138685f, -0.349208f, -0.070083f, 0.028991f,
-0.081630f, -0.395992f, -0.146791f, -0.027354f, 0.063396f, -0.272484f,
0.058299f, 0.338207f, 0.110767f, -0.052642f, -0.233848f, -0.027448f,
0.030328f, 0.155572f, -0.093826f, 0.019331f, 0.120638f, 0.006292f,
-0.106083f, -0.236290f, -0.140933f, -0.088067f, -0.025138f, -0.208395f,
-0.025502f, 0.144192f, -0.048353f, -0.106144f, -0.305121f, -0.114147f,
0.090963f, 0.327727f, 0.035606f, -0.093779f, 0.002651f, -0.171081f,
-0.188131f, -0.216571f, -0.209101f, -0.054402f, 0.157147f, -0.057127f,
0.066584f, 0.008988f, 0.041191f, 0.034456f, -0.078255f, 0.052099f,
-0.022239f, 0.066981f, -0.117520f, -0.072637f, 0.062512f, 0.037570f,
-0.057544f, -0.312359f, 0.034357f, -0.031549f, 0.002566f, -0.207375f,
-0.070654f, -0.018786f, -0.044815f, -0.012814f, -0.076320f, 0.078183f,
0.023877f, 0.117078f, 0.022292f, -0.205424f, -0.060430f, -0.017296f,
-0.004827f, -0.321036f, -0.092155f, 0.038837f, 0.073190f, -0.067513f,
0.026521f, 0.171945f, 0.087318f, 0.034495f, -0.034089f, 0.154410f,
-0.061431f, 0.007435f, -0.111094f, -0.095976f, 0.014741f, -0.132324f,
-0.029517f, -0.192160f, 0.098667f, 0.020762f, 0.177050f, -0.064510f,
-0.054437f, -0.058678f, -0.001858f, 0.167602f, 0.015735f, 0.054338f,
0.016477f, 0.186381f, -0.010667f, 0.054692f, 0.126742f, 0.013140f,
0.090353f, -0.133608f, -0.018017f, -0.152619f, 0.027600f, -0.138700f,
-0.050274f, 0.045141f, -0.118731f, 0.094797f, -0.167605f, 0.097461f,
-0.009131f, 0.199920f, -0.052976f, 0.158194f, 0.178568f, -0.107600f,
0.009671f, -0.084072f, -0.040258f, -0.205673f, 0.102891f, 0.223511f,
0.042699f, 0.118548f, -0.021274f, 0.110997f, -0.155121f, 0.027696f,
-0.149968f, 0.051552f, -0.129219f, 0.173524f, 0.073972f, -0.189045f,
-0.034523f, -0.106655f, -0.011843f, -0.197381f, 0.219413f, 0.183197f,
-0.054920f, 0.144955f, 0.036517f, -0.085412f, -0.229070f, -0.143710f,
-0.049486f, 0.156634f, -0.008673f, -0.064778f, 0.082344f, 0.145673f,
0.002912f, -0.210121f, -0.116564f, 0.078425f, 0.220908f, -0.067594f,
0.048610f, 0.084912f, -0.066202f, -0.112515f, -0.217767f, -0.082640f,
-0.017414f, 0.230265f, -0.070735f, 0.066073f, 0.215256f, 0.071157f,
-0.087220f, -0.202235f, -0.011918f, 0.099562f, 0.174716f, -0.063845f,
-0.121055f, 0.014367f, 0.132709f, -0.005060f, -0.244606f, -0.179693f,
-0.134690f, 0.023239f, -0.193116f, -0.076975f, -0.021164f, -0.001938f,
-0.163799f, -0.111437f, -0.210362f, -0.166376f, 0.034754f, 0.010036f,
-0.021917f, 0.068014f, -0.086893f, -0.251746f, -0.267171f, 0.037383f,
0.003966f, 0.033571f, -0.151506f, 0.025437f, -0.020626f, -0.308454f,
-0.343143f, -0.092263f, -0.026261f, -0.028345f, 0.036036f, 0.035169f,
0.129470f, 0.122205f, 0.015661f, -0.070612f, -0.094333f, -0.066055f,
-0.041083f, 0.159146f, 0.073184f, 0.110044f, 0.174471f, 0.078069f,
-0.014881f, 0.008116f, 0.013209f, 0.075857f, 0.195605f, 0.062714f,
0.067955f, 0.056544f, -0.153908f, -0.141749f, -0.072550f, 0.033523f,
-0.024665f, 0.134487f, 0.079076f, 0.133562f, 0.227130f, 0.018054f,
0.004928f, 0.169162f, 0.065152f, 0.072160f, 0.131631f, 0.096303f,
0.054288f, 0.106256f, 0.114632f, 0.119038f, 0.515200f, 0.247429f,
0.199134f, 0.211957f, 0.127558f, -0.294684f, -0.194890f, -0.049988f,
-0.112247f, -0.008122f, -0.006176f, 0.037035f, -0.110881f, -0.249989f,
0.152434f, 0.234621f, 0.153340f, 0.349283f, 0.683049f, 0.157174f,
0.124844f, 0.099136f, 0.064407f, -0.248400f, -0.155323f, -0.026498f,
-0.023450f, 0.049051f, -0.114187f, 0.007195f, -0.176825f, -0.376926f,
0.366159f, -0.179938f, -0.148508f, 0.006043f, 0.170048f, 0.097866f,
-0.102658f, -0.260430f, 0.248868f, 0.037019f, -0.118111f, 0.078176f,
0.194171f, 0.211328f, 0.368612f, 0.361213f, 0.130013f, 0.094650f,
0.227396f, -0.178058f, -0.114782f, -0.008093f, 0.231080f, -0.011843f,
-0.097917f, -0.325788f, 0.141879f, 0.119738f, -0.230427f, -0.117419f,
-0.114153f, 0.037903f, 0.116383f, 0.218773f, -0.101884f, 0.059466f,
0.119255f, 0.010874f, -0.031449f, 0.045996f, 0.119931f, 0.273760f,
0.311700f, 0.261794f, 0.194809f, 0.339829f, 0.239449f, 0.064140f,
0.077597f, 0.098996f, 0.143534f, 0.184602f, 0.037507f, 0.225494f,
0.096142f, -0.147370f, -0.207833f, -0.174742f, -0.086391f, -0.038942f,
0.159577f, -0.088492f, -0.000989f, 0.108154f, -0.025890f, -0.072713f,
0.025997f, -0.006803f, -0.086879f, -0.011290f, -0.269200f, -0.103450f,
-0.124910f, -0.116340f, 0.141459f, 0.208800f, 0.042268f, 0.265034f,
0.516474f, 0.217591f, -0.018843f, -0.313328f, -0.168363f, 0.047129f,
0.090480f, -0.109852f, -0.018761f, 0.210669f, 0.281269f, -0.043591f,
-0.034147f, -0.237772f, -0.134843f, -0.072481f, -0.103831f, 0.038355f,
0.308619f, 0.148023f, -0.045867f, -0.123950f, -0.210860f, -0.064973f,
-0.036308f, -0.046731f, -0.022099f, 0.095776f, 0.409423f, 0.060635f,
-0.065196f, 0.051828f, 0.027981f, -0.009609f, -0.137681f, -0.095011f,
-0.019045f, 0.177278f, 0.009759f, -0.092119f, -0.016958f, -0.133860f,
-0.118421f, -0.032039f, -0.006214f, -0.084541f, 0.063971f, -0.073642f,
0.165676f, 0.110443f, 0.044131f, 0.046568f, 0.053292f, -0.055466f,
0.015512f, 0.371947f, 0.232102f, -0.016923f, 0.103979f, -0.091758f,
0.005907f, 0.209100f, 0.157433f, 0.030518f, 0.250366f, 0.062322f,
0.036720f, 0.094676f, 0.017306f, -0.010328f, -0.079012f, 0.016781f,
-0.112435f, 0.061795f, 0.042543f, -0.126799f, -0.009975f, -0.056760f,
0.046424f, -0.194712f, -0.139399f, -0.037731f, 0.157989f, -0.016261f,
0.123345f, 0.230563f, 0.083300f, -0.016392f, 0.059567f, -0.016035f,
-0.064767f, 0.231945f, 0.156629f, 0.034602f, 0.145628f, 0.041315f,
0.034535f, 0.019967f, -0.089188f, -0.012091f, 0.307857f, 0.211405f,
-0.025091f, -0.148249f, -0.129384f, 0.063536f, -0.068603f, -0.067941f,
-0.035104f, 0.210832f, 0.063810f, 0.062764f, -0.089889f, -0.030554f,
0.014791f, -0.053362f, -0.037818f, -0.196640f, 0.008388f, -0.082654f,
0.143056f, 0.064221f, 0.069795f, 0.191040f, 0.097321f, -0.028679f,
0.075794f, 0.313154f, 0.086240f, 0.207643f, 0.017809f, 0.122867f,
0.224586f, 0.167403f, -0.023884f, 0.047434f, 0.344091f, 0.187745f,
0.136177f, 0.141738f, 0.063799f, 0.045233f, -0.077342f, -0.003525f,
-0.165041f, -0.025616f, -0.073745f, 0.164439f, 0.011200f, -0.145896f,
-0.027954f, -0.061987f, -0.039874f, -0.142775f, 0.151042f, -0.038238f,
0.053152f, 0.078615f, 0.086061f, 0.100593f, 0.128046f, -0.071006f,
-0.116558f, 0.208445f, 0.051086f, 0.076843f, 0.023191f, -0.084781f,
-0.011790f, 0.147807f, -0.048554f, -0.113932f, 0.283322f, 0.190934f,
0.092789f, 0.033018f, -0.142428f, -0.142480f, -0.099023f, -0.041020f,
-0.042760f, 0.203295f, -0.053475f, 0.042424f, 0.222839f, -0.019167f,
-0.133176f, -0.276216f, -0.031998f, 0.117290f, 0.177827f, -0.059973f,
-0.064744f, -0.117040f, -0.155482f, -0.099531f, 0.164121f, -0.026682f,
-0.093810f, 0.238993f, -0.006506f, 0.007830f, 0.065819f, -0.203643f,
-0.100925f, -0.053652f, -0.130770f, 0.026277f, 0.131796f, 0.032742f,
0.127186f, 0.116694f, -0.161122f, -0.279773f, -0.252515f, -0.002638f,
0.042812f, 0.096776f, -0.123280f, 0.064858f, -0.010455f, -0.219760f,
-0.239331f, -0.104363f, -0.058022f, -0.053584f, 0.025611f, 0.005129f,
-0.100418f, -0.045712f, -0.194418f, -0.126366f, -0.030530f, 0.051168f,
0.215959f, 0.172402f, -0.054700f, -0.185995f, -0.278360f, -0.193693f,
-0.040309f, 0.003735f, -0.007770f, 0.123556f, 0.190179f, -0.077315f,
0.117403f, 0.212942f, 0.012160f, 0.000113f, 0.027331f, 0.040202f,
0.033293f, 0.219438f, 0.184174f, 0.259349f, 0.311206f, 0.082547f,
-0.047875f, -0.078417f, 0.010746f, 0.082620f, 0.311931f, 0.307605f,
0.003863f, 0.021405f, -0.026388f, -0.019572f, 0.020582f, -0.059353f,
0.025199f, 0.261319f, 0.086316f, 0.143614f, 0.107780f, 0.003900f,
-0.188397f, -0.038563f, -0.106045f, -0.125154f, -0.010509f, 0.054021f,
0.242130f, 0.279152f, 0.215546f, 0.346995f, 0.440856f, 0.237452f,
0.234154f, 0.301646f, 0.168929f, -0.208358f, -0.126848f, 0.010260f,
0.121018f, -0.062975f, -0.052848f, 0.050341f, -0.061103f, -0.266482f,
0.107186f, 0.140221f, 0.280065f, 0.287889f, 0.373198f, 0.151596f,
0.013593f, 0.115616f, 0.014616f, -0.281710f, -0.237597f, -0.117305f,
-0.000034f, -0.136739f, -0.196275f, -0.095225f, -0.125310f, -0.250514f,
0.236804f, -0.071805f, -0.037421f, 0.048230f, 0.321596f, 0.063632f,
0.024039f, -0.029133f, 0.230983f, 0.160593f, -0.154355f, -0.013086f,
-0.079929f, 0.094692f, 0.160391f, 0.180239f, 0.053895f, 0.100759f,
0.288631f, 0.038191f, 0.181692f, 0.229682f, 0.440166f, 0.063401f,
0.006273f, 0.020865f, 0.338695f, 0.256244f, -0.043927f, 0.115617f,
0.003296f, 0.173965f, 0.021318f, -0.040936f, -0.118932f, 0.182380f,
0.235922f, -0.053233f, -0.015053f, -0.101057f, 0.095341f, 0.051111f,
0.161831f, 0.032614f, 0.159496f, 0.072375f, 0.025089f, 0.023748f,
0.029151f, 0.161284f, -0.117717f, -0.036191f, -0.176822f, -0.162006f,
0.226542f, -0.078329f, 0.043079f, -0.119172f, 0.054614f, -0.101365f,
-0.064541f, -0.115304f, 0.135170f, 0.298872f, 0.098060f, 0.089428f,
-0.007497f, 0.110391f, -0.028824f, 0.020835f, -0.036804f, 0.125411f,
0.192105f, -0.048931f, 0.003086f, -0.010681f, 0.074698f, -0.016263f,
0.096063f, 0.060267f, -0.007277f, 0.139139f, -0.080635f, 0.036628f,
0.086058f, 0.131979f, 0.085707f, 0.025301f, 0.226094f, 0.194759f,
0.042193f, -0.157846f, -0.068402f, -0.141450f, -0.112659f, -0.076305f,
-0.069085f, -0.114332f, -0.102005f, 0.132193f, -0.067042f, 0.106643f,
0.198964f, 0.171616f, 0.167237f, -0.033730f, -0.026755f, 0.083621f,
0.149459f, -0.002799f, -0.000318f, 0.011753f, 0.065889f, -0.089375f,
-0.049610f, 0.224579f, 0.216548f, -0.034908f, -0.017851f, -0.088144f,
0.007530f, 0.240268f, 0.073270f, 0.013263f, 0.175323f, 0.012082f,
0.093993f, 0.015282f, 0.105854f, 0.107990f, 0.077798f, -0.096166f,
-0.079607f, 0.177820f, 0.142392f, 0.033337f, -0.078100f, -0.081616f,
-0.046993f, 0.139459f, 0.020272f, -0.123161f, 0.175269f, 0.105217f,
0.057328f, 0.080909f, -0.012612f, -0.097081f, 0.082060f, -0.096716f,
-0.063921f, 0.201884f, 0.128166f, -0.035051f, -0.032227f, -0.068139f,
-0.115915f, 0.095080f, -0.086007f, -0.067543f, 0.030776f, 0.032712f,
0.088937f, 0.054336f, -0.039329f, -0.114022f, 0.171672f, -0.112321f,
-0.217646f, 0.065186f, 0.060223f, 0.192174f, 0.055580f, -0.131107f,
-0.144338f, 0.056730f, -0.034707f, -0.081616f, -0.135298f, -0.000614f,
0.087189f, 0.014614f, 0.067709f, 0.107689f, 0.225780f, 0.084361f,
-0.008544f, 0.051649f, -0.048369f, -0.037739f, -0.060710f, 0.002654f,
0.016935f, 0.085563f, -0.015961f, -0.019265f, 0.111788f, 0.062376f,
0.202019f, 0.047713f, 0.042261f, 0.069716f, 0.242913f, 0.021052f,
-0.072812f, -0.155920f, -0.026436f, 0.035621f, -0.079300f, -0.028787f,
-0.048329f, 0.084718f, -0.060565f, -0.083750f, -0.164075f, -0.040742f,
-0.086219f, 0.015271f, -0.005204f, -0.016038f, 0.045816f, -0.050433f,
-0.077652f, 0.117109f, 0.009611f, -0.009045f, -0.008634f, -0.055373f,
-0.085968f, 0.028527f, -0.054736f, -0.168089f, 0.175839f, 0.071205f,
-0.023603f, 0.037907f, -0.004561f, -0.022634f, 0.123831f, 0.094469f,
-0.072920f, -0.133642f, -0.014032f, -0.142754f, -0.026999f, -0.199409f,
0.013268f, 0.226989f, 0.048650f, -0.170988f, -0.050141f, 0.007880f,
0.061880f, 0.019078f, -0.043578f, -0.038139f, 0.134814f, 0.054097f,
-0.081670f, 0.176838f, 0.047920f, -0.038176f, 0.050406f, -0.107181f,
-0.036279f, 0.027060f, 0.081594f, -0.002820f, 0.090507f, -0.033338f,
-0.059571f, 0.013404f, -0.099860f, 0.073371f, 0.342805f, 0.098305f,
-0.150910f, -0.020822f, -0.056960f, 0.046262f, -0.043413f, -0.149405f,
-0.129105f, -0.010899f, -0.014229f, -0.179949f, -0.113044f, -0.049468f,
-0.065513f, 0.090269f, -0.011919f, 0.087846f, 0.095796f, 0.146127f,
0.101599f, 0.078066f, -0.084348f, -0.100002f, -0.020134f, -0.050169f,
0.062122f, 0.014640f, 0.019143f, 0.036543f, 0.180924f, -0.013976f,
-0.066768f, -0.001090f, -0.070419f, -0.004839f, -0.001504f, 0.034483f,
-0.044954f, -0.050336f, -0.088638f, -0.174782f, -0.116082f, -0.205507f,
0.015587f, -0.042839f, -0.096879f, -0.144097f, -0.050268f, -0.196796f,
0.109639f, 0.271411f, 0.173732f, 0.108070f, 0.156437f, 0.124255f,
0.097242f, 0.238693f, 0.083941f, 0.109105f, 0.223940f, 0.267188f,
0.027385f, 0.025819f, 0.125070f, 0.093738f, 0.040353f, 0.038645f,
-0.012730f, 0.144063f, 0.052931f, -0.009138f, 0.084193f, 0.160272f,
-0.041366f, 0.011951f, -0.121446f, -0.106713f, -0.047566f, 0.047984f,
-0.255224f, -0.076116f, 0.098685f, -0.150845f, -0.171513f, -0.156590f,
0.058331f, 0.187493f, 0.413018f, 0.554265f, 0.372242f, 0.237943f,
0.124571f, 0.110829f, 0.010322f, -0.174477f, -0.067627f, -0.001979f,
0.142913f, 0.040597f, 0.019907f, 0.025963f, -0.043585f, -0.120732f,
0.099937f, 0.091059f, 0.247307f, 0.204226f, -0.042753f, -0.068580f,
-0.119002f, 0.026722f, 0.034853f, -0.060934f, -0.025054f, -0.093026f,
-0.035372f, -0.233209f, -0.049869f, -0.039151f, -0.022279f, -0.065380f,
-9.063785f };
return vector<float>(detector, detector + sizeof(detector)/sizeof(detector[0]));
}

View File

@ -84,10 +84,9 @@ if(HAVE_QT)
QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
ocv_check_flag_support(CXX -Wno-missing-declarations HAVE_CXX_WNO_MISSING_DECLARATIONS)
if(HAVE_CXX_WNO_MISSING_DECLARATIONS)
list(APPEND highgui_srcs src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag)
if(${_have_flag})
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
endif()
elseif(WIN32)
@ -150,7 +149,9 @@ endif(HAVE_opencv_androidcamera)
if(HAVE_XIMEA)
list(APPEND highgui_srcs src/cap_ximea.cpp)
ocv_include_directories(${XIMEA_PATH})
link_directories(${XIMEA_LIBRARY_DIR})
if(XIMEA_LIBRARY_DIR)
link_directories(${XIMEA_LIBRARY_DIR})
endif()
list(APPEND HIGHGUI_LIBRARIES m3api)
endif(HAVE_XIMEA)

View File

@ -1,8 +1,8 @@
#include "precomp.hpp"
#include "xiApi.h"
#include "xiExt.h"
#include "m3Api.h"
/**********************************************************************************/
@ -18,20 +18,20 @@ public:
virtual bool setProperty(int, double);
virtual bool grabFrame();
virtual IplImage* retrieveFrame(int);
virtual int getCaptureDomain() { return CV_CAP_XIAPI; } // Return the type of the capture object: CV_CAP_VFW, etc...
virtual int getCaptureDomain() { return CV_CAP_XIAPI; } // Return the type of the capture object: CV_CAP_VFW, etc...
protected:
void init();
void errMsg(char* msg, int errNum);
void init();
void errMsg(const char* msg, int errNum);
IplImage* frame;
HANDLE hmv;
DWORD numDevices;
XI_IMG image;
int width;
int height;
int format;
int timeout;
HANDLE hmv;
DWORD numDevices;
XI_IMG image;
int width;
int height;
int format;
int timeout;
};
/**********************************************************************************/
@ -43,7 +43,7 @@ CvCapture* cvCreateCameraCapture_XIMEA( int index )
if( capture->open( index ))
return capture;
delete capture;
delete capture;
return 0;
}
@ -51,8 +51,9 @@ CvCapture* cvCreateCameraCapture_XIMEA( int index )
// Enumerate connected devices
void CvCaptureCAM_XIMEA::init()
{
xiGetNumberDevices( &numDevices);
hmv = NULL;
xiGetNumberDevices( &numDevices);
hmv = NULL;
memset(&image, 0, sizeof(XI_IMG));
}
@ -60,57 +61,85 @@ void CvCaptureCAM_XIMEA::init()
// Initialize camera input
bool CvCaptureCAM_XIMEA::open( int wIndex )
{
int mvret = XI_OK;
int mvret = XI_OK;
if(numDevices == 0)
return false;
if((mvret = xiOpenDevice( wIndex, &hmv)) != XI_OK)
{
errMsg("Open XI_DEVICE failed", mvret);
return false;
}
if(numDevices == 0)
return false;
// always use auto exposure/gain
xiSetParamInt( hmv, XI_PRM_AEAG, 1);
if((mvret = xiOpenDevice( wIndex, &hmv)) != XI_OK)
{
errMsg("Open XI_DEVICE failed", mvret);
return false;
}
// always use auto white ballance
xiSetParamInt( hmv, XI_PRM_AUTO_WB, 1);
// always use auto exposure/gain
mvret = xiSetParamInt( hmv, XI_PRM_AEAG, 1);
if(mvret != XI_OK) goto error;
xiGetParamInt( hmv, XI_PRM_WIDTH, &width);
xiGetParamInt( hmv, XI_PRM_HEIGHT, &height);
// default image format RGB24
xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, XI_RGB24);
format = XI_RGB24;
// allocate frame buffer for RGB24 image
frame = cvCreateImage(cvSize( width, height), IPL_DEPTH_8U, 3);
// always use auto white ballance
mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, 1);
if(mvret != XI_OK) goto error;
//default capture timeout 10s
timeout = 10000;
mvret = xiGetParamInt( hmv, XI_PRM_WIDTH, &width);
if(mvret != XI_OK) goto error;
return true;
mvret = xiGetParamInt( hmv, XI_PRM_HEIGHT, &height);
if(mvret != XI_OK) goto error;
// default image format RGB24
format = XI_RGB24;
mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, format);
if(mvret != XI_OK) goto error;
// allocate frame buffer for RGB24 image
frame = cvCreateImage(cvSize( width, height), IPL_DEPTH_8U, 3);
//default capture timeout 10s
timeout = 10000;
mvret = xiStartAcquisition(hmv);
if(mvret != XI_OK)
{
errMsg("StartAcquisition XI_DEVICE failed", mvret);
goto error;
}
return true;
error:
xiCloseDevice(hmv);
hmv = NULL;
return false;
}
/**********************************************************************************/
void CvCaptureCAM_XIMEA::close()
{
xiCloseDevice(hmv);
hmv = NULL;
xiStopAcquisition(hmv);
xiCloseDevice(hmv);
hmv = NULL;
}
/**********************************************************************************/
bool CvCaptureCAM_XIMEA::grabFrame()
{
int mvret = XI_OK;
image.size = sizeof(XI_IMG);
if((mvret = xiGetImage( hmv, timeout, &image)) != XI_OK)
{
errMsg("Error during GetImage", mvret);
return false;
}
image.size = sizeof(XI_IMG);
int mvret = xiGetImage( hmv, timeout, &image);
if(mvret == MM40_ACQUISITION_STOPED)
{
xiStartAcquisition(hmv);
mvret = xiGetImage(hmv, timeout, &image);
}
if(mvret != XI_OK)
{
errMsg("Error during GetImage", mvret);
return false;
}
return true;
}
@ -118,136 +147,150 @@ bool CvCaptureCAM_XIMEA::grabFrame()
IplImage* CvCaptureCAM_XIMEA::retrieveFrame(int)
{
// update cvImage after format has changed
if( image.width != width || image.height != height || image.frm != format)
{
cvReleaseImage(&frame);
switch( image.frm)
{
case XI_MONO8 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 1); break;
case XI_MONO16 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_16U, 1); break;
case XI_RGB24 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 3); break;
case XI_RGB32 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 4); break;
}
// update global image format
format = image.frm;
width = image.width;
height = image.height;
}
// update cvImage after format has changed
if( (int)image.width != width || (int)image.height != height || image.frm != (XI_IMG_FORMAT)format)
{
cvReleaseImage(&frame);
switch( image.frm)
{
case XI_MONO8 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 1); break;
case XI_MONO16 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_16U, 1); break;
case XI_RGB24 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 3); break;
case XI_RGB32 : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 4); break;
default :
return frame;
}
// update global image format
format = image.frm;
width = image.width;
height = image.height;
}
// copy pixel data
switch( image.frm)
{
case XI_MONO8 : memcpy( frame->imageData, image.bp, image.width*image.height); break;
case XI_MONO16 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(WORD)); break;
case XI_RGB24 : memcpy( frame->imageData, image.bp, image.width*image.height*3); break;
case XI_RGB32 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(DWORD)); break;
}
return frame;
// copy pixel data
switch( image.frm)
{
case XI_MONO8 : memcpy( frame->imageData, image.bp, image.width*image.height); break;
case XI_MONO16 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(WORD)); break;
case XI_RGB24 : memcpy( frame->imageData, image.bp, image.width*image.height*3); break;
case XI_RGB32 : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(DWORD)); break;
default: break;
}
return frame;
}
/**********************************************************************************/
double CvCaptureCAM_XIMEA::getProperty( int property_id )
{
if(hmv == NULL)
return 0;
if(hmv == NULL)
return 0;
int ival = 0;
float fval = 0;
int ival = 0;
float fval = 0;
switch( property_id )
{
// OCV parameters
case CV_CAP_PROP_POS_FRAMES : return (double) image.nframe;
case CV_CAP_PROP_FRAME_WIDTH : xiGetParamInt( hmv, XI_PRM_WIDTH, &ival); return ival;
case CV_CAP_PROP_FRAME_HEIGHT : xiGetParamInt( hmv, XI_PRM_HEIGHT, &ival); return ival;
case CV_CAP_PROP_FPS : xiGetParamFloat( hmv, XI_PRM_FRAMERATE, &fval); return fval;
case CV_CAP_PROP_GAIN : xiGetParamFloat( hmv, XI_PRM_GAIN, &fval); return fval;
case CV_CAP_PROP_EXPOSURE : xiGetParamInt( hmv, XI_PRM_EXPOSURE, &ival); return ival;
switch( property_id )
{
// OCV parameters
case CV_CAP_PROP_POS_FRAMES : return (double) image.nframe;
case CV_CAP_PROP_FRAME_WIDTH : xiGetParamInt( hmv, XI_PRM_WIDTH, &ival); return ival;
case CV_CAP_PROP_FRAME_HEIGHT : xiGetParamInt( hmv, XI_PRM_HEIGHT, &ival); return ival;
case CV_CAP_PROP_FPS : xiGetParamFloat( hmv, XI_PRM_FRAMERATE, &fval); return fval;
case CV_CAP_PROP_GAIN : xiGetParamFloat( hmv, XI_PRM_GAIN, &fval); return fval;
case CV_CAP_PROP_EXPOSURE : xiGetParamInt( hmv, XI_PRM_EXPOSURE, &ival); return ival;
// XIMEA camera properties
case CV_CAP_PROP_XI_DOWNSAMPLING : xiGetParamInt( hmv, XI_PRM_DOWNSAMPLING, &ival); return ival;
case CV_CAP_PROP_XI_DATA_FORMAT : xiGetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, &ival); return ival;
case CV_CAP_PROP_XI_OFFSET_X : xiGetParamInt( hmv, XI_PRM_OFFSET_X, &ival); return ival;
case CV_CAP_PROP_XI_OFFSET_Y : xiGetParamInt( hmv, XI_PRM_OFFSET_Y, &ival); return ival;
case CV_CAP_PROP_XI_TRG_SOURCE : xiGetParamInt( hmv, XI_PRM_TRG_SOURCE, &ival); return ival;
case CV_CAP_PROP_XI_GPI_SELECTOR : xiGetParamInt( hmv, XI_PRM_GPI_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_GPI_MODE : xiGetParamInt( hmv, XI_PRM_GPI_MODE, &ival); return ival;
case CV_CAP_PROP_XI_GPI_LEVEL : xiGetParamInt( hmv, XI_PRM_GPI_LEVEL, &ival); return ival;
case CV_CAP_PROP_XI_GPO_SELECTOR : xiGetParamInt( hmv, XI_PRM_GPO_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_GPO_MODE : xiGetParamInt( hmv, XI_PRM_GPO_MODE, &ival); return ival;
case CV_CAP_PROP_XI_LED_SELECTOR : xiGetParamInt( hmv, XI_PRM_LED_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_LED_MODE : xiGetParamInt( hmv, XI_PRM_LED_MODE, &ival); return ival;
case CV_CAP_PROP_XI_AUTO_WB : xiGetParamInt( hmv, XI_PRM_AUTO_WB, &ival); return ival;
case CV_CAP_PROP_XI_AEAG : xiGetParamInt( hmv, XI_PRM_AEAG, &ival); return ival;
case CV_CAP_PROP_XI_EXP_PRIORITY : xiGetParamFloat( hmv, XI_PRM_EXP_PRIORITY, &fval); return fval;
case CV_CAP_PROP_XI_AE_MAX_LIMIT : xiGetParamInt( hmv, XI_PRM_EXP_PRIORITY, &ival); return ival;
case CV_CAP_PROP_XI_AG_MAX_LIMIT : xiGetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, &fval); return fval;
case CV_CAP_PROP_XI_AEAG_LEVEL : xiGetParamInt( hmv, XI_PRM_AEAG_LEVEL, &ival); return ival;
case CV_CAP_PROP_XI_TIMEOUT : return timeout;
}
return 0;
// XIMEA camera properties
case CV_CAP_PROP_XI_DOWNSAMPLING : xiGetParamInt( hmv, XI_PRM_DOWNSAMPLING, &ival); return ival;
case CV_CAP_PROP_XI_DATA_FORMAT : xiGetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, &ival); return ival;
case CV_CAP_PROP_XI_OFFSET_X : xiGetParamInt( hmv, XI_PRM_OFFSET_X, &ival); return ival;
case CV_CAP_PROP_XI_OFFSET_Y : xiGetParamInt( hmv, XI_PRM_OFFSET_Y, &ival); return ival;
case CV_CAP_PROP_XI_TRG_SOURCE : xiGetParamInt( hmv, XI_PRM_TRG_SOURCE, &ival); return ival;
case CV_CAP_PROP_XI_GPI_SELECTOR : xiGetParamInt( hmv, XI_PRM_GPI_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_GPI_MODE : xiGetParamInt( hmv, XI_PRM_GPI_MODE, &ival); return ival;
case CV_CAP_PROP_XI_GPI_LEVEL : xiGetParamInt( hmv, XI_PRM_GPI_LEVEL, &ival); return ival;
case CV_CAP_PROP_XI_GPO_SELECTOR : xiGetParamInt( hmv, XI_PRM_GPO_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_GPO_MODE : xiGetParamInt( hmv, XI_PRM_GPO_MODE, &ival); return ival;
case CV_CAP_PROP_XI_LED_SELECTOR : xiGetParamInt( hmv, XI_PRM_LED_SELECTOR, &ival); return ival;
case CV_CAP_PROP_XI_LED_MODE : xiGetParamInt( hmv, XI_PRM_LED_MODE, &ival); return ival;
case CV_CAP_PROP_XI_AUTO_WB : xiGetParamInt( hmv, XI_PRM_AUTO_WB, &ival); return ival;
case CV_CAP_PROP_XI_AEAG : xiGetParamInt( hmv, XI_PRM_AEAG, &ival); return ival;
case CV_CAP_PROP_XI_EXP_PRIORITY : xiGetParamFloat( hmv, XI_PRM_EXP_PRIORITY, &fval); return fval;
case CV_CAP_PROP_XI_AE_MAX_LIMIT : xiGetParamInt( hmv, XI_PRM_EXP_PRIORITY, &ival); return ival;
case CV_CAP_PROP_XI_AG_MAX_LIMIT : xiGetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, &fval); return fval;
case CV_CAP_PROP_XI_AEAG_LEVEL : xiGetParamInt( hmv, XI_PRM_AEAG_LEVEL, &ival); return ival;
case CV_CAP_PROP_XI_TIMEOUT : return timeout;
}
return 0;
}
/**********************************************************************************/
bool CvCaptureCAM_XIMEA::setProperty( int property_id, double value )
{
int ival = (int) value;
float fval = (float) value;
int mvret = XI_OK;
switch(property_id)
{
// OCV parameters
case CV_CAP_PROP_FRAME_WIDTH : mvret = xiSetParamInt( hmv, XI_PRM_WIDTH, ival); break;
case CV_CAP_PROP_FRAME_HEIGHT : mvret = xiSetParamInt( hmv, XI_PRM_HEIGHT, ival); break;
case CV_CAP_PROP_FPS : mvret = xiSetParamFloat( hmv, XI_PRM_FRAMERATE, fval); break;
case CV_CAP_PROP_GAIN : mvret = xiSetParamFloat( hmv, XI_PRM_GAIN, fval); break;
case CV_CAP_PROP_EXPOSURE : mvret = xiSetParamInt( hmv, XI_PRM_EXPOSURE, ival); break;
// XIMEA camera properties
case CV_CAP_PROP_XI_DOWNSAMPLING : mvret = xiSetParamInt( hmv, XI_PRM_DOWNSAMPLING, ival); break;
case CV_CAP_PROP_XI_DATA_FORMAT : mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, ival); break;
case CV_CAP_PROP_XI_OFFSET_X : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_X, ival); break;
case CV_CAP_PROP_XI_OFFSET_Y : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_Y, ival); break;
case CV_CAP_PROP_XI_TRG_SOURCE : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, ival); break;
case CV_CAP_PROP_XI_GPI_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPI_SELECTOR, ival); break;
case CV_CAP_PROP_XI_TRG_SOFTWARE : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, 1); break;
case CV_CAP_PROP_XI_GPI_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPI_MODE, ival); break;
case CV_CAP_PROP_XI_GPI_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_GPI_LEVEL, ival); break;
case CV_CAP_PROP_XI_GPO_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPO_SELECTOR, ival); break;
case CV_CAP_PROP_XI_GPO_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPO_MODE, ival); break;
case CV_CAP_PROP_XI_LED_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_LED_SELECTOR, ival); break;
case CV_CAP_PROP_XI_LED_MODE : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CV_CAP_PROP_XI_AUTO_WB : mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, ival); break;
case CV_CAP_PROP_XI_MANUAL_WB : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CV_CAP_PROP_XI_AEAG : mvret = xiSetParamInt( hmv, XI_PRM_AEAG, ival); break;
case CV_CAP_PROP_XI_EXP_PRIORITY : mvret = xiSetParamFloat( hmv, XI_PRM_EXP_PRIORITY, fval); break;
case CV_CAP_PROP_XI_AE_MAX_LIMIT : mvret = xiSetParamInt( hmv, XI_PRM_EXP_PRIORITY, ival); break;
case CV_CAP_PROP_XI_AG_MAX_LIMIT : mvret = xiSetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, fval); break;
case CV_CAP_PROP_XI_AEAG_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_AEAG_LEVEL, ival); break;
case CV_CAP_PROP_XI_TIMEOUT : timeout = ival; break;
}
{
int ival = (int) value;
float fval = (float) value;
int mvret = XI_OK;
switch(property_id)
{
// OCV parameters
case CV_CAP_PROP_FRAME_WIDTH : mvret = xiSetParamInt( hmv, XI_PRM_WIDTH, ival);
if(mvret == XI_OK) width = ival;
break;
case CV_CAP_PROP_FRAME_HEIGHT : mvret = xiSetParamInt( hmv, XI_PRM_HEIGHT, ival);
if(mvret == XI_OK) height = ival;
break;
case CV_CAP_PROP_FPS : mvret = xiSetParamFloat( hmv, XI_PRM_FRAMERATE, fval); break;
case CV_CAP_PROP_GAIN : mvret = xiSetParamFloat( hmv, XI_PRM_GAIN, fval); break;
case CV_CAP_PROP_EXPOSURE : mvret = xiSetParamInt( hmv, XI_PRM_EXPOSURE, ival); break;
// XIMEA camera properties
case CV_CAP_PROP_XI_DOWNSAMPLING : mvret = xiSetParamInt( hmv, XI_PRM_DOWNSAMPLING, ival); break;
case CV_CAP_PROP_XI_DATA_FORMAT : mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, ival);
if(mvret == XI_OK) format = ival;
break;
case CV_CAP_PROP_XI_OFFSET_X : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_X, ival); break;
case CV_CAP_PROP_XI_OFFSET_Y : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_Y, ival); break;
case CV_CAP_PROP_XI_TRG_SOURCE : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, ival); break;
case CV_CAP_PROP_XI_GPI_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPI_SELECTOR, ival); break;
case CV_CAP_PROP_XI_TRG_SOFTWARE : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, 1); break;
case CV_CAP_PROP_XI_GPI_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPI_MODE, ival); break;
case CV_CAP_PROP_XI_GPI_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_GPI_LEVEL, ival); break;
case CV_CAP_PROP_XI_GPO_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPO_SELECTOR, ival); break;
case CV_CAP_PROP_XI_GPO_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPO_MODE, ival); break;
case CV_CAP_PROP_XI_LED_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_LED_SELECTOR, ival); break;
case CV_CAP_PROP_XI_LED_MODE : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CV_CAP_PROP_XI_AUTO_WB : mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, ival); break;
case CV_CAP_PROP_XI_MANUAL_WB : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CV_CAP_PROP_XI_AEAG : mvret = xiSetParamInt( hmv, XI_PRM_AEAG, ival); break;
case CV_CAP_PROP_XI_EXP_PRIORITY : mvret = xiSetParamFloat( hmv, XI_PRM_EXP_PRIORITY, fval); break;
case CV_CAP_PROP_XI_AE_MAX_LIMIT : mvret = xiSetParamInt( hmv, XI_PRM_EXP_PRIORITY, ival); break;
case CV_CAP_PROP_XI_AG_MAX_LIMIT : mvret = xiSetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, fval); break;
case CV_CAP_PROP_XI_AEAG_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_AEAG_LEVEL, ival); break;
case CV_CAP_PROP_XI_TIMEOUT : timeout = ival; break;
}
if(mvret != XI_OK)
{
errMsg("Set parameter error", mvret);
return false;
}
else
return true;
if(mvret != XI_OK)
{
errMsg("Set parameter error", mvret);
return false;
}
else
return true;
}
/**********************************************************************************/
void CvCaptureCAM_XIMEA::errMsg(char* msg, int errNum)
void CvCaptureCAM_XIMEA::errMsg(const char* msg, int errNum)
{
char buf[512];
sprintf( buf, "%s : %d\n", msg, errNum);
OutputDebugString(buf);
#if defined WIN32 || defined _WIN32
char buf[512];
sprintf( buf, "%s : %d\n", msg, errNum);
OutputDebugString(buf);
#else
fprintf(stderr, "%s : %d\n", msg, errNum);
#endif
}
/**********************************************************************************/

View File

@ -1,176 +1,176 @@
/*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.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 if advised of the possibility of such damage.
//
//M*/
#include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#ifdef HAVE_FFMPEG
#include "ffmpeg_codecs.hpp"
using namespace cv;
using namespace std;
class CV_FFmpegWriteBigVideoTest : public cvtest::BaseTest
{
public:
void run(int)
{
const int img_r = 4096;
const int img_c = 4096;
const double fps0 = 15;
const double time_sec = 1;
const size_t n = sizeof(codec_bmp_tags)/sizeof(codec_bmp_tags[0]);
bool created = false;
for (size_t j = 0; j < n; ++j)
{
stringstream s; s << codec_bmp_tags[j].tag;
int tag = codec_bmp_tags[j].tag;
if( tag != MKTAG('H', '2', '6', '3') &&
tag != MKTAG('H', '2', '6', '1') &&
//tag != MKTAG('D', 'I', 'V', 'X') &&
tag != MKTAG('D', 'X', '5', '0') &&
tag != MKTAG('X', 'V', 'I', 'D') &&
tag != MKTAG('m', 'p', '4', 'v') &&
//tag != MKTAG('D', 'I', 'V', '3') &&
//tag != MKTAG('W', 'M', 'V', '1') &&
//tag != MKTAG('W', 'M', 'V', '2') &&
tag != MKTAG('M', 'P', 'E', 'G') &&
tag != MKTAG('M', 'J', 'P', 'G') &&
//tag != MKTAG('j', 'p', 'e', 'g') &&
tag != 0 &&
tag != MKTAG('I', '4', '2', '0') &&
//tag != MKTAG('Y', 'U', 'Y', '2') &&
tag != MKTAG('F', 'L', 'V', '1') )
continue;
const string filename = "output_"+s.str()+".avi";
try
{
double fps = fps0;
Size frame_s = Size(img_c, img_r);
if( tag == CV_FOURCC('H', '2', '6', '1') )
frame_s = Size(352, 288);
else if( tag == CV_FOURCC('H', '2', '6', '3') )
frame_s = Size(704, 576);
/*else if( tag == CV_FOURCC('M', 'J', 'P', 'G') ||
tag == CV_FOURCC('j', 'p', 'e', 'g') )
frame_s = Size(1920, 1080);*/
if( tag == CV_FOURCC('M', 'P', 'E', 'G') )
fps = 25;
VideoWriter writer(filename, tag, fps, frame_s);
if (writer.isOpened() == false)
{
ts->printf(ts->LOG, "\n\nFile name: %s\n", filename.c_str());
ts->printf(ts->LOG, "Codec id: %d Codec tag: %c%c%c%c\n", j,
tag & 255, (tag >> 8) & 255, (tag >> 16) & 255, (tag >> 24) & 255);
ts->printf(ts->LOG, "Error: cannot create video file.");
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
else
{
Mat img(frame_s, CV_8UC3, Scalar::all(0));
const int coeff = cvRound(cv::min(frame_s.width, frame_s.height)/(fps0 * time_sec));
for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )
{
//circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);
rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),
Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);
writer << img;
}
if (!created) created = true;
else remove(filename.c_str());
}
}
catch(...)
{
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
ts->set_failed_test_info(cvtest::TS::OK);
}
}
};
TEST(Highgui_Video, ffmpeg_writebig) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }
class CV_FFmpegReadImageTest : public cvtest::BaseTest
{
public:
void run(int)
{
try
{
string filename = ts->get_data_path() + "../cv/features2d/tsukuba.png";
VideoCapture cap(filename);
Mat img0 = imread(filename, 1);
Mat img, img_next;
cap >> img;
cap >> img_next;
CV_Assert( !img0.empty() && !img.empty() && img_next.empty() );
double diff = norm(img0, img, CV_C);
CV_Assert( diff == 0 );
}
catch(...)
{
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
ts->set_failed_test_info(cvtest::TS::OK);
}
};
TEST(Highgui_Video, ffmpeg_image) { CV_FFmpegReadImageTest test; test.safe_run(); }
#endif
/*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.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 if advised of the possibility of such damage.
//
//M*/
#include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#ifdef HAVE_FFMPEG
#include "ffmpeg_codecs.hpp"
using namespace cv;
using namespace std;
class CV_FFmpegWriteBigVideoTest : public cvtest::BaseTest
{
public:
void run(int)
{
const int img_r = 4096;
const int img_c = 4096;
const double fps0 = 15;
const double time_sec = 1;
const size_t n = sizeof(codec_bmp_tags)/sizeof(codec_bmp_tags[0]);
bool created = false;
for (size_t j = 0; j < n; ++j)
{
stringstream s; s << codec_bmp_tags[j].tag;
int tag = codec_bmp_tags[j].tag;
if( tag != MKTAG('H', '2', '6', '3') &&
tag != MKTAG('H', '2', '6', '1') &&
//tag != MKTAG('D', 'I', 'V', 'X') &&
tag != MKTAG('D', 'X', '5', '0') &&
tag != MKTAG('X', 'V', 'I', 'D') &&
tag != MKTAG('m', 'p', '4', 'v') &&
//tag != MKTAG('D', 'I', 'V', '3') &&
//tag != MKTAG('W', 'M', 'V', '1') &&
//tag != MKTAG('W', 'M', 'V', '2') &&
tag != MKTAG('M', 'P', 'E', 'G') &&
tag != MKTAG('M', 'J', 'P', 'G') &&
//tag != MKTAG('j', 'p', 'e', 'g') &&
tag != 0 &&
tag != MKTAG('I', '4', '2', '0') &&
//tag != MKTAG('Y', 'U', 'Y', '2') &&
tag != MKTAG('F', 'L', 'V', '1') )
continue;
const string filename = "output_"+s.str()+".avi";
try
{
double fps = fps0;
Size frame_s = Size(img_c, img_r);
if( tag == CV_FOURCC('H', '2', '6', '1') )
frame_s = Size(352, 288);
else if( tag == CV_FOURCC('H', '2', '6', '3') )
frame_s = Size(704, 576);
/*else if( tag == CV_FOURCC('M', 'J', 'P', 'G') ||
tag == CV_FOURCC('j', 'p', 'e', 'g') )
frame_s = Size(1920, 1080);*/
if( tag == CV_FOURCC('M', 'P', 'E', 'G') )
fps = 25;
VideoWriter writer(filename, tag, fps, frame_s);
if (writer.isOpened() == false)
{
ts->printf(ts->LOG, "\n\nFile name: %s\n", filename.c_str());
ts->printf(ts->LOG, "Codec id: %d Codec tag: %c%c%c%c\n", j,
tag & 255, (tag >> 8) & 255, (tag >> 16) & 255, (tag >> 24) & 255);
ts->printf(ts->LOG, "Error: cannot create video file.");
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
else
{
Mat img(frame_s, CV_8UC3, Scalar::all(0));
const int coeff = cvRound(cv::min(frame_s.width, frame_s.height)/(fps0 * time_sec));
for (int i = 0 ; i < static_cast<int>(fps * time_sec); i++ )
{
//circle(img, Point2i(img_c / 2, img_r / 2), cv::min(img_r, img_c) / 2 * (i + 1), Scalar(255, 0, 0, 0), 2);
rectangle(img, Point2i(coeff * i, coeff * i), Point2i(coeff * (i + 1), coeff * (i + 1)),
Scalar::all(255 * (1.0 - static_cast<double>(i) / (fps * time_sec * 2) )), -1);
writer << img;
}
if (!created) created = true;
else remove(filename.c_str());
}
}
catch(...)
{
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
ts->set_failed_test_info(cvtest::TS::OK);
}
}
};
TEST(Highgui_Video, ffmpeg_writebig) { CV_FFmpegWriteBigVideoTest test; test.safe_run(); }
class CV_FFmpegReadImageTest : public cvtest::BaseTest
{
public:
void run(int)
{
try
{
string filename = ts->get_data_path() + "../cv/features2d/tsukuba.png";
VideoCapture cap(filename);
Mat img0 = imread(filename, 1);
Mat img, img_next;
cap >> img;
cap >> img_next;
CV_Assert( !img0.empty() && !img.empty() && img_next.empty() );
double diff = norm(img0, img, CV_C);
CV_Assert( diff == 0 );
}
catch(...)
{
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
}
ts->set_failed_test_info(cvtest::TS::OK);
}
};
TEST(Highgui_Video, ffmpeg_image) { CV_FFmpegReadImageTest test; test.safe_run(); }
#endif

View File

@ -59,7 +59,7 @@ public:
ts->printf(cvtest::TS::LOG, "finish reading big image\n");
if (img.empty()) ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
ts->printf(cvtest::TS::LOG, "start writing big image\n");
imwrite(string(ts->get_data_path()) + "readwrite/write.png", img);
imwrite(cv::tempfile(".png"), img);
ts->printf(cvtest::TS::LOG, "finish writing big image\n");
}
catch(...)
@ -72,10 +72,14 @@ public:
string ext_from_int(int ext)
{
#ifdef HAVE_PNG
if (ext == 0) return ".png";
#endif
if (ext == 1) return ".bmp";
if (ext == 2) return ".pgm";
#ifdef HAVE_TIFF
if (ext == 3) return ".tiff";
#endif
return "";
}
@ -92,16 +96,21 @@ public:
for (int k = 1; k <= 5; ++k)
{
for (int ext = 0; ext < 4; ++ext) // 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
{
if(ext_from_int(ext).empty())
continue;
for (int num_channels = 1; num_channels <= 3; num_channels+=2)
{
ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", CV_8U, num_channels, ext_from_int(ext).c_str());
Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_8U, num_channels), Scalar::all(0));
circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
ts->printf(ts->LOG, "writing image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
imwrite(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), img);
ts->printf(ts->LOG, "reading test image : %s\n", string(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext)).c_str());
Mat img_test = imread(string(ts->get_data_path()) + "readwrite/test" + ext_from_int(ext), CV_LOAD_IMAGE_UNCHANGED);
string img_path = cv::tempfile(ext_from_int(ext).c_str());
ts->printf(ts->LOG, "writing image : %s\n", img_path.c_str());
imwrite(img_path, img);
ts->printf(ts->LOG, "reading test image : %s\n", img_path.c_str());
Mat img_test = imread(img_path, CV_LOAD_IMAGE_UNCHANGED);
if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
@ -115,14 +124,17 @@ public:
ts->set_failed_test_info(ts->FAIL_MISMATCH);
}
}
}
#ifdef HAVE_JPEG
for (int num_channels = 1; num_channels <= 3; num_channels+=2)
{
// jpeg
ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", CV_8U, num_channels, ".jpg");
Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_8U, num_channels), Scalar::all(0));
circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
string filename = string(ts->get_data_path() + "readwrite/test_" + char(k + 48) + "_c" + char(num_channels + 48) + "_.jpg");
string filename = cv::tempfile(".jpg");
imwrite(filename, img);
img = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
@ -142,14 +154,17 @@ public:
ts->set_failed_test_info(ts->FAIL_MISMATCH);
}
}
#endif
#ifdef HAVE_TIFF
for (int num_channels = 1; num_channels <= 3; num_channels+=2)
{
// tiff
ts->printf(ts->LOG, "image type depth:%d channels:%d ext: %s\n", CV_16U, num_channels, ".tiff");
Mat img(img_r * k, img_c * k, CV_MAKETYPE(CV_16U, num_channels), Scalar::all(0));
circle(img, Point2i((img_c * k) / 2, (img_r * k) / 2), cv::min((img_r * k), (img_c * k)) / 4 , Scalar::all(255));
string filename = string(ts->get_data_path() + "readwrite/test.tiff");
string filename = cv::tempfile(".tiff");
imwrite(filename, img);
ts->printf(ts->LOG, "reading test image : %s\n", filename.c_str());
Mat img_test = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
@ -171,6 +186,7 @@ public:
ts->set_failed_test_info(ts->FAIL_MISMATCH);
}
}
#endif
}
}
catch(const cv::Exception & e)
@ -205,9 +221,7 @@ public:
TEST(Highgui_Image, write_big) { CV_GrfmtWriteBigImageTest test; test.safe_run(); }
#endif
#if defined(HAVE_PNG) && defined(HAVE_TIFF) && defined(HAVE_JPEG)
TEST(Highgui_Image, write_imageseq) { CV_GrfmtWriteSequenceImageTest test; test.safe_run(); }
#endif
TEST(Highgui_Image, read_bmp_rle8) { CV_GrfmtReadBMPRLE8Test test; test.safe_run(); }

View File

@ -155,7 +155,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
for(size_t i = 0; i < ext_num; ++i)
{
string ext = exts[i];
string full_name = "img." + ext;
string full_name = cv::tempfile(ext.c_str());
ts->printf(ts->LOG, " full_name : %s\n", full_name.c_str());
imwrite(full_name, image);
@ -225,7 +225,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt)
{
string src_file = dir + "../cv/shared/video_for_test.avi";
string tmp_name = format("video_%s.%s", cvtest::fourccToString(fmt.fourcc).c_str(), fmt.ext.c_str());
string tmp_name = cv::tempfile((cvtest::fourccToString(fmt.fourcc) + "." + fmt.ext).c_str());
ts->printf(ts->LOG, "reading video : %s and converting it to %s\n", src_file.c_str(), tmp_name.c_str());
@ -291,8 +291,8 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
if (psnr < thresDbell)
{
printf("Too low psnr = %gdb\n", psnr);
imwrite("img.png", img);
imwrite("img1.png", img1);
// imwrite("img.png", img);
// imwrite("img1.png", img1);
ts->set_failed_test_info(ts->FAIL_MISMATCH);
break;
}
@ -323,7 +323,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
stringstream s_digit; s_digit << i;
string full_name = "img_"+s_digit.str()+".bmp";
string full_name = cv::tempfile((s_digit.str() + ".bmp").c_str());
ts->printf(ts->LOG, " full_name : %s\n", full_name.c_str());
imwrite(full_name, image);
@ -395,7 +395,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
int fourcc = fmt.fourcc;
string fourcc_str = cvtest::fourccToString(fourcc);
const string video_file = "video_" + fourcc_str + "." + ext;
const string video_file = cv::tempfile((fourcc_str + "." + ext).c_str());
Size frame_size(968 & -2, 757 & -2);
VideoWriter writer(video_file, fourcc, 25, frame_size, true);

View File

@ -53,29 +53,27 @@ public:
{
framesize = Size(640, 480);
}
Mat drawFrame(int i)
{
Mat mat = Mat::zeros(framesize, CV_8UC3);
mat = Scalar(fabs(cos(i*0.08)*255), fabs(sin(i*0.05)*255), i);
putText(mat, format("%03d", i), Point(10, 350), 0, 10, Scalar(128, 255, 255), 15);
return mat;
}
string getFilename(const cvtest::VideoFormat& fmt)
{
return format("test_video_%s.%s", cvtest::fourccToString(fmt.fourcc).c_str(), fmt.ext.c_str());
return cv::tempfile((cvtest::fourccToString(fmt.fourcc) + "." + fmt.ext).c_str());
}
bool CreateTestVideo(const cvtest::VideoFormat& fmt, int framecount)
bool CreateTestVideo(const cvtest::VideoFormat& fmt, int framecount, string filename)
{
string filename = getFilename(fmt);
VideoWriter writer(filename, fmt.fourcc, 25, framesize, true);
if( !writer.isOpened() )
return false;
for (int i = 0; i < framecount; ++i)
{
Mat img = drawFrame(i);
@ -87,7 +85,7 @@ public:
void run(int)
{
int n_frames = 100;
for( int testcase = 0; ; testcase++ )
{
const cvtest::VideoFormat& fmt = cvtest::g_specific_fmt_list[testcase];
@ -96,82 +94,82 @@ public:
string filename = getFilename(fmt);
ts->printf(ts->LOG, "\nFile: %s\n", filename.c_str());
if( !CreateTestVideo(fmt, n_frames) )
if( !CreateTestVideo(fmt, n_frames, filename) )
{
ts->printf(ts->LOG, "\nError: cannot create video file");
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
return;
}
VideoCapture cap(filename);
if (!cap.isOpened())
{
ts->printf(ts->LOG, "\nError: cannot read video file.");
ts->set_failed_test_info(ts->FAIL_INVALID_TEST_DATA);
return;
}
int N0 = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
cap.set(CV_CAP_PROP_POS_FRAMES, 0);
int N = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
if (N != n_frames || N != N0)
{
ts->printf(ts->LOG, "\nError: returned frame count (N0=%d, N=%d) is different from the reference number %d\n", N0, N, n_frames);
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
return;
}
for (int k = 0; k < N; ++k)
{
int idx = theRNG().uniform(0, N);
if( !cap.set(CV_CAP_PROP_POS_FRAMES, idx) )
{
ts->printf(ts->LOG, "\nError: cannot seek to frame %d.\n", idx);
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
return;
}
int idx1 = (int)cap.get(CV_CAP_PROP_POS_FRAMES);
Mat img; cap >> img;
Mat img0 = drawFrame(idx);
if( idx != idx1 )
{
ts->printf(ts->LOG, "\nError: the current position (%d) after seek is different from specified (%d)\n",
idx1, idx);
ts->printf(ts->LOG, "Saving both frames ...\n");
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
imwrite("opencv_test_highgui_postest_actual.png", img);
imwrite("opencv_test_highgui_postest_expected.png", img0);
// imwrite("opencv_test_highgui_postest_actual.png", img);
// imwrite("opencv_test_highgui_postest_expected.png", img0);
return;
}
if (img.empty())
{
ts->printf(ts->LOG, "\nError: cannot read a frame at position %d.\n", idx);
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
return;
}
double err = PSNR(img, img0);
if( err < 20 )
{
ts->printf(ts->LOG, "The frame read after positioning to %d is incorrect (PSNR=%g)\n", idx, err);
ts->printf(ts->LOG, "Saving both frames ...\n");
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
imwrite("opencv_test_highgui_postest_actual.png", img);
imwrite("opencv_test_highgui_postest_expected.png", img0);
// imwrite("opencv_test_highgui_postest_actual.png", img);
// imwrite("opencv_test_highgui_postest_expected.png", img0);
return;
}
}
}
}
Size framesize;
};

View File

@ -52,10 +52,10 @@ class CV_GrabcutTest : public cvtest::BaseTest
{
public:
CV_GrabcutTest();
~CV_GrabcutTest();
~CV_GrabcutTest();
protected:
bool verify(const Mat& mask, const Mat& exp);
void run(int);
void run(int);
};
CV_GrabcutTest::CV_GrabcutTest() {}
@ -73,29 +73,29 @@ bool CV_GrabcutTest::verify(const Mat& mask, const Mat& exp)
}
void CV_GrabcutTest::run( int /* start_from */)
{
{
cvtest::DefaultRngAuto defRng;
Mat img = imread(string(ts->get_data_path()) + "shared/airplane.jpg");
Mat img = imread(string(ts->get_data_path()) + "shared/airplane.jpg");
Mat mask_prob = imread(string(ts->get_data_path()) + "grabcut/mask_prob.png", 0);
Mat exp_mask1 = imread(string(ts->get_data_path()) + "grabcut/exp_mask1.png", 0);
Mat exp_mask2 = imread(string(ts->get_data_path()) + "grabcut/exp_mask2.png", 0);
if (img.empty() || (!mask_prob.empty() && img.size() != mask_prob.size()) ||
(!exp_mask1.empty() && img.size() != exp_mask1.size()) ||
(!exp_mask2.empty() && img.size() != exp_mask2.size()) )
{
ts->set_failed_test_info(cvtest::TS::FAIL_MISSING_TEST_DATA);
ts->set_failed_test_info(cvtest::TS::FAIL_MISSING_TEST_DATA);
return;
}
Rect rect(Point(24, 126), Point(483, 294));
Mat exp_bgdModel, exp_fgdModel;
Mat mask;
mask = Scalar(0);
Mat bgdModel, fgdModel;
grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_RECT );
grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_RECT );
grabCut( img, mask, rect, bgdModel, fgdModel, 2, GC_EVAL );
// Multiply images by 255 for more visuality of test data.
@ -109,16 +109,16 @@ void CV_GrabcutTest::run( int /* start_from */)
exp_mask1 = (mask & 1) * 255;
imwrite(string(ts->get_data_path()) + "grabcut/exp_mask1.png", exp_mask1);
}
if (!verify((mask & 1) * 255, exp_mask1))
{
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
{
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
return;
}
mask = mask_prob;
bgdModel.release();
fgdModel.release();
fgdModel.release();
rect = Rect();
grabCut( img, mask, rect, bgdModel, fgdModel, 0, GC_INIT_WITH_MASK );
grabCut( img, mask, rect, bgdModel, fgdModel, 1, GC_EVAL );
@ -128,13 +128,13 @@ void CV_GrabcutTest::run( int /* start_from */)
exp_mask2 = (mask & 1) * 255;
imwrite(string(ts->get_data_path()) + "grabcut/exp_mask2.png", exp_mask2);
}
if (!verify((mask & 1) * 255, exp_mask2))
{
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
return;
}
ts->set_failed_test_info(cvtest::TS::OK);
}
ts->set_failed_test_info(cvtest::TS::OK);
}
TEST(Imgproc_GrabCut, regression) { CV_GrabcutTest test; test.safe_run(); }

View File

@ -50,8 +50,8 @@ class CV_WatershedTest : public cvtest::BaseTest
{
public:
CV_WatershedTest();
~CV_WatershedTest();
protected:
~CV_WatershedTest();
protected:
void run(int);
};
@ -59,23 +59,23 @@ CV_WatershedTest::CV_WatershedTest() {}
CV_WatershedTest::~CV_WatershedTest() {}
void CV_WatershedTest::run( int /* start_from */)
{
string exp_path = string(ts->get_data_path()) + "watershed/wshed_exp.png";
{
string exp_path = string(ts->get_data_path()) + "watershed/wshed_exp.png";
Mat exp = imread(exp_path, 0);
Mat orig = imread(string(ts->get_data_path()) + "inpaint/orig.jpg");
FileStorage fs(string(ts->get_data_path()) + "watershed/comp.xml", FileStorage::READ);
if (orig.empty() || !fs.isOpened())
{
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
return;
}
CvSeq* cnts = (CvSeq*)fs["contours"].readObj();
Mat markers(orig.size(), CV_32SC1);
markers = Scalar(0);
IplImage iplmrks = markers;
IplImage iplmrks = markers;
vector<unsigned char> colors(1);
for(int i = 0; cnts != 0; cnts = cnts->h_next, ++i )
@ -105,25 +105,25 @@ void CV_WatershedTest::run( int /* start_from */)
if (pixel <= 0 || pixel > compNum)
continue; // bad result, doing nothing and going to get error latter;
// repaint in saved color to compare with expected;
if(exp.data)
pixel = colors[pixel];
pixel = colors[pixel];
}
}
}
Mat markers8U;
markers.convertTo(markers8U, CV_8U, 1, 1);
if( exp.empty() || orig.size() != exp.size() )
{
imwrite(exp_path, markers8U);
exp = markers8U;
}
if (0 != norm(markers8U, exp, NORM_INF))
{
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
{
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
return;
}
ts->set_failed_test_info(cvtest::TS::OK);

View File

@ -0,0 +1,5 @@
#Wed Jun 29 04:36:40 MSD 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -922,7 +922,7 @@ extern "C" {
self.save(output_path+"/"+module+".txt", report.getvalue())
print "Done %i of %i funcs." % (len(self.ported_func_list), len(self.ported_func_list)+ len(self.skipped_func_list))
#print "Done %i of %i funcs." % (len(self.ported_func_list), len(self.ported_func_list)+ len(self.skipped_func_list))
@ -1402,7 +1402,7 @@ if __name__ == "__main__":
import hdr_parser
module = sys.argv[2]
srcfiles = sys.argv[3:]
print "Generating module '" + module + "' from headers:\n\t" + "\n\t".join(srcfiles)
#print "Generating module '" + module + "' from headers:\n\t" + "\n\t".join(srcfiles)
generator = JavaWrapperGenerator()
generator.gen(srcfiles, module, dstdir)

View File

@ -1 +1 @@
ocv_define_module(legacy opencv_calib3d opencv_highgui opencv_video opencv_ml)
ocv_define_module(legacy opencv_calib3d opencv_video opencv_ml OPTIONAL opencv_highgui)

View File

@ -17,16 +17,16 @@
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
* Redistributions 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 Contributor may not be used to endorse or
* promote products derived from this software without
* specific prior written permission.
* Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
* Redistributions 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 Contributor 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,
@ -71,26 +71,26 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
mask = cvarrToMat(_mask);
vector<KeyPoint> kpt;
Mat descr;
Ptr<Feature2D> surf = Algorithm::create<Feature2D>("Feature2D.SURF");
if( surf.empty() )
CV_Error(CV_StsNotImplemented, "OpenCV was built without SURF support");
surf->set("hessianThreshold", params.hessianThreshold);
surf->set("nOctaves", params.nOctaves);
surf->set("nOctaveLayers", params.nOctaveLayers);
surf->set("upright", params.upright != 0);
surf->set("extended", params.extended != 0);
surf->operator()(img, mask, kpt, _descriptors ? _OutputArray(descr) : noArray(),
useProvidedKeyPts != 0);
if( _keypoints )
*_keypoints = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvSURFPoint), storage);
if( _descriptors )
*_descriptors = cvCreateSeq(0, sizeof(CvSeq), descr.cols*descr.elemSize(), storage);
*_descriptors = cvCreateSeq(0, sizeof(CvSeq), surf->descriptorSize() * CV_ELEM_SIZE(surf->descriptorType()), storage);
for( size_t i = 0; i < kpt.size(); i++ )
{
if( _keypoints )
@ -113,7 +113,7 @@ cvGetStarKeypoints( const CvArr* _img, CvMemStorage* storage,
params.suppressNonmaxSize);
vector<KeyPoint> kpts;
star->detect(cvarrToMat(_img), kpts, Mat());
CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvStarKeypoint), storage);
for( size_t i = 0; i < kpts.size(); i++ )
{

View File

@ -46,7 +46,10 @@
// */
#include "precomp.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui_c.h"
#endif
/////////////////////////////// CvImage implementation //////////////////////////////////
@ -112,8 +115,10 @@ bool CvImage::load( const char* filename, const char* imgname, int color )
img = temp_img;
}*/
}
#ifdef HAVE_OPENCV_HIGHGUI
else
img = cvLoadImage( filename, color );
#endif
attach( img );
return img != 0;
@ -161,8 +166,12 @@ void CvImage::save( const char* filename, const char* imgname, const int* params
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, image, imgname );
#ifdef HAVE_OPENCV_HIGHGUI
else
cvSaveImage( filename, image, params );
#else
(void)params;
#endif
}
@ -175,8 +184,12 @@ void CvImage::write( CvFileStorage* fs, const char* imgname )
void CvImage::show( const char* window_name )
{
#ifdef HAVE_OPENCV_HIGHGUI
if( image )
cvShowImage( window_name, image );
#else
(void)window_name;
#endif
}
@ -238,8 +251,10 @@ bool CvMatrix::load( const char* filename, const char* matname, int color )
m = temp_mat;
}*/
}
#ifdef HAVE_OPENCV_HIGHGUI
else
m = cvLoadImageM( filename, color );
#endif
set( m, false );
return m != 0;
@ -287,8 +302,12 @@ void CvMatrix::save( const char* filename, const char* matname, const int* param
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, matrix, matname );
#ifdef HAVE_OPENCV_HIGHGUI
else
cvSaveImage( filename, matrix, params );
#else
(void)params;
#endif
}
@ -301,8 +320,12 @@ void CvMatrix::write( CvFileStorage* fs, const char* matname )
void CvMatrix::show( const char* window_name )
{
#ifdef HAVE_OPENCV_HIGHGUI
if( matrix )
cvShowImage( window_name, matrix );
#else
(void)window_name;
#endif
}

View File

@ -8,7 +8,10 @@
*/
#include "precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
#include <stdio.h>
namespace cv{
@ -665,7 +668,11 @@ namespace cv{
cvMinMaxLoc(m_samples[i], 0, &maxval);
cvConvertScale(m_samples[i], patch, 255/maxval);
#ifdef HAVE_OPENCV_HIGHGUI
cvSaveImage(buf, patch);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
cvReleaseImage(&patch);
}
@ -1794,7 +1801,12 @@ namespace cv{
sprintf(filename, "%s/%s", path, imagename);
//printf("Reading image %s...", filename);
IplImage* img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
IplImage* img = 0;
#ifdef HAVE_OPENCV_HIGHGUI
img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
//printf("done\n");
extractPatches (img, patches, patch_size);

View File

@ -366,7 +366,7 @@ void CV_CvEMTest::run( int /*start_from*/ )
int currCode = runCase(caseIndex++, params, trainData, trainLabels, testData, testLabels, sizes);
code = currCode == cvtest::TS::OK ? code : currCode;
}
ts->set_failed_test_info( code );
}
@ -382,7 +382,7 @@ protected:
samples.at<float>(0,0) = 1;
samples.at<float>(1,0) = 2;
samples.at<float>(2,0) = 3;
Mat labels(samples.rows, 1, CV_32S);
CvEMParams params;
@ -398,7 +398,7 @@ protected:
// Write out
string filename = tempfile() + ".xml";
string filename = cv::tempfile(".xml");
{
FileStorage fs = FileStorage(filename, FileStorage::WRITE);
try

View File

@ -421,7 +421,7 @@ void CV_StereoMatchingTest::run(int)
ts->set_failed_test_info( code );
return;
}
string fullResultFilename = dataPath + ALGORITHMS_DIR + algorithmName + RESULT_FILE;
FileStorage resFS( fullResultFilename, FileStorage::READ );
bool isWrite = true; // write or compare results
@ -660,7 +660,7 @@ class CV_StereoGCTest : public CV_StereoMatchingTest
public:
CV_StereoGCTest()
{
name = "stereogc";
name = "stereogc";
fill(rmsEps.begin(), rmsEps.end(), 3.f);
fracEps[0] = 0.05f; // all
fracEps[1] = 0.05f; // noOccl

View File

@ -527,7 +527,7 @@ protected:
firstResult.at<int>(i) = static_cast<int>(em.predict(samples.row(i))[1]);
// Write out
string filename = tempfile() + ".xml";
string filename = cv::tempfile(".xml");
{
FileStorage fs = FileStorage(filename, FileStorage::WRITE);
try

View File

@ -62,7 +62,7 @@ protected:
class CV_AMLTest : public CV_MLBaseTest
{
public:
CV_AMLTest( const char* _modelName );
CV_AMLTest( const char* _modelName );
protected:
virtual int run_test_case( int testCaseIdx );
virtual int validate_test_results( int testCaseIdx );
@ -71,7 +71,7 @@ protected:
class CV_SLMLTest : public CV_MLBaseTest
{
public:
CV_SLMLTest( const char* _modelName );
CV_SLMLTest( const char* _modelName );
protected:
virtual int run_test_case( int testCaseIdx );
virtual int validate_test_results( int testCaseIdx );

View File

@ -84,7 +84,7 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx )
// 1. compare files
ifstream f1( fname1.c_str() ), f2( fname2.c_str() );
string s1, s2;
int lineIdx = 0;
int lineIdx = 0;
CV_Assert( f1.is_open() && f2.is_open() );
for( ; !f1.eof() && !f2.eof(); lineIdx++ )
{

View File

@ -1,2 +1,2 @@
set(the_description "Object Detection")
ocv_define_module(objdetect OPTIONAL opencv_highgui)
ocv_define_module(objdetect opencv_core opencv_imgproc OPTIONAL opencv_highgui)

View File

@ -44,7 +44,7 @@
#include <string>
#ifdef HAVE_CVCONFIG_H
#ifdef HAVE_CVCONFIG_H
#include "cvconfig.h"
#endif
@ -61,7 +61,7 @@ const CvRect true_bounding_boxes[3] = {cvRect(0, 45, 362, 452), cvRect(304, 0, 6
class CV_LatentSVMDetectorTest : public cvtest::BaseTest
{
protected:
protected:
void run(int);
bool isEqual(CvRect r1, CvRect r2, int eps);
};
@ -75,7 +75,7 @@ bool CV_LatentSVMDetectorTest::isEqual(CvRect r1, CvRect r2, int eps)
}
void CV_LatentSVMDetectorTest::run( int /* start_from */)
{
{
string img_path = string(ts->get_data_path()) + "latentsvmdetector/cat.jpg";
string model_path = string(ts->get_data_path()) + "latentsvmdetector/models_VOC2007/cat.xml";
int numThreads = -1;
@ -102,7 +102,7 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
}
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* detections = 0;
CvSeq* detections = 0;
detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads);
if (detections->total != num_detections)
{

View File

@ -49,8 +49,8 @@ class CV_InpaintTest : public cvtest::BaseTest
{
public:
CV_InpaintTest();
~CV_InpaintTest();
protected:
~CV_InpaintTest();
protected:
void run(int);
};
@ -61,43 +61,40 @@ CV_InpaintTest::~CV_InpaintTest() {}
void CV_InpaintTest::run( int )
{
string folder = string(ts->get_data_path()) + "inpaint/";
Mat orig = imread(folder + "orig.jpg");
string folder = string(ts->get_data_path()) + "inpaint/";
Mat orig = imread(folder + "orig.jpg");
Mat exp1 = imread(folder + "exp1.png");
Mat exp2 = imread(folder + "exp2.png");
Mat mask = imread(folder + "mask.png");
Mat mask = imread(folder + "mask.png");
if (orig.empty() || exp1.empty() || exp2.empty() || mask.empty())
{
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
return;
}
Mat inv_mask;
Mat inv_mask;
mask.convertTo(inv_mask, CV_8UC3, -1.0, 255.0);
Mat mask1ch;
cv::cvtColor(mask, mask1ch, CV_BGR2GRAY);
Mat test = orig.clone();
test.setTo(Scalar::all(255), mask1ch);
test.setTo(Scalar::all(255), mask1ch);
Mat res1, res2;
inpaint( test, mask1ch, res1, 5, CV_INPAINT_NS );
inpaint( test, mask1ch, res2, 5, CV_INPAINT_TELEA );
imwrite("d:/exp1.png", res1);
imwrite("d:/exp2.png", res2);
inpaint( test, mask1ch, res2, 5, CV_INPAINT_TELEA );
Mat diff1, diff2;
absdiff( orig, res1, diff1 );
absdiff( orig, res2, diff2 );
double n1 = norm(diff1.reshape(1), NORM_INF, inv_mask.reshape(1));
double n2 = norm(diff2.reshape(1), NORM_INF, inv_mask.reshape(1));
if (n1 != 0 || n2 != 0)
{
{
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
return;
}
@ -109,9 +106,9 @@ void CV_InpaintTest::run( int )
n2 = norm(diff2.reshape(1), NORM_INF, mask.reshape(1));
const int jpeg_thres = 3;
if (n1 > jpeg_thres || n2 > jpeg_thres)
if (n1 > jpeg_thres || n2 > jpeg_thres)
{
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
return;
}

View File

@ -37,8 +37,6 @@ for l in open("%s/api" % sys.argv[1]):
# Validation: check that any optional arguments are last
had_error = False
for (f, args, ty, flags) in api:
if f == 'PolarToCart':
print f, [(a.init != None) for a in args]
has_init = [(a.init != None) for a in args if not 'O' in a.flags]
if True in has_init and not all(has_init[has_init.index(True):]):
print 'Error in definition for "%s", optional arguments must be last' % f
@ -130,7 +128,7 @@ def has_optional(al):
def gen(name, args, ty, flags):
yield ""
if has_optional(args):
yield "static PyObject *pycv%s(PyObject *self, PyObject *args, PyObject *kw)" % cname(name)
yield "static PyObject *pycv%s(PyObject *self, PyObject *args, PyObject *kw)" % cname(name)
else:
yield "static PyObject *pycv%s(PyObject *self, PyObject *args)" % cname(name)
if 'doconly' in flags:
@ -185,7 +183,7 @@ def gen(name, args, ty, flags):
in_args = [ a for a in args if not 'O' in a.flags ]
fmt0 = "".join([ fmap[a.ty] for a in in_args if not a.init])
fmt1 = "".join([ fmap[a.ty] for a in in_args if a.init])
yield ''
if len(fmt0 + fmt1) > 0:
if len(fmt1) > 0:

File diff suppressed because it is too large Load Diff

View File

@ -96,13 +96,13 @@ def query_yes_no(stdout, question, default="yes"):
else:
stdout.write("Please respond with 'yes' or 'no' "\
"(or 'y' or 'n').\n")
def getRunningProcessExePathByName_win32(name):
from ctypes import windll, POINTER, pointer, Structure, sizeof
from ctypes import c_long , c_int , c_uint , c_char , c_ubyte , c_char_p , c_void_p
class PROCESSENTRY32(Structure):
_fields_ = [ ( 'dwSize' , c_uint ) ,
_fields_ = [ ( 'dwSize' , c_uint ) ,
( 'cntUsage' , c_uint) ,
( 'th32ProcessID' , c_uint) ,
( 'th32DefaultHeapID' , c_uint) ,
@ -111,25 +111,25 @@ def getRunningProcessExePathByName_win32(name):
( 'th32ParentProcessID' , c_uint) ,
( 'pcPriClassBase' , c_long) ,
( 'dwFlags' , c_uint) ,
( 'szExeFile' , c_char * 260 ) ,
( 'szExeFile' , c_char * 260 ) ,
( 'th32MemoryBase' , c_long) ,
( 'th32AccessKey' , c_long ) ]
class MODULEENTRY32(Structure):
_fields_ = [ ( 'dwSize' , c_long ) ,
_fields_ = [ ( 'dwSize' , c_long ) ,
( 'th32ModuleID' , c_long ),
( 'th32ProcessID' , c_long ),
( 'GlblcntUsage' , c_long ),
( 'ProccntUsage' , c_long ) ,
( 'modBaseAddr' , c_long ) ,
( 'modBaseSize' , c_long ) ,
( 'modBaseSize' , c_long ) ,
( 'hModule' , c_void_p ) ,
( 'szModule' , c_char * 256 ),
( 'szExePath' , c_char * 260 ) ]
TH32CS_SNAPPROCESS = 2
TH32CS_SNAPMODULE = 0x00000008
## CreateToolhelp32Snapshot
CreateToolhelp32Snapshot= windll.kernel32.CreateToolhelp32Snapshot
CreateToolhelp32Snapshot.reltype = c_long
@ -150,7 +150,7 @@ def getRunningProcessExePathByName_win32(name):
Module32First = windll.kernel32.Module32First
Module32First.argtypes = [ c_void_p , POINTER(MODULEENTRY32) ]
Module32First.rettype = c_int
hProcessSnap = c_void_p(0)
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS , 0 )
@ -180,7 +180,7 @@ def getRunningProcessExePathByName_posix(name):
for pid in pids:
try:
path = os.readlink(os.path.join('/proc', pid, 'exe'))
if path and path.endswith(name):
if path and path.endswith(name):
return path
except:
pass
@ -195,7 +195,7 @@ def getRunningProcessExePathByName(name):
return None
except:
return None
class RunInfo(object):
def setCallback(self, name, callback):
setattr(self, name, callback)
@ -224,7 +224,7 @@ class RunInfo(object):
except:
pass
cachefile.close()
# fix empty tests dir
if not self.tests_dir:
self.tests_dir = self.path
@ -236,12 +236,12 @@ class RunInfo(object):
else:
self.adb = None
# detect target platform
# detect target platform
if self.android_executable or self.android_abi or self.ndk_path:
self.targetos = "android"
else:
self.targetos = hostos
if self.targetos == "android":
# fix adb tool location
if not self.adb:
@ -250,7 +250,7 @@ class RunInfo(object):
self.adb = "adb"
if options.adb_serial:
self.adb = [self.adb, "-s", options.adb_serial]
else:
else:
self.adb = [self.adb]
try:
output = Popen(self.adb + ["shell", "ls"], stdout=PIPE, stderr=PIPE).communicate()
@ -317,23 +317,23 @@ class RunInfo(object):
self.targetarch = "x86"
else:
self.targetarch = "unknown"
# fix CUDA attributes
self.with_cuda = self.with_cuda == "ON"
if self.cuda_library and self.cuda_library.endswith("-NOTFOUND"):
self.cuda_library = None
self.has_cuda = self.with_cuda and self.cuda_library and self.targetarch in ["x86", "x64"]
self.hardware = None
self.getSvnVersion(self.cmake_home, "cmake_home_svn")
if self.opencv_home == self.cmake_home:
self.opencv_home_svn = self.cmake_home_svn
else:
self.getSvnVersion(self.opencv_home, "opencv_home_svn")
self.tests = self.getAvailableTestApps()
def getSvnVersion(self, path, name):
if not path:
setattr(self, name, None)
@ -352,7 +352,7 @@ class RunInfo(object):
setattr(self, name, None)
except OSError:
setattr(self, name, None)
def tryGetSvnVersionWithTortoise(self, path, name):
try:
wcrev = "SubWCRev.exe"
@ -377,7 +377,7 @@ class RunInfo(object):
if dir:
import shutil
shutil.rmtree(dir)
def isTest(self, fullpath):
if not os.path.isfile(fullpath):
return False
@ -388,14 +388,14 @@ class RunInfo(object):
if self.targetos == "android" and fullpath.endswith(".apk"):
return True
return True
def getAvailableTestApps(self):
if self.tests_dir and os.path.isdir(self.tests_dir):
files = glob.glob(os.path.join(self.tests_dir, self.nameprefix + "*"))
files = [f for f in files if self.isTest(f)]
return files
return []
def getLogName(self, app, timestamp):
app = os.path.basename(app)
if app.endswith(".exe"):
@ -508,17 +508,17 @@ class RunInfo(object):
hw = ""
tstamp = timestamp.strftime("%Y-%m-%d--%H-%M-%S")
return "%s_%s_%s_%s%s%s.xml" % (app, self.targetos, self.targetarch, hw, rev, tstamp)
def getTest(self, name):
# full path
if self.isTest(name):
return name
# name only
fullname = os.path.join(self.tests_dir, name)
if self.isTest(fullname):
return fullname
# name without extension
fullname += ".exe"
if self.isTest(fullname):
@ -527,7 +527,7 @@ class RunInfo(object):
fullname += ".apk"
if self.isTest(fullname):
return fullname
# short name for OpenCV tests
for t in self.tests:
if t == name:
@ -547,7 +547,7 @@ class RunInfo(object):
if fname == name:
return t
return None
def runAdb(self, *args):
cmd = self.adb[:]
cmd.extend(args)
@ -559,7 +559,7 @@ class RunInfo(object):
except OSError:
pass
return None
def isRunnable(self):
if self.error:
return False
@ -585,7 +585,7 @@ class RunInfo(object):
if hw:
self.hardware = hw.groups()[0].strip()
return True
def runTest(self, path, workingDir, _stdout, _stderr, args = []):
if self.error:
return
@ -593,13 +593,13 @@ class RunInfo(object):
timestamp = datetime.datetime.now()
logfile = self.getLogName(path, timestamp)
exe = os.path.abspath(path)
userlog = [a for a in args if a.startswith("--gtest_output=")]
if len(userlog) == 0:
args.append("--gtest_output=xml:" + logfile)
else:
logfile = userlog[0][userlog[0].find(":")+1:]
if self.targetos == "android" and exe.endswith(".apk"):
print "running java tests:", exe
try:
@ -653,10 +653,11 @@ class RunInfo(object):
elif self.targetos == "android":
hostlogpath = ""
usercolor = [a for a in args if a.startswith("--gtest_color=")]
if len(userlog) == 0 and _stdout.isatty() and hostos != "nt":
if len(usercolor) == 0 and _stdout.isatty() and hostos != "nt":
args.append("--gtest_color=yes")
try:
andoidcwd = "/data/bin/" + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/"
tempdir = "/data/local/tmp/"
andoidcwd = tempdir + getpass.getuser().replace(" ","") + "_" + self.options.mode +"/"
exename = os.path.basename(exe)
androidexe = andoidcwd + exename
#upload
@ -692,6 +693,9 @@ class RunInfo(object):
return
#rm log
Popen(self.adb + ["shell", "rm " + andoidcwd + logfile], stdout=_stdout, stderr=_stderr).wait()
# clean temporary files
Popen(self.adb + ["shell", "rm " + tempdir + "__opencv_temp.*"], stdout=_stdout, stderr=_stderr).wait()
except OSError:
pass
if os.path.isfile(hostlogpath):
@ -704,16 +708,27 @@ class RunInfo(object):
else:
cmd.extend(args)
print >> _stderr, "Running:", " ".join(cmd)
try:
try:
Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait()
except OSError:
pass
# clean temporary files
temp_path = os.environ.get('OPENCV_TEMP_PATH')
if not temp_path:
if hostos == "nt":
temp_path = tempfile.gettempdir()
else:
temp_path = "/tmp"
for filename in glob.glob(os.path.join(temp_path, "__opencv_temp.*")) :
os.remove( filename )
logpath = os.path.join(workingDir, logfile)
if os.path.isfile(logpath):
return logpath
return None
def runTests(self, tests, _stdout, _stderr, workingDir, args = []):
if self.error:
return []
@ -747,10 +762,10 @@ def getRunArgs(args):
if __name__ == "__main__":
test_args = [a for a in sys.argv if a.startswith("--perf_") or a.startswith("--gtest_")]
argv = [a for a in sys.argv if not(a.startswith("--perf_") or a.startswith("--gtest_"))]
parser = OptionParser()
parser.add_option("-t", "--tests", dest="tests", help="comma-separated list of modules to test", metavar="SUITS", default="")
parser.add_option("-w", "--cwd", dest="cwd", help="working directory for tests", metavar="PATH", default=".")
parser.add_option("-a", "--accuracy", dest="accuracy", help="look for accuracy tests instead of performance tests", action="store_true", default=False)
parser.add_option("-l", "--longname", dest="useLongNames", action="store_true", help="generate log files with long names", default=False)
@ -759,26 +774,26 @@ if __name__ == "__main__":
parser.add_option("", "--serial", dest="adb_serial", help="Android: directs command to the USB device or emulator with the given serial number", metavar="serial number", default="")
parser.add_option("", "--package", dest="junit_package", help="Android: run jUnit tests for specified package", metavar="package", default="")
parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False)
(options, args) = parser.parse_args(argv)
if options.accuracy:
options.mode = "test"
else:
options.mode = "perf"
run_args = getRunArgs(args[1:] or ['.'])
if len(run_args) == 0:
print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<build_path>"
exit(1)
tests = [s.strip() for s in options.tests.split(",") if s]
if len(tests) != 1 or len(run_args) != 1:
#remove --gtest_output from params
test_args = [a for a in test_args if not a.startswith("--gtest_output=")]
logs = []
for path in run_args:
info = RunInfo(path, options)
@ -789,5 +804,5 @@ if __name__ == "__main__":
info.test_data_path = options.test_data_path
logs.extend(info.runTests(tests, sys.stdout, sys.stderr, options.cwd, test_args))
if logs:
if logs:
print >> sys.stderr, "Collected:", " ".join(logs)

View File

@ -40,6 +40,7 @@
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
// The following lines pull in the real gtest *.cc files.
@ -300,7 +301,7 @@ class GTEST_API_ SingleFailureChecker {
(substr));\
{\
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
&gtest_failures);\
if (::testing::internal::AlwaysTrue()) { statement; }\
}\
@ -313,6 +314,7 @@ class GTEST_API_ SingleFailureChecker {
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
@ -514,6 +516,12 @@ GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
// Formats the given time in milliseconds as seconds.
GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
// Converts the given time in milliseconds to a date string in the ISO 8601
// format, without the timezone information. N.B.: due to the use the
// non-reentrant localtime() function, this function is not thread safe. Do
// not use it in any code that can be called from multiple threads.
GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
// Parses a string for an Int32 flag, in the form of "--flag=value".
//
// On success, stores the value of the flag in *value, and returns
@ -592,6 +600,7 @@ class GTestFlagSaver {
GTEST_FLAG(stream_result_to) = stream_result_to_;
GTEST_FLAG(throw_on_failure) = throw_on_failure_;
}
private:
// Fields for saving the original values of flags.
bool also_run_disabled_tests_;
@ -834,8 +843,11 @@ class OsStackTraceGetterInterface {
class OsStackTraceGetter : public OsStackTraceGetterInterface {
public:
OsStackTraceGetter() : caller_frame_(NULL) {}
virtual String CurrentStackTrace(int max_depth, int skip_count);
virtual void UponLeavingGTest();
virtual String CurrentStackTrace(int max_depth, int skip_count)
GTEST_LOCK_EXCLUDED_(mutex_);
virtual void UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_);
// This string is inserted in place of stack frames that are part of
// Google Test's implementation.
@ -950,6 +962,10 @@ class GTEST_API_ UnitTestImpl {
// Gets the number of tests that should run.
int test_to_run_count() const;
// Gets the time of the test program start, in ms from the start of the
// UNIX epoch.
TimeInMillis start_timestamp() const { return start_timestamp_; }
// Gets the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const { return elapsed_time_; }
@ -1008,7 +1024,7 @@ class GTEST_API_ UnitTestImpl {
// For example, if Foo() calls Bar(), which in turn calls
// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
String CurrentOsStackTraceExceptTop(int skip_count);
String CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
// Finds and returns a TestCase with the given name. If one doesn't
// exist, creates one and returns it.
@ -1282,6 +1298,10 @@ class GTEST_API_ UnitTestImpl {
// Our random number generator.
internal::Random random_;
// The time of the test program start, in ms from the start of the
// UNIX epoch.
TimeInMillis start_timestamp_;
// How long the test took to run, in milliseconds.
TimeInMillis elapsed_time_;
@ -1613,7 +1633,7 @@ UInt32 Random::Generate(UInt32 range) {
// Test. g_init_gtest_count is set to the number of times
// InitGoogleTest() has been called. We don't protect this variable
// under a mutex as it is only accessed in the main thread.
int g_init_gtest_count = 0;
GTEST_API_ int g_init_gtest_count = 0;
static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
// Iterates over a vector of TestCases, keeping a running sum of the
@ -1668,7 +1688,7 @@ void AssertHelper::operator=(const Message& message) const {
}
// Mutex for linked pointers.
GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
// Application pathname gotten in InitGoogleTest.
String g_executable_path;
@ -2125,17 +2145,6 @@ TimeInMillis GetTimeInMillis() {
// class String
// Returns the input enclosed in double quotes if it's not NULL;
// otherwise returns "(null)". For example, "\"Hello\"" is returned
// for input "Hello".
//
// This is useful for printing a C string in the syntax of a literal.
//
// Known issue: escape sequences are not handled yet.
String String::ShowCStringQuoted(const char* c_str) {
return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
}
// Copies at most length characters from str into a newly-allocated
// piece of memory of size length+1. The memory is allocated with new[].
// A terminating null byte is written to the memory, and a pointer to it
@ -2476,8 +2485,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
String::ShowCStringQuoted(expected),
String::ShowCStringQuoted(actual),
PrintToString(expected),
PrintToString(actual),
false);
}
@ -2492,8 +2501,8 @@ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
String::ShowCStringQuoted(expected),
String::ShowCStringQuoted(actual),
PrintToString(expected),
PrintToString(actual),
true);
}
@ -2841,15 +2850,6 @@ String String::ShowWideCString(const wchar_t * wide_c_str) {
return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
}
// Similar to ShowWideCString(), except that this function encloses
// the converted string in double quotes.
String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
if (wide_c_str == NULL) return String("(null)");
return String::Format("L\"%s\"",
String::ShowWideCString(wide_c_str).c_str());
}
// Compares two wide C strings. Returns true iff they have the same
// content.
//
@ -2875,8 +2875,8 @@ AssertionResult CmpHelperSTREQ(const char* expected_expression,
return EqFailure(expected_expression,
actual_expression,
String::ShowWideCStringQuoted(expected),
String::ShowWideCStringQuoted(actual),
PrintToString(expected),
PrintToString(actual),
false);
}
@ -2891,8 +2891,8 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression,
return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
<< s2_expression << "), actual: "
<< String::ShowWideCStringQuoted(s1)
<< " vs " << String::ShowWideCStringQuoted(s2);
<< PrintToString(s1)
<< " vs " << PrintToString(s2);
}
// Compares two C strings, ignoring case. Returns true iff they have
@ -4015,8 +4015,6 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
private:
static void PrintFailedTests(const UnitTest& unit_test);
internal::String test_case_name_;
};
// Fired before each iteration of tests starts.
@ -4063,11 +4061,10 @@ void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
}
void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
test_case_name_ = test_case.name();
const internal::String counts =
FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
ColoredPrintf(COLOR_GREEN, "[----------] ");
printf("%s from %s", counts.c_str(), test_case_name_.c_str());
printf("%s from %s", counts.c_str(), test_case.name());
if (test_case.type_param() == NULL) {
printf("\n");
} else {
@ -4078,7 +4075,7 @@ void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
PrintTestName(test_case_name_.c_str(), test_info.name());
PrintTestName(test_info.test_case_name(), test_info.name());
printf("\n");
fflush(stdout);
}
@ -4101,7 +4098,7 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
} else {
ColoredPrintf(COLOR_RED, "[ FAILED ] ");
}
PrintTestName(test_case_name_.c_str(), test_info.name());
PrintTestName(test_info.test_case_name(), test_info.name());
if (test_info.result()->Failed())
PrintFullTestCommentIfPresent(test_info);
@ -4117,12 +4114,11 @@ void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
if (!GTEST_FLAG(print_time)) return;
test_case_name_ = test_case.name();
const internal::String counts =
FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
ColoredPrintf(COLOR_GREEN, "[----------] ");
printf("%s from %s (%s ms total)\n\n",
counts.c_str(), test_case_name_.c_str(),
counts.c_str(), test_case.name(),
internal::StreamableToString(test_case.elapsed_time()).c_str());
fflush(stdout);
}
@ -4507,6 +4503,32 @@ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
return ss.str();
}
// Converts the given epoch time in milliseconds to a date string in the ISO
// 8601 format, without the timezone information.
std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
// Using non-reentrant version as localtime_r is not portable.
time_t seconds = static_cast<time_t>(ms / 1000);
#ifdef _MSC_VER
# pragma warning(push) // Saves the current warning state.
# pragma warning(disable:4996) // Temporarily disables warning 4996
// (function or variable may be unsafe).
const struct tm* const time_struct = localtime(&seconds); // NOLINT
# pragma warning(pop) // Restores the warning state again.
#else
const struct tm* const time_struct = localtime(&seconds); // NOLINT
#endif
if (time_struct == NULL)
return ""; // Invalid ms value
return String::Format("%d-%02d-%02dT%02d:%02d:%02d", // YYYY-MM-DDThh:mm:ss
time_struct->tm_year + 1900,
time_struct->tm_mon + 1,
time_struct->tm_mday,
time_struct->tm_hour,
time_struct->tm_min,
time_struct->tm_sec);
}
// Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream,
const char* data) {
@ -4556,16 +4578,17 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
for (int i = 0; i < result.total_part_count(); ++i) {
const TestPartResult& part = result.GetTestPartResult(i);
if (part.failed()) {
if (++failures == 1)
if (++failures == 1) {
*stream << ">\n";
*stream << " <failure message=\""
<< EscapeXmlAttribute(part.summary()).c_str()
<< "\" type=\"\">";
}
const string location = internal::FormatCompilerIndependentFileLocation(
part.file_name(), part.line_number());
const string message = location + "\n" + part.message();
OutputXmlCDataSection(stream,
RemoveInvalidXmlCharacters(message).c_str());
const string summary = location + "\n" + part.summary();
*stream << " <failure message=\""
<< EscapeXmlAttribute(summary.c_str())
<< "\" type=\"\">";
const string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*stream << "</failure>\n";
}
}
@ -4603,10 +4626,11 @@ void XmlUnitTestResultPrinter::PrintXmlUnitTest(FILE* out,
fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(out,
"<testsuites tests=\"%d\" failures=\"%d\" disabled=\"%d\" "
"errors=\"0\" time=\"%s\" ",
"errors=\"0\" timestamp=\"%s\" time=\"%s\" ",
unit_test.total_test_count(),
unit_test.failed_test_count(),
unit_test.disabled_test_count(),
FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()).c_str(),
FormatTimeInMillisAsSeconds(unit_test.elapsed_time()).c_str());
if (GTEST_FLAG(shuffle)) {
fprintf(out, "random_seed=\"%d\" ", unit_test.random_seed());
@ -4812,8 +4836,8 @@ void StreamingListener::MakeConnection() {
// Pushes the given source file location and message onto a per-thread
// trace stack maintained by Google Test.
// L < UnitTest::mutex_
ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
ScopedTrace::ScopedTrace(const char* file, int line, const Message& message)
GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
TraceInfo trace;
trace.file = file;
trace.line = line;
@ -4823,8 +4847,8 @@ ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) {
}
// Pops the info pushed by the c'tor.
// L < UnitTest::mutex_
ScopedTrace::~ScopedTrace() {
ScopedTrace::~ScopedTrace()
GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
UnitTest::GetInstance()->PopGTestTrace();
}
@ -4838,14 +4862,14 @@ ScopedTrace::~ScopedTrace() {
// skip_count - the number of top frames to be skipped; doesn't count
// against max_depth.
//
// L < mutex_
// We use "L < mutex_" to denote that the function may acquire mutex_.
String OsStackTraceGetter::CurrentStackTrace(int, int) {
String OsStackTraceGetter::CurrentStackTrace(int /* max_depth */,
int /* skip_count */)
GTEST_LOCK_EXCLUDED_(mutex_) {
return String("");
}
// L < mutex_
void OsStackTraceGetter::UponLeavingGTest() {
void OsStackTraceGetter::UponLeavingGTest()
GTEST_LOCK_EXCLUDED_(mutex_) {
}
const char* const
@ -4999,6 +5023,12 @@ int UnitTest::total_test_count() const { return impl()->total_test_count(); }
// Gets the number of tests that should run.
int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); }
// Gets the time of the test program start, in ms from the start of the
// UNIX epoch.
internal::TimeInMillis UnitTest::start_timestamp() const {
return impl()->start_timestamp();
}
// Gets the elapsed time, in milliseconds.
internal::TimeInMillis UnitTest::elapsed_time() const {
return impl()->elapsed_time();
@ -5052,12 +5082,13 @@ Environment* UnitTest::AddEnvironment(Environment* env) {
// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call
// this to report their results. The user code should use the
// assertion macros instead of calling this directly.
// L < mutex_
void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
const char* file_name,
int line_number,
const internal::String& message,
const internal::String& os_stack_trace) {
void UnitTest::AddTestPartResult(
TestPartResult::Type result_type,
const char* file_name,
int line_number,
const internal::String& message,
const internal::String& os_stack_trace)
GTEST_LOCK_EXCLUDED_(mutex_) {
Message msg;
msg << message;
@ -5141,7 +5172,6 @@ int UnitTest::Run() {
// process. In either case the user does not want to see pop-up dialogs
// about crashes - they are expected.
if (impl()->catch_exceptions() || in_death_test_child_process) {
# if !GTEST_OS_WINDOWS_MOBILE
// SetErrorMode doesn't exist on CE.
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
@ -5172,7 +5202,6 @@ int UnitTest::Run() {
0x0, // Clear the following flags:
_WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
# endif
}
#endif // GTEST_HAS_SEH
@ -5190,16 +5219,16 @@ const char* UnitTest::original_working_dir() const {
// Returns the TestCase object for the test that's currently running,
// or NULL if no test is running.
// L < mutex_
const TestCase* UnitTest::current_test_case() const {
const TestCase* UnitTest::current_test_case() const
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock lock(&mutex_);
return impl_->current_test_case();
}
// Returns the TestInfo object for the test that's currently running,
// or NULL if no test is running.
// L < mutex_
const TestInfo* UnitTest::current_test_info() const {
const TestInfo* UnitTest::current_test_info() const
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock lock(&mutex_);
return impl_->current_test_info();
}
@ -5210,9 +5239,9 @@ int UnitTest::random_seed() const { return impl_->random_seed(); }
#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them.
// L < mutex_
internal::ParameterizedTestCaseRegistry&
UnitTest::parameterized_test_registry() {
UnitTest::parameterized_test_registry()
GTEST_LOCK_EXCLUDED_(mutex_) {
return impl_->parameterized_test_registry();
}
#endif // GTEST_HAS_PARAM_TEST
@ -5229,15 +5258,15 @@ UnitTest::~UnitTest() {
// Pushes a trace defined by SCOPED_TRACE() on to the per-thread
// Google Test trace stack.
// L < mutex_
void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) {
void UnitTest::PushGTestTrace(const internal::TraceInfo& trace)
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock lock(&mutex_);
impl_->gtest_trace_stack().push_back(trace);
}
// Pops a trace from the per-thread Google Test trace stack.
// L < mutex_
void UnitTest::PopGTestTrace() {
void UnitTest::PopGTestTrace()
GTEST_LOCK_EXCLUDED_(mutex_) {
internal::MutexLock lock(&mutex_);
impl_->gtest_trace_stack().pop_back();
}
@ -5273,6 +5302,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
post_flag_parse_init_performed_(false),
random_seed_(0), // Will be overridden by the flag before first use.
random_(0), // Will be reseeded before first use.
start_timestamp_(0),
elapsed_time_(0),
#if GTEST_HAS_DEATH_TEST
internal_run_death_test_flag_(NULL),
@ -5504,6 +5534,7 @@ bool UnitTestImpl::RunAllTests() {
TestEventListener* repeater = listeners()->repeater();
start_timestamp_ = GetTimeInMillis();
repeater->OnTestProgramStart(*parent_);
// How many times to repeat the tests? We don't want to repeat them
@ -5865,7 +5896,7 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
// part can be omitted.
//
// Returns the value of the flag, or NULL if the parsing failed.
static const char* ParseFlagValue(const char* str,
const char* ParseFlagValue(const char* str,
const char* flag,
bool def_optional) {
// str and flag must not be NULL.
@ -6240,13 +6271,18 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
#if GTEST_HAS_DEATH_TEST
# if GTEST_OS_MAC && !GTEST_OS_MAC_IOS
# if GTEST_OS_MAC
# include <crt_externs.h>
# endif // GTEST_OS_MAC
# include <errno.h>
# include <fcntl.h>
# include <limits.h>
# if GTEST_OS_LINUX
# include <signal.h>
# endif // GTEST_OS_LINUX
# include <stdarg.h>
# if GTEST_OS_WINDOWS
@ -6256,6 +6292,10 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
# include <sys/wait.h>
# endif // GTEST_OS_WINDOWS
# if GTEST_OS_QNX
# include <spawn.h>
# endif // GTEST_OS_QNX
#endif // GTEST_HAS_DEATH_TEST
@ -6301,13 +6341,42 @@ GTEST_DEFINE_string_(
"Indicates the file, line number, temporal index of "
"the single death test to run, and a file descriptor to "
"which a success code may be sent, all separated by "
"colons. This flag is specified if and only if the current "
"the '|' characters. This flag is specified if and only if the current "
"process is a sub-process launched for running a thread-safe "
"death test. FOR INTERNAL USE ONLY.");
} // namespace internal
#if GTEST_HAS_DEATH_TEST
namespace internal {
// Valid only for fast death tests. Indicates the code is running in the
// child process of a fast style death test.
static bool g_in_fast_death_test_child = false;
// Returns a Boolean value indicating whether the caller is currently
// executing in the context of the death test child process. Tools such as
// Valgrind heap checkers may need this to modify their behavior in death
// tests. IMPORTANT: This is an internal utility. Using it may break the
// implementation of death tests. User code MUST NOT use it.
bool InDeathTestChild() {
# if GTEST_OS_WINDOWS
// On Windows, death tests are thread-safe regardless of the value of the
// death_test_style flag.
return !GTEST_FLAG(internal_run_death_test).empty();
# else
if (GTEST_FLAG(death_test_style) == "threadsafe")
return !GTEST_FLAG(internal_run_death_test).empty();
else
return g_in_fast_death_test_child;
#endif
}
} // namespace internal
// ExitedWithCode constructor.
ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
}
@ -7017,6 +7086,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
// Event forwarding to the listeners of event listener API mush be shut
// down in death test subprocesses.
GetUnitTestImpl()->listeners()->SuppressEventForwarding();
g_in_fast_death_test_child = true;
return EXECUTE_TEST;
} else {
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
@ -7036,6 +7106,11 @@ class ExecDeathTest : public ForkingDeathTest {
ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
virtual TestRole AssumeRole();
private:
static ::std::vector<testing::internal::string>
GetArgvsForDeathTestChildProcess() {
::std::vector<testing::internal::string> args = GetInjectableArgvs();
return args;
}
// The name of the file in which the death test is located.
const char* const file_;
// The line number on which the death test is located.
@ -7070,6 +7145,7 @@ class Arguments {
char* const* Argv() {
return &args_[0];
}
private:
std::vector<char*> args_;
};
@ -7081,7 +7157,7 @@ struct ExecDeathTestArgs {
int close_fd; // File descriptor to close; the read end of a pipe
};
# if GTEST_OS_MAC && !GTEST_OS_MAC_IOS
# if GTEST_OS_MAC
inline char** GetEnviron() {
// When Google Test is built as a framework on MacOS X, the environ variable
// is unavailable. Apple's documentation (man environ) recommends using
@ -7095,6 +7171,7 @@ extern "C" char** environ;
inline char** GetEnviron() { return environ; }
# endif // GTEST_OS_MAC
# if !GTEST_OS_QNX
// The main function for a threadsafe-style death test child process.
// This function is called in a clone()-ed process and thus must avoid
// any potentially unsafe operations like malloc or libc functions.
@ -7127,6 +7204,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
GetLastErrnoDescription().c_str()));
return EXIT_FAILURE;
}
# endif // !GTEST_OS_QNX
// Two utility routines that together determine the direction the stack
// grows.
@ -7137,25 +7215,76 @@ static int ExecDeathTestChildMain(void* child_arg) {
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
// correct answer.
bool StackLowerThanAddress(const void* ptr) GTEST_NO_INLINE_;
bool StackLowerThanAddress(const void* ptr) {
void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
void StackLowerThanAddress(const void* ptr, bool* result) {
int dummy;
return &dummy < ptr;
*result = (&dummy < ptr);
}
static bool StackGrowsDown() {
int dummy;
return StackLowerThanAddress(&dummy);
bool result;
StackLowerThanAddress(&dummy, &result);
return result;
}
// A threadsafe implementation of fork(2) for threadsafe-style death tests
// that uses clone(2). It dies with an error message if anything goes
// wrong.
static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
// Spawns a child process with the same executable as the current process in
// a thread-safe manner and instructs it to run the death test. The
// implementation uses fork(2) + exec. On systems where clone(2) is
// available, it is used instead, being slightly more thread-safe. On QNX,
// fork supports only single-threaded environments, so this function uses
// spawn(2) there instead. The function dies with an error message if
// anything goes wrong.
static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
ExecDeathTestArgs args = { argv, close_fd };
pid_t child_pid = -1;
# if GTEST_HAS_CLONE
# if GTEST_OS_QNX
// Obtains the current directory and sets it to be closed in the child
// process.
const int cwd_fd = open(".", O_RDONLY);
GTEST_DEATH_TEST_CHECK_(cwd_fd != -1);
GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC));
// We need to execute the test program in the same environment where
// it was originally invoked. Therefore we change to the original
// working directory first.
const char* const original_dir =
UnitTest::GetInstance()->original_working_dir();
// We can safely call chdir() as it's a direct system call.
if (chdir(original_dir) != 0) {
DeathTestAbort(String::Format("chdir(\"%s\") failed: %s",
original_dir,
GetLastErrnoDescription().c_str()));
return EXIT_FAILURE;
}
int fd_flags;
// Set close_fd to be closed after spawn.
GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD));
GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD,
fd_flags | FD_CLOEXEC));
struct inheritance inherit = {0};
// spawn is a system call.
child_pid = spawn(args.argv[0], 0, NULL, &inherit, args.argv, GetEnviron());
// Restores the current working directory.
GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
# else // GTEST_OS_QNX
# if GTEST_OS_LINUX
// When a SIGPROF signal is received while fork() or clone() are executing,
// the process may hang. To avoid this, we ignore SIGPROF here and re-enable
// it after the call to fork()/clone() is complete.
struct sigaction saved_sigprof_action;
struct sigaction ignore_sigprof_action;
memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action));
sigemptyset(&ignore_sigprof_action.sa_mask);
ignore_sigprof_action.sa_handler = SIG_IGN;
GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction(
SIGPROF, &ignore_sigprof_action, &saved_sigprof_action));
# endif // GTEST_OS_LINUX
# if GTEST_HAS_CLONE
const bool use_fork = GTEST_FLAG(death_test_use_fork);
if (!use_fork) {
@ -7172,14 +7301,19 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
}
# else
# else
const bool use_fork = true;
# endif // GTEST_HAS_CLONE
# endif // GTEST_HAS_CLONE
if (use_fork && (child_pid = fork()) == 0) {
ExecDeathTestChildMain(&args);
_exit(0);
}
# endif // GTEST_OS_QNX
# if GTEST_OS_LINUX
GTEST_DEATH_TEST_CHECK_SYSCALL_(
sigaction(SIGPROF, &saved_sigprof_action, NULL));
# endif // GTEST_OS_LINUX
GTEST_DEATH_TEST_CHECK_(child_pid != -1);
return child_pid;
@ -7216,7 +7350,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag,
file_, line_, death_test_index, pipe_fd[1]);
Arguments args;
args.AddArguments(GetArgvs());
args.AddArguments(GetArgvsForDeathTestChildProcess());
args.AddArgument(filter_flag.c_str());
args.AddArgument(internal_flag.c_str());
@ -7227,7 +7361,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
// is necessary.
FlushInfoLog();
const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]);
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
set_child_pid(child_pid);
set_read_fd(pipe_fd[0]);
@ -7862,6 +7996,11 @@ void FilePath::Normalize() {
# include <mach/vm_map.h>
#endif // GTEST_OS_MAC
#if GTEST_OS_QNX
# include <devctl.h>
# include <sys/procfs.h>
#endif // GTEST_OS_QNX
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
@ -7904,6 +8043,26 @@ size_t GetThreadCount() {
}
}
#elif GTEST_OS_QNX
// Returns the number of threads running in the process, or 0 to indicate that
// we cannot detect it.
size_t GetThreadCount() {
const int fd = open("/proc/self/as", O_RDONLY);
if (fd < 0) {
return 0;
}
procfs_info process_info;
const int status =
devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), NULL);
close(fd);
if (status == EOK) {
return static_cast<size_t>(process_info.num_threads);
} else {
return 0;
}
}
#else
size_t GetThreadCount() {
@ -8295,7 +8454,6 @@ class CapturedStream {
public:
// The ctor redirects the stream to a temporary file.
CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
# if GTEST_OS_WINDOWS
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
@ -8312,10 +8470,15 @@ class CapturedStream {
<< temp_file_path;
filename_ = temp_file_path;
# else
// There's no guarantee that a test has write access to the
// current directory, so we create the temporary file in the /tmp
// directory instead.
// There's no guarantee that a test has write access to the current
// directory, so we create the temporary file in the /tmp directory instead.
// We use /tmp on most systems, and /mnt/sdcard on Android. That's because
// Android doesn't have /tmp.
# if GTEST_OS_LINUX_ANDROID
char name_template[] = "/mnt/sdcard/gtest_captured_stream.XXXXXX";
# else
char name_template[] = "/tmp/captured_stream.XXXXXX";
# endif // GTEST_OS_LINUX_ANDROID
const int captured_fd = mkstemp(name_template);
filename_ = name_template;
# endif // GTEST_OS_WINDOWS
@ -8434,11 +8597,23 @@ String GetCapturedStderr() { return GetCapturedStream(&g_captured_stderr); }
#if GTEST_HAS_DEATH_TEST
// A copy of all command line arguments. Set by InitGoogleTest().
::std::vector<String> g_argvs;
::std::vector<testing::internal::string> g_argvs;
// Returns the command line as a vector of strings.
const ::std::vector<String>& GetArgvs() { return g_argvs; }
static const ::std::vector<testing::internal::string>* g_injected_test_argvs =
NULL; // Owned.
void SetInjectableArgvs(const ::std::vector<testing::internal::string>* argvs) {
if (g_injected_test_argvs != argvs)
delete g_injected_test_argvs;
g_injected_test_argvs = argvs;
}
const ::std::vector<testing::internal::string>& GetInjectableArgvs() {
if (g_injected_test_argvs != NULL) {
return *g_injected_test_argvs;
}
return g_argvs;
}
#endif // GTEST_HAS_DEATH_TEST
#if GTEST_OS_WINDOWS_MOBILE
@ -8605,14 +8780,6 @@ namespace {
using ::std::ostream;
#if GTEST_OS_WINDOWS_MOBILE // Windows CE does not define _snprintf_s.
# define snprintf _snprintf
#elif defined(_MSC_VER) && _MSC_VER >= 1400 // VC 8.0 and later deprecate snprintf and _snprintf.
# define snprintf _snprintf_s
#elif defined(_MSC_VER) && _MSC_VER
# define snprintf _snprintf
#endif // GTEST_OS_WINDOWS_MOBILE
// Prints a segment of bytes in the given object.
void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
size_t count, ostream* os) {
@ -8627,7 +8794,7 @@ void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
else
*os << '-';
}
snprintf(text, sizeof(text), "%02X", obj_bytes[j]);
GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
*os << text;
}
}
@ -8741,9 +8908,9 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
return kSpecialEscape;
}
// Prints a char c as if it's part of a string literal, escaping it when
// Prints a wchar_t c as if it's part of a string literal, escaping it when
// necessary; returns how c was formatted.
static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
switch (c) {
case L'\'':
*os << "'";
@ -8758,8 +8925,9 @@ static CharFormat PrintAsWideStringLiteralTo(wchar_t c, ostream* os) {
// Prints a char c as if it's part of a string literal, escaping it when
// necessary; returns how c was formatted.
static CharFormat PrintAsNarrowStringLiteralTo(char c, ostream* os) {
return PrintAsWideStringLiteralTo(static_cast<unsigned char>(c), os);
static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
return PrintAsStringLiteralTo(
static_cast<wchar_t>(static_cast<unsigned char>(c)), os);
}
// Prints a wide or narrow character c and its code. '\0' is printed
@ -8805,48 +8973,63 @@ void PrintTo(wchar_t wc, ostream* os) {
PrintCharAndCodeTo<wchar_t>(wc, os);
}
// Prints the given array of characters to the ostream.
// The array starts at *begin, the length is len, it may include '\0' characters
// and may not be null-terminated.
static void PrintCharsAsStringTo(const char* begin, size_t len, ostream* os) {
*os << "\"";
// Prints the given array of characters to the ostream. CharType must be either
// char or wchar_t.
// The array starts at begin, the length is len, it may include '\0' characters
// and may not be NUL-terminated.
template <typename CharType>
static void PrintCharsAsStringTo(
const CharType* begin, size_t len, ostream* os) {
const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\"";
*os << kQuoteBegin;
bool is_previous_hex = false;
for (size_t index = 0; index < len; ++index) {
const char cur = begin[index];
const CharType cur = begin[index];
if (is_previous_hex && IsXDigit(cur)) {
// Previous character is of '\x..' form and this character can be
// interpreted as another hexadecimal digit in its number. Break string to
// disambiguate.
*os << "\" \"";
*os << "\" " << kQuoteBegin;
}
is_previous_hex = PrintAsNarrowStringLiteralTo(cur, os) == kHexEscape;
is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
}
*os << "\"";
}
// Prints a (const) char/wchar_t array of 'len' elements, starting at address
// 'begin'. CharType must be either char or wchar_t.
template <typename CharType>
static void UniversalPrintCharArray(
const CharType* begin, size_t len, ostream* os) {
// The code
// const char kFoo[] = "foo";
// generates an array of 4, not 3, elements, with the last one being '\0'.
//
// Therefore when printing a char array, we don't print the last element if
// it's '\0', such that the output matches the string literal as it's
// written in the source code.
if (len > 0 && begin[len - 1] == '\0') {
PrintCharsAsStringTo(begin, len - 1, os);
return;
}
// If, however, the last element in the array is not '\0', e.g.
// const char kFoo[] = { 'f', 'o', 'o' };
// we must print the entire array. We also print a message to indicate
// that the array is not NUL-terminated.
PrintCharsAsStringTo(begin, len, os);
*os << " (no terminating NUL)";
}
// Prints a (const) char array of 'len' elements, starting at address 'begin'.
void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
PrintCharsAsStringTo(begin, len, os);
UniversalPrintCharArray(begin, len, os);
}
// Prints the given array of wide characters to the ostream.
// The array starts at *begin, the length is len, it may include L'\0'
// characters and may not be null-terminated.
static void PrintWideCharsAsStringTo(const wchar_t* begin, size_t len,
ostream* os) {
*os << "L\"";
bool is_previous_hex = false;
for (size_t index = 0; index < len; ++index) {
const wchar_t cur = begin[index];
if (is_previous_hex && isascii(cur) && IsXDigit(static_cast<char>(cur))) {
// Previous character is of '\x..' form and this character can be
// interpreted as another hexadecimal digit in its number. Break string to
// disambiguate.
*os << "\" L\"";
}
is_previous_hex = PrintAsWideStringLiteralTo(cur, os) == kHexEscape;
}
*os << "\"";
// Prints a (const) wchar_t array of 'len' elements, starting at address
// 'begin'.
void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
UniversalPrintCharArray(begin, len, os);
}
// Prints the given C string to the ostream.
@ -8872,7 +9055,7 @@ void PrintTo(const wchar_t* s, ostream* os) {
*os << "NULL";
} else {
*os << ImplicitCast_<const void*>(s) << " pointing to ";
PrintWideCharsAsStringTo(s, wcslen(s), os);
PrintCharsAsStringTo(s, wcslen(s), os);
}
}
#endif // wchar_t is native
@ -8891,13 +9074,13 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
// Prints a ::wstring object.
#if GTEST_HAS_GLOBAL_WSTRING
void PrintWideStringTo(const ::wstring& s, ostream* os) {
PrintWideCharsAsStringTo(s.data(), s.size(), os);
PrintCharsAsStringTo(s.data(), s.size(), os);
}
#endif // GTEST_HAS_GLOBAL_WSTRING
#if GTEST_HAS_STD_WSTRING
void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
PrintWideCharsAsStringTo(s.data(), s.size(), os);
PrintCharsAsStringTo(s.data(), s.size(), os);
}
#endif // GTEST_HAS_STD_WSTRING

View File

@ -1,3 +1,3 @@
set(the_description "Video stabilization")
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_highgui opencv_photo OPTIONAL opencv_gpu)
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d OPTIONAL opencv_gpu opencv_highgui)

View File

@ -43,6 +43,11 @@
#include "precomp.hpp"
#include "opencv2/videostab/frame_source.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
# include "opencv2/highgui/highgui.hpp"
#endif
using namespace std;
namespace cv
@ -50,25 +55,74 @@ namespace cv
namespace videostab
{
struct VideoFileSource::VideoReader
{
#ifdef HAVE_OPENCV_HIGHGUI
mutable VideoCapture vc;
#endif
};
VideoFileSource::VideoFileSource(const string &path, bool volatileFrame)
: path_(path), volatileFrame_(volatileFrame) { reset(); }
: path_(path), volatileFrame_(volatileFrame), reader_(VideoReader()) { reset(); }
void VideoFileSource::reset()
{
reader_.release();
reader_.open(path_);
if (!reader_.isOpened())
#ifdef HAVE_OPENCV_HIGHGUI
reader_.vc.release();
reader_.vc.open(path_);
if (!reader_.vc.isOpened())
throw runtime_error("can't open file: " + path_);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
#endif
}
Mat VideoFileSource::nextFrame()
{
Mat frame;
reader_ >> frame;
#ifdef HAVE_OPENCV_HIGHGUI
reader_.vc >> frame;
#endif
return volatileFrame_ ? frame : frame.clone();
}
int VideoFileSource::width()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_WIDTH));
#else
return 0;
#endif
}
int VideoFileSource::height()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_HEIGHT));
#else
return 0;
#endif
}
int VideoFileSource::count()
{
#ifdef HAVE_OPENCV_HIGHGUI
return static_cast<int>(reader_.vc.get(CV_CAP_PROP_FRAME_COUNT));
#else
return 0;
#endif
}
double VideoFileSource::fps()
{
#ifdef HAVE_OPENCV_HIGHGUI
return reader_.vc.get(CV_CAP_PROP_FPS);
#else
return 0;
#endif
}
} // namespace videostab
} // namespace cv

View File

@ -50,7 +50,6 @@
#include <stdexcept>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/features2d/features2d.hpp"

View File

@ -0,0 +1,5 @@
#Wed Jun 29 04:36:40 MSD 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,3 +1,12 @@
'''
This program illustrates the use of findContours and drawContours.
The original image is put up along with the image of drawn contours.
Usage:
contours.py
A trackbar is put up which controls the contour level from -3 to 3
'''
import numpy as np
import cv2
@ -30,6 +39,8 @@ def make_image():
return img
if __name__ == '__main__':
print __doc__
img = make_image()
h, w = img.shape[:2]

View File

@ -1,8 +1,21 @@
'''
This sample demonstrates Canny edge detection.
Usage:
edge.py [<video source>]
Trackbars control edge thresholds.
'''
import cv2
import video
import sys
if __name__ == '__main__':
print __doc__
try: fn = sys.argv[1]
except: fn = 0

View File

@ -1,3 +1,28 @@
'''
The sample demonstrates how to train Random Trees classifier
(or Boosting classifier, or MLP, or Knearest, or Support Vector Machines) using the provided dataset.
We use the sample database letter-recognition.data
from UCI Repository, here is the link:
Newman, D.J. & Hettich, S. & Blake, C.L. & Merz, C.J. (1998).
UCI Repository of machine learning databases
[http://www.ics.uci.edu/~mlearn/MLRepository.html].
Irvine, CA: University of California, Department of Information and Computer Science.
The dataset consists of 20000 feature vectors along with the
responses - capital latin letters A..Z.
The first 10000 samples are used for training
and the remaining 10000 - to test the classifier.
======================================================
USAGE:
letter_recog.py [--model <model>]
[--data <data fn>]
[--load <model fn>] [--save <model fn>]
Models: RTrees, KNearest, Boost, SVM, MLP
'''
import numpy as np
import cv2
@ -77,7 +102,6 @@ class Boost(LetterStatModel):
class SVM(LetterStatModel):
train_ratio = 0.1
def __init__(self):
self.model = cv2.SVM()
@ -118,12 +142,11 @@ if __name__ == '__main__':
import getopt
import sys
print __doc__
models = [RTrees, KNearest, Boost, SVM, MLP] # NBayes
models = dict( [(cls.__name__.lower(), cls) for cls in models] )
print 'USAGE: letter_recog.py [--model <model>] [--data <data fn>] [--load <model fn>] [--save <model fn>]'
print 'Models: ', ', '.join(models)
print
args, dummy = getopt.getopt(sys.argv[1:], '', ['model=', 'data=', 'load=', 'save='])
args = dict(args)