Fixed number of warnings. Fixed mingw64 build.

This commit is contained in:
Andrey Kamaev 2012-06-12 14:46:12 +00:00
parent 02e3afae3a
commit c5aba337e9
110 changed files with 2232 additions and 2367 deletions

View File

@ -23,7 +23,8 @@ if(MSVC)
add_definitions(-DJAS_WIN_MSVC_BUILD) add_definitions(-DJAS_WIN_MSVC_BUILD)
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused) ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow
/wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267)
if(UNIX) if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)

View File

@ -90,8 +90,9 @@ if(WIN32)
list(APPEND lib_srcs tif_win32.c) list(APPEND lib_srcs tif_win32.c)
endif(WIN32) endif(WIN32)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wcast-align) ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations) -Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)) if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

View File

@ -419,7 +419,7 @@ typedef uLong FAR uLongf;
#endif #endif
#ifndef _FILE_OFFSET_BITS #ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 0
#endif #endif
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0

View File

@ -2191,15 +2191,15 @@ void cvCreateCascadeClassifier( const char* dirname,
{ {
char xml_path[1024]; char xml_path[1024];
int len = (int)strlen(dirname); int len = (int)strlen(dirname);
CvHaarClassifierCascade* cascade = 0; CvHaarClassifierCascade* cascade1 = 0;
strcpy( xml_path, dirname ); strcpy( xml_path, dirname );
if( xml_path[len-1] == '\\' || xml_path[len-1] == '/' ) if( xml_path[len-1] == '\\' || xml_path[len-1] == '/' )
len--; len--;
strcpy( xml_path + len, ".xml" ); strcpy( xml_path + len, ".xml" );
cascade = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) ); cascade1 = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
if( cascade ) if( cascade1 )
cvSave( xml_path, cascade ); cvSave( xml_path, cascade1 );
cvReleaseHaarClassifierCascade( &cascade ); cvReleaseHaarClassifierCascade( &cascade1 );
} }
} }
else else
@ -2502,7 +2502,6 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
{ {
CvTreeCascadeNode* single_cluster; CvTreeCascadeNode* single_cluster;
CvTreeCascadeNode* multiple_clusters; CvTreeCascadeNode* multiple_clusters;
CvSplit* cur_split;
int single_num; int single_num;
icvSetNumSamples( training_data, poscount + negcount ); icvSetNumSamples( training_data, poscount + negcount );
@ -2675,18 +2674,19 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
} /* try different number of clusters */ } /* try different number of clusters */
cvReleaseMat( &vals ); cvReleaseMat( &vals );
CV_CALL( cur_split = (CvSplit*) cvAlloc( sizeof( *cur_split ) ) ); CvSplit* curSplit;
CV_ZERO_OBJ( cur_split ); CV_CALL( curSplit = (CvSplit*) cvAlloc( sizeof( *curSplit ) ) );
CV_ZERO_OBJ( curSplit );
if( last_split ) last_split->next = cur_split; if( last_split ) last_split->next = curSplit;
else first_split = cur_split; else first_split = curSplit;
last_split = cur_split; last_split = curSplit;
cur_split->single_cluster = single_cluster; curSplit->single_cluster = single_cluster;
cur_split->multiple_clusters = multiple_clusters; curSplit->multiple_clusters = multiple_clusters;
cur_split->num_clusters = best_clusters; curSplit->num_clusters = best_clusters;
cur_split->parent = parent; curSplit->parent = parent;
cur_split->single_multiple_ratio = (float) single_num / best_num; curSplit->single_multiple_ratio = (float) single_num / best_num;
} }
if( parent ) parent = parent->next_same_level; if( parent ) parent = parent->next_same_level;

View File

@ -323,8 +323,6 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
int i00, i10, i01, i11; int i00, i10, i01, i11;
i00 = i10 = i01 = i11 = (int) fill_value; i00 = i10 = i01 = i11 = (int) fill_value;
double i = fill_value;
/* linear interpolation using 2x2 neighborhood */ /* linear interpolation using 2x2 neighborhood */
if( isrc_x >= 0 && isrc_x <= src_size.width && if( isrc_x >= 0 && isrc_x <= src_size.width &&
isrc_y >= 0 && isrc_y <= src_size.height ) isrc_y >= 0 && isrc_y <= src_size.height )
@ -349,9 +347,8 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
double i0 = i00 + (i10 - i00)*delta_x; double i0 = i00 + (i10 - i00)*delta_x;
double i1 = i01 + (i11 - i01)*delta_x; double i1 = i01 + (i11 - i01)*delta_x;
i = i0 + (i1 - i0)*delta_y;
((uchar*)(dst_data + y * dst_step))[x] = (uchar) i; ((uchar*)(dst_data + y * dst_step))[x] = (uchar) (i0 + (i1 - i0)*delta_y);
} }
x_min += k_left; x_min += k_left;
x_max += k_right; x_max += k_right;

View File

@ -214,7 +214,7 @@ int main( int argc, char* argv[] )
totaltime = 0.0; totaltime = 0.0;
if( info != NULL ) if( info != NULL )
{ {
int x, y, width, height; int x, y;
IplImage* img; IplImage* img;
int hits, missed, falseAlarms; int hits, missed, falseAlarms;
int totalHits, totalMissed, totalFalseAlarms; int totalHits, totalMissed, totalFalseAlarms;
@ -249,11 +249,12 @@ int main( int argc, char* argv[] )
ref = (ObjectPos*) cvAlloc( refcount * sizeof( *ref ) ); ref = (ObjectPos*) cvAlloc( refcount * sizeof( *ref ) );
for( i = 0; i < refcount; i++ ) for( i = 0; i < refcount; i++ )
{ {
error = (fscanf( info, "%d %d %d %d", &x, &y, &width, &height ) != 4); int w, h;
error = (fscanf( info, "%d %d %d %d", &x, &y, &w, &h ) != 4);
if( error ) break; if( error ) break;
ref[i].x = 0.5F * width + x; ref[i].x = 0.5F * w + x;
ref[i].y = 0.5F * height + y; ref[i].y = 0.5F * h + y;
ref[i].width = sqrtf( 0.5F * (width * width + height * height) ); ref[i].width = sqrtf( 0.5F * (w * w + h * h) );
ref[i].found = 0; ref[i].found = 0;
ref[i].neghbors = 0; ref[i].neghbors = 0;
} }

View File

@ -14,6 +14,8 @@ if(MINGW)
endif() endif()
if(MSVC) if(MSVC)
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT) if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT)
# override cmake default exception handling option # override cmake default exception handling option
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@ -72,10 +74,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wundef) add_extra_compiler_option(-Wundef)
add_extra_compiler_option(-Winit-self) add_extra_compiler_option(-Winit-self)
add_extra_compiler_option(-Wpointer-arith) add_extra_compiler_option(-Wpointer-arith)
#add_extra_compiler_option(-Wcast-align) add_extra_compiler_option(-Wshadow)
#add_extra_compiler_option(-Wstrict-aliasing=2)
#add_extra_compiler_option(-Wshadow) if(ENABLE_NOISY_WARNINGS)
add_extra_compiler_option(-Wcast-align)
add_extra_compiler_option(-Wstrict-aliasing=2)
else()
add_extra_compiler_option(-Wno-narrowing)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
#add_extra_compiler_option(-Wno-unnamed-type-template-args) #add_extra_compiler_option(-Wno-unnamed-type-template-args)
endif()
# The -Wno-long-long is required in 64bit systems when including sytem headers. # The -Wno-long-long is required in 64bit systems when including sytem headers.
if(X86_64) if(X86_64)
@ -259,6 +267,10 @@ if(MSVC)
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
endif()
# allow extern "C" functions throw exceptions # allow extern "C" functions throw exceptions
foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG) foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}") string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}")

View File

@ -18,7 +18,7 @@ if(WIN32)
# Try to find the XIMEA API path in registry. # Try to find the XIMEA API path in registry.
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE) GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
if(XIMEA_PATH) if(EXISTS XIMEA_PATH)
set(XIMEA_FOUND 1) set(XIMEA_FOUND 1)
# set LIB folders # set LIB folders

View File

@ -42,10 +42,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -335,7 +335,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
{ {
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon; float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values... // TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001); *(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001f);
//std::cout<<"BasicRetinaFilter::inputFrame[IDpixel]=%f, X0=%f, outputFrame[IDpixel]=%f\n", inputFrame[IDpixel], X0, outputFrame[IDpixel]); //std::cout<<"BasicRetinaFilter::inputFrame[IDpixel]=%f, X0=%f, outputFrame[IDpixel]=%f\n", inputFrame[IDpixel], X0, outputFrame[IDpixel]);
} }
} }

View File

@ -18,7 +18,7 @@
#include "precomp.hpp" #include "precomp.hpp"
#include <iostream> #include <iostream>
#if defined _MSC_VER && _MSC_VER >= 1400 #ifdef _MSC_VER
#pragma warning( disable: 4305 ) #pragma warning( disable: 4305 )
#endif #endif

View File

@ -63,7 +63,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
// dimensionality of (reshaped) samples // dimensionality of (reshaped) samples
size_t d = src.getMat(0).total(); size_t d = src.getMat(0).total();
// create data matrix // create data matrix
Mat data(n, d, rtype); Mat data((int)n, (int)d, rtype);
// now copy data // now copy data
for(unsigned int i = 0; i < n; i++) { for(unsigned int i = 0; i < n; i++) {
// make sure data can be reshaped, throw exception if not! // make sure data can be reshaped, throw exception if not!
@ -232,13 +232,13 @@ public:
// //
// radius, neighbors are used in the local binary patterns creation. // radius, neighbors are used in the local binary patterns creation.
// grid_x, grid_y control the grid size of the spatial histograms. // grid_x, grid_y control the grid size of the spatial histograms.
LBPH(int radius=1, int neighbors=8, LBPH(int radius_=1, int neighbors_=8,
int grid_x=8, int grid_y=8, int gridx=8, int gridy=8,
double threshold = DBL_MAX) : double threshold = DBL_MAX) :
_grid_x(grid_x), _grid_x(gridx),
_grid_y(grid_y), _grid_y(gridy),
_radius(radius), _radius(radius_),
_neighbors(neighbors), _neighbors(neighbors_),
_threshold(threshold) {} _threshold(threshold) {}
// Initializes and computes this LBPH Model. The current implementation is // Initializes and computes this LBPH Model. The current implementation is
@ -248,13 +248,13 @@ public:
// (grid_x=8), (grid_y=8) controls the grid size of the spatial histograms. // (grid_x=8), (grid_y=8) controls the grid size of the spatial histograms.
LBPH(InputArray src, LBPH(InputArray src,
InputArray labels, InputArray labels,
int radius=1, int neighbors=8, int radius_=1, int neighbors_=8,
int grid_x=8, int grid_y=8, int gridx=8, int gridy=8,
double threshold = DBL_MAX) : double threshold = DBL_MAX) :
_grid_x(grid_x), _grid_x(gridx),
_grid_y(grid_y), _grid_y(gridy),
_radius(radius), _radius(radius_),
_neighbors(neighbors), _neighbors(neighbors_),
_threshold(threshold) { _threshold(threshold) {
train(src, labels); train(src, labels);
} }
@ -367,7 +367,7 @@ void Eigenfaces::predict(InputArray _src, int &minClass, double &minDist) const
double dist = norm(_projections[sampleIdx], q, NORM_L2); double dist = norm(_projections[sampleIdx], q, NORM_L2);
if((dist < minDist) && (dist < _threshold)) { if((dist < minDist) && (dist < _threshold)) {
minDist = dist; minDist = dist;
minClass = _labels.at<int>(sampleIdx); minClass = _labels.at<int>((int)sampleIdx);
} }
} }
} }
@ -473,7 +473,7 @@ void Fisherfaces::predict(InputArray _src, int &minClass, double &minDist) const
double dist = norm(_projections[sampleIdx], q, NORM_L2); double dist = norm(_projections[sampleIdx], q, NORM_L2);
if((dist < minDist) && (dist < _threshold)) { if((dist < minDist) && (dist < _threshold)) {
minDist = dist; minDist = dist;
minClass = _labels.at<int>(sampleIdx); minClass = _labels.at<int>((int)sampleIdx);
} }
} }
} }
@ -643,7 +643,7 @@ static Mat histc(InputArray _src, int minVal, int maxVal, bool normed)
static Mat spatial_histogram(InputArray _src, int numPatterns, static Mat spatial_histogram(InputArray _src, int numPatterns,
int grid_x, int grid_y, bool normed) int grid_x, int grid_y, bool /*normed*/)
{ {
Mat src = _src.getMat(); Mat src = _src.getMat();
// calculate LBP patch size // calculate LBP patch size
@ -758,7 +758,7 @@ void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
double dist = compareHist(_histograms[sampleIdx], query, CV_COMP_CHISQR); double dist = compareHist(_histograms[sampleIdx], query, CV_COMP_CHISQR);
if((dist < minDist) && (dist < _threshold)) { if((dist < minDist) && (dist < _threshold)) {
minDist = dist; minDist = dist;
minClass = _labels.at<int>(sampleIdx); minClass = _labels.at<int>((int)sampleIdx);
} }
} }
} }

View File

@ -70,12 +70,12 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
// dimensionality of (reshaped) samples // dimensionality of (reshaped) samples
size_t d = src.getMat(0).total(); size_t d = src.getMat(0).total();
// create data matrix // create data matrix
Mat data(n, d, rtype); Mat data((int)n, (int)d, rtype);
// now copy data // now copy data
for(size_t i = 0; i < n; i++) { for(int i = 0; i < (int)n; i++) {
// make sure data can be reshaped, throw exception if not! // make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total() != d) { if(src.getMat(i).total() != d) {
string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total()); string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} }
// get a hold of the current row // get a hold of the current row
@ -987,7 +987,7 @@ void LDA::lda(InputArray _src, InputArray _lbls) {
vector<int> mapped_labels(labels.size()); vector<int> mapped_labels(labels.size());
vector<int> num2label = remove_dups(labels); vector<int> num2label = remove_dups(labels);
map<int, int> label2num; map<int, int> label2num;
for (size_t i = 0; i < num2label.size(); i++) for (int i = 0; i < (int)num2label.size(); i++)
label2num[num2label[i]] = i; label2num[num2label[i]] = i;
for (size_t i = 0; i < labels.size(); i++) for (size_t i = 0; i < labels.size(); i++)
mapped_labels[i] = label2num[labels[i]]; mapped_labels[i] = label2num[labels[i]];
@ -995,7 +995,7 @@ void LDA::lda(InputArray _src, InputArray _lbls) {
int N = data.rows; int N = data.rows;
int D = data.cols; int D = data.cols;
// number of unique labels // number of unique labels
int C = num2label.size(); int C = (int)num2label.size();
// we can't do a LDA on one class, what do you // we can't do a LDA on one class, what do you
// want to separate from each other then? // want to separate from each other then?
if(C == 1) { if(C == 1) {

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -808,7 +808,7 @@ void cv::SpinImageModel::selectRandomSubset(float ratio)
subset.resize(setSize); subset.resize(setSize);
for(size_t i = 0; i < setSize; ++i) for(size_t i = 0; i < setSize; ++i)
{ {
int pos = rnd.next() % left.size(); int pos = rnd.next() % (int)left.size();
subset[i] = (int)left[pos]; subset[i] = (int)left[pos];
left[pos] = left.back(); left[pos] = left.back();

View File

@ -48,6 +48,11 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4714 ) //__forceinline is not inlined
#pragma warning( disable: 4127 ) //conditional expression is constant
#endif
namespace cv namespace cv
{ {

View File

@ -984,13 +984,13 @@ _AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
#if CV_ENABLE_UNROLLED #if CV_ENABLE_UNROLLED
for(; i <= n - 4; i += 4 ) for(; i <= n - 4; i += 4 )
{ {
_AccTp v0 = a[i] - b[i], v1 = a[i+1] - b[i+1], v2 = a[i+2] - b[i+2], v3 = a[i+3] - b[i+3]; _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
s += v0*v0 + v1*v1 + v2*v2 + v3*v3; s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
} }
#endif #endif
for( ; i < n; i++ ) for( ; i < n; i++ )
{ {
_AccTp v = (_AccTp)(a[i] - b[i]); _AccTp v = _AccTp(a[i] - b[i]);
s += v*v; s += v*v;
} }
return s; return s;
@ -1024,13 +1024,13 @@ _AccTp normL1(const _Tp* a, const _Tp* b, int n)
#if CV_ENABLE_UNROLLED #if CV_ENABLE_UNROLLED
for(; i <= n - 4; i += 4 ) for(; i <= n - 4; i += 4 )
{ {
_AccTp v0 = a[i] - b[i], v1 = a[i+1] - b[i+1], v2 = a[i+2] - b[i+2], v3 = a[i+3] - b[i+3]; _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
s += std::abs(v0) + std::abs(v1) + std::abs(v2) + std::abs(v3); s += std::abs(v0) + std::abs(v1) + std::abs(v2) + std::abs(v3);
} }
#endif #endif
for( ; i < n; i++ ) for( ; i < n; i++ )
{ {
_AccTp v = (_AccTp)(a[i] - b[i]); _AccTp v = _AccTp(a[i] - b[i]);
s += std::abs(v); s += std::abs(v);
} }
return s; return s;

View File

@ -79,7 +79,7 @@
# define CV_ENABLE_UNROLLED 1 # define CV_ENABLE_UNROLLED 1
#endif #endif
#if (defined _M_X64 && _MSC_VER >= 1400) || (__GNUC__ >= 4 && defined __x86_64__) #if (defined _M_X64 && defined _MSC_VER && _MSC_VER >= 1400) || (__GNUC__ >= 4 && defined __x86_64__)
# if defined WIN32 # if defined WIN32
# include <intrin.h> # include <intrin.h>
# endif # endif

View File

@ -46,8 +46,8 @@ namespace cv
// On Win64 optimized versions of DFT and DCT fail the tests (fixed in VS2010) // On Win64 optimized versions of DFT and DCT fail the tests (fixed in VS2010)
#if defined _MSC_VER && !defined CV_ICC && defined _M_X64 && _MSC_VER < 1600 #if defined _MSC_VER && !defined CV_ICC && defined _M_X64 && _MSC_VER < 1600
#pragma optimize("", off) # pragma optimize("", off)
#pragma warning( disable : 4748 ) # pragma warning(disable: 4748)
#endif #endif
/****************************************************************************************\ /****************************************************************************************\

View File

@ -43,11 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
// disable warnings related to inline functions
#pragma warning( disable: 4251 4711 4710 4514 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -1264,7 +1264,7 @@ struct NormOp : public BaseElemWiseOp
dst.at<double>(0,0) = cvtest::norm(src[0], normType, mask); dst.at<double>(0,0) = cvtest::norm(src[0], normType, mask);
dst.at<double>(0,1) = cvtest::norm(src[0], src[1], normType, mask); dst.at<double>(0,1) = cvtest::norm(src[0], src[1], normType, mask);
} }
void generateScalars(int, RNG& rng) void generateScalars(int, RNG& /*rng*/)
{ {
} }
double getMaxErr(int) double getMaxErr(int)

View File

@ -2023,14 +2023,7 @@ void Core_GraphScanTest::run( int )
event = "End of procedure"; event = "End of procedure";
break; break;
default: default:
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( push )
#pragma warning( disable : 4127 )
#endif
CV_TS_SEQ_CHECK_CONDITION( 0, "Invalid code appeared during graph scan" ); CV_TS_SEQ_CHECK_CONDITION( 0, "Invalid code appeared during graph scan" );
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( pop )
#endif
} }
ts->printf( cvtest::TS::LOG, "%s", event ); ts->printf( cvtest::TS::LOG, "%s", event );

View File

@ -274,6 +274,7 @@ public:
private: private:
const Mat mask; const Mat mask;
MaskPredicate& operator=(const MaskPredicate&);
}; };
void KeyPointsFilter::runByPixelsMask( vector<KeyPoint>& keypoints, const Mat& mask ) void KeyPointsFilter::runByPixelsMask( vector<KeyPoint>& keypoints, const Mat& mask )

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4512 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -27,10 +27,6 @@
*************************************************************************/ *************************************************************************/
#include "precomp.hpp" #include "precomp.hpp"
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#include "opencv2/flann/flann.hpp" #include "opencv2/flann/flann.hpp"
namespace cvflann namespace cvflann

View File

@ -5,10 +5,6 @@
#include <cstdarg> #include <cstdarg>
#include <sstream> #include <sstream>
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
# include "cvconfig.h" # include "cvconfig.h"
#endif #endif

View File

@ -1702,15 +1702,7 @@ class CV_EXPORTS GoodFeaturesToTrackDetector_GPU
{ {
public: public:
explicit GoodFeaturesToTrackDetector_GPU(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 0.0, explicit GoodFeaturesToTrackDetector_GPU(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 0.0,
int blockSize = 3, bool useHarrisDetector = false, double harrisK = 0.04) int blockSize = 3, bool useHarrisDetector = false, double harrisK = 0.04);
{
this->maxCorners = maxCorners;
this->qualityLevel = qualityLevel;
this->minDistance = minDistance;
this->blockSize = blockSize;
this->useHarrisDetector = useHarrisDetector;
this->harrisK = harrisK;
}
//! return 1 rows matrix with CV_32FC2 type //! return 1 rows matrix with CV_32FC2 type
void operator ()(const GpuMat& image, GpuMat& corners, const GpuMat& mask = GpuMat()); void operator ()(const GpuMat& image, GpuMat& corners, const GpuMat& mask = GpuMat());
@ -1742,6 +1734,18 @@ private:
GpuMat tmpCorners_; GpuMat tmpCorners_;
}; };
inline GoodFeaturesToTrackDetector_GPU::GoodFeaturesToTrackDetector_GPU(int maxCorners_, double qualityLevel_, double minDistance_,
int blockSize_, bool useHarrisDetector_, double harrisK_)
{
maxCorners = maxCorners_;
qualityLevel = qualityLevel_;
minDistance = minDistance_;
blockSize = blockSize_;
useHarrisDetector = useHarrisDetector_;
harrisK = harrisK_;
}
class CV_EXPORTS PyrLKOpticalFlow class CV_EXPORTS PyrLKOpticalFlow
{ {
public: public:

View File

@ -57,7 +57,7 @@ void cv::gpu::VideoReader_GPU::open(const cv::Ptr<VideoSource>&) { throw_nogpu()
bool cv::gpu::VideoReader_GPU::isOpened() const { return false; } bool cv::gpu::VideoReader_GPU::isOpened() const { return false; }
void cv::gpu::VideoReader_GPU::close() { } void cv::gpu::VideoReader_GPU::close() { }
bool cv::gpu::VideoReader_GPU::read(GpuMat&) { throw_nogpu(); return false; } bool cv::gpu::VideoReader_GPU::read(GpuMat&) { throw_nogpu(); return false; }
cv::gpu::VideoReader_GPU::FormatInfo cv::gpu::VideoReader_GPU::format() const { throw_nogpu(); FormatInfo format = {MPEG1,Monochrome,0,0}; return format; } cv::gpu::VideoReader_GPU::FormatInfo cv::gpu::VideoReader_GPU::format() const { throw_nogpu(); FormatInfo format_ = {MPEG1,Monochrome,0,0}; return format_; }
bool cv::gpu::VideoReader_GPU::VideoSource::parseVideoData(const unsigned char*, size_t, bool) { throw_nogpu(); return false; } bool cv::gpu::VideoReader_GPU::VideoSource::parseVideoData(const unsigned char*, size_t, bool) { throw_nogpu(); return false; }
void cv::gpu::VideoReader_GPU::dumpFormat(std::ostream&) { throw_nogpu(); } void cv::gpu::VideoReader_GPU::dumpFormat(std::ostream&) { throw_nogpu(); }

View File

@ -513,7 +513,6 @@ PARAM_TEST_CASE(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor,
bool useRoi; bool useRoi;
cv::Mat img; cv::Mat img;
cv::Mat kernel;
virtual void SetUp() virtual void SetUp()
{ {

View File

@ -150,8 +150,6 @@ PARAM_TEST_CASE(CalcHist, cv::gpu::DeviceInfo, cv::Size)
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
cv::Size size; cv::Size size;
cv::Mat src;
cv::Mat hist_gold;
virtual void SetUp() virtual void SetUp()
{ {
@ -221,8 +219,6 @@ PARAM_TEST_CASE(ColumnSum, cv::gpu::DeviceInfo, cv::Size)
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
cv::Size size; cv::Size size;
cv::Mat src;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
@ -276,8 +272,6 @@ PARAM_TEST_CASE(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient, UseRoi)
bool useL2gradient; bool useL2gradient;
bool useRoi; bool useRoi;
cv::Mat edges_gold;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
@ -573,11 +567,6 @@ PARAM_TEST_CASE(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)
int ksize; int ksize;
bool ccorr; bool ccorr;
cv::Mat src;
cv::Mat kernel;
cv::Mat dst_gold;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
@ -670,9 +659,6 @@ PARAM_TEST_CASE(MatchTemplate32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, C
int method; int method;
int n, m, h, w; int n, m, h, w;
cv::Mat image, templ;
cv::Mat dst_gold;
virtual void SetUp() virtual void SetUp()
{ {

View File

@ -69,16 +69,16 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
} }
#ifdef DUMP #ifdef DUMP
void dump(const cv::Mat& block_hists, const std::vector<cv::Point>& locations) void dump(const cv::Mat& blockHists, const std::vector<cv::Point>& locations)
{ {
f.write((char*)&block_hists.rows, sizeof(block_hists.rows)); f.write((char*)&blockHists.rows, sizeof(blockHists.rows));
f.write((char*)&block_hists.cols, sizeof(block_hists.cols)); f.write((char*)&blockHists.cols, sizeof(blockHists.cols));
for (int i = 0; i < block_hists.rows; ++i) for (int i = 0; i < blockHists.rows; ++i)
{ {
for (int j = 0; j < block_hists.cols; ++j) for (int j = 0; j < blockHists.cols; ++j)
{ {
float val = block_hists.at<float>(i, j); float val = blockHists.at<float>(i, j);
f.write((char*)&val, sizeof(val)); f.write((char*)&val, sizeof(val));
} }
} }
@ -90,21 +90,21 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
f.write((char*)&locations[i], sizeof(locations[i])); f.write((char*)&locations[i], sizeof(locations[i]));
} }
#else #else
void compare(const cv::Mat& block_hists, const std::vector<cv::Point>& locations) void compare(const cv::Mat& blockHists, const std::vector<cv::Point>& locations)
{ {
int rows, cols; int rows, cols;
f.read((char*)&rows, sizeof(rows)); f.read((char*)&rows, sizeof(rows));
f.read((char*)&cols, sizeof(cols)); f.read((char*)&cols, sizeof(cols));
ASSERT_EQ(rows, block_hists.rows); ASSERT_EQ(rows, blockHists.rows);
ASSERT_EQ(cols, block_hists.cols); ASSERT_EQ(cols, blockHists.cols);
for (int i = 0; i < block_hists.rows; ++i) for (int i = 0; i < blockHists.rows; ++i)
{ {
for (int j = 0; j < block_hists.cols; ++j) for (int j = 0; j < blockHists.cols; ++j)
{ {
float val; float val;
f.read((char*)&val, sizeof(val)); f.read((char*)&val, sizeof(val));
ASSERT_NEAR(val, block_hists.at<float>(i, j), 1e-3); ASSERT_NEAR(val, blockHists.at<float>(i, j), 1e-3);
} }
} }

View File

@ -76,6 +76,10 @@ if(HAVE_QT)
endif() endif()
include(${QT_USE_FILE}) include(${QT_USE_FILE})
if(QT_INCLUDE_DIR)
ocv_include_directories(${QT_INCLUDE_DIR})
endif()
QT4_ADD_RESOURCES(_RCC_OUTFILES src/window_QT.qrc) QT4_ADD_RESOURCES(_RCC_OUTFILES src/window_QT.qrc)
QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h) QT4_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)

View File

@ -41,13 +41,9 @@
#include "precomp.hpp" #include "precomp.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4711 )
#endif
#if defined _M_X64 && defined _MSC_VER && !defined CV_ICC #if defined _M_X64 && defined _MSC_VER && !defined CV_ICC
#pragma optimize("",off) #pragma optimize("",off)
#pragma warning( disable: 4748 ) #pragma warning(disable: 4748)
#endif #endif
namespace cv namespace cv

View File

@ -90,6 +90,7 @@ Thanks to:
#include "precomp.hpp" #include "precomp.hpp"
#if defined _MSC_VER && _MSC_VER >= 100 #if defined _MSC_VER && _MSC_VER >= 100
//'sprintf': name was marked as #pragma deprecated
#pragma warning(disable: 4995) #pragma warning(disable: 4995)
#endif #endif
@ -1170,10 +1171,10 @@ bool videoInput::setupDevice(int deviceNumber){
// //
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
bool videoInput::setupDevice(int deviceNumber, int connection){ bool videoInput::setupDevice(int deviceNumber, int _connection){
if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false; if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false;
setPhyCon(deviceNumber, connection); setPhyCon(deviceNumber, _connection);
if(setup(deviceNumber))return true; if(setup(deviceNumber))return true;
return false; return false;
} }
@ -1220,11 +1221,11 @@ bool videoInput::setupDeviceFourcc(int deviceNumber, int w, int h,int fourcc){
// //
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
bool videoInput::setupDevice(int deviceNumber, int w, int h, int connection){ bool videoInput::setupDevice(int deviceNumber, int w, int h, int _connection){
if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false; if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false;
setAttemptCaptureSize(deviceNumber,w,h); setAttemptCaptureSize(deviceNumber,w,h);
setPhyCon(deviceNumber, connection); setPhyCon(deviceNumber, _connection);
if(setup(deviceNumber))return true; if(setup(deviceNumber))return true;
return false; return false;
} }
@ -2945,7 +2946,7 @@ HRESULT videoInput::ShowFilterPropertyPages(IBaseFilter *pFilter){
return hr; return hr;
} }
HRESULT videoInput::ShowStreamPropertyPages(IAMStreamConfig *pStream){ HRESULT videoInput::ShowStreamPropertyPages(IAMStreamConfig * /*pStream*/){
HRESULT hr = NOERROR; HRESULT hr = NOERROR;
return hr; return hr;
@ -3035,11 +3036,11 @@ HRESULT videoInput::routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter *
LONG lInpin, lOutpin; LONG lInpin, lOutpin;
hr = Crossbar->get_PinCounts(&lOutpin , &lInpin); hr = Crossbar->get_PinCounts(&lOutpin , &lInpin);
BOOL IPin=TRUE; LONG pIndex=0 , pRIndex=0 , pType=0; BOOL iPin=TRUE; LONG pIndex=0 , pRIndex=0 , pType=0;
while( pIndex < lInpin) while( pIndex < lInpin)
{ {
hr = Crossbar->get_CrossbarPinInfo( IPin , pIndex , &pRIndex , &pType); hr = Crossbar->get_CrossbarPinInfo( iPin , pIndex , &pRIndex , &pType);
if( pType == conType){ if( pType == conType){
if(verbose)printf("SETUP: Found Physical Interface"); if(verbose)printf("SETUP: Found Physical Interface");

View File

@ -43,16 +43,12 @@
#include <vfw.h> #include <vfw.h>
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4711 )
#endif
#ifdef __GNUC__ #ifdef __GNUC__
#define WM_CAP_FIRSTA (WM_USER) #define WM_CAP_FIRSTA (WM_USER)
#define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0) #define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0)
#endif #endif
#if defined _M_X64 #if defined _M_X64 && defined _MSC_VER
#pragma optimize("",off) #pragma optimize("",off)
#pragma warning(disable: 4748) #pragma warning(disable: 4748)
#endif #endif
@ -177,13 +173,13 @@ bool CvCaptureAVI_VFW::open( const char* filename )
{ {
size.width = aviinfo.rcFrame.right - aviinfo.rcFrame.left; size.width = aviinfo.rcFrame.right - aviinfo.rcFrame.left;
size.height = aviinfo.rcFrame.bottom - aviinfo.rcFrame.top; size.height = aviinfo.rcFrame.bottom - aviinfo.rcFrame.top;
BITMAPINFOHEADER bmih = icvBitmapHeader( size.width, size.height, 24 ); BITMAPINFOHEADER bmihdr = icvBitmapHeader( size.width, size.height, 24 );
film_range.start_index = (int)aviinfo.dwStart; film_range.start_index = (int)aviinfo.dwStart;
film_range.end_index = film_range.start_index + (int)aviinfo.dwLength; film_range.end_index = film_range.start_index + (int)aviinfo.dwLength;
fps = (double)aviinfo.dwRate/aviinfo.dwScale; fps = (double)aviinfo.dwRate/aviinfo.dwScale;
pos = film_range.start_index; pos = film_range.start_index;
getframe = AVIStreamGetFrameOpen( avistream, &bmih ); getframe = AVIStreamGetFrameOpen( avistream, &bmihdr );
if( getframe != 0 ) if( getframe != 0 )
return true; return true;
} }

View File

@ -45,7 +45,8 @@
#ifdef HAVE_JPEG #ifdef HAVE_JPEG
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4324 4611) //interaction between '_setjmp' and C++ object destruction is non-portable
#pragma warning(disable: 4611)
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -69,11 +70,18 @@ extern "C" {
namespace cv namespace cv
{ {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4324) //structure was padded due to __declspec(align())
#endif
struct JpegErrorMgr struct JpegErrorMgr
{ {
struct jpeg_error_mgr pub; struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer; jmp_buf setjmp_buffer;
}; };
#ifdef _MSC_VER
# pragma warning(pop)
#endif
struct JpegSource struct JpegSource
{ {

View File

@ -60,7 +60,7 @@
#include "grfmt_png.hpp" #include "grfmt_png.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200 #if defined _MSC_VER && _MSC_VER >= 1200
// disable warnings related to _setjmp // interaction between '_setjmp' and C++ object destruction is non-portable
#pragma warning( disable: 4611 ) #pragma warning( disable: 4611 )
#endif #endif

View File

@ -42,10 +42,6 @@
#ifndef __HIGHGUI_H_ #ifndef __HIGHGUI_H_
#define __HIGHGUI_H_ #define __HIGHGUI_H_
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 )
#endif
#include "cvconfig.h" #include "cvconfig.h"
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"

View File

@ -1216,27 +1216,27 @@ double GuiReceiver::isOpenGl(QString name)
// CvTrackbar // CvTrackbar
CvTrackbar::CvTrackbar(CvWindow* arg, QString name, int* value, int count, CvTrackbarCallback2 on_change, void* data) CvTrackbar::CvTrackbar(CvWindow* arg, QString name, int* value, int _count, CvTrackbarCallback2 on_change, void* data)
{ {
callback = NULL; callback = NULL;
callback2 = on_change; callback2 = on_change;
userdata = data; userdata = data;
create(arg, name, value, count); create(arg, name, value, _count);
} }
CvTrackbar::CvTrackbar(CvWindow* arg, QString name, int* value, int count, CvTrackbarCallback on_change) CvTrackbar::CvTrackbar(CvWindow* arg, QString name, int* value, int _count, CvTrackbarCallback on_change)
{ {
callback = on_change; callback = on_change;
callback2 = NULL; callback2 = NULL;
userdata = NULL; userdata = NULL;
create(arg, name, value, count); create(arg, name, value, _count);
} }
void CvTrackbar::create(CvWindow* arg, QString name, int* value, int count) void CvTrackbar::create(CvWindow* arg, QString name, int* value, int _count)
{ {
type = type_CvTrackbar; type = type_CvTrackbar;
myparent = arg; myparent = arg;
@ -1247,7 +1247,7 @@ void CvTrackbar::create(CvWindow* arg, QString name, int* value, int count)
slider = new QSlider(Qt::Horizontal); slider = new QSlider(Qt::Horizontal);
slider->setFocusPolicy(Qt::StrongFocus); slider->setFocusPolicy(Qt::StrongFocus);
slider->setMinimum(0); slider->setMinimum(0);
slider->setMaximum(count); slider->setMaximum(_count);
slider->setPageStep(5); slider->setPageStep(5);
slider->setValue(*value); slider->setValue(*value);
slider->setTickPosition(QSlider::TicksBelow); slider->setTickPosition(QSlider::TicksBelow);
@ -1473,7 +1473,7 @@ void CvRadioButton::callCallBack(bool checked)
//here CvWinProperties class //here CvWinProperties class
CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* parent) CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* /*parent*/)
{ {
//setParent(parent); //setParent(parent);
type = type_CvWinProperties; type = type_CvWinProperties;
@ -1502,7 +1502,7 @@ void CvWinProperties::closeEvent(QCloseEvent* e)
} }
void CvWinProperties::showEvent(QShowEvent* event) void CvWinProperties::showEvent(QShowEvent* evnt)
{ {
//why -1,-1 ?: do this trick because the first time the code is run, //why -1,-1 ?: do this trick because the first time the code is run,
//no value pos was saved so we let Qt move the window in the middle of its parent (event ignored). //no value pos was saved so we let Qt move the window in the middle of its parent (event ignored).
@ -1514,20 +1514,20 @@ void CvWinProperties::showEvent(QShowEvent* event)
if (mypos.x() >= 0) if (mypos.x() >= 0)
{ {
move(mypos); move(mypos);
event->accept(); evnt->accept();
} }
else else
{ {
event->ignore(); evnt->ignore();
} }
} }
void CvWinProperties::hideEvent(QHideEvent* event) void CvWinProperties::hideEvent(QHideEvent* evnt)
{ {
QSettings settings("OpenCV2", windowTitle()); QSettings settings("OpenCV2", windowTitle());
settings.setValue("pos", pos()); //there is an offset of 6 pixels (so the window's position is wrong -- why ?) settings.setValue("pos", pos()); //there is an offset of 6 pixels (so the window's position is wrong -- why ?)
event->accept(); evnt->accept();
} }
@ -1651,8 +1651,8 @@ void CvWindow::readSettings()
//organisation and application's name //organisation and application's name
QSettings settings("OpenCV2", QFileInfo(QApplication::applicationFilePath()).fileName()); QSettings settings("OpenCV2", QFileInfo(QApplication::applicationFilePath()).fileName());
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); QPoint _pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(400, 400)).toSize(); QSize _size = settings.value("size", QSize(400, 400)).toSize();
param_flags = settings.value("mode_resize", param_flags).toInt(); param_flags = settings.value("mode_resize", param_flags).toInt();
param_gui_mode = settings.value("mode_gui", param_gui_mode).toInt(); param_gui_mode = settings.value("mode_gui", param_gui_mode).toInt();
@ -1664,8 +1664,8 @@ void CvWindow::readSettings()
//trackbar here //trackbar here
icvLoadTrackbars(&settings); icvLoadTrackbars(&settings);
resize(size); resize(_size);
move(pos); move(_pos);
if (global_control_panel) if (global_control_panel)
{ {
@ -1852,10 +1852,10 @@ bool CvWindow::isOpenGl()
} }
void CvWindow::setViewportSize(QSize size) void CvWindow::setViewportSize(QSize _size)
{ {
myView->getWidget()->resize(size); myView->getWidget()->resize(_size);
myView->setSize(size); myView->setSize(_size);
} }
@ -2059,29 +2059,29 @@ void CvWindow::displayPropertiesWin()
//Need more test here ! //Need more test here !
void CvWindow::keyPressEvent(QKeyEvent *event) void CvWindow::keyPressEvent(QKeyEvent *evnt)
{ {
//see http://doc.trolltech.com/4.6/qt.html#Key-enum //see http://doc.trolltech.com/4.6/qt.html#Key-enum
int key = event->key(); int key = evnt->key();
Qt::Key qtkey = static_cast<Qt::Key>(key); Qt::Key qtkey = static_cast<Qt::Key>(key);
char asciiCode = QTest::keyToAscii(qtkey); char asciiCode = QTest::keyToAscii(qtkey);
if (asciiCode != 0) if (asciiCode != 0)
key = static_cast<int>(asciiCode); key = static_cast<int>(asciiCode);
else else
key = event->nativeVirtualKey(); //same codes as returned by GTK-based backend key = evnt->nativeVirtualKey(); //same codes as returned by GTK-based backend
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions //control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
if (event->modifiers() != Qt::ControlModifier) if (evnt->modifiers() != Qt::ControlModifier)
{ {
mutexKey.lock(); mutexKey.lock();
last_key = key; last_key = key;
mutexKey.unlock(); mutexKey.unlock();
key_pressed.wakeAll(); key_pressed.wakeAll();
//event->accept(); //evnt->accept();
} }
QWidget::keyPressEvent(event); QWidget::keyPressEvent(evnt);
} }
@ -2089,11 +2089,11 @@ void CvWindow::icvLoadControlPanel()
{ {
QSettings settings("OpenCV2", QFileInfo(QApplication::applicationFilePath()).fileName() + " control panel"); QSettings settings("OpenCV2", QFileInfo(QApplication::applicationFilePath()).fileName() + " control panel");
int size = settings.beginReadArray("bars"); int bsize = settings.beginReadArray("bars");
if (size == global_control_panel->myLayout->layout()->count()) if (bsize == global_control_panel->myLayout->layout()->count())
{ {
for (int i = 0; i < size; ++i) for (int i = 0; i < bsize; ++i)
{ {
CvBar* t = (CvBar*) global_control_panel->myLayout->layout()->itemAt(i); CvBar* t = (CvBar*) global_control_panel->myLayout->layout()->itemAt(i);
settings.setArrayIndex(i); settings.setArrayIndex(i);
@ -2215,13 +2215,13 @@ void CvWindow::icvLoadButtonbar(CvButtonbar* b, QSettings* settings)
void CvWindow::icvLoadTrackbars(QSettings* settings) void CvWindow::icvLoadTrackbars(QSettings* settings)
{ {
int size = settings->beginReadArray("trackbars"); int bsize = settings->beginReadArray("trackbars");
//trackbar are saved in the same order, so no need to use icvFindTrackbarByName //trackbar are saved in the same order, so no need to use icvFindTrackbarByName
if (myBarLayout->layout()->count() == size) //if not the same number, the window saved and loaded is not the same (nb trackbar not equal) if (myBarLayout->layout()->count() == bsize) //if not the same number, the window saved and loaded is not the same (nb trackbar not equal)
{ {
for (int i = 0; i < size; ++i) for (int i = 0; i < bsize; ++i)
{ {
settings->setArrayIndex(i); settings->setArrayIndex(i);
@ -2544,7 +2544,7 @@ void DefaultViewPort::saveView()
} }
void DefaultViewPort::contextMenuEvent(QContextMenuEvent* event) void DefaultViewPort::contextMenuEvent(QContextMenuEvent* evnt)
{ {
if (centralWidget->vect_QActions.size() > 0) if (centralWidget->vect_QActions.size() > 0)
{ {
@ -2553,12 +2553,12 @@ void DefaultViewPort::contextMenuEvent(QContextMenuEvent* event)
foreach (QAction *a, centralWidget->vect_QActions) foreach (QAction *a, centralWidget->vect_QActions)
menu.addAction(a); menu.addAction(a);
menu.exec(event->globalPos()); menu.exec(evnt->globalPos());
} }
} }
void DefaultViewPort::resizeEvent(QResizeEvent* event) void DefaultViewPort::resizeEvent(QResizeEvent* evnt)
{ {
controlImagePosition(); controlImagePosition();
@ -2569,7 +2569,7 @@ void DefaultViewPort::resizeEvent(QResizeEvent* event)
if (param_keepRatio == CV_WINDOW_KEEPRATIO)//to keep the same aspect ratio if (param_keepRatio == CV_WINDOW_KEEPRATIO)//to keep the same aspect ratio
{ {
QSize newSize = QSize(image2Draw_mat->cols, image2Draw_mat->rows); QSize newSize = QSize(image2Draw_mat->cols, image2Draw_mat->rows);
newSize.scale(event->size(), Qt::KeepAspectRatio); newSize.scale(evnt->size(), Qt::KeepAspectRatio);
//imageWidth/imageHeight = newWidth/newHeight +/- epsilon //imageWidth/imageHeight = newWidth/newHeight +/- epsilon
//ratioX = ratioY +/- epsilon //ratioX = ratioY +/- epsilon
@ -2580,7 +2580,7 @@ void DefaultViewPort::resizeEvent(QResizeEvent* event)
//move to the middle //move to the middle
//newSize get the delta offset to place the picture in the middle of its parent //newSize get the delta offset to place the picture in the middle of its parent
newSize = (event->size() - newSize) / 2; newSize = (evnt->size() - newSize) / 2;
//if the toolbar is displayed, avoid drawing myview on top of it //if the toolbar is displayed, avoid drawing myview on top of it
if (centralWidget->myToolBar) if (centralWidget->myToolBar)
@ -2591,78 +2591,78 @@ void DefaultViewPort::resizeEvent(QResizeEvent* event)
} }
} }
return QGraphicsView::resizeEvent(event); return QGraphicsView::resizeEvent(evnt);
} }
void DefaultViewPort::wheelEvent(QWheelEvent* event) void DefaultViewPort::wheelEvent(QWheelEvent* evnt)
{ {
scaleView(event->delta() / 240.0, event->pos()); scaleView(evnt->delta() / 240.0, evnt->pos());
viewport()->update(); viewport()->update();
} }
void DefaultViewPort::mousePressEvent(QMouseEvent* event) void DefaultViewPort::mousePressEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
//icvmouseHandler: pass parameters for cv_event, flags //icvmouseHandler: pass parameters for cv_event, flags
icvmouseHandler(event, mouse_down, cv_event, flags); icvmouseHandler(evnt, mouse_down, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
if (param_matrixWorld.m11()>1) if (param_matrixWorld.m11()>1)
{ {
setCursor(Qt::ClosedHandCursor); setCursor(Qt::ClosedHandCursor);
positionGrabbing = event->pos(); positionGrabbing = evnt->pos();
} }
QWidget::mousePressEvent(event); QWidget::mousePressEvent(evnt);
} }
void DefaultViewPort::mouseReleaseEvent(QMouseEvent* event) void DefaultViewPort::mouseReleaseEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
//icvmouseHandler: pass parameters for cv_event, flags //icvmouseHandler: pass parameters for cv_event, flags
icvmouseHandler(event, mouse_up, cv_event, flags); icvmouseHandler(evnt, mouse_up, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
if (param_matrixWorld.m11()>1) if (param_matrixWorld.m11()>1)
setCursor(Qt::OpenHandCursor); setCursor(Qt::OpenHandCursor);
QWidget::mouseReleaseEvent(event); QWidget::mouseReleaseEvent(evnt);
} }
void DefaultViewPort::mouseDoubleClickEvent(QMouseEvent* event) void DefaultViewPort::mouseDoubleClickEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
//icvmouseHandler: pass parameters for cv_event, flags //icvmouseHandler: pass parameters for cv_event, flags
icvmouseHandler(event, mouse_dbclick, cv_event, flags); icvmouseHandler(evnt, mouse_dbclick, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
QWidget::mouseDoubleClickEvent(event); QWidget::mouseDoubleClickEvent(evnt);
} }
void DefaultViewPort::mouseMoveEvent(QMouseEvent* event) void DefaultViewPort::mouseMoveEvent(QMouseEvent* evnt)
{ {
int cv_event = CV_EVENT_MOUSEMOVE, flags = 0; int cv_event = CV_EVENT_MOUSEMOVE, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
//icvmouseHandler: pass parameters for cv_event, flags //icvmouseHandler: pass parameters for cv_event, flags
icvmouseHandler(event, mouse_move, cv_event, flags); icvmouseHandler(evnt, mouse_move, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
if (param_matrixWorld.m11() > 1 && event->buttons() == Qt::LeftButton) if (param_matrixWorld.m11() > 1 && evnt->buttons() == Qt::LeftButton)
{ {
QPointF dxy = (pt - positionGrabbing)/param_matrixWorld.m11(); QPointF dxy = (pt - positionGrabbing)/param_matrixWorld.m11();
positionGrabbing = event->pos(); positionGrabbing = evnt->pos();
moveView(dxy); moveView(dxy);
} }
@ -2671,11 +2671,11 @@ void DefaultViewPort::mouseMoveEvent(QMouseEvent* event)
if (centralWidget->myStatusBar) if (centralWidget->myStatusBar)
viewport()->update(); viewport()->update();
QWidget::mouseMoveEvent(event); QWidget::mouseMoveEvent(evnt);
} }
void DefaultViewPort::paintEvent(QPaintEvent* event) void DefaultViewPort::paintEvent(QPaintEvent* evnt)
{ {
QPainter myPainter(viewport()); QPainter myPainter(viewport());
myPainter.setWorldTransform(param_matrixWorld); myPainter.setWorldTransform(param_matrixWorld);
@ -2707,7 +2707,7 @@ void DefaultViewPort::paintEvent(QPaintEvent* event)
if (centralWidget->myStatusBar) if (centralWidget->myStatusBar)
drawStatusBar(); drawStatusBar();
QGraphicsView::paintEvent(event); QGraphicsView::paintEvent(evnt);
} }
@ -2811,10 +2811,10 @@ void DefaultViewPort::scaleView(qreal factor,QPointF center)
//up, down, dclick, move //up, down, dclick, move
void DefaultViewPort::icvmouseHandler(QMouseEvent *event, type_mouse_event category, int &cv_event, int &flags) void DefaultViewPort::icvmouseHandler(QMouseEvent *evnt, type_mouse_event category, int &cv_event, int &flags)
{ {
Qt::KeyboardModifiers modifiers = event->modifiers(); Qt::KeyboardModifiers modifiers = evnt->modifiers();
Qt::MouseButtons buttons = event->buttons(); Qt::MouseButtons buttons = evnt->buttons();
flags = 0; flags = 0;
if(modifiers & Qt::ShiftModifier) if(modifiers & Qt::ShiftModifier)
@ -2832,7 +2832,7 @@ void DefaultViewPort::icvmouseHandler(QMouseEvent *event, type_mouse_event categ
flags |= CV_EVENT_FLAG_MBUTTON; flags |= CV_EVENT_FLAG_MBUTTON;
cv_event = CV_EVENT_MOUSEMOVE; cv_event = CV_EVENT_MOUSEMOVE;
switch(event->button()) switch(evnt->button())
{ {
case Qt::LeftButton: case Qt::LeftButton:
cv_event = tableMouseButtons[category][0]; cv_event = tableMouseButtons[category][0];
@ -2933,12 +2933,12 @@ void DefaultViewPort::drawImgRegion(QPainter *painter)
QSize view = size(); QSize view = size();
QVarLengthArray<QLineF, 30> linesX; QVarLengthArray<QLineF, 30> linesX;
for (qreal x = offsetX*param_matrixWorld.m11(); x < view.width(); x += param_matrixWorld.m11() ) for (qreal _x = offsetX*param_matrixWorld.m11(); _x < view.width(); _x += param_matrixWorld.m11() )
linesX.append(QLineF(x, 0, x, view.height())); linesX.append(QLineF(_x, 0, _x, view.height()));
QVarLengthArray<QLineF, 30> linesY; QVarLengthArray<QLineF, 30> linesY;
for (qreal y = offsetY*param_matrixWorld.m11(); y < view.height(); y += param_matrixWorld.m11() ) for (qreal _y = offsetY*param_matrixWorld.m11(); _y < view.height(); _y += param_matrixWorld.m11() )
linesY.append(QLineF(0, y, view.width(), y)); linesY.append(QLineF(0, _y, view.width(), _y));
QFont f = painter->font(); QFont f = painter->font();
@ -3043,17 +3043,17 @@ void DefaultViewPort::drawInstructions(QPainter *painter)
QFontMetrics metrics = QFontMetrics(font()); QFontMetrics metrics = QFontMetrics(font());
int border = qMax(4, metrics.leading()); int border = qMax(4, metrics.leading());
QRect rect = metrics.boundingRect(0, 0, width() - 2*border, int(height()*0.125), QRect qrect = metrics.boundingRect(0, 0, width() - 2*border, int(height()*0.125),
Qt::AlignCenter | Qt::TextWordWrap, infoText); Qt::AlignCenter | Qt::TextWordWrap, infoText);
painter->setRenderHint(QPainter::TextAntialiasing); painter->setRenderHint(QPainter::TextAntialiasing);
painter->fillRect(QRect(0, 0, width(), rect.height() + 2*border), painter->fillRect(QRect(0, 0, width(), qrect.height() + 2*border),
QColor(0, 0, 0, 127)); QColor(0, 0, 0, 127));
painter->setPen(Qt::white); painter->setPen(Qt::white);
painter->fillRect(QRect(0, 0, width(), rect.height() + 2*border), painter->fillRect(QRect(0, 0, width(), qrect.height() + 2*border),
QColor(0, 0, 0, 127)); QColor(0, 0, 0, 127));
painter->drawText((width() - rect.width())/2, border, painter->drawText((width() - qrect.width())/2, border,
rect.width(), rect.height(), qrect.width(), qrect.height(),
Qt::AlignCenter | Qt::TextWordWrap, infoText); Qt::AlignCenter | Qt::TextWordWrap, infoText);
} }
@ -3068,7 +3068,7 @@ void DefaultViewPort::setSize(QSize size_)
#ifdef HAVE_QT_OPENGL #ifdef HAVE_QT_OPENGL
OpenGlViewPort::OpenGlViewPort(QWidget* parent) : QGLWidget(parent), size(-1, -1) OpenGlViewPort::OpenGlViewPort(QWidget* _parent) : QGLWidget(_parent), size(-1, -1)
{ {
mouseCallback = 0; mouseCallback = 0;
mouseData = 0; mouseData = 0;
@ -3381,26 +3381,26 @@ void OpenGlViewPort::initializeGL()
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
std::auto_ptr<GlFuncTab_QT> glFuncTab(new GlFuncTab_QT(getDC())); std::auto_ptr<GlFuncTab_QT> qglFuncTab(new GlFuncTab_QT(getDC()));
#else #else
std::auto_ptr<GlFuncTab_QT> glFuncTab(new GlFuncTab_QT); std::auto_ptr<GlFuncTab_QT> qglFuncTab(new GlFuncTab_QT);
#endif #endif
// Load extensions // Load extensions
glFuncTab->glGenBuffersExt = (PFNGLGENBUFFERSPROC)context()->getProcAddress("glGenBuffers"); qglFuncTab->glGenBuffersExt = (PFNGLGENBUFFERSPROC)context()->getProcAddress("glGenBuffers");
glFuncTab->glDeleteBuffersExt = (PFNGLDELETEBUFFERSPROC)context()->getProcAddress("glDeleteBuffers"); qglFuncTab->glDeleteBuffersExt = (PFNGLDELETEBUFFERSPROC)context()->getProcAddress("glDeleteBuffers");
glFuncTab->glBufferDataExt = (PFNGLBUFFERDATAPROC)context()->getProcAddress("glBufferData"); qglFuncTab->glBufferDataExt = (PFNGLBUFFERDATAPROC)context()->getProcAddress("glBufferData");
glFuncTab->glBufferSubDataExt = (PFNGLBUFFERSUBDATAPROC)context()->getProcAddress("glBufferSubData"); qglFuncTab->glBufferSubDataExt = (PFNGLBUFFERSUBDATAPROC)context()->getProcAddress("glBufferSubData");
glFuncTab->glBindBufferExt = (PFNGLBINDBUFFERPROC)context()->getProcAddress("glBindBuffer"); qglFuncTab->glBindBufferExt = (PFNGLBINDBUFFERPROC)context()->getProcAddress("glBindBuffer");
glFuncTab->glMapBufferExt = (PFNGLMAPBUFFERPROC)context()->getProcAddress("glMapBuffer"); qglFuncTab->glMapBufferExt = (PFNGLMAPBUFFERPROC)context()->getProcAddress("glMapBuffer");
glFuncTab->glUnmapBufferExt = (PFNGLUNMAPBUFFERPROC)context()->getProcAddress("glUnmapBuffer"); qglFuncTab->glUnmapBufferExt = (PFNGLUNMAPBUFFERPROC)context()->getProcAddress("glUnmapBuffer");
glFuncTab->initialized = true; qglFuncTab->initialized = true;
this->glFuncTab = glFuncTab.release(); glFuncTab = qglFuncTab.release();
icvSetOpenGlFuncTab(this->glFuncTab); icvSetOpenGlFuncTab(glFuncTab);
} }
void OpenGlViewPort::resizeGL(int w, int h) void OpenGlViewPort::resizeGL(int w, int h)
@ -3420,58 +3420,58 @@ void OpenGlViewPort::paintGL()
CV_CheckGlError(); CV_CheckGlError();
} }
void OpenGlViewPort::mousePressEvent(QMouseEvent* event) void OpenGlViewPort::mousePressEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
icvmouseHandler(event, mouse_down, cv_event, flags); icvmouseHandler(evnt, mouse_down, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
QGLWidget::mousePressEvent(event); QGLWidget::mousePressEvent(evnt);
} }
void OpenGlViewPort::mouseReleaseEvent(QMouseEvent* event) void OpenGlViewPort::mouseReleaseEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
icvmouseHandler(event, mouse_up, cv_event, flags); icvmouseHandler(evnt, mouse_up, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
QGLWidget::mouseReleaseEvent(event); QGLWidget::mouseReleaseEvent(evnt);
} }
void OpenGlViewPort::mouseDoubleClickEvent(QMouseEvent* event) void OpenGlViewPort::mouseDoubleClickEvent(QMouseEvent* evnt)
{ {
int cv_event = -1, flags = 0; int cv_event = -1, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
icvmouseHandler(event, mouse_dbclick, cv_event, flags); icvmouseHandler(evnt, mouse_dbclick, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
QGLWidget::mouseDoubleClickEvent(event); QGLWidget::mouseDoubleClickEvent(evnt);
} }
void OpenGlViewPort::mouseMoveEvent(QMouseEvent* event) void OpenGlViewPort::mouseMoveEvent(QMouseEvent* evnt)
{ {
int cv_event = CV_EVENT_MOUSEMOVE, flags = 0; int cv_event = CV_EVENT_MOUSEMOVE, flags = 0;
QPoint pt = event->pos(); QPoint pt = evnt->pos();
//icvmouseHandler: pass parameters for cv_event, flags //icvmouseHandler: pass parameters for cv_event, flags
icvmouseHandler(event, mouse_move, cv_event, flags); icvmouseHandler(evnt, mouse_move, cv_event, flags);
icvmouseProcessing(QPointF(pt), cv_event, flags); icvmouseProcessing(QPointF(pt), cv_event, flags);
QGLWidget::mouseMoveEvent(event); QGLWidget::mouseMoveEvent(evnt);
} }
void OpenGlViewPort::icvmouseHandler(QMouseEvent* event, type_mouse_event category, int& cv_event, int& flags) void OpenGlViewPort::icvmouseHandler(QMouseEvent* evnt, type_mouse_event category, int& cv_event, int& flags)
{ {
Qt::KeyboardModifiers modifiers = event->modifiers(); Qt::KeyboardModifiers modifiers = evnt->modifiers();
Qt::MouseButtons buttons = event->buttons(); Qt::MouseButtons buttons = evnt->buttons();
flags = 0; flags = 0;
if (modifiers & Qt::ShiftModifier) if (modifiers & Qt::ShiftModifier)
@ -3489,7 +3489,7 @@ void OpenGlViewPort::icvmouseHandler(QMouseEvent* event, type_mouse_event catego
flags |= CV_EVENT_FLAG_MBUTTON; flags |= CV_EVENT_FLAG_MBUTTON;
cv_event = CV_EVENT_MOUSEMOVE; cv_event = CV_EVENT_MOUSEMOVE;
switch (event->button()) switch (evnt->button())
{ {
case Qt::LeftButton: case Qt::LeftButton:
cv_event = tableMouseButtons[category][0]; cv_event = tableMouseButtons[category][0];

View File

@ -55,16 +55,6 @@
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
/*#if _MSC_VER >= 1200
#pragma warning( disable: 4505 )
#pragma comment(lib,"gtk-win32-2.0.lib")
#pragma comment(lib,"glib-2.0.lib")
#pragma comment(lib,"gobject-2.0.lib")
#pragma comment(lib,"gdk-win32-2.0.lib")
#pragma comment(lib,"gdk_pixbuf-2.0.lib")
#endif*/
// TODO Fix the initial window size when flags=0. Right now the initial window is by default // TODO Fix the initial window size when flags=0. Right now the initial window is by default
// 320x240 size. A better default would be actual size of the image. Problem // 320x240 size. A better default would be actual size of the image. Problem
// is determining desired window size with trackbars while still allowing resizing. // is determining desired window size with trackbars while still allowing resizing.

View File

@ -43,10 +43,6 @@
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4710 )
#endif
#define COMPILE_MULTIMON_STUBS // Required for multi-monitor support #define COMPILE_MULTIMON_STUBS // Required for multi-monitor support
#ifndef _MULTIMON_USE_SECURE_CRT #ifndef _MULTIMON_USE_SECURE_CRT
# define _MULTIMON_USE_SECURE_CRT 0 // some MinGW platforms have no strncpy_s # define _MULTIMON_USE_SECURE_CRT 0 // some MinGW platforms have no strncpy_s
@ -907,7 +903,7 @@ namespace
void releaseGlContext(CvWindow* window) void releaseGlContext(CvWindow* window)
{ {
CV_FUNCNAME( "releaseGlContext" ); //CV_FUNCNAME( "releaseGlContext" );
__BEGIN__; __BEGIN__;
@ -1907,18 +1903,18 @@ static LRESULT CALLBACK WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
if( hg_on_preprocess ) if( hg_on_preprocess )
{ {
int was_processed = 0; int was_processed = 0;
int ret = hg_on_preprocess(hwnd, uMsg, wParam, lParam, &was_processed); int rethg = hg_on_preprocess(hwnd, uMsg, wParam, lParam, &was_processed);
if( was_processed ) if( was_processed )
return ret; return rethg;
} }
ret = HighGUIProc(hwnd, uMsg, wParam, lParam); ret = HighGUIProc(hwnd, uMsg, wParam, lParam);
if(hg_on_postprocess) if(hg_on_postprocess)
{ {
int was_processed = 0; int was_processed = 0;
int ret = hg_on_postprocess(hwnd, uMsg, wParam, lParam, &was_processed); int rethg = hg_on_postprocess(hwnd, uMsg, wParam, lParam, &was_processed);
if( was_processed ) if( was_processed )
return ret; return rethg;
} }
return ret; return ret;

View File

@ -112,9 +112,9 @@ public:
return; return;
} }
int N0 = cap.get(CV_CAP_PROP_FRAME_COUNT); int N0 = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
cap.set(CV_CAP_PROP_POS_FRAMES, 0); cap.set(CV_CAP_PROP_POS_FRAMES, 0);
int N = cap.get(CV_CAP_PROP_FRAME_COUNT); int N = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
if (N != n_frames || N != N0) if (N != n_frames || N != N0)
{ {

View File

@ -169,10 +169,6 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
* Multi-Scale variant of Classical Hough Transform * * Multi-Scale variant of Classical Hough Transform *
\****************************************************************************************/ \****************************************************************************************/
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4714 )
#endif
//DECLARE_AND_IMPLEMENT_LIST( _index, h_ ); //DECLARE_AND_IMPLEMENT_LIST( _index, h_ );
IMPLEMENT_LIST( _index, h_ ) IMPLEMENT_LIST( _index, h_ )

View File

@ -1521,7 +1521,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
assert( k < ssize.width*2 ); assert( k < ssize.width*2 );
xofs[k].di = dx*cn; xofs[k].di = dx*cn;
xofs[k].si = sx*cn; xofs[k].si = sx*cn;
xofs[k++].alpha = 1.f / min(scale_x, src.cols - fsx1); xofs[k++].alpha = float(1.0 / min(scale_x, src.cols - fsx1));
} }
if( fsx2 - sx2 > 1e-3 ) if( fsx2 - sx2 > 1e-3 )

View File

@ -43,11 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
// disable warnings related to inline functions
#pragma warning( disable: 4251 4711 4710 4514 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -453,11 +453,6 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
namespace cv namespace cv
{ {
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4244 )
#endif
typedef ushort HT; typedef ushort HT;
/** /**
@ -569,7 +564,7 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
for( c = 0; c < cn; c++ ) for( c = 0; c < cn; c++ )
{ {
for( j = 0; j < n; j++ ) for( j = 0; j < n; j++ )
COP( c, j, src[cn*j+c], += r+2 ); COP( c, j, src[cn*j+c], += (cv::HT)(r+2) );
for( i = 1; i < r; i++ ) for( i = 1; i < r; i++ )
{ {
@ -628,7 +623,7 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
if ( luc[c][k] <= j-r ) if ( luc[c][k] <= j-r )
{ {
memset( &H[c].fine[k], 0, 16 * sizeof(HT) ); memset( &H[c].fine[k], 0, 16 * sizeof(HT) );
for ( luc[c][k] = j-r; luc[c][k] < MIN(j+r+1,n); ++luc[c][k] ) for ( luc[c][k] = cv::HT(j-r); luc[c][k] < MIN(j+r+1,n); ++luc[c][k] )
histogram_add_simd( &h_fine[16*(n*(16*c+k)+luc[c][k])], H[c].fine[k] ); histogram_add_simd( &h_fine[16*(n*(16*c+k)+luc[c][k])], H[c].fine[k] );
if ( luc[c][k] < j+r+1 ) if ( luc[c][k] < j+r+1 )
@ -691,7 +686,7 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
if ( luc[c][k] <= j-r ) if ( luc[c][k] <= j-r )
{ {
memset( &H[c].fine[k], 0, 16 * sizeof(HT) ); memset( &H[c].fine[k], 0, 16 * sizeof(HT) );
for ( luc[c][k] = j-r; luc[c][k] < MIN(j+r+1,n); ++luc[c][k] ) for ( luc[c][k] = cv::HT(j-r); luc[c][k] < MIN(j+r+1,n); ++luc[c][k] )
histogram_add( &h_fine[16*(n*(16*c+k)+luc[c][k])], H[c].fine[k] ); histogram_add( &h_fine[16*(n*(16*c+k)+luc[c][k])], H[c].fine[k] );
if ( luc[c][k] < j+r+1 ) if ( luc[c][k] < j+r+1 )
@ -733,11 +728,6 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
#undef COP #undef COP
} }
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( default: 4244 )
#endif
static void static void
medianBlur_8u_Om( const Mat& _src, Mat& _dst, int m ) medianBlur_8u_Om( const Mat& _src, Mat& _dst, int m )
{ {

View File

@ -2826,7 +2826,7 @@ template<class Distance>
class CV_EXPORTS BruteForceMatcher : public BFMatcher class CV_EXPORTS BruteForceMatcher : public BFMatcher
{ {
public: public:
BruteForceMatcher( Distance d = Distance() ) : BFMatcher(Distance::normType, false) {} BruteForceMatcher( Distance d = Distance() ) : BFMatcher(Distance::normType, false) {(void)d;}
virtual ~BruteForceMatcher() {} virtual ~BruteForceMatcher() {}
}; };

View File

@ -41,18 +41,9 @@
#include "precomp.hpp" #include "precomp.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning(disable:4786) // Disable MSVC warnings in the standard library.
#pragma warning(disable:4100)
#pragma warning(disable:4512)
#endif
#include <stdio.h> #include <stdio.h>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning(default:4100)
#pragma warning(default:4512)
#endif
#define ARRAY_SIZEOF(a) (sizeof(a)/sizeof((a)[0])) #define ARRAY_SIZEOF(a) (sizeof(a)/sizeof((a)[0]))

View File

@ -53,10 +53,6 @@
#include "assert.h" #include "assert.h"
#include "math.h" #include "math.h"
#if defined _MSC_VER && _MSC_VER >= 1400
#pragma warning(disable: 4512) // suppress "assignment operator could not be generated"
#endif
// J.S. Beis and D.G. Lowe. Shape indexing using approximate nearest-neighbor search // J.S. Beis and D.G. Lowe. Shape indexing using approximate nearest-neighbor search
// in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog., // in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog.,
// pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html // pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html
@ -140,6 +136,8 @@ private:
bool operator() (const __instype & lhs) const { bool operator() (const __instype & lhs) const {
return deref(ctor(lhs), dim) <= deref(ctor(pivot), dim); return deref(ctor(lhs), dim) <= deref(ctor(pivot), dim);
} }
private:
median_pr& operator=(const median_pr&);
}; };
template < class __instype, class __valuector > template < class __instype, class __valuector >

View File

@ -110,7 +110,6 @@ public:
void AddBlob(CvBlob* pBlob) void AddBlob(CvBlob* pBlob)
{ {
float FV[MAX_FV_SIZE+1]; float FV[MAX_FV_SIZE+1];
int i;
DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlobByID(CV_BLOB_ID(pBlob)); DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlobByID(CV_BLOB_ID(pBlob));
if(!m_ClearFlag) Clear(); if(!m_ClearFlag) Clear();
@ -129,7 +128,7 @@ public:
pFVBlob->blob = pBlob[0]; pFVBlob->blob = pBlob[0];
/* Shift: */ /* Shift: */
for(i=(BLOB_NUM-1); i>0; --i) for(int i=(BLOB_NUM-1); i>0; --i)
{ {
pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1]; pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1];
} }
@ -153,8 +152,7 @@ public:
float AverVy = 0; float AverVy = 0;
{ /* Average velocity: */ { /* Average velocity: */
CvBlob* pBlobSeq = pFVBlob->BlobSeq; CvBlob* pBlobSeq = pFVBlob->BlobSeq;
int i; for(int i=1;i<BLOB_NUM;++i)
for(i=1;i<BLOB_NUM;++i)
{ {
AverVx += CV_BLOB_X(pBlobSeq+i-1)-CV_BLOB_X(pBlobSeq+i); AverVx += CV_BLOB_X(pBlobSeq+i-1)-CV_BLOB_X(pBlobSeq+i);
AverVy += CV_BLOB_Y(pBlobSeq+i-1)-CV_BLOB_Y(pBlobSeq+i); AverVy += CV_BLOB_Y(pBlobSeq+i-1)-CV_BLOB_Y(pBlobSeq+i);
@ -291,7 +289,6 @@ public:
void AddBlob(CvBlob* pBlob) void AddBlob(CvBlob* pBlob)
{ {
//float FV[MAX_FV_SIZE+1]; //float FV[MAX_FV_SIZE+1];
int i;
DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlobByID(CV_BLOB_ID(pBlob)); DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlobByID(CV_BLOB_ID(pBlob));
if(!m_ClearFlag) Clear(); if(!m_ClearFlag) Clear();
@ -308,7 +305,7 @@ public:
} /* Add new record if necessary. */ } /* Add new record if necessary. */
/* Shift: */ /* Shift: */
for(i=(BLOB_NUM-1); i>0; --i) for(int i=(BLOB_NUM-1); i>0; --i)
{ {
pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1]; pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1];
} }
@ -321,8 +318,7 @@ public:
float T = (CV_BLOB_WX(pBlob)+CV_BLOB_WY(pBlob))*0.01f; float T = (CV_BLOB_WX(pBlob)+CV_BLOB_WY(pBlob))*0.01f;
float AverVx = 0; float AverVx = 0;
float AverVy = 0; float AverVy = 0;
int i; for(int i=1; i<BLOB_NUM; ++i)
for(i=1; i<BLOB_NUM; ++i)
{ {
AverVx += CV_BLOB_X(pBlobSeq+i-1)-CV_BLOB_X(pBlobSeq+i); AverVx += CV_BLOB_X(pBlobSeq+i-1)-CV_BLOB_X(pBlobSeq+i);
AverVy += CV_BLOB_Y(pBlobSeq+i-1)-CV_BLOB_Y(pBlobSeq+i); AverVy += CV_BLOB_Y(pBlobSeq+i-1)-CV_BLOB_Y(pBlobSeq+i);
@ -829,11 +825,10 @@ public:
}; };
virtual void Process(IplImage* pImg, IplImage* pFG) virtual void Process(IplImage* pImg, IplImage* pFG)
{ {
int i;
m_pFVGen->Process(pImg, pFG); m_pFVGen->Process(pImg, pFG);
int SK = m_SmoothKernel[0]; int SK = m_SmoothKernel[0];
for(i=0; i<m_pFVGen->GetFVNum(); ++i) for(int i=0; i<m_pFVGen->GetFVNum(); ++i)
{ {
int BlobID = 0; int BlobID = 0;
float* pFV = m_pFVGen->GetFV(i,&BlobID); float* pFV = m_pFVGen->GetFV(i,&BlobID);
@ -876,30 +871,29 @@ public:
} }
{ /* If it is a new FV then add it to trajectory histogram: */ { /* If it is a new FV then add it to trajectory histogram: */
int i,flag = 1; int flag = 1;
int r = m_SmoothRadius; int r = m_SmoothRadius;
// printf("BLob %3d NEW FV [", CV_BLOB_ID(pF)); // printf("BLob %3d NEW FV [", CV_BLOB_ID(pF));
// for(i=0;i<m_Dim;++i) printf("%d,", m_pFVi[i]); // for(i=0;i<m_Dim;++i) printf("%d,", m_pFVi[i]);
// printf("]"); // printf("]");
for(i=0; i<m_Dim; ++i) for(int k=0; k<m_Dim; ++k)
{ {
m_pFViVar[i]=-r; m_pFViVar[k]=-r;
} }
while(flag) while(flag)
{ {
float dist = 0; float dist = 0;
int HistAdd = 0; int HistAdd = 0;
int i;
int good = 1; int good = 1;
for(i=0; i<m_Dim; ++i) for(int k=0; k<m_Dim; ++k)
{ {
m_pFViVarRes[i] = m_pFVi[i]+m_pFViVar[i]; m_pFViVarRes[k] = m_pFVi[k]+m_pFViVar[k];
if(m_pFViVarRes[i]<0) good= 0; if(m_pFViVarRes[k]<0) good= 0;
if(m_pFViVarRes[i]>=m_BinNum) good= 0; if(m_pFViVarRes[k]>=m_BinNum) good= 0;
dist += m_pFViVar[i]*m_pFViVar[i]; dist += m_pFViVar[k]*m_pFViVar[k];
}/* Calculate next dimension. */ }/* Calculate next dimension. */
if(SK=='G' || SK=='g') if(SK=='G' || SK=='g')
@ -923,13 +917,14 @@ public:
pF->pHist->SetMax(m_pFViVarRes, HistAdd); pF->pHist->SetMax(m_pFViVarRes, HistAdd);
} /* Update histogram. */ } /* Update histogram. */
for(i=0; i<m_Dim; ++i) int idx = 0;
for( ; idx<m_Dim; ++idx)
{ /* Next config: */ { /* Next config: */
if((m_pFViVar[i]++) < r) if((m_pFViVar[idx]++) < r)
break; break;
m_pFViVar[i] = -r; m_pFViVar[idx] = -r;
} /* Increase next dimension variable. */ } /* Increase next dimension variable. */
if(i==m_Dim)break; if(idx==m_Dim)break;
} /* Next variation. */ } /* Next variation. */
} /* If new FV. */ } /* If new FV. */
} /* Next FV. */ } /* Next FV. */
@ -961,15 +956,12 @@ public:
for(Val = m_HistMat.GetNext(&idxs,1); idxs; Val=m_HistMat.GetNext(&idxs,0)) for(Val = m_HistMat.GetNext(&idxs,1); idxs; Val=m_HistMat.GetNext(&idxs,0))
{ /* Draw all elements: */ { /* Draw all elements: */
float vf;
int x,y;
if(!idxs) break; if(!idxs) break;
if(Val == 0) continue; if(Val == 0) continue;
vf = (float)Val/(m_HistMat.m_Max?m_HistMat.m_Max:1); float vf = (float)Val/(m_HistMat.m_Max?m_HistMat.m_Max:1);
x = cvRound((float)(pI->width-1)*(float)idxs[0] / (float)m_BinNum); int x = cvRound((float)(pI->width-1)*(float)idxs[0] / (float)m_BinNum);
y = cvRound((float)(pI->height-1)*(float)idxs[1] / (float)m_BinNum); int y = cvRound((float)(pI->height-1)*(float)idxs[1] / (float)m_BinNum);
cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(255,0,0),CV_FILLED); cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(255,0,0),CV_FILLED);
if(m_Dim > 3) if(m_Dim > 3)
@ -982,13 +974,13 @@ public:
m_pFVGen->GetFVMax()[0]==m_pFVGen->GetFVMax()[2] && m_pFVGen->GetFVMax()[0]==m_pFVGen->GetFVMax()[2] &&
m_pFVGen->GetFVMax()[1]==m_pFVGen->GetFVMax()[3]) m_pFVGen->GetFVMax()[1]==m_pFVGen->GetFVMax()[3])
{ {
int x = cvRound((float)(pI->width-1)*(float)idxs[2] / (float)m_BinNum); int x1 = cvRound((float)(pI->width-1)*(float)idxs[2] / (float)m_BinNum);
int y = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum); int y1 = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum);
cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED); cvCircle(pI, cvPoint(x1,y1), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED);
} }
} /* Draw all elements. */ } /* Draw all elements. */
for(i=m_TrackFGList.GetBlobNum();i>0;--i) for(int i=m_TrackFGList.GetBlobNum();i>0;--i)
{ {
DefTrackFG* pF = (DefTrackFG*)m_TrackFGList.GetBlob(i-1); DefTrackFG* pF = (DefTrackFG*)m_TrackFGList.GetBlob(i-1);
DefMat* pHist = pF?pF->pHist:NULL; DefMat* pHist = pF?pF->pHist:NULL;
@ -1018,9 +1010,9 @@ public:
m_pFVGen->GetFVMax()[0]==m_pFVGen->GetFVMax()[2] && m_pFVGen->GetFVMax()[0]==m_pFVGen->GetFVMax()[2] &&
m_pFVGen->GetFVMax()[1]==m_pFVGen->GetFVMax()[3]) m_pFVGen->GetFVMax()[1]==m_pFVGen->GetFVMax()[3])
{ /* if SS feature vector */ { /* if SS feature vector */
int x = cvRound((float)(pI->width-1)*(float)idxs[2] / (float)m_BinNum); int x1 = cvRound((float)(pI->width-1)*(float)idxs[2] / (float)m_BinNum);
int y = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum); int y1 = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum);
cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED); cvCircle(pI, cvPoint(x1,y1), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED);
} }
} /* Draw all elements. */ } /* Draw all elements. */
} /* Next track. */ } /* Next track. */
@ -1410,7 +1402,7 @@ public:
for(j=0; j<pF->pFVSeq->total; ++j) for(j=0; j<pF->pFVSeq->total; ++j)
{ /* Copy new data to train data: */ { /* Copy new data to train data: */
float* pFVVar = m_pFVGen->GetFVVar(); float* pFVvar = m_pFVGen->GetFVVar();
float* pFV = (float*)cvGetSeqElem(pF->pFVSeq,j); float* pFV = (float*)cvGetSeqElem(pF->pFVSeq,j);
int k; int k;
@ -1420,9 +1412,9 @@ public:
float* pTD = (float*)CV_MAT_ELEM_PTR( pTrainData[0], old_height+j*mult+k, 0); float* pTD = (float*)CV_MAT_ELEM_PTR( pTrainData[0], old_height+j*mult+k, 0);
memcpy(pTD,pFV,sizeof(float)*m_Dim); memcpy(pTD,pFV,sizeof(float)*m_Dim);
if(pFVVar)for(t=0;t<m_Dim;++t) if(pFVvar)for(t=0;t<m_Dim;++t)
{ /* Scale FV: */ { /* Scale FV: */
pTD[t] /= pFVVar[t]; pTD[t] /= pFVvar[t];
} }
if(k>0) if(k>0)

View File

@ -206,7 +206,6 @@ CvBlobTrackerAuto1::~CvBlobTrackerAuto1()
void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
{ {
int CurBlobNum = 0; int CurBlobNum = 0;
int i;
IplImage* pFG = pMask; IplImage* pFG = pMask;
/* Bump frame counter: */ /* Bump frame counter: */
@ -268,15 +267,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
TIME_BEGIN() TIME_BEGIN()
if(m_pBT) if(m_pBT)
{ {
int i;
m_pBT->Process(pImg, pFG); m_pBT->Process(pImg, pFG);
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Update data of tracked blob list: */ { /* Update data of tracked blob list: */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
int BlobID = CV_BLOB_ID(pB); int BlobID = CV_BLOB_ID(pB);
int i = m_pBT->GetBlobIndexByID(BlobID); int idx = m_pBT->GetBlobIndexByID(BlobID);
m_pBT->ProcessBlob(i, pB, pImg, pFG); m_pBT->ProcessBlob(idx, pB, pImg, pFG);
pB->ID = BlobID; pB->ID = BlobID;
} }
CurBlobNum = m_pBT->GetBlobNum(); CurBlobNum = m_pBT->GetBlobNum();
@ -286,9 +284,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
/* This part should be removed: */ /* This part should be removed: */
if(m_BTReal && m_pBT) if(m_BTReal && m_pBT)
{ /* Update blob list (detect new blob for real blob tracker): */ { /* Update blob list (detect new blob for real blob tracker): */
int i; for(int i=m_pBT->GetBlobNum(); i>0; --i)
for(i=m_pBT->GetBlobNum(); i>0; --i)
{ /* Update data of tracked blob list: */ { /* Update data of tracked blob list: */
CvBlob* pB = m_pBT->GetBlob(i-1); CvBlob* pB = m_pBT->GetBlob(i-1);
if(pB && m_BlobList.GetBlobByID(CV_BLOB_ID(pB)) == NULL ) if(pB && m_BlobList.GetBlobByID(CV_BLOB_ID(pB)) == NULL )
@ -301,7 +297,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
} /* Next blob. */ } /* Next blob. */
/* Delete blobs: */ /* Delete blobs: */
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Update tracked-blob list: */ { /* Update tracked-blob list: */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
if(pB && m_pBT->GetBlobByID(CV_BLOB_ID(pB)) == NULL ) if(pB && m_pBT->GetBlobByID(CV_BLOB_ID(pB)) == NULL )
@ -315,15 +311,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
TIME_BEGIN() TIME_BEGIN()
if(m_pBTPostProc) if(m_pBTPostProc)
{ /* Post-processing module: */ { /* Post-processing module: */
int i; for(int i=m_BlobList.GetBlobNum(); i>0; --i)
for(i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Update tracked-blob list: */ { /* Update tracked-blob list: */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
m_pBTPostProc->AddBlob(pB); m_pBTPostProc->AddBlob(pB);
} }
m_pBTPostProc->Process(); m_pBTPostProc->Process();
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Update tracked-blob list: */ { /* Update tracked-blob list: */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
int BlobID = CV_BLOB_ID(pB); int BlobID = CV_BLOB_ID(pB);
@ -423,12 +418,12 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
if(m_pBD->DetectNewBlob(pImg, pFG, &NewBlobList, &m_BlobList)) if(m_pBD->DetectNewBlob(pImg, pFG, &NewBlobList, &m_BlobList))
{ /* Add new blob to tracker and blob list: */ { /* Add new blob to tracker and blob list: */
int i; int i;
IplImage* pMask = pFG; IplImage* pmask = pFG;
/*if(0)if(NewBlobList.GetBlobNum()>0 && pFG ) /*if(0)if(NewBlobList.GetBlobNum()>0 && pFG )
{// erode FG mask (only for FG_0 and MS1||MS2) {// erode FG mask (only for FG_0 and MS1||MS2)
pMask = cvCloneImage(pFG); pmask = cvCloneImage(pFG);
cvErode(pFG,pMask,NULL,2); cvErode(pFG,pmask,NULL,2);
}*/ }*/
for(i=0; i<NewBlobList.GetBlobNum(); ++i) for(i=0; i<NewBlobList.GetBlobNum(); ++i)
@ -438,7 +433,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
if(pBN && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH) if(pBN && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH)
{ {
CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pMask ); CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pmask );
if(pB) if(pB)
{ {
NewB.blob = pB[0]; NewB.blob = pB[0];
@ -449,7 +444,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
} }
} /* Add next blob from list of detected blob. */ } /* Add next blob from list of detected blob. */
if(pMask != pFG) cvReleaseImage(&pMask); if(pmask != pFG) cvReleaseImage(&pmask);
} /* Create and add new blobs and trackers. */ } /* Create and add new blobs and trackers. */
@ -460,7 +455,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
TIME_BEGIN() TIME_BEGIN()
if(m_pBTGen) if(m_pBTGen)
{ /* Run track generator: */ { /* Run track generator: */
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Update data of tracked blob list: */ { /* Update data of tracked blob list: */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
m_pBTGen->AddBlob(pB); m_pBTGen->AddBlob(pB);

View File

@ -175,7 +175,6 @@ public:
{ {
CvSeq* cnts; CvSeq* cnts;
CvSeq* cnt; CvSeq* cnt;
int i;
//CvMat* pMC = NULL; //CvMat* pMC = NULL;
if(m_BlobList.GetBlobNum() <= 0 ) return; if(m_BlobList.GetBlobNum() <= 0 ) return;
@ -219,7 +218,7 @@ public:
cvReleaseImage(&pBin); cvReleaseImage(&pBin);
} }
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Predict new blob position. */ { /* Predict new blob position. */
CvBlob* pB = NULL; CvBlob* pB = NULL;
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1); DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
@ -237,11 +236,10 @@ public:
if(m_BlobList.GetBlobNum()>0 && m_BlobListNew.GetBlobNum()>0) if(m_BlobList.GetBlobNum()>0 && m_BlobListNew.GetBlobNum()>0)
{ /* Resolve new blob to old: */ { /* Resolve new blob to old: */
int i,j;
int NOld = m_BlobList.GetBlobNum(); int NOld = m_BlobList.GetBlobNum();
int NNew = m_BlobListNew.GetBlobNum(); int NNew = m_BlobListNew.GetBlobNum();
for(i=0; i<NOld; i++) for(int i=0; i<NOld; i++)
{ /* Set 0 collision and clear all hyp: */ { /* Set 0 collision and clear all hyp: */
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i); DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
pF->Collision = 0; pF->Collision = 0;
@ -249,12 +247,12 @@ public:
} /* Set 0 collision. */ } /* Set 0 collision. */
/* Create correspondence records: */ /* Create correspondence records: */
for(j=0; j<NNew; ++j) for(int j=0; j<NNew; ++j)
{ {
CvBlob* pB1 = m_BlobListNew.GetBlob(j); CvBlob* pB1 = m_BlobListNew.GetBlob(j);
DefBlobTrackerCR* pFLast = NULL; DefBlobTrackerCR* pFLast = NULL;
for(i=0; i<NOld; i++) for(int i=0; i<NOld; i++)
{ /* Check intersection: */ { /* Check intersection: */
int Intersection = 0; int Intersection = 0;
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i); DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
@ -276,14 +274,13 @@ public:
} /* Check next new blob. */ } /* Check next new blob. */
} /* Resolve new blob to old. */ } /* Resolve new blob to old. */
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Track each blob. */ { /* Track each blob. */
CvBlob* pB = m_BlobList.GetBlob(i-1); CvBlob* pB = m_BlobList.GetBlob(i-1);
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)pB; DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)pB;
int BlobID = CV_BLOB_ID(pB); int BlobID = CV_BLOB_ID(pB);
//CvBlob* pBBest = NULL; //CvBlob* pBBest = NULL;
//double DistBest = -1; //double DistBest = -1;
int j;
if(pBT->pResolver) if(pBT->pResolver)
{ {
@ -309,7 +306,7 @@ public:
CvBlob* pBBest = NULL; CvBlob* pBBest = NULL;
double DistBest = -1; double DistBest = -1;
double CMax = 0; double CMax = 0;
for(j=pBT->pBlobHyp->GetBlobNum();j>0;--j) for(int j=pBT->pBlobHyp->GetBlobNum();j>0;--j)
{ /* Find best CC: */ { /* Find best CC: */
CvBlob* pBNew = pBT->pBlobHyp->GetBlob(j-1); CvBlob* pBNew = pBT->pBlobHyp->GetBlob(j-1);
if(pBT->pResolver) if(pBT->pResolver)
@ -354,8 +351,7 @@ public:
if(m_Wnd) if(m_Wnd)
{ {
IplImage* pI = cvCloneImage(pImg); IplImage* pI = cvCloneImage(pImg);
int i; for(int i=m_BlobListNew.GetBlobNum(); i>0; --i)
for(i=m_BlobListNew.GetBlobNum(); i>0; --i)
{ /* Draw each new CC: */ { /* Draw each new CC: */
CvBlob* pB = m_BlobListNew.GetBlob(i-1); CvBlob* pB = m_BlobListNew.GetBlob(i-1);
CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB)); CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB));
@ -369,7 +365,7 @@ public:
CV_RGB(255,255,0), 1 ); CV_RGB(255,255,0), 1 );
} }
for(i=m_BlobList.GetBlobNum(); i>0; --i) for(int i=m_BlobList.GetBlobNum(); i>0; --i)
{ /* Draw each new CC: */ { /* Draw each new CC: */
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1); DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
CvBlob* pB = &(pF->BlobPredict); CvBlob* pB = &(pF->BlobPredict);

View File

@ -395,7 +395,7 @@ public:
{ /* Mean shift in scale space: */ { /* Mean shift in scale space: */
float news = 0; float news = 0;
float sum = 0; float sum1 = 0;
float scale; float scale;
Center = cvPoint(cvRound(m_Blob.x),cvRound(m_Blob.y)); Center = cvPoint(cvRound(m_Blob.x),cvRound(m_Blob.y));
@ -407,13 +407,13 @@ public:
{ {
double W = cvDotProduct(m_Weights, m_KernelMeanShiftG[si]);; double W = cvDotProduct(m_Weights, m_KernelMeanShiftG[si]);;
int s = si-SCALE_RANGE; int s = si-SCALE_RANGE;
sum += (float)fabs(W); sum1 += (float)fabs(W);
news += (float)(s*W); news += (float)(s*W);
} }
if(sum>0) if(sum1>0)
{ {
news /= sum; news /= sum1;
} }
scale = (float)pow((double)SCALE_BASE,(double)news); scale = (float)pow((double)SCALE_BASE,(double)news);

View File

@ -74,9 +74,9 @@ public:
{ {
float WSum = 0; float WSum = 0;
int i; int i;
int index = m_Frame % TIME_WND; int idx = m_Frame % TIME_WND;
int size = MIN((m_Frame+1), TIME_WND); int size = MIN((m_Frame+1), TIME_WND);
m_pBlobs[index] = pBlob[0]; m_pBlobs[idx] = pBlob[0];
m_Blob.x = m_Blob.y = m_Blob.w = m_Blob.h = 0; m_Blob.x = m_Blob.y = m_Blob.w = m_Blob.h = 0;
for(i=0; i<size; ++i) for(i=0; i<size; ++i)

View File

@ -44,10 +44,6 @@
#undef quad #undef quad
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4701 )
#endif
CvCalibFilter::CvCalibFilter() CvCalibFilter::CvCalibFilter()
{ {
/* etalon data */ /* etalon data */
@ -93,7 +89,7 @@ CvCalibFilter::~CvCalibFilter()
bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params, bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
int pointCount, CvPoint2D32f* points ) int pointCount, CvPoint2D32f* _points )
{ {
int i, arrSize; int i, arrSize;
@ -132,7 +128,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
case CV_CALIB_ETALON_USER: case CV_CALIB_ETALON_USER:
etalonParamCount = 0; etalonParamCount = 0;
if( !points || pointCount < 4 ) if( !_points || pointCount < 4 )
{ {
assert(0); assert(0);
return false; return false;
@ -188,9 +184,9 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
{ {
memcpy( etalonParams, params, arrSize ); memcpy( etalonParams, params, arrSize );
} }
if (points != NULL) if (_points != NULL)
{ {
memcpy( etalonPoints, points, arrSize ); memcpy( etalonPoints, _points, arrSize );
} }
break; break;
@ -205,7 +201,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
CvCalibEtalonType CvCalibEtalonType
CvCalibFilter::GetEtalon( int* paramCount, const double** params, CvCalibFilter::GetEtalon( int* paramCount, const double** params,
int* pointCount, const CvPoint2D32f** points ) const int* pointCount, const CvPoint2D32f** _points ) const
{ {
if( paramCount ) if( paramCount )
*paramCount = etalonParamCount; *paramCount = etalonParamCount;
@ -216,8 +212,8 @@ CvCalibFilter::GetEtalon( int* paramCount, const double** params,
if( pointCount ) if( pointCount )
*pointCount = etalonPointCount; *pointCount = etalonPointCount;
if( points ) if( _points )
*points = etalonPoints; *_points = etalonPoints;
return etalonType; return etalonType;
} }

View File

@ -311,19 +311,19 @@ int RandomizedTree::getIndex(uchar* patch_data) const
} }
void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set, void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
RNG &rng, int depth, int views, size_t reduced_num_dim, RNG &rng, int _depth, int views, size_t reduced_num_dim,
int num_quant_bits) int num_quant_bits)
{ {
PatchGenerator make_patch; PatchGenerator make_patch;
train(base_set, rng, make_patch, depth, views, reduced_num_dim, num_quant_bits); train(base_set, rng, make_patch, _depth, views, reduced_num_dim, num_quant_bits);
} }
void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set, void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
RNG &rng, PatchGenerator &make_patch, RNG &rng, PatchGenerator &make_patch,
int depth, int views, size_t reduced_num_dim, int _depth, int views, size_t reduced_num_dim,
int num_quant_bits) int num_quant_bits)
{ {
init((int)base_set.size(), depth, rng); init((int)base_set.size(), _depth, rng);
Mat patch; Mat patch;
@ -381,10 +381,10 @@ void RandomizedTree::freePosteriors(int which)
classes_ = -1; classes_ = -1;
} }
void RandomizedTree::init(int num_classes, int depth, RNG &rng) void RandomizedTree::init(int num_classes, int _depth, RNG &rng)
{ {
depth_ = depth; depth_ = _depth;
num_leaves_ = 1 << depth; // 2**d num_leaves_ = 1 << _depth; // 2**d
int num_nodes = num_leaves_ - 1; // 2**d - 1 int num_nodes = num_leaves_ - 1; // 2**d - 1
// Initialize probabilities and counts to 0 // Initialize probabilities and counts to 0
@ -631,9 +631,9 @@ void RandomizedTree::savePosteriors(std::string url, bool append)
for (int i=0; i<num_leaves_; i++) { for (int i=0; i<num_leaves_; i++) {
float *post = posteriors_[i]; float *post = posteriors_[i];
char buf[20]; char buf[20];
for (int i=0; i<classes_; i++) { for (int j=0; j<classes_; j++) {
sprintf(buf, "%.10e", *post++); sprintf(buf, "%.10e", *post++);
file << buf << ((i<classes_-1) ? " " : ""); file << buf << ((j<classes_-1) ? " " : "");
} }
file << std::endl; file << std::endl;
} }
@ -645,8 +645,8 @@ void RandomizedTree::savePosteriors2(std::string url, bool append)
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out)); std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out));
for (int i=0; i<num_leaves_; i++) { for (int i=0; i<num_leaves_; i++) {
uchar *post = posteriors2_[i]; uchar *post = posteriors2_[i];
for (int i=0; i<classes_; i++) for (int j=0; j<classes_; j++)
file << int(*post++) << (i<classes_-1?" ":""); file << int(*post++) << (j<classes_-1?" ":"");
file << std::endl; file << std::endl;
} }
file.close(); file.close();

View File

@ -190,79 +190,79 @@ static void icvFindStereoCorrespondenceByBirchfieldDP( uchar* src1, uchar* src2,
for( x = 1; x < imgW; x++ ) for( x = 1; x < imgW; x++ )
{ {
int d = MIN( x + 1, maxDisparity + 1); int dp = MIN( x + 1, maxDisparity + 1);
uchar* _edges = edges + y*imgW + x; uchar* _edges = edges + y*imgW + x;
int e0 = _edges[0] & 1; int e0 = _edges[0] & 1;
_CvDPCell* _cell = cells + x*dispH; _CvDPCell* _cell = cells + x*dispH;
do do
{ {
int s = dsi[d*imgW+x]; int _s = dsi[dp*imgW+x];
int sum[3]; int sum[3];
//check left step //check left step
sum[0] = _cell[d-dispH].sum - param2; sum[0] = _cell[dp-dispH].sum - param2;
//check up step //check up step
if( _cell[d+1].step != ICV_DP_STEP_DIAG && e0 ) if( _cell[dp+1].step != ICV_DP_STEP_DIAG && e0 )
{ {
sum[1] = _cell[d+1].sum + param1; sum[1] = _cell[dp+1].sum + param1;
if( _cell[d-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-d] & 2) ) if( _cell[dp-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-dp] & 2) )
{ {
int t; int t;
sum[2] = _cell[d-1-dispH].sum + param1; sum[2] = _cell[dp-1-dispH].sum + param1;
t = sum[1] < sum[0]; t = sum[1] < sum[0];
//choose local-optimal pass //choose local-optimal pass
if( sum[t] <= sum[2] ) if( sum[t] <= sum[2] )
{ {
_cell[d].step = (uchar)t; _cell[dp].step = (uchar)t;
_cell[d].sum = sum[t] + s; _cell[dp].sum = sum[t] + _s;
} }
else else
{ {
_cell[d].step = ICV_DP_STEP_DIAG; _cell[dp].step = ICV_DP_STEP_DIAG;
_cell[d].sum = sum[2] + s; _cell[dp].sum = sum[2] + _s;
} }
} }
else else
{ {
if( sum[0] <= sum[1] ) if( sum[0] <= sum[1] )
{ {
_cell[d].step = ICV_DP_STEP_LEFT; _cell[dp].step = ICV_DP_STEP_LEFT;
_cell[d].sum = sum[0] + s; _cell[dp].sum = sum[0] + _s;
} }
else else
{ {
_cell[d].step = ICV_DP_STEP_UP; _cell[dp].step = ICV_DP_STEP_UP;
_cell[d].sum = sum[1] + s; _cell[dp].sum = sum[1] + _s;
} }
} }
} }
else if( _cell[d-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-d] & 2) ) else if( _cell[dp-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-dp] & 2) )
{ {
sum[2] = _cell[d-1-dispH].sum + param1; sum[2] = _cell[dp-1-dispH].sum + param1;
if( sum[0] <= sum[2] ) if( sum[0] <= sum[2] )
{ {
_cell[d].step = ICV_DP_STEP_LEFT; _cell[dp].step = ICV_DP_STEP_LEFT;
_cell[d].sum = sum[0] + s; _cell[dp].sum = sum[0] + _s;
} }
else else
{ {
_cell[d].step = ICV_DP_STEP_DIAG; _cell[dp].step = ICV_DP_STEP_DIAG;
_cell[d].sum = sum[2] + s; _cell[dp].sum = sum[2] + _s;
} }
} }
else else
{ {
_cell[d].step = ICV_DP_STEP_LEFT; _cell[dp].step = ICV_DP_STEP_LEFT;
_cell[d].sum = sum[0] + s; _cell[dp].sum = sum[0] + _s;
} }
} }
while( --d ); while( --dp );
}// for x }// for x
//extract optimal way and fill disparity image //extract optimal way and fill disparity image

View File

@ -539,8 +539,7 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
/* Buffer size determination */ /* Buffer size determination */
if( ioFlags ) if( ioFlags )
{ {
int size = icvDefaultBufferSize(); ioBufSize = MIN( icvDefaultBufferSize(), n );
ioBufSize = MIN( size, n );
} }
/* memory allocation (if necesseay) */ /* memory allocation (if necesseay) */
@ -695,13 +694,13 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
for( igr = 0; igr < ngr; igr++ ) for( igr = 0; igr < ngr; igr++ )
{ {
int i, io, ie, imin = igr * nio, imax = imin + nio; int io, ie, imin = igr * nio, imax = imin + nio;
if( imax > m1 ) if( imax > m1 )
imax = m1; imax = m1;
for( i = 0; i < eigSize.width * (imax - imin); i++ ) for(int k = 0; k < eigSize.width * (imax - imin); k++ )
((float *) buffer)[i] = 0.f; ((float *) buffer)[k] = 0.f;
for( io = 0; io < nObjects; io++ ) for( io = 0; io < nObjects; io++ )
{ {

View File

@ -202,8 +202,8 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
{ {
CV_Assert(_sample_idx.empty()); CV_Assert(_sample_idx.empty());
Mat prbs, weights, means, logLikelihoods; Mat prbs, weights, means, logLikelihoods;
std::vector<Mat> covsHdrs; std::vector<Mat> covshdrs;
init_params(_params, prbs, weights, means, covsHdrs); init_params(_params, prbs, weights, means, covshdrs);
emObj = EM(_params.nclusters, _params.cov_mat_type, _params.term_crit); emObj = EM(_params.nclusters, _params.cov_mat_type, _params.term_crit);
bool isOk = false; bool isOk = false;
@ -211,7 +211,7 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
isOk = emObj.train(_samples, isOk = emObj.train(_samples,
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs); logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
else if( _params.start_step == EM::START_E_STEP ) else if( _params.start_step == EM::START_E_STEP )
isOk = emObj.trainE(_samples, means, covsHdrs, weights, isOk = emObj.trainE(_samples, means, covshdrs, weights,
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs); logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
else if( _params.start_step == EM::START_M_STEP ) else if( _params.start_step == EM::START_M_STEP )
isOk = emObj.trainM(_samples, prbs, isOk = emObj.trainM(_samples, prbs,

View File

@ -117,11 +117,11 @@ static void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStora
for(cnt_cur=0; cnt_cur<clasters->total; ++cnt_cur) for(cnt_cur=0; cnt_cur<clasters->total; ++cnt_cur)
{ {
CvRect rect; CvRect rect;
CvSeq* cnt; CvSeq* cont;
int k = *(int*)cvGetSeqElem( clasters, cnt_cur ); int k = *(int*)cvGetSeqElem( clasters, cnt_cur );
if(k!=claster_cur) continue; if(k!=claster_cur) continue;
cnt = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur ); cont = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur );
rect = ((CvContour*)cnt)->rect; rect = ((CvContour*)cont)->rect;
if(rect_res.height<0) if(rect_res.height<0)
{ {
@ -399,7 +399,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
if(Good) if(Good)
do{ /* For each configuration: */ do{ /* For each configuration: */
CvBlob* pBL[EBD_FRAME_NUM]; CvBlob* pBL[EBD_FRAME_NUM];
int Good = 1; int good = 1;
double Error = 0; double Error = 0;
CvBlob* pBNew = m_pBlobLists[EBD_FRAME_NUM-1]->GetBlob(pBLIndex[EBD_FRAME_NUM-1]); CvBlob* pBNew = m_pBlobLists[EBD_FRAME_NUM-1]->GetBlob(pBLIndex[EBD_FRAME_NUM-1]);
@ -408,7 +408,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
Count++; Count++;
/* Check intersection last blob with existed: */ /* Check intersection last blob with existed: */
if(Good && pOldBlobList) if(good && pOldBlobList)
{ /* Check intersection last blob with existed: */ { /* Check intersection last blob with existed: */
int k; int k;
for(k=pOldBlobList->GetBlobNum(); k>0; --k) for(k=pOldBlobList->GetBlobNum(); k>0; --k)
@ -416,22 +416,22 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
CvBlob* pBOld = pOldBlobList->GetBlob(k-1); CvBlob* pBOld = pOldBlobList->GetBlob(k-1);
if((fabs(pBOld->x-pBNew->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pBNew))) && if((fabs(pBOld->x-pBNew->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pBNew))) &&
(fabs(pBOld->y-pBNew->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pBNew)))) (fabs(pBOld->y-pBNew->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pBNew))))
Good = 0; good = 0;
} }
} /* Check intersection last blob with existed. */ } /* Check intersection last blob with existed. */
/* Check distance to image border: */ /* Check distance to image border: */
if(Good) if(good)
{ /* Check distance to image border: */ { /* Check distance to image border: */
CvBlob* pB = pBNew; CvBlob* pB = pBNew;
float dx = MIN(pB->x,S.width-pB->x)/CV_BLOB_RX(pB); float dx = MIN(pB->x,S.width-pB->x)/CV_BLOB_RX(pB);
float dy = MIN(pB->y,S.height-pB->y)/CV_BLOB_RY(pB); float dy = MIN(pB->y,S.height-pB->y)/CV_BLOB_RY(pB);
if(dx < 1.1 || dy < 1.1) Good = 0; if(dx < 1.1 || dy < 1.1) good = 0;
} /* Check distance to image border. */ } /* Check distance to image border. */
/* Check uniform motion: */ /* Check uniform motion: */
if(Good) if(good)
{ {
int N = EBD_FRAME_NUM; int N = EBD_FRAME_NUM;
float sum[2] = {0,0}; float sum[2] = {0,0};
@ -466,13 +466,13 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
if( Error > S.width*0.01 || if( Error > S.width*0.01 ||
fabs(a[0])>S.width*0.1 || fabs(a[0])>S.width*0.1 ||
fabs(a[1])>S.height*0.1) fabs(a[1])>S.height*0.1)
Good = 0; good = 0;
} /* Check configuration. */ } /* Check configuration. */
/* New best trajectory: */ /* New best trajectory: */
if(Good && (BestError == -1 || BestError > Error)) if(good && (BestError == -1 || BestError > Error))
{ {
for(i=0; i<EBD_FRAME_NUM; ++i) for(i=0; i<EBD_FRAME_NUM; ++i)
{ {

View File

@ -2729,8 +2729,7 @@ static int icvSelectBestRt( int numImages,
/* allocate memory for 64d data */ /* allocate memory for 64d data */
int totalNum = 0; int totalNum = 0;
int i; for(int i = 0; i < numImages; i++ )
for( i = 0; i < numImages; i++ )
{ {
totalNum += numPoints[i]; totalNum += numPoints[i];
} }
@ -2828,8 +2827,7 @@ static int icvSelectBestRt( int numImages,
points2 = (CvPoint3D64d*)calloc(numberPnt,sizeof(CvPoint3D64d)); points2 = (CvPoint3D64d*)calloc(numberPnt,sizeof(CvPoint3D64d));
/* Transform object points to first camera position */ /* Transform object points to first camera position */
int i; for(int i = 0; i < numberPnt; i++ )
for( i = 0; i < numberPnt; i++ )
{ {
/* Create second camera point */ /* Create second camera point */
CvPoint3D64d tmpPoint; CvPoint3D64d tmpPoint;
@ -2859,8 +2857,6 @@ static int icvSelectBestRt( int numImages,
dy = tmpPoint2.y - points1[i].y; dy = tmpPoint2.y - points1[i].y;
dz = tmpPoint2.z - points1[i].z; dz = tmpPoint2.z - points1[i].z;
err = sqrt(dx*dx + dy*dy + dz*dz);*/ err = sqrt(dx*dx + dy*dy + dz*dz);*/
} }
#if 0 #if 0
@ -3094,8 +3090,7 @@ int icvComputeRestStereoParams(CvStereoCamera *stereoparams)
corns[3].x = 0; corns[3].x = 0;
corns[3].y = (float)(stereoparams->camera[0]->imgSize[1]-1); corns[3].y = (float)(stereoparams->camera[0]->imgSize[1]-1);
int i; for(int i = 0; i < 4; i++ )
for( i = 0; i < 4; i++ )
{ {
/* For first camera */ /* For first camera */
icvConvertWarpCoordinates( stereoparams->coeffs[0], icvConvertWarpCoordinates( stereoparams->coeffs[0],

View File

@ -326,18 +326,18 @@ void FaceDetection::FindCandidats()
for (int j = 0; j < m_seqRects->total; j++) for (int j = 0; j < m_seqRects->total; j++)
{ {
CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, j); CvContourRect* prect = (CvContourRect*)cvGetSeqElem(m_seqRects, j);
if ( !bInvalidRect1 ) if ( !bInvalidRect1 )
{ {
lpRect1 = NULL; lpRect1 = NULL;
lpRect1 = new CvRect(); lpRect1 = new CvRect();
*lpRect1 = pRect->r; *lpRect1 = prect->r;
}else }else
{ {
delete lpRect1; delete lpRect1;
lpRect1 = new CvRect(); lpRect1 = new CvRect();
*lpRect1 = pRect->r; *lpRect1 = prect->r;
} }

View File

@ -1163,7 +1163,7 @@ icvViterbiSegmentation( int num_states, int /*num_obs*/, CvMatr32f transP,
if ( m_HMMType == _CV_CAUSAL ) //causal model if ( m_HMMType == _CV_CAUSAL ) //causal model
{ {
int t,j; int t;
for (t = 1 ; t < m_maxNumObs; t++) for (t = 1 ; t < m_maxNumObs; t++)
{ {
@ -1198,7 +1198,6 @@ icvViterbiSegmentation( int num_states, int /*num_obs*/, CvMatr32f transP,
{ {
for (j = 0; j < num_states; j++) for (j = 0; j < num_states; j++)
{ {
int i;
m_Gamma[ t*num_states + j] = m_Gamma[(t-1) * num_states + 0] + m_a[0*num_states+j]; m_Gamma[ t*num_states + j] = m_Gamma[(t-1) * num_states + 0] + m_a[0*num_states+j];
m_csi[t *num_states + j] = 0; m_csi[t *num_states + j] = 0;
@ -1453,7 +1452,6 @@ icvEstimateHMMStateParams( CvImgObsInfo** obs_info_array, int num_img, CvEHMM* h
for (m = 0; m < state->num_mix; m++) for (m = 0; m < state->num_mix; m++)
{ {
int k;
CvVect32f mu = state->mu + m * vect_len; CvVect32f mu = state->mu + m * vect_len;
CvVect32f invar = state->inv_var + m * vect_len; CvVect32f invar = state->inv_var + m * vect_len;

View File

@ -182,13 +182,13 @@ void CvImage::show( const char* window_name )
/////////////////////////////// CvMatrix implementation ////////////////////////////////// /////////////////////////////// CvMatrix implementation //////////////////////////////////
CvMatrix::CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data ) CvMatrix::CvMatrix( int _rows, int _cols, int _type, CvMemStorage* storage, bool alloc_data )
{ {
if( storage ) if( storage )
{ {
matrix = (CvMat*)cvMemStorageAlloc( storage, sizeof(*matrix) ); matrix = (CvMat*)cvMemStorageAlloc( storage, sizeof(*matrix) );
cvInitMatHeader( matrix, rows, cols, type, alloc_data ? cvInitMatHeader( matrix, _rows, _cols, _type, alloc_data ?
cvMemStorageAlloc( storage, rows*cols*CV_ELEM_SIZE(type) ) : 0 ); cvMemStorageAlloc( storage, _rows*_cols*CV_ELEM_SIZE(_type) ) : 0 );
} }
else else
matrix = 0; matrix = 0;

View File

@ -48,10 +48,6 @@
#include "_kdtree.hpp" #include "_kdtree.hpp"
#include "_featuretree.h" #include "_featuretree.h"
#if defined _MSC_VER && _MSC_VER >= 1400
#pragma warning(disable:4996) // suppress "function call with parameters may be unsafe" in std::copy
#endif
class CvKDTreeWrap : public CvFeatureTree { class CvKDTreeWrap : public CvFeatureTree {
template <class __scalartype, int __cvtype> template <class __scalartype, int __cvtype>
struct deref { struct deref {

View File

@ -135,13 +135,11 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
} }
/* ----- End test ----- */ /* ----- End test ----- */
int i;
/* Allocate memory for derivates */ /* Allocate memory for derivates */
double p[12]; double p[12];
/* Copy projection matrix */ /* Copy projection matrix */
for( i = 0; i < 12; i++ ) for(int i = 0; i < 12; i++ )
{ {
p[i] = cvmGet(projMatr,i/4,i%4); p[i] = cvmGet(projMatr,i/4,i%4);
} }
@ -168,7 +166,6 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7]; piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7];
piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11]; piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11];
int i;
/* fill derivate by point */ /* fill derivate by point */
double tmp3 = 1/(piX[2]*piX[2]); double tmp3 = 1/(piX[2]*piX[2]);
@ -177,7 +174,7 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
double tmp2 = -piX[1]*tmp3; double tmp2 = -piX[1]*tmp3;
/* fill derivate by projection matrix */ /* fill derivate by projection matrix */
for( i = 0; i < 4; i++ ) for(int i = 0; i < 4; i++ )
{ {
/* derivate for x */ /* derivate for x */
cvmSet(derivProj,currVisPoint*2,i,X[i]/piX[2]);//x' p1i cvmSet(derivProj,currVisPoint*2,i,X[i]/piX[2]);//x' p1i
@ -291,8 +288,7 @@ static void icvComputeDerivatePoints(CvMat *points4D,CvMat *projMatr, CvMat *pre
/* Compute derivates by points */ /* Compute derivates by points */
double p[12]; double p[12];
int i; for(int i = 0; i < 12; i++ )
for( i = 0; i < 12; i++ )
{ {
p[i] = cvmGet(projMatr,i/4,i%4); p[i] = cvmGet(projMatr,i/4,i%4);
} }
@ -316,13 +312,11 @@ static void icvComputeDerivatePoints(CvMat *points4D,CvMat *projMatr, CvMat *pre
piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7]; piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7];
piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11]; piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11];
int i,j;
double tmp3 = 1/(piX[2]*piX[2]); double tmp3 = 1/(piX[2]*piX[2]);
for( j = 0; j < 2; j++ )//for x and y for(int j = 0; j < 2; j++ )//for x and y
{ {
for( i = 0; i < 4; i++ )// for X,Y,Z,W for(int i = 0; i < 4; i++ )// for X,Y,Z,W
{ {
cvmSet( derivPoint, cvmSet( derivPoint,
j, currVisPoint*4+i, j, currVisPoint*4+i,
@ -863,26 +857,25 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
double point3D_dat[3]; double point3D_dat[3];
point3D = cvMat(3,1,CV_64F,point3D_dat); point3D = cvMat(3,1,CV_64F,point3D_dat);
int currPoint;
int numVis = 0; int numVis = 0;
double totalError = 0; double totalError = 0;
for( currPoint = 0; currPoint < numPoints; currPoint++ ) for(int curPoint = 0; curPoint < numPoints; curPoint++ )
{ {
if( cvmGet(presPoints[currImage],0,currPoint) > 0) if( cvmGet(presPoints[currImage],0,curPoint) > 0)
{ {
double dx,dy; double dx,dy;
cvGetCol(points4D,&point4D,currPoint); cvGetCol(points4D,&point4D,curPoint);
cvmMul(projMatrs[currImage],&point4D,&point3D); cvmMul(projMatrs[currImage],&point4D,&point3D);
double w = point3D_dat[2]; double w = point3D_dat[2];
double x = point3D_dat[0] / w; double x = point3D_dat[0] / w;
double y = point3D_dat[1] / w; double y = point3D_dat[1] / w;
dx = cvmGet(projPoints[currImage],0,currPoint) - x; dx = cvmGet(projPoints[currImage],0,curPoint) - x;
dy = cvmGet(projPoints[currImage],1,currPoint) - y; dy = cvmGet(projPoints[currImage],1,curPoint) - y;
if( projError ) if( projError )
{ {
cvmSet(projError[currImage],0,currPoint,dx); cvmSet(projError[currImage],0,curPoint,dx);
cvmSet(projError[currImage],1,currPoint,dy); cvmSet(projError[currImage],1,curPoint,dy);
} }
totalError += sqrt(dx*dx+dy*dy); totalError += sqrt(dx*dx+dy*dy);
numVis++; numVis++;
@ -1147,10 +1140,8 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
CV_CALL( changeVectorX_points4D = cvCreateMat(4,numPoints,CV_64F)); CV_CALL( changeVectorX_points4D = cvCreateMat(4,numPoints,CV_64F));
CV_CALL( changeVectorX_projMatrs = cvCreateMat(3,4,CV_64F)); CV_CALL( changeVectorX_projMatrs = cvCreateMat(3,4,CV_64F));
int currImage;
/* ----- Test input params ----- */ /* ----- Test input params ----- */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
/* Test size of input initial and result projection matrices */ /* Test size of input initial and result projection matrices */
if( !CV_IS_MAT(projMatrs[currImage]) ) if( !CV_IS_MAT(projMatrs[currImage]) )
@ -1194,7 +1185,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
/* ----- End test ----- */ /* ----- End test ----- */
/* Copy projection matrices to vectorX0 */ /* Copy projection matrices to vectorX0 */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
CV_CALL( vectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F)); CV_CALL( vectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F));
CV_CALL( newVectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F)); CV_CALL( newVectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F));
@ -1230,7 +1221,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
CV_CALL( workMatrsInvVi[i] = cvCreateMat(4,4,CV_64F) ); CV_CALL( workMatrsInvVi[i] = cvCreateMat(4,4,CV_64F) );
} }
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
CV_CALL( matrsUk[currImage] = cvCreateMat(12,12,CV_64F) ); CV_CALL( matrsUk[currImage] = cvCreateMat(12,12,CV_64F) );
CV_CALL( workMatrsUk[currImage] = cvCreateMat(12,12,CV_64F) ); CV_CALL( workMatrsUk[currImage] = cvCreateMat(12,12,CV_64F) );
@ -1299,7 +1290,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
/* Compute error with observed value and computed projection */ /* Compute error with observed value and computed projection */
double prevError; double prevError;
prevError = 0; prevError = 0;
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]); cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
double currNorm = cvNorm(errorProjPoints[currImage]); double currNorm = cvNorm(errorProjPoints[currImage]);
@ -1325,8 +1316,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
fprintf(file,"projection errors\n"); fprintf(file,"projection errors\n");
/* Print all proejction errors */ /* Print all proejction errors */
int currImage; for(int currImage = 0; currImage < numImages; currImage++)
for( currImage = 0; currImage < numImages; currImage++)
{ {
fprintf(file,"\nImage=%d\n",currImage); fprintf(file,"\nImage=%d\n",currImage);
int numPn = errorProjPoints[currImage]->cols; int numPn = errorProjPoints[currImage]->cols;
@ -1419,7 +1409,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
} }
#endif #endif
/* Copy matrices Uk to work matrices Uk */ /* Copy matrices Uk to work matrices Uk */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
cvCopy(matrsUk[currImage],workMatrsUk[currImage]); cvCopy(matrsUk[currImage],workMatrsUk[currImage]);
} }
@ -1459,7 +1449,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
{ {
cvCopy(matrsVi[currV],workMatrVi); cvCopy(matrsVi[currV],workMatrVi);
for( int i = 0; i < 4; i++ ) for( i = 0; i < 4; i++ )
{ {
cvmSet(workMatrVi,i,i,cvmGet(matrsVi[currV],i,i)*(1+alpha) ); cvmSet(workMatrVi,i,i,cvmGet(matrsVi[currV],i,i)*(1+alpha) );
} }
@ -1468,7 +1458,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
} }
/* Add alpha to matrUk and make matrix workMatrsUk */ /* Add alpha to matrUk and make matrix workMatrsUk */
for( currImage = 0; currImage< numImages; currImage++ ) for(int currImage = 0; currImage< numImages; currImage++ )
{ {
for( i = 0; i < 12; i++ ) for( i = 0; i < 12; i++ )
@ -1485,7 +1475,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
int currRowV; int currRowV;
for( currRowV = 0; currRowV < 4; currRowV++ ) for( currRowV = 0; currRowV < 4; currRowV++ )
{ {
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
for( int currCol = 0; currCol < 12; currCol++ )/* For each column of transposed matrix W */ for( int currCol = 0; currCol < 12; currCol++ )/* For each column of transposed matrix W */
{ {
@ -1506,7 +1496,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
cvmMul(matrW,matrTmpSys1,matrSysDeltaP); cvmMul(matrW,matrTmpSys1,matrSysDeltaP);
/* need to compute U-matrTmpSys2. But we compute matTmpSys2-U */ /* need to compute U-matrTmpSys2. But we compute matTmpSys2-U */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
CvMat subMatr; CvMat subMatr;
cvGetSubRect(matrSysDeltaP,&subMatr,cvRect(currImage*12,currImage*12,12,12)); cvGetSubRect(matrSysDeltaP,&subMatr,cvRect(currImage*12,currImage*12,12,12));
@ -1536,8 +1526,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
FILE* file; FILE* file;
file = fopen( TRACK_BUNDLE_FILE_DELTAP ,"w"); file = fopen( TRACK_BUNDLE_FILE_DELTAP ,"w");
int currImage; for(int currImage = 0; currImage < numImages; currImage++ )
for( currImage = 0; currImage < numImages; currImage++ )
{ {
fprintf(file,"\nImage=%d\n",currImage); fprintf(file,"\nImage=%d\n",currImage);
int i; int i;
@ -1576,7 +1565,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
/* We know delta and compute new value of vector X: nextVectX = vectX + deltas */ /* We know delta and compute new value of vector X: nextVectX = vectX + deltas */
/* Compute new P */ /* Compute new P */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
@ -1604,7 +1593,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
icvProjPointsStatusFunc(numImages, newVectorX_points4D, newVectorX_projMatrs, pointsPres, projVisPoints); icvProjPointsStatusFunc(numImages, newVectorX_points4D, newVectorX_projMatrs, pointsPres, projVisPoints);
/* Compute error with observed value and computed projection */ /* Compute error with observed value and computed projection */
double newError = 0; double newError = 0;
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]); cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
double currNorm = cvNorm(errorProjPoints[currImage]); double currNorm = cvNorm(errorProjPoints[currImage]);
@ -1643,8 +1632,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
/* Print all projection errors */ /* Print all projection errors */
#if 0 #if 0
fprintf(file,"projection errors\n"); fprintf(file,"projection errors\n");
int currImage; for(int currImage = 0; currImage < numImages; currImage++)
for( currImage = 0; currImage < numImages; currImage++)
{ {
fprintf(file,"\nImage=%d\n",currImage); fprintf(file,"\nImage=%d\n",currImage);
int numPn = errorProjPoints[currImage]->cols; int numPn = errorProjPoints[currImage]->cols;
@ -1676,7 +1664,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
double currNorm1 = 0; double currNorm1 = 0;
double currNorm2 = 0; double currNorm2 = 0;
/* compute norm for projection matrices */ /* compute norm for projection matrices */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
currNorm1 = cvNorm(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]); currNorm1 = cvNorm(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]);
currNorm2 = cvNorm(newVectorX_projMatrs[currImage]); currNorm2 = cvNorm(newVectorX_projMatrs[currImage]);
@ -1713,7 +1701,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
} }
alpha /= 10; alpha /= 10;
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
cvCopy(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]); cvCopy(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]);
} }
@ -1745,7 +1733,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
/*--------------------------------------------*/ /*--------------------------------------------*/
/* Optimization complete copy computed params */ /* Optimization complete copy computed params */
/* Copy projection matrices */ /* Copy projection matrices */
for( currImage = 0; currImage < numImages; currImage++ ) for(int currImage = 0; currImage < numImages; currImage++ )
{ {
cvCopy(newVectorX_projMatrs[currImage],resultProjMatrs[currImage]); cvCopy(newVectorX_projMatrs[currImage],resultProjMatrs[currImage]);
} }

View File

@ -423,8 +423,8 @@ namespace cv{
} }
cvAdd(pca_descriptors[0].GetPatch(i), m_samples[i], m_samples[i]); cvAdd(pca_descriptors[0].GetPatch(i), m_samples[i], m_samples[i]);
double sum = cvSum(m_samples[i]).val[0]; double sm = cvSum(m_samples[i]).val[0];
cvConvertScale(m_samples[i], m_samples[i], 1.0/sum); cvConvertScale(m_samples[i], m_samples[i], 1.0/sm);
#if 0 #if 0
IplImage* test = cvCreateImage(cvSize(12, 12), IPL_DEPTH_8U, 1); IplImage* test = cvCreateImage(cvSize(12, 12), IPL_DEPTH_8U, 1);
@ -1671,7 +1671,6 @@ namespace cv{
if (! m_pca_descriptors[i].ReadByName(fn, buf)) if (! m_pca_descriptors[i].ReadByName(fn, buf))
{ {
char buf[1024];
sprintf(buf, "descriptor for pca component %d", i); sprintf(buf, "descriptor for pca component %d", i);
m_pca_descriptors[i].ReadByName(fn, buf); m_pca_descriptors[i].ReadByName(fn, buf);
} }

View File

@ -41,10 +41,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -277,12 +277,12 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
curr_ts++; curr_ts++;
while( norphans > 0 ) while( norphans > 0 )
{ {
GCVtx* v = orphans[--norphans]; GCVtx* v1 = orphans[--norphans];
int d, min_dist = INT_MAX; int d, min_dist = INT_MAX;
e0 = 0; e0 = 0;
vt = v->t; vt = v1->t;
for( ei = v->first; ei != 0; ei = edges[ei].next ) for( ei = v1->first; ei != 0; ei = edges[ei].next )
{ {
if( edges[ei^(vt^1)].weight == 0 ) if( edges[ei^(vt^1)].weight == 0 )
continue; continue;
@ -329,16 +329,16 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
} }
} }
if( (v->parent = e0) > 0 ) if( (v1->parent = e0) > 0 )
{ {
v->ts = curr_ts; v1->ts = curr_ts;
v->dist = min_dist; v1->dist = min_dist;
continue; continue;
} }
/* no parent is found */ /* no parent is found */
v->ts = 0; v1->ts = 0;
for( ei = v->first; ei != 0; ei = edges[ei].next ) for( ei = v1->first; ei != 0; ei = edges[ei].next )
{ {
u = edges[ei].dst; u = edges[ei].dst;
ej = u->parent; ej = u->parent;
@ -349,7 +349,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
u->next = nilNode; u->next = nilNode;
last = last->next = u; last = last->next = u;
} }
if( ej > 0 && edges[ej].dst == v ) if( ej > 0 && edges[ej].dst == v1 )
{ {
if( norphans >= maxOrphans ) if( norphans >= maxOrphans )
maxOrphans = icvGCResizeOrphansBuf( orphans, norphans ); maxOrphans = icvGCResizeOrphansBuf( orphans, norphans );
@ -820,12 +820,12 @@ static int64 icvAlphaExpand( int64 Eprev, int alpha, CvStereoGCState* state, CvS
GCVtx** pright = pright0 + pstep*y; GCVtx** pright = pright0 + pstep*y;
for( x = 0; x < cols; x++ ) for( x = 0; x < cols; x++ )
{ {
GCVtx* var = pleft[x]; GCVtx* var2 = pleft[x];
if( var && var->parent && var->t ) if( var2 && var2->parent && var2->t )
dleft[x] = (short)alpha; dleft[x] = (short)alpha;
var = pright[x]; var2 = pright[x];
if( var && var->parent && var->t ) if( var2 && var2->parent && var2->t )
dright[x] = (short)-alpha; dright[x] = (short)-alpha;
} }
} }

View File

@ -500,15 +500,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
int y0=0, y1=pFG->height-1; int y0=0, y1=pFG->height-1;
for(y0=0; y0<pFG->height; ++y0) for(y0=0; y0<pFG->height; ++y0)
{ {
CvMat m; CvMat tmp;
CvScalar s = cvSum(cvGetRow(pFG, &m, y0)); CvScalar s = cvSum(cvGetRow(pFG, &tmp, y0));
if(s.val[0] > 255*7) break; if(s.val[0] > 255*7) break;
} }
for(y1=pFG->height-1; y1>0; --y1) for(y1=pFG->height-1; y1>0; --y1)
{ {
CvMat m; CvMat tmp;
CvScalar s = cvSum(cvGetRow(pFG, &m, y1)); CvScalar s = cvSum(cvGetRow(pFG, &tmp, y1));
if(s.val[0] > 255*7) break; if(s.val[0] > 255*7) break;
} }
@ -573,8 +573,8 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
p->FrameNum = cvReadIntByName( fs, node, "FrameNum", p->FrameNum ); p->FrameNum = cvReadIntByName( fs, node, "FrameNum", p->FrameNum );
p->FrameNum = cvReadIntByName( fs, node, "Dur", p->FrameNum ); p->FrameNum = cvReadIntByName( fs, node, "Dur", p->FrameNum );
{ {
int LastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 ); int lastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 );
p->FrameNum = MIN(p->FrameNum,LastFrame - p->FrameBegin+1); p->FrameNum = MIN(p->FrameNum,lastFrame - p->FrameBegin+1);
} }
icvTestSeqAllocTrans(p); icvTestSeqAllocTrans(p);
@ -621,8 +621,8 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
if(pTransSeq&&KeyFrameNum>1) if(pTransSeq&&KeyFrameNum>1)
{ {
int i0,i1,i; int i0,i1;
for(i=0; i<KeyFrameNum; ++i) for(int i=0; i<KeyFrameNum; ++i)
{ {
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i); CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i);
KeyFrames[i] = cvReadIntByName(fs,pTN,"frame",-1); KeyFrames[i] = cvReadIntByName(fs,pTN,"frame",-1);
@ -633,14 +633,12 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
for(i0=0, i1=1; i1<KeyFrameNum;) for(i0=0, i1=1; i1<KeyFrameNum;)
{ {
int i;
for(i1=i0+1; i1<KeyFrameNum && KeyFrames[i1]<0; i1++); for(i1=i0+1; i1<KeyFrameNum && KeyFrames[i1]<0; i1++);
assert(i1<KeyFrameNum); assert(i1<KeyFrameNum);
assert(i1>i0); assert(i1>i0);
for(i=i0+1; i<i1; ++i) for(int i=i0+1; i<i1; ++i)
{ {
KeyFrames[i] = cvRound(KeyFrames[i0] + (float)(i-i0)*(float)(KeyFrames[i1] - KeyFrames[i0])/(float)(i1-i0)); KeyFrames[i] = cvRound(KeyFrames[i0] + (float)(i-i0)*(float)(KeyFrames[i1] - KeyFrames[i0])/(float)(i1-i0));
} }
@ -665,9 +663,9 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
{ /* Only one transform record: */ { /* Only one transform record: */
int i; int i;
double val; double val;
CvFileNode* node = cvGetFileNodeByName( fs, pTN,name); CvFileNode* fnode = cvGetFileNodeByName( fs, pTN,name);
if(node == NULL) continue; if(fnode == NULL) continue;
val = cvReadReal(node,defv); val = cvReadReal(fnode,defv);
for(i=0; i<p->TransNum; ++i) for(i=0; i<p->TransNum; ++i)
{ {
@ -683,15 +681,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
double v0; double v0;
double v1; double v1;
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,0); CvFileNode* pTN1 = (CvFileNode*)cvGetSeqElem(pTransSeq,0);
v0 = cvReadRealByName(fs, pTN,name,defv); v0 = cvReadRealByName(fs, pTN1,name,defv);
for(i1=1,i0=0; i1<KeyFrameNum; ++i1) for(i1=1,i0=0; i1<KeyFrameNum; ++i1)
{ {
int f0,f1; int f0,f1;
int i; int i;
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i1); CvFileNode* pTN2 = (CvFileNode*)cvGetSeqElem(pTransSeq,i1);
CvFileNode* pVN = cvGetFileNodeByName(fs,pTN,name); CvFileNode* pVN = cvGetFileNodeByName(fs,pTN2,name);
if(pVN)v1 = cvReadReal(pVN,defv); if(pVN)v1 = cvReadReal(pVN,defv);
else if(pVN == NULL && i1 == KeyFrameNum-1) v1 = defv; else if(pVN == NULL && i1 == KeyFrameNum-1) v1 = defv;

View File

@ -861,8 +861,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
projMatrs[1] = projMatr2; projMatrs[1] = projMatr2;
projMatrs[2] = projMatr3; projMatrs[2] = projMatr3;
int i; for(int i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
{ {
if( projMatrs[i]->cols != 4 || projMatrs[i]->rows != 3 ) if( projMatrs[i]->cols != 4 || projMatrs[i]->rows != 3 )
{ {
@ -870,7 +869,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
} }
} }
for( i = 0; i < 3; i++ ) for(int i = 0; i < 3; i++ )
{ {
if( points[i]->rows != 2) if( points[i]->rows != 2)
{ {
@ -951,10 +950,9 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
icvProject4DPoints(recPoints4D,&proj6[2],tmpProjPoints[2]); icvProject4DPoints(recPoints4D,&proj6[2],tmpProjPoints[2]);
/* Compute distances and number of good points (inliers) */ /* Compute distances and number of good points (inliers) */
int i;
int currImage; int currImage;
numGoodPoints = 0; numGoodPoints = 0;
for( i = 0; i < numPoints; i++ ) for(int i = 0; i < numPoints; i++ )
{ {
double dist=-1; double dist=-1;
dist = 0; dist = 0;
@ -1051,7 +1049,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
CvMat *optStatus; CvMat *optStatus;
optStatus = cvCreateMat(1,numPoints,CV_64F); optStatus = cvCreateMat(1,numPoints,CV_64F);
int testNumber = 0; int testNumber = 0;
for( i=0;i<numPoints;i++ ) for(int i=0;i<numPoints;i++ )
{ {
cvmSet(optStatus,0,i,(double)bestFlags[i]); cvmSet(optStatus,0,i,(double)bestFlags[i]);
testNumber += bestFlags[i]; testNumber += bestFlags[i];
@ -1063,7 +1061,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
CvMat *gPresPoints; CvMat *gPresPoints;
gPresPoints = cvCreateMat(1,maxGoodPoints,CV_64F); gPresPoints = cvCreateMat(1,maxGoodPoints,CV_64F);
for( i = 0; i < maxGoodPoints; i++) for(int i = 0; i < maxGoodPoints; i++)
{ {
cvmSet(gPresPoints,0,i,1.0); cvmSet(gPresPoints,0,i,1.0);
} }
@ -1130,7 +1128,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
int currImage; int currImage;
finalGoodPoints = 0; finalGoodPoints = 0;
for( i = 0; i < numPoints; i++ ) for(int i = 0; i < numPoints; i++ )
{ {
double dist=-1; double dist=-1;
/* Choose max distance for each of three points */ /* Choose max distance for each of three points */
@ -1178,7 +1176,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
/* Create status */ /* Create status */
CvMat *optStatus; CvMat *optStatus;
optStatus = cvCreateMat(1,numPoints,CV_64F); optStatus = cvCreateMat(1,numPoints,CV_64F);
for( i=0;i<numPoints;i++ ) for(int i=0;i<numPoints;i++ )
{ {
cvmSet(optStatus,0,i,(double)bestFlags[i]); cvmSet(optStatus,0,i,(double)bestFlags[i]);
} }
@ -1236,7 +1234,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
int currImage; int currImage;
finalGoodPoints = 0; finalGoodPoints = 0;
for( i = 0; i < numPoints; i++ ) for(int i = 0; i < numPoints; i++ )
{ {
double dist=-1; double dist=-1;
/* Choose max distance for each of three points */ /* Choose max distance for each of three points */
@ -1662,15 +1660,12 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
matrA_dat[7] = s; matrA_dat[7] = s;
matrA_dat[8] = -(p+q+r+s+t); matrA_dat[8] = -(p+q+r+s+t);
CvMat matrU;
CvMat matrW; CvMat matrW;
CvMat matrV; CvMat matrV;
double matrU_dat[3*3];
double matrW_dat[3*3]; double matrW_dat[3*3];
double matrV_dat[3*3]; double matrV_dat[3*3];
matrU = cvMat(3,3,CV_64F,matrU_dat);
matrW = cvMat(3,3,CV_64F,matrW_dat); matrW = cvMat(3,3,CV_64F,matrW_dat);
matrV = cvMat(3,3,CV_64F,matrV_dat); matrV = cvMat(3,3,CV_64F,matrV_dat);
@ -1731,27 +1726,24 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
matrK_dat[4*6+5] = -B2; matrK_dat[4*6+5] = -B2;
matrK_dat[5*6+5] = -C2; matrK_dat[5*6+5] = -C2;
CvMat matrU; CvMat matrW1;
CvMat matrW; CvMat matrV1;
CvMat matrV;
double matrU_dat[36]; double matrW_dat1[36];
double matrW_dat[36]; double matrV_dat1[36];
double matrV_dat[36];
matrU = cvMat(6,6,CV_64F,matrU_dat); matrW1 = cvMat(6,6,CV_64F,matrW_dat1);
matrW = cvMat(6,6,CV_64F,matrW_dat); matrV1 = cvMat(6,6,CV_64F,matrV_dat1);
matrV = cvMat(6,6,CV_64F,matrV_dat);
/* From svd we need just last vector of V or last row V' */ /* From svd we need just last vector of V or last row V' */
/* We get transposed matrixes U and V */ /* We get transposed matrixes U and V */
cvSVD(&matrK,&matrW,0,&matrV,CV_SVD_V_T); cvSVD(&matrK,&matrW1,0,&matrV1,CV_SVD_V_T);
a = matrV_dat[6*5+0]; a = matrV_dat1[6*5+0];
b = matrV_dat[6*5+1]; b = matrV_dat1[6*5+1];
c = matrV_dat[6*5+2]; c = matrV_dat1[6*5+2];
d = matrV_dat[6*5+3]; d = matrV_dat1[6*5+3];
/* we don't need last two coefficients. Because it just a k1,k2 */ /* we don't need last two coefficients. Because it just a k1,k2 */
cvmSet(projMatrCoefs,0,0,a); cvmSet(projMatrCoefs,0,0,a);

View File

@ -137,7 +137,7 @@ struct CvFaceTracker
if (NULL != mstgContours) if (NULL != mstgContours)
cvReleaseMemStorage(&mstgContours); cvReleaseMemStorage(&mstgContours);
}; };
int Init(CvRect* pRects, IplImage* imgGray) int Init(CvRect* pRects, IplImage* imgray)
{ {
for (int i = 0; i < NUM_FACE_ELEMENTS; i++) for (int i = 0; i < NUM_FACE_ELEMENTS; i++)
{ {
@ -146,10 +146,10 @@ struct CvFaceTracker
ptTempl[i] = face[i].ptCenter; ptTempl[i] = face[i].ptCenter;
rTempl[i] = face[i].r; rTempl[i] = face[i].r;
} }
imgGray = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1); imgray = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
imgThresh = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1); imgThresh = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
mstgContours = cvCreateMemStorage(); mstgContours = cvCreateMemStorage();
if ((NULL == imgGray) || if ((NULL == imgray) ||
(NULL == imgThresh) || (NULL == imgThresh) ||
(NULL == mstgContours)) (NULL == mstgContours))
return FALSE; return FALSE;

View File

@ -593,11 +593,11 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 ) for( int i = 0; i < (int)fn.size(); i+=3 )
{ {
string name = fn[i]; string nm = fn[i];
DatasetParams params; DatasetParams params;
string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
datasetsParams[name] = params; datasetsParams[nm] = params;
} }
return cvtest::TS::OK; return cvtest::TS::OK;
} }

View File

@ -41,10 +41,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4514 4710 4711 4710 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -88,10 +88,6 @@ using namespace cv;
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4514 ) /* unreferenced inline functions */
#endif
#if 1 #if 1
typedef float Qfloat; typedef float Qfloat;
#define QFLOAT_TYPE CV_32F #define QFLOAT_TYPE CV_32F

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4512 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -416,7 +416,7 @@ void hysteresisGradient(Mat& magnitude, Mat& quantized_angle,
// Only accept the quantization if majority of pixels in the patch agree // Only accept the quantization if majority of pixels in the patch agree
static const int NEIGHBOR_THRESHOLD = 5; static const int NEIGHBOR_THRESHOLD = 5;
if (max_votes >= NEIGHBOR_THRESHOLD) if (max_votes >= NEIGHBOR_THRESHOLD)
quantized_angle.at<uchar>(r, c) = 1 << index; quantized_angle.at<uchar>(r, c) = uchar(1 << index);
} }
} }
} }
@ -1252,7 +1252,7 @@ static void similarity(const std::vector<Mat>& linear_memories, const Template&
} }
#endif #endif
for ( ; j < template_positions; ++j) for ( ; j < template_positions; ++j)
dst_ptr[j] += lm_ptr[j]; dst_ptr[j] = uchar(dst_ptr[j] + lm_ptr[j]);
} }
} }
@ -1334,7 +1334,7 @@ static void similarityLocal(const std::vector<Mat>& linear_memories, const Templ
for (int row = 0; row < 16; ++row) for (int row = 0; row < 16; ++row)
{ {
for (int col = 0; col < 16; ++col) for (int col = 0; col < 16; ++col)
dst_ptr[col] += lm_ptr[col]; dst_ptr[col] = uchar(dst_ptr[col] + lm_ptr[col]);
dst_ptr += 16; dst_ptr += 16;
lm_ptr += W; lm_ptr += W;
} }

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4512 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -205,8 +205,18 @@ static CvMat *PyCvMat_AsCvMat(PyObject *o)
} }
#define cvReleaseIplConvKernel(x) cvReleaseStructuringElement(x) #define cvReleaseIplConvKernel(x) cvReleaseStructuringElement(x)
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( push )
#pragma warning( disable : 4244 )
#endif
#include "generated3.i" #include "generated3.i"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( pop )
#endif
/* iplimage */ /* iplimage */
static void iplimage_dealloc(PyObject *self) static void iplimage_dealloc(PyObject *self)
@ -388,7 +398,8 @@ static PyObject *cvmat_tostring(PyObject *self, PyObject *args)
bps = CV_MAT_CN(m->type) * 8; bps = CV_MAT_CN(m->type) * 8;
break; break;
default: default:
return failmsg("Unrecognised depth %d", CV_MAT_DEPTH(m->type)), (PyObject*)0; failmsg("Unrecognized depth %d", CV_MAT_DEPTH(m->type));
return (PyObject*)0;
} }
int bpl = m->cols * bps; // bytes per line int bpl = m->cols * bps; // bytes per line
@ -3800,7 +3811,7 @@ static int zero = 0;
#define CVPY_VALIDATE_DrawChessboardCorners() do { \ #define CVPY_VALIDATE_DrawChessboardCorners() do { \
if ((patternSize.width * patternSize.height) != corners.count) \ if ((patternSize.width * patternSize.height) != corners.count) \
return (PyObject*)failmsg("Size is %dx%d, but corner list is length %d", patternSize.width, patternSize.height, corners.count); \ return (PyObject*)0; \
} while (0) } while (0)
#define cvGetRotationMatrix2D cv2DRotationMatrix #define cvGetRotationMatrix2D cv2DRotationMatrix
@ -3839,8 +3850,17 @@ static double cppKMeans(const CvArr* _samples, int cluster_count, CvArr* _labels
#define cvKMeans2(samples, nclusters, labels, termcrit, attempts, flags, centers) \ #define cvKMeans2(samples, nclusters, labels, termcrit, attempts, flags, centers) \
cppKMeans(samples, nclusters, labels, termcrit, attempts, flags, centers) cppKMeans(samples, nclusters, labels, termcrit, attempts, flags, centers)
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( push )
#pragma warning( disable : 4244 )
#endif
#include "generated0.i" #include "generated0.i"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( pop )
#endif
static PyMethodDef old_methods[] = { static PyMethodDef old_methods[] = {
#if PYTHON_USE_NUMPY #if PYTHON_USE_NUMPY

View File

@ -17,9 +17,6 @@ ocv_create_module()
if(BUILD_SHARED_LIBS AND NOT MINGW) if(BUILD_SHARED_LIBS AND NOT MINGW)
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1) add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
if (MSVC AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275")
endif()
else() else()
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0) add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0)
endif() endif()

View File

@ -19,8 +19,8 @@
#include <stdarg.h> // for va_list #include <stdarg.h> // for va_list
#if defined _MSC_VER && _MSC_VER >= 1200 #ifdef _MSC_VER
#pragma warning( disable: 4251 4275 4355 4127 ) #pragma warning( disable: 4127 )
#endif #endif
#define GTEST_DONT_DEFINE_FAIL 0 #define GTEST_DONT_DEFINE_FAIL 0

View File

@ -16843,7 +16843,7 @@ class GTEST_API_ TestPartResultArray {
}; };
// This interface knows how to report a test part result. // This interface knows how to report a test part result.
class TestPartResultReporterInterface { class GTEST_API_ TestPartResultReporterInterface {
public: public:
virtual ~TestPartResultReporterInterface() {} virtual ~TestPartResultReporterInterface() {}

View File

@ -1,7 +1,3 @@
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4127 4251)
#endif
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/ts/ts.hpp" #include "opencv2/ts/ts.hpp"

View File

@ -36,7 +36,11 @@
// This line ensures that gtest.h can be compiled on its own, even // This line ensures that gtest.h can be compiled on its own, even
// when it's fused. // when it's fused.
#include "opencv2/ts/ts.hpp" #include "precomp.hpp"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif
// The following lines pull in the real gtest *.cc files. // The following lines pull in the real gtest *.cc files.
// Copyright 2005, Google Inc. // Copyright 2005, Google Inc.

View File

@ -584,9 +584,17 @@ int64 TestBase::_calibrate()
return (int64)compensation; return (int64)compensation;
} }
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4355) // 'this' : used in base member initializer list
#endif
TestBase::TestBase(): declare(this) TestBase::TestBase(): declare(this)
{ {
} }
#ifdef _MSC_VER
# pragma warning(pop)
#endif
void TestBase::declareArray(SizeVector& sizes, cv::InputOutputArray a, int wtype) void TestBase::declareArray(SizeVector& sizes, cv::InputOutputArray a, int wtype)
{ {

View File

@ -455,7 +455,7 @@ struct MOG2Invoker
} }
//set the number of modes //set the number of modes
modesUsed[x] = nmodes; modesUsed[x] = uchar(nmodes);
mask[x] = background ? 0 : mask[x] = background ? 0 :
detectShadows && detectShadowGMM(data, nchannels, nmodes, gmm, mean, Tb, TB, tau) ? detectShadows && detectShadowGMM(data, nchannels, nmodes, gmm, mean, Tb, TB, tau) ?
shadowVal : 255; shadowVal : 255;
@ -571,7 +571,7 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask
bgmodelUsedModes.data, nmixtures, (float)learningRate, bgmodelUsedModes.data, nmixtures, (float)learningRate,
(float)varThreshold, (float)varThreshold,
backgroundRatio, varThresholdGen, backgroundRatio, varThresholdGen,
fVarInit, fVarMin, fVarMax, -learningRate*fCT, fTau, fVarInit, fVarMin, fVarMax, float(-learningRate*fCT), fTau,
bShadowDetection, nShadowDetection)); bShadowDetection, nShadowDetection));
} }
} }

View File

@ -43,10 +43,6 @@
#ifndef __OPENCV_PRECOMP_H__ #ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__ #define __OPENCV_PRECOMP_H__
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif

View File

@ -730,8 +730,8 @@ Mat KeypointBasedMotionEstimatorGpu::estimate(const gpu::GpuMat &frame0, const g
// perform outlier rejection // perform outlier rejection
IOutlierRejector *outlierRejector = static_cast<IOutlierRejector*>(outlierRejector_); IOutlierRejector *rejector = static_cast<IOutlierRejector*>(outlierRejector_);
if (!dynamic_cast<NullOutlierRejector*>(outlierRejector)) if (!dynamic_cast<NullOutlierRejector*>(rejector))
{ {
outlierRejector_->process(frame0.size(), hostPointsPrev_, hostPoints_, rejectionStatus_); outlierRejector_->process(frame0.size(), hostPointsPrev_, hostPoints_, rejectionStatus_);
@ -750,8 +750,8 @@ Mat KeypointBasedMotionEstimatorGpu::estimate(const gpu::GpuMat &frame0, const g
} }
} }
hostPointsPrev_ = Mat(1, hostPointsPrevTmp_.size(), CV_32FC2, &hostPointsPrevTmp_[0]); hostPointsPrev_ = Mat(1, (int)hostPointsPrevTmp_.size(), CV_32FC2, &hostPointsPrevTmp_[0]);
hostPoints_ = Mat(1, hostPointsTmp_.size(), CV_32FC2, &hostPointsTmp_[0]); hostPoints_ = Mat(1, (int)hostPointsTmp_.size(), CV_32FC2, &hostPointsTmp_[0]);
} }
// estimate motion // estimate motion

View File

@ -52,7 +52,7 @@ namespace videostab
{ {
void NullOutlierRejector::process( void NullOutlierRejector::process(
Size frameSize, InputArray points0, InputArray points1, OutputArray mask) Size /*frameSize*/, InputArray points0, InputArray points1, OutputArray mask)
{ {
CV_Assert(points0.type() == points1.type()); CV_Assert(points0.type() == points1.type());
CV_Assert(points0.getMat().checkVector(2) == points1.getMat().checkVector(2)); CV_Assert(points0.getMat().checkVector(2) == points1.getMat().checkVector(2));

View File

@ -95,13 +95,13 @@ void MoreAccurateMotionWobbleSuppressor::suppress(int idx, const Mat &frame, Mat
yl = ML(1,0)*x + ML(1,1)*y + ML(1,2); yl = ML(1,0)*x + ML(1,1)*y + ML(1,2);
zl = ML(2,0)*x + ML(2,1)*y + ML(2,2); zl = ML(2,0)*x + ML(2,1)*y + ML(2,2);
xl /= zl; yl /= zl; xl /= zl; yl /= zl;
wl = idx - k1; wl = float(idx - k1);
xr = MR(0,0)*x + MR(0,1)*y + MR(0,2); xr = MR(0,0)*x + MR(0,1)*y + MR(0,2);
yr = MR(1,0)*x + MR(1,1)*y + MR(1,2); yr = MR(1,0)*x + MR(1,1)*y + MR(1,2);
zr = MR(2,0)*x + MR(2,1)*y + MR(2,2); zr = MR(2,0)*x + MR(2,1)*y + MR(2,2);
xr /= zr; yr /= zr; xr /= zr; yr /= zr;
wr = k2 - idx; wr = float(k2 - idx);
mapx_(y,x) = (wr * xl + wl * xr) / (wl + wr); mapx_(y,x) = (wr * xl + wl * xr) / (wl + wr);
mapy_(y,x) = (wr * yl + wl * yr) / (wl + wr); mapy_(y,x) = (wr * yl + wl * yr) / (wl + wr);

View File

@ -32,9 +32,6 @@ static void help()
// define whether to use approximate nearest-neighbor search // define whether to use approximate nearest-neighbor search
#define USE_FLANN #define USE_FLANN
IplImage* image = 0;
#ifdef USE_FLANN #ifdef USE_FLANN
static void static void
flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors, flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,

View File

@ -179,7 +179,7 @@ static const char* var_desc[] =
}; };
static void print_variable_importance( CvDTree* dtree, const char** var_desc ) static void print_variable_importance( CvDTree* dtree )
{ {
const CvMat* var_importance = dtree->get_var_importance(); const CvMat* var_importance = dtree->get_var_importance();
int i; int i;
@ -201,21 +201,16 @@ static void print_variable_importance( CvDTree* dtree, const char** var_desc )
for( i = 0; i < var_importance->cols*var_importance->rows; i++ ) for( i = 0; i < var_importance->cols*var_importance->rows; i++ )
{ {
double val = var_importance->data.db[i]; double val = var_importance->data.db[i];
if( var_desc )
{
char buf[100]; char buf[100];
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1); int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
strncpy( buf, var_desc[i], len ); strncpy( buf, var_desc[i], len );
buf[len] = '\0'; buf[len] = '\0';
printf( "%s", buf ); printf( "%s", buf );
}
else
printf( "var #%d", i );
printf( ": %g%%\n", val*100. ); printf( ": %g%%\n", val*100. );
} }
} }
static void interactive_classification( CvDTree* dtree, const char** var_desc ) static void interactive_classification( CvDTree* dtree )
{ {
char input[1000]; char input[1000];
const CvDTreeNode* root; const CvDTreeNode* root;
@ -319,8 +314,8 @@ int main( int argc, char** argv )
cvReleaseMat( &missing ); cvReleaseMat( &missing );
cvReleaseMat( &responses ); cvReleaseMat( &responses );
print_variable_importance( dtree, var_desc ); print_variable_importance( dtree );
interactive_classification( dtree, var_desc ); interactive_classification( dtree );
delete dtree; delete dtree;
return 0; return 0;

View File

@ -200,17 +200,18 @@ static void loadNewFrame(const std::string filenamePrototype, const int currentF
// TODO : take care of this step !!! maybe disable of do this in a nicer way ... each successive image should get the same transformation... but it depends on the initial image format // TODO : take care of this step !!! maybe disable of do this in a nicer way ... each successive image should get the same transformation... but it depends on the initial image format
double maxInput, minInput; double maxInput, minInput;
minMaxLoc(inputImage, &minInput, &maxInput); minMaxLoc(inputImage, &minInput, &maxInput);
std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
;if (firstTimeread)
if (firstTimeread)
{ {
/* the first time, get the pixel values range and rougthly update scaling value /* the first time, get the pixel values range and rougthly update scaling value
in order to center values around 128 and getting a range close to [0-255], in order to center values around 128 and getting a range close to [0-255],
=> actually using a little less in order to let some more flexibility in range evolves... => actually using a little less in order to let some more flexibility in range evolves...
*/ */
double maxInput, minInput; double maxInput1, minInput1;
minMaxLoc(inputImage, &minInput, &maxInput); minMaxLoc(inputImage, &minInput1, &maxInput1);
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl; std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput1<<", "<<minInput1<<std::endl;
globalRescalefactor=(float)(50.0/(maxInput-minInput)); // less than 255 for flexibility... experimental value to be carefull about globalRescalefactor=(float)(50.0/(maxInput1-minInput1)); // less than 255 for flexibility... experimental value to be carefull about
double channelOffset = -1.5*minInput; double channelOffset = -1.5*minInput;
globalOffset= cv::Scalar(channelOffset, channelOffset, channelOffset, channelOffset); globalOffset= cv::Scalar(channelOffset, channelOffset, channelOffset, channelOffset);
} }

View File

@ -803,9 +803,9 @@ void VocData::calcClassifierPrecRecall(const string& input_file, vector<float>&
std::sort(order.begin(),order.end(),orderingSorter()); std::sort(order.begin(),order.end(),orderingSorter());
/* 2. save ranking results to text file */ /* 2. save ranking results to text file */
string input_file_std = checkFilenamePathsep(input_file); string input_file_std1 = checkFilenamePathsep(input_file);
size_t fnamestart = input_file_std.rfind("/"); size_t fnamestart = input_file_std1.rfind("/");
string scoregt_file_str = input_file_std.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt"; string scoregt_file_str = input_file_std1.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt";
std::ofstream scoregt_file(scoregt_file_str.c_str()); std::ofstream scoregt_file(scoregt_file_str.c_str());
if (scoregt_file.is_open()) if (scoregt_file.is_open())
{ {

View File

@ -230,13 +230,13 @@ static void findConstrainedCorrespondences(const Mat& _F,
{ {
if( i1 == i ) if( i1 == i )
continue; continue;
Point2f p1 = keypoints1[i1].pt; Point2f pt1 = keypoints1[i1].pt;
const float* d11 = descriptors1.ptr<float>(i1); const float* d11 = descriptors1.ptr<float>(i1);
double dist = 0; double dist = 0;
e = p2.x*(F[0]*p1.x + F[1]*p1.y + F[2]) + e = p2.x*(F[0]*pt1.x + F[1]*pt1.y + F[2]) +
p2.y*(F[3]*p1.x + F[4]*p1.y + F[5]) + p2.y*(F[3]*pt1.x + F[4]*pt1.y + F[5]) +
F[6]*p1.x + F[7]*p1.y + F[8]; F[6]*pt1.x + F[7]*pt1.y + F[8];
if( fabs(e) > eps ) if( fabs(e) > eps )
continue; continue;

View File

@ -173,9 +173,9 @@ static void saveCameraParams( const string& filename,
{ {
FileStorage fs( filename, FileStorage::WRITE ); FileStorage fs( filename, FileStorage::WRITE );
time_t t; time_t tt;
time( &t ); time( &tt );
struct tm *t2 = localtime( &t ); struct tm *t2 = localtime( &tt );
char buf[1024]; char buf[1024];
strftime( buf, sizeof(buf)-1, "%c", t2 ); strftime( buf, sizeof(buf)-1, "%c", t2 );

View File

@ -73,7 +73,6 @@ int main( int argc, const char** argv )
VideoCapture cap; VideoCapture cap;
Rect trackWindow; Rect trackWindow;
RotatedRect trackBox;
int hsize = 16; int hsize = 16;
float hranges[] = {0,180}; float hranges[] = {0,180};
const float* phranges = hranges; const float* phranges = hranges;

View File

@ -28,9 +28,9 @@ static void help()
int main(int,char**) int main(int,char**)
{ {
help(); help();
Mat i = Mat::eye(4, 4, CV_64F); Mat I = Mat::eye(4, 4, CV_64F);
i.at<double>(1,1) = CV_PI; I.at<double>(1,1) = CV_PI;
cout << "i = " << i << ";" << endl; cout << "I = " << I << ";" << endl;
Mat r = Mat(10, 3, CV_8UC3); Mat r = Mat(10, 3, CV_8UC3);
randu(r, Scalar::all(0), Scalar::all(255)); randu(r, Scalar::all(0), Scalar::all(255));

View File

@ -223,8 +223,8 @@ void BaseQualityEvaluator::readAllDatasetsRunParams()
isWriteParams = false; isWriteParams = false;
FileNode topfn = fs.getFirstTopLevelNode(); FileNode topfn = fs.getFirstTopLevelNode();
FileNode fn = topfn[DEFAULT_PARAMS]; FileNode pfn = topfn[DEFAULT_PARAMS];
readDefaultRunParams(fn); readDefaultRunParams(pfn);
for( int i = 0; i < DATASETS_COUNT; i++ ) for( int i = 0; i < DATASETS_COUNT; i++ )
{ {
@ -280,7 +280,7 @@ bool BaseQualityEvaluator::readDataset( const string& datasetName, vector<Mat>&
if( !fs.isOpened() ) if( !fs.isOpened() )
{ {
cout << "filename " << dirname + filename.str() << endl; cout << "filename " << dirname + filename.str() << endl;
FileStorage fs( dirname + filename.str(), FileStorage::READ ); FileStorage fs2( dirname + filename.str(), FileStorage::READ );
return false; return false;
} }
fs.getFirstTopLevelNode() >> Hs[i]; fs.getFirstTopLevelNode() >> Hs[i];

Some files were not shown because too many files have changed in this diff Show More