Fixed number of warnings. Fixed mingw64 build.
This commit is contained in:
parent
02e3afae3a
commit
c5aba337e9
3
3rdparty/libjasper/CMakeLists.txt
vendored
3
3rdparty/libjasper/CMakeLists.txt
vendored
@ -23,7 +23,8 @@ if(MSVC)
|
||||
add_definitions(-DJAS_WIN_MSVC_BUILD)
|
||||
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(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||
|
5
3rdparty/libtiff/CMakeLists.txt
vendored
5
3rdparty/libtiff/CMakeLists.txt
vendored
@ -90,8 +90,9 @@ if(WIN32)
|
||||
list(APPEND lib_srcs tif_win32.c)
|
||||
endif(WIN32)
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wcast-align)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef
|
||||
-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))
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
|
2
3rdparty/zlib/zconf.h.cmakein
vendored
2
3rdparty/zlib/zconf.h.cmakein
vendored
@ -419,7 +419,7 @@ typedef uLong FAR uLongf;
|
||||
#endif
|
||||
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
# define _FILE_OFFSET_BITS
|
||||
# define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||
|
@ -2191,15 +2191,15 @@ void cvCreateCascadeClassifier( const char* dirname,
|
||||
{
|
||||
char xml_path[1024];
|
||||
int len = (int)strlen(dirname);
|
||||
CvHaarClassifierCascade* cascade = 0;
|
||||
CvHaarClassifierCascade* cascade1 = 0;
|
||||
strcpy( xml_path, dirname );
|
||||
if( xml_path[len-1] == '\\' || xml_path[len-1] == '/' )
|
||||
len--;
|
||||
strcpy( xml_path + len, ".xml" );
|
||||
cascade = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
|
||||
if( cascade )
|
||||
cvSave( xml_path, cascade );
|
||||
cvReleaseHaarClassifierCascade( &cascade );
|
||||
cascade1 = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
|
||||
if( cascade1 )
|
||||
cvSave( xml_path, cascade1 );
|
||||
cvReleaseHaarClassifierCascade( &cascade1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2502,7 +2502,6 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
|
||||
{
|
||||
CvTreeCascadeNode* single_cluster;
|
||||
CvTreeCascadeNode* multiple_clusters;
|
||||
CvSplit* cur_split;
|
||||
int single_num;
|
||||
|
||||
icvSetNumSamples( training_data, poscount + negcount );
|
||||
@ -2675,18 +2674,19 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
|
||||
} /* try different number of clusters */
|
||||
cvReleaseMat( &vals );
|
||||
|
||||
CV_CALL( cur_split = (CvSplit*) cvAlloc( sizeof( *cur_split ) ) );
|
||||
CV_ZERO_OBJ( cur_split );
|
||||
CvSplit* curSplit;
|
||||
CV_CALL( curSplit = (CvSplit*) cvAlloc( sizeof( *curSplit ) ) );
|
||||
CV_ZERO_OBJ( curSplit );
|
||||
|
||||
if( last_split ) last_split->next = cur_split;
|
||||
else first_split = cur_split;
|
||||
last_split = cur_split;
|
||||
if( last_split ) last_split->next = curSplit;
|
||||
else first_split = curSplit;
|
||||
last_split = curSplit;
|
||||
|
||||
cur_split->single_cluster = single_cluster;
|
||||
cur_split->multiple_clusters = multiple_clusters;
|
||||
cur_split->num_clusters = best_clusters;
|
||||
cur_split->parent = parent;
|
||||
cur_split->single_multiple_ratio = (float) single_num / best_num;
|
||||
curSplit->single_cluster = single_cluster;
|
||||
curSplit->multiple_clusters = multiple_clusters;
|
||||
curSplit->num_clusters = best_clusters;
|
||||
curSplit->parent = parent;
|
||||
curSplit->single_multiple_ratio = (float) single_num / best_num;
|
||||
}
|
||||
|
||||
if( parent ) parent = parent->next_same_level;
|
||||
|
@ -323,8 +323,6 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
|
||||
int i00, i10, i01, i11;
|
||||
i00 = i10 = i01 = i11 = (int) fill_value;
|
||||
|
||||
double i = fill_value;
|
||||
|
||||
/* linear interpolation using 2x2 neighborhood */
|
||||
if( isrc_x >= 0 && isrc_x <= src_size.width &&
|
||||
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 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_max += k_right;
|
||||
|
@ -214,7 +214,7 @@ int main( int argc, char* argv[] )
|
||||
totaltime = 0.0;
|
||||
if( info != NULL )
|
||||
{
|
||||
int x, y, width, height;
|
||||
int x, y;
|
||||
IplImage* img;
|
||||
int hits, missed, falseAlarms;
|
||||
int totalHits, totalMissed, totalFalseAlarms;
|
||||
@ -249,11 +249,12 @@ int main( int argc, char* argv[] )
|
||||
ref = (ObjectPos*) cvAlloc( refcount * sizeof( *ref ) );
|
||||
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;
|
||||
ref[i].x = 0.5F * width + x;
|
||||
ref[i].y = 0.5F * height + y;
|
||||
ref[i].width = sqrtf( 0.5F * (width * width + height * height) );
|
||||
ref[i].x = 0.5F * w + x;
|
||||
ref[i].y = 0.5F * h + y;
|
||||
ref[i].width = sqrtf( 0.5F * (w * w + h * h) );
|
||||
ref[i].found = 0;
|
||||
ref[i].neghbors = 0;
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ if(MINGW)
|
||||
endif()
|
||||
|
||||
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)
|
||||
# override cmake default exception handling option
|
||||
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(-Winit-self)
|
||||
add_extra_compiler_option(-Wpointer-arith)
|
||||
#add_extra_compiler_option(-Wcast-align)
|
||||
#add_extra_compiler_option(-Wstrict-aliasing=2)
|
||||
#add_extra_compiler_option(-Wshadow)
|
||||
#add_extra_compiler_option(-Wno-unnamed-type-template-args)
|
||||
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)
|
||||
endif()
|
||||
|
||||
# The -Wno-long-long is required in 64bit systems when including sytem headers.
|
||||
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_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
|
||||
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}}")
|
||||
|
@ -18,7 +18,7 @@ if(WIN32)
|
||||
# Try to find the XIMEA API path in registry.
|
||||
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 LIB folders
|
||||
|
@ -42,10 +42,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -335,7 +335,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
|
||||
{
|
||||
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...
|
||||
*(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]);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable: 4305 )
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace cv
|
||||
{
|
||||
|
||||
using std::set;
|
||||
|
||||
|
||||
// Reads a sequence from a FileNode::SEQ with type _Tp into a result vector.
|
||||
template<typename _Tp>
|
||||
inline void readFileNodeList(const FileNode& fn, vector<_Tp>& result) {
|
||||
@ -48,7 +48,7 @@ inline void writeFileNodeList(FileStorage& fs, const string& name,
|
||||
}
|
||||
fs << "]";
|
||||
}
|
||||
|
||||
|
||||
static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double beta=0) {
|
||||
// make sure the input data is a vector of matrices or vector of vector
|
||||
if(src.kind() != _InputArray::STD_VECTOR_MAT && src.kind() != _InputArray::STD_VECTOR_VECTOR) {
|
||||
@ -63,7 +63,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
// dimensionality of (reshaped) samples
|
||||
size_t d = src.getMat(0).total();
|
||||
// create data matrix
|
||||
Mat data(n, d, rtype);
|
||||
Mat data((int)n, (int)d, rtype);
|
||||
// now copy data
|
||||
for(unsigned int i = 0; i < n; i++) {
|
||||
// make sure data can be reshaped, throw exception if not!
|
||||
@ -83,7 +83,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Removes duplicate elements in a given vector.
|
||||
template<typename _Tp>
|
||||
inline vector<_Tp> remove_dups(const vector<_Tp>& src) {
|
||||
@ -98,7 +98,7 @@ inline vector<_Tp> remove_dups(const vector<_Tp>& src) {
|
||||
return elems;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Turk, M., and Pentland, A. "Eigenfaces for recognition.". Journal of
|
||||
// Cognitive Neuroscience 3 (1991), 71–86.
|
||||
class Eigenfaces : public FaceRecognizer
|
||||
@ -146,10 +146,10 @@ public:
|
||||
|
||||
// See FaceRecognizer::save.
|
||||
void save(FileStorage& fs) const;
|
||||
|
||||
|
||||
AlgorithmInfo* info() const;
|
||||
};
|
||||
|
||||
|
||||
// Belhumeur, P. N., Hespanha, J., and Kriegman, D. "Eigenfaces vs. Fisher-
|
||||
// faces: Recognition using class specific linear projection.". IEEE
|
||||
// Transactions on Pattern Analysis and Machine Intelligence 19, 7 (1997),
|
||||
@ -232,13 +232,13 @@ public:
|
||||
//
|
||||
// radius, neighbors are used in the local binary patterns creation.
|
||||
// grid_x, grid_y control the grid size of the spatial histograms.
|
||||
LBPH(int radius=1, int neighbors=8,
|
||||
int grid_x=8, int grid_y=8,
|
||||
LBPH(int radius_=1, int neighbors_=8,
|
||||
int gridx=8, int gridy=8,
|
||||
double threshold = DBL_MAX) :
|
||||
_grid_x(grid_x),
|
||||
_grid_y(grid_y),
|
||||
_radius(radius),
|
||||
_neighbors(neighbors),
|
||||
_grid_x(gridx),
|
||||
_grid_y(gridy),
|
||||
_radius(radius_),
|
||||
_neighbors(neighbors_),
|
||||
_threshold(threshold) {}
|
||||
|
||||
// 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.
|
||||
LBPH(InputArray src,
|
||||
InputArray labels,
|
||||
int radius=1, int neighbors=8,
|
||||
int grid_x=8, int grid_y=8,
|
||||
int radius_=1, int neighbors_=8,
|
||||
int gridx=8, int gridy=8,
|
||||
double threshold = DBL_MAX) :
|
||||
_grid_x(grid_x),
|
||||
_grid_y(grid_y),
|
||||
_radius(radius),
|
||||
_neighbors(neighbors),
|
||||
_grid_x(gridx),
|
||||
_grid_y(gridy),
|
||||
_radius(radius_),
|
||||
_neighbors(neighbors_),
|
||||
_threshold(threshold) {
|
||||
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);
|
||||
if((dist < minDist) && (dist < _threshold)) {
|
||||
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);
|
||||
if((dist < minDist) && (dist < _threshold)) {
|
||||
minDist = dist;
|
||||
minClass = _labels.at<int>(sampleIdx);
|
||||
minClass = _labels.at<int>((int)sampleIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -641,9 +641,9 @@ static Mat histc(InputArray _src, int minVal, int maxVal, bool normed)
|
||||
return Mat();
|
||||
}
|
||||
|
||||
|
||||
|
||||
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();
|
||||
// calculate LBP patch size
|
||||
@ -681,7 +681,7 @@ static Mat elbp(InputArray src, int radius, int neighbors) {
|
||||
elbp(src, dst, radius, neighbors);
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
void LBPH::load(const FileStorage& fs) {
|
||||
fs["radius"] >> _radius;
|
||||
fs["neighbors"] >> _neighbors;
|
||||
@ -758,7 +758,7 @@ void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
|
||||
double dist = compareHist(_histograms[sampleIdx], query, CV_COMP_CHISQR);
|
||||
if((dist < minDist) && (dist < _threshold)) {
|
||||
minDist = dist;
|
||||
minClass = _labels.at<int>(sampleIdx);
|
||||
minClass = _labels.at<int>((int)sampleIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -770,23 +770,23 @@ int LBPH::predict(InputArray _src) const {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_components, double threshold)
|
||||
{
|
||||
return new Eigenfaces(num_components, threshold);
|
||||
}
|
||||
|
||||
|
||||
Ptr<FaceRecognizer> createFisherFaceRecognizer(int num_components, double threshold)
|
||||
{
|
||||
return new Fisherfaces(num_components, threshold);
|
||||
}
|
||||
|
||||
|
||||
Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius, int neighbors,
|
||||
int grid_x, int grid_y, double threshold)
|
||||
{
|
||||
return new LBPH(radius, neighbors, grid_x, grid_y, threshold);
|
||||
}
|
||||
|
||||
|
||||
CV_INIT_ALGORITHM(Eigenfaces, "FaceRecognizer.Eigenfaces",
|
||||
obj.info()->addParam(obj, "ncomponents", obj._num_components);
|
||||
obj.info()->addParam(obj, "threshold", obj._threshold);
|
||||
@ -803,8 +803,8 @@ CV_INIT_ALGORITHM(Fisherfaces, "FaceRecognizer.Fisherfaces",
|
||||
obj.info()->addParam(obj, "labels", obj._labels, true);
|
||||
obj.info()->addParam(obj, "eigenvectors", obj._eigenvectors, true);
|
||||
obj.info()->addParam(obj, "eigenvalues", obj._eigenvalues, true);
|
||||
obj.info()->addParam(obj, "mean", obj._mean, true));
|
||||
|
||||
obj.info()->addParam(obj, "mean", obj._mean, true));
|
||||
|
||||
CV_INIT_ALGORITHM(LBPH, "FaceRecognizer.LBPH",
|
||||
obj.info()->addParam(obj, "radius", obj._radius);
|
||||
obj.info()->addParam(obj, "neighbors", obj._neighbors);
|
||||
@ -813,7 +813,7 @@ CV_INIT_ALGORITHM(LBPH, "FaceRecognizer.LBPH",
|
||||
obj.info()->addParam(obj, "threshold", obj._threshold);
|
||||
obj.info()->addParam(obj, "histograms", obj._histograms, true);
|
||||
obj.info()->addParam(obj, "labels", obj._labels, true));
|
||||
|
||||
|
||||
bool initModule_contrib()
|
||||
{
|
||||
Ptr<Algorithm> efaces = createEigenfaces(), ffaces = createFisherfaces(), lbph = createLBPH();
|
||||
|
@ -70,12 +70,12 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
// dimensionality of (reshaped) samples
|
||||
size_t d = src.getMat(0).total();
|
||||
// create data matrix
|
||||
Mat data(n, d, rtype);
|
||||
Mat data((int)n, (int)d, rtype);
|
||||
// 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!
|
||||
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);
|
||||
}
|
||||
// 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> num2label = remove_dups(labels);
|
||||
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;
|
||||
for (size_t i = 0; i < labels.size(); i++)
|
||||
mapped_labels[i] = label2num[labels[i]];
|
||||
@ -995,7 +995,7 @@ void LDA::lda(InputArray _src, InputArray _lbls) {
|
||||
int N = data.rows;
|
||||
int D = data.cols;
|
||||
// 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
|
||||
// want to separate from each other then?
|
||||
if(C == 1) {
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -808,7 +808,7 @@ void cv::SpinImageModel::selectRandomSubset(float ratio)
|
||||
subset.resize(setSize);
|
||||
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];
|
||||
|
||||
left[pos] = left.back();
|
||||
|
@ -48,6 +48,11 @@
|
||||
#include "opencv2/core/core_c.h"
|
||||
#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
|
||||
{
|
||||
|
||||
|
@ -984,13 +984,13 @@ _AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
|
||||
#if CV_ENABLE_UNROLLED
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
for( ; i < n; i++ )
|
||||
{
|
||||
_AccTp v = (_AccTp)(a[i] - b[i]);
|
||||
_AccTp v = _AccTp(a[i] - b[i]);
|
||||
s += v*v;
|
||||
}
|
||||
return s;
|
||||
@ -1024,13 +1024,13 @@ _AccTp normL1(const _Tp* a, const _Tp* b, int n)
|
||||
#if CV_ENABLE_UNROLLED
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
for( ; i < n; i++ )
|
||||
{
|
||||
_AccTp v = (_AccTp)(a[i] - b[i]);
|
||||
_AccTp v = _AccTp(a[i] - b[i]);
|
||||
s += std::abs(v);
|
||||
}
|
||||
return s;
|
||||
|
@ -79,7 +79,7 @@
|
||||
# define CV_ENABLE_UNROLLED 1
|
||||
#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
|
||||
# include <intrin.h>
|
||||
# endif
|
||||
|
@ -46,8 +46,8 @@ namespace cv
|
||||
|
||||
// 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
|
||||
#pragma optimize("", off)
|
||||
#pragma warning( disable : 4748 )
|
||||
# pragma optimize("", off)
|
||||
# pragma warning(disable: 4748)
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
|
@ -43,11 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -1264,7 +1264,7 @@ struct NormOp : public BaseElemWiseOp
|
||||
dst.at<double>(0,0) = cvtest::norm(src[0], 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)
|
||||
|
@ -2023,14 +2023,7 @@ void Core_GraphScanTest::run( int )
|
||||
event = "End of procedure";
|
||||
break;
|
||||
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" );
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
}
|
||||
|
||||
ts->printf( cvtest::TS::LOG, "%s", event );
|
||||
|
@ -274,6 +274,7 @@ public:
|
||||
|
||||
private:
|
||||
const Mat mask;
|
||||
MaskPredicate& operator=(const MaskPredicate&);
|
||||
};
|
||||
|
||||
void KeyPointsFilter::runByPixelsMask( vector<KeyPoint>& keypoints, const Mat& mask )
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -27,10 +27,6 @@
|
||||
*************************************************************************/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
#include "opencv2/flann/flann.hpp"
|
||||
|
||||
namespace cvflann
|
||||
|
@ -5,10 +5,6 @@
|
||||
#include <cstdarg>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
# include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -1702,15 +1702,7 @@ class CV_EXPORTS GoodFeaturesToTrackDetector_GPU
|
||||
{
|
||||
public:
|
||||
explicit GoodFeaturesToTrackDetector_GPU(int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 0.0,
|
||||
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;
|
||||
}
|
||||
int blockSize = 3, bool useHarrisDetector = false, double harrisK = 0.04);
|
||||
|
||||
//! return 1 rows matrix with CV_32FC2 type
|
||||
void operator ()(const GpuMat& image, GpuMat& corners, const GpuMat& mask = GpuMat());
|
||||
@ -1742,6 +1734,18 @@ private:
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
@ -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; }
|
||||
void cv::gpu::VideoReader_GPU::close() { }
|
||||
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; }
|
||||
void cv::gpu::VideoReader_GPU::dumpFormat(std::ostream&) { throw_nogpu(); }
|
||||
|
||||
|
@ -513,7 +513,6 @@ PARAM_TEST_CASE(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor,
|
||||
bool useRoi;
|
||||
|
||||
cv::Mat img;
|
||||
cv::Mat kernel;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
@ -150,8 +150,6 @@ PARAM_TEST_CASE(CalcHist, cv::gpu::DeviceInfo, cv::Size)
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
|
||||
cv::Size size;
|
||||
cv::Mat src;
|
||||
cv::Mat hist_gold;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
@ -202,7 +200,7 @@ TEST_P(EqualizeHist, Accuracy)
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::equalizeHist(loadMat(src), dst);
|
||||
|
||||
|
||||
cv::Mat dst_gold;
|
||||
cv::equalizeHist(src, dst_gold);
|
||||
|
||||
@ -221,8 +219,6 @@ PARAM_TEST_CASE(ColumnSum, cv::gpu::DeviceInfo, cv::Size)
|
||||
cv::gpu::DeviceInfo devInfo;
|
||||
cv::Size size;
|
||||
|
||||
cv::Mat src;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
@ -276,8 +272,6 @@ PARAM_TEST_CASE(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient, UseRoi)
|
||||
bool useL2gradient;
|
||||
bool useRoi;
|
||||
|
||||
cv::Mat edges_gold;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
@ -361,7 +355,7 @@ TEST_P(MeanShift, Filtering)
|
||||
else
|
||||
img_template = readImage("meanshift/con_result_CC1X.png");
|
||||
ASSERT_FALSE(img_template.empty());
|
||||
|
||||
|
||||
cv::gpu::GpuMat d_dst;
|
||||
cv::gpu::meanShiftFiltering(loadMat(img), d_dst, spatialRad, colorRad);
|
||||
|
||||
@ -396,7 +390,7 @@ TEST_P(MeanShift, Proc)
|
||||
cv::gpu::meanShiftProc(loadMat(img), rmap, spmap, spatialRad, colorRad);
|
||||
|
||||
ASSERT_EQ(CV_8UC4, rmap.type());
|
||||
|
||||
|
||||
EXPECT_MAT_NEAR(rmap_filtered, rmap, 0.0);
|
||||
EXPECT_MAT_NEAR(spmap_template, spmap, 0.0);
|
||||
}
|
||||
@ -573,11 +567,6 @@ PARAM_TEST_CASE(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)
|
||||
int ksize;
|
||||
bool ccorr;
|
||||
|
||||
cv::Mat src;
|
||||
cv::Mat kernel;
|
||||
|
||||
cv::Mat dst_gold;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
devInfo = GET_PARAM(0);
|
||||
@ -596,7 +585,7 @@ TEST_P(Convolve, Accuracy)
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::convolve(loadMat(src), loadMat(kernel), dst, ccorr);
|
||||
|
||||
|
||||
cv::Mat dst_gold;
|
||||
convolveDFT(src, kernel, dst_gold, ccorr);
|
||||
|
||||
@ -670,9 +659,6 @@ PARAM_TEST_CASE(MatchTemplate32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, C
|
||||
int method;
|
||||
|
||||
int n, m, h, w;
|
||||
cv::Mat image, templ;
|
||||
|
||||
cv::Mat dst_gold;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
@ -1080,7 +1066,7 @@ TEST_P(CornerHarris, Accuracy)
|
||||
|
||||
cv::gpu::GpuMat dst;
|
||||
cv::gpu::cornerHarris(loadMat(src), dst, blockSize, apertureSize, k, borderType);
|
||||
|
||||
|
||||
cv::Mat dst_gold;
|
||||
cv::cornerHarris(src, dst_gold, blockSize, apertureSize, k, borderType);
|
||||
|
||||
|
@ -69,16 +69,16 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
|
||||
}
|
||||
|
||||
#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*)&block_hists.cols, sizeof(block_hists.cols));
|
||||
f.write((char*)&blockHists.rows, sizeof(blockHists.rows));
|
||||
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));
|
||||
}
|
||||
}
|
||||
@ -90,21 +90,21 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
|
||||
f.write((char*)&locations[i], sizeof(locations[i]));
|
||||
}
|
||||
#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;
|
||||
f.read((char*)&rows, sizeof(rows));
|
||||
f.read((char*)&cols, sizeof(cols));
|
||||
ASSERT_EQ(rows, block_hists.rows);
|
||||
ASSERT_EQ(cols, block_hists.cols);
|
||||
ASSERT_EQ(rows, blockHists.rows);
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,10 @@ if(HAVE_QT)
|
||||
endif()
|
||||
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_WRAP_CPP(_MOC_OUTFILES src/window_QT.h)
|
||||
|
||||
|
@ -41,13 +41,9 @@
|
||||
|
||||
#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
|
||||
#pragma optimize("",off)
|
||||
#pragma warning( disable: 4748 )
|
||||
#pragma warning(disable: 4748)
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
|
@ -90,6 +90,7 @@ Thanks to:
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 100
|
||||
//'sprintf': name was marked as #pragma deprecated
|
||||
#pragma warning(disable: 4995)
|
||||
#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;
|
||||
|
||||
setPhyCon(deviceNumber, connection);
|
||||
setPhyCon(deviceNumber, _connection);
|
||||
if(setup(deviceNumber))return true;
|
||||
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;
|
||||
|
||||
setAttemptCaptureSize(deviceNumber,w,h);
|
||||
setPhyCon(deviceNumber, connection);
|
||||
setPhyCon(deviceNumber, _connection);
|
||||
if(setup(deviceNumber))return true;
|
||||
return false;
|
||||
}
|
||||
@ -2945,7 +2946,7 @@ HRESULT videoInput::ShowFilterPropertyPages(IBaseFilter *pFilter){
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT videoInput::ShowStreamPropertyPages(IAMStreamConfig *pStream){
|
||||
HRESULT videoInput::ShowStreamPropertyPages(IAMStreamConfig * /*pStream*/){
|
||||
|
||||
HRESULT hr = NOERROR;
|
||||
return hr;
|
||||
@ -3035,11 +3036,11 @@ HRESULT videoInput::routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter *
|
||||
LONG lInpin, lOutpin;
|
||||
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)
|
||||
{
|
||||
hr = Crossbar->get_CrossbarPinInfo( IPin , pIndex , &pRIndex , &pType);
|
||||
hr = Crossbar->get_CrossbarPinInfo( iPin , pIndex , &pRIndex , &pType);
|
||||
|
||||
if( pType == conType){
|
||||
if(verbose)printf("SETUP: Found Physical Interface");
|
||||
|
@ -43,16 +43,12 @@
|
||||
|
||||
#include <vfw.h>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4711 )
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define WM_CAP_FIRSTA (WM_USER)
|
||||
#define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0)
|
||||
#endif
|
||||
|
||||
#if defined _M_X64
|
||||
#if defined _M_X64 && defined _MSC_VER
|
||||
#pragma optimize("",off)
|
||||
#pragma warning(disable: 4748)
|
||||
#endif
|
||||
@ -177,13 +173,13 @@ bool CvCaptureAVI_VFW::open( const char* filename )
|
||||
{
|
||||
size.width = aviinfo.rcFrame.right - aviinfo.rcFrame.left;
|
||||
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.end_index = film_range.start_index + (int)aviinfo.dwLength;
|
||||
fps = (double)aviinfo.dwRate/aviinfo.dwScale;
|
||||
pos = film_range.start_index;
|
||||
getframe = AVIStreamGetFrameOpen( avistream, &bmih );
|
||||
getframe = AVIStreamGetFrameOpen( avistream, &bmihdr );
|
||||
if( getframe != 0 )
|
||||
return true;
|
||||
}
|
||||
|
@ -45,7 +45,8 @@
|
||||
#ifdef HAVE_JPEG
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4324 4611)
|
||||
//interaction between '_setjmp' and C++ object destruction is non-portable
|
||||
#pragma warning(disable: 4611)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -69,11 +70,18 @@ extern "C" {
|
||||
namespace cv
|
||||
{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4324) //structure was padded due to __declspec(align())
|
||||
#endif
|
||||
struct JpegErrorMgr
|
||||
{
|
||||
struct jpeg_error_mgr pub;
|
||||
jmp_buf setjmp_buffer;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
struct JpegSource
|
||||
{
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "grfmt_png.hpp"
|
||||
|
||||
#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 )
|
||||
#endif
|
||||
|
||||
|
@ -42,10 +42,6 @@
|
||||
#ifndef __HIGHGUI_H_
|
||||
#define __HIGHGUI_H_
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4251 )
|
||||
#endif
|
||||
|
||||
#include "cvconfig.h"
|
||||
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
@ -1216,27 +1216,27 @@ double GuiReceiver::isOpenGl(QString name)
|
||||
// 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;
|
||||
callback2 = on_change;
|
||||
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;
|
||||
callback2 = 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;
|
||||
myparent = arg;
|
||||
@ -1247,7 +1247,7 @@ void CvTrackbar::create(CvWindow* arg, QString name, int* value, int count)
|
||||
slider = new QSlider(Qt::Horizontal);
|
||||
slider->setFocusPolicy(Qt::StrongFocus);
|
||||
slider->setMinimum(0);
|
||||
slider->setMaximum(count);
|
||||
slider->setMaximum(_count);
|
||||
slider->setPageStep(5);
|
||||
slider->setValue(*value);
|
||||
slider->setTickPosition(QSlider::TicksBelow);
|
||||
@ -1473,7 +1473,7 @@ void CvRadioButton::callCallBack(bool checked)
|
||||
|
||||
|
||||
//here CvWinProperties class
|
||||
CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* parent)
|
||||
CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* /*parent*/)
|
||||
{
|
||||
//setParent(parent);
|
||||
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,
|
||||
//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)
|
||||
{
|
||||
move(mypos);
|
||||
event->accept();
|
||||
evnt->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
evnt->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CvWinProperties::hideEvent(QHideEvent* event)
|
||||
void CvWinProperties::hideEvent(QHideEvent* evnt)
|
||||
{
|
||||
QSettings settings("OpenCV2", windowTitle());
|
||||
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
|
||||
QSettings settings("OpenCV2", QFileInfo(QApplication::applicationFilePath()).fileName());
|
||||
|
||||
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
|
||||
QSize size = settings.value("size", QSize(400, 400)).toSize();
|
||||
QPoint _pos = settings.value("pos", QPoint(200, 200)).toPoint();
|
||||
QSize _size = settings.value("size", QSize(400, 400)).toSize();
|
||||
|
||||
param_flags = settings.value("mode_resize", param_flags).toInt();
|
||||
param_gui_mode = settings.value("mode_gui", param_gui_mode).toInt();
|
||||
@ -1664,8 +1664,8 @@ void CvWindow::readSettings()
|
||||
//trackbar here
|
||||
icvLoadTrackbars(&settings);
|
||||
|
||||
resize(size);
|
||||
move(pos);
|
||||
resize(_size);
|
||||
move(_pos);
|
||||
|
||||
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->setSize(size);
|
||||
myView->getWidget()->resize(_size);
|
||||
myView->setSize(_size);
|
||||
}
|
||||
|
||||
|
||||
@ -2059,29 +2059,29 @@ void CvWindow::displayPropertiesWin()
|
||||
|
||||
|
||||
//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
|
||||
int key = event->key();
|
||||
int key = evnt->key();
|
||||
|
||||
Qt::Key qtkey = static_cast<Qt::Key>(key);
|
||||
char asciiCode = QTest::keyToAscii(qtkey);
|
||||
if (asciiCode != 0)
|
||||
key = static_cast<int>(asciiCode);
|
||||
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
|
||||
if (event->modifiers() != Qt::ControlModifier)
|
||||
if (evnt->modifiers() != Qt::ControlModifier)
|
||||
{
|
||||
mutexKey.lock();
|
||||
last_key = key;
|
||||
mutexKey.unlock();
|
||||
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");
|
||||
|
||||
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);
|
||||
settings.setArrayIndex(i);
|
||||
@ -2215,13 +2215,13 @@ void CvWindow::icvLoadButtonbar(CvButtonbar* b, 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
|
||||
|
||||
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);
|
||||
|
||||
@ -2544,7 +2544,7 @@ void DefaultViewPort::saveView()
|
||||
}
|
||||
|
||||
|
||||
void DefaultViewPort::contextMenuEvent(QContextMenuEvent* event)
|
||||
void DefaultViewPort::contextMenuEvent(QContextMenuEvent* evnt)
|
||||
{
|
||||
if (centralWidget->vect_QActions.size() > 0)
|
||||
{
|
||||
@ -2553,12 +2553,12 @@ void DefaultViewPort::contextMenuEvent(QContextMenuEvent* event)
|
||||
foreach (QAction *a, centralWidget->vect_QActions)
|
||||
menu.addAction(a);
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
menu.exec(evnt->globalPos());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DefaultViewPort::resizeEvent(QResizeEvent* event)
|
||||
void DefaultViewPort::resizeEvent(QResizeEvent* evnt)
|
||||
{
|
||||
controlImagePosition();
|
||||
|
||||
@ -2569,7 +2569,7 @@ void DefaultViewPort::resizeEvent(QResizeEvent* event)
|
||||
if (param_keepRatio == CV_WINDOW_KEEPRATIO)//to keep the same aspect ratio
|
||||
{
|
||||
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
|
||||
//ratioX = ratioY +/- epsilon
|
||||
@ -2580,7 +2580,7 @@ void DefaultViewPort::resizeEvent(QResizeEvent* event)
|
||||
|
||||
//move to the middle
|
||||
//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 (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();
|
||||
}
|
||||
|
||||
|
||||
void DefaultViewPort::mousePressEvent(QMouseEvent* event)
|
||||
void DefaultViewPort::mousePressEvent(QMouseEvent* evnt)
|
||||
{
|
||||
int cv_event = -1, flags = 0;
|
||||
QPoint pt = event->pos();
|
||||
QPoint pt = evnt->pos();
|
||||
|
||||
//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);
|
||||
|
||||
if (param_matrixWorld.m11()>1)
|
||||
{
|
||||
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;
|
||||
QPoint pt = event->pos();
|
||||
QPoint pt = evnt->pos();
|
||||
|
||||
//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);
|
||||
|
||||
if (param_matrixWorld.m11()>1)
|
||||
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;
|
||||
QPoint pt = event->pos();
|
||||
QPoint pt = evnt->pos();
|
||||
|
||||
//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);
|
||||
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
QWidget::mouseDoubleClickEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
void DefaultViewPort::mouseMoveEvent(QMouseEvent* event)
|
||||
void DefaultViewPort::mouseMoveEvent(QMouseEvent* evnt)
|
||||
{
|
||||
int cv_event = CV_EVENT_MOUSEMOVE, flags = 0;
|
||||
QPoint pt = event->pos();
|
||||
QPoint pt = evnt->pos();
|
||||
|
||||
//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);
|
||||
|
||||
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();
|
||||
positionGrabbing = event->pos();
|
||||
positionGrabbing = evnt->pos();
|
||||
moveView(dxy);
|
||||
}
|
||||
|
||||
@ -2671,11 +2671,11 @@ void DefaultViewPort::mouseMoveEvent(QMouseEvent* event)
|
||||
if (centralWidget->myStatusBar)
|
||||
viewport()->update();
|
||||
|
||||
QWidget::mouseMoveEvent(event);
|
||||
QWidget::mouseMoveEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
void DefaultViewPort::paintEvent(QPaintEvent* event)
|
||||
void DefaultViewPort::paintEvent(QPaintEvent* evnt)
|
||||
{
|
||||
QPainter myPainter(viewport());
|
||||
myPainter.setWorldTransform(param_matrixWorld);
|
||||
@ -2707,7 +2707,7 @@ void DefaultViewPort::paintEvent(QPaintEvent* event)
|
||||
if (centralWidget->myStatusBar)
|
||||
drawStatusBar();
|
||||
|
||||
QGraphicsView::paintEvent(event);
|
||||
QGraphicsView::paintEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
@ -2811,10 +2811,10 @@ void DefaultViewPort::scaleView(qreal factor,QPointF center)
|
||||
|
||||
|
||||
//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::MouseButtons buttons = event->buttons();
|
||||
Qt::KeyboardModifiers modifiers = evnt->modifiers();
|
||||
Qt::MouseButtons buttons = evnt->buttons();
|
||||
|
||||
flags = 0;
|
||||
if(modifiers & Qt::ShiftModifier)
|
||||
@ -2832,7 +2832,7 @@ void DefaultViewPort::icvmouseHandler(QMouseEvent *event, type_mouse_event categ
|
||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||
|
||||
cv_event = CV_EVENT_MOUSEMOVE;
|
||||
switch(event->button())
|
||||
switch(evnt->button())
|
||||
{
|
||||
case Qt::LeftButton:
|
||||
cv_event = tableMouseButtons[category][0];
|
||||
@ -2933,12 +2933,12 @@ void DefaultViewPort::drawImgRegion(QPainter *painter)
|
||||
|
||||
QSize view = size();
|
||||
QVarLengthArray<QLineF, 30> linesX;
|
||||
for (qreal x = offsetX*param_matrixWorld.m11(); x < view.width(); x += param_matrixWorld.m11() )
|
||||
linesX.append(QLineF(x, 0, x, view.height()));
|
||||
for (qreal _x = offsetX*param_matrixWorld.m11(); _x < view.width(); _x += param_matrixWorld.m11() )
|
||||
linesX.append(QLineF(_x, 0, _x, view.height()));
|
||||
|
||||
QVarLengthArray<QLineF, 30> linesY;
|
||||
for (qreal y = offsetY*param_matrixWorld.m11(); y < view.height(); y += param_matrixWorld.m11() )
|
||||
linesY.append(QLineF(0, y, view.width(), y));
|
||||
for (qreal _y = offsetY*param_matrixWorld.m11(); _y < view.height(); _y += param_matrixWorld.m11() )
|
||||
linesY.append(QLineF(0, _y, view.width(), _y));
|
||||
|
||||
|
||||
QFont f = painter->font();
|
||||
@ -3043,17 +3043,17 @@ void DefaultViewPort::drawInstructions(QPainter *painter)
|
||||
QFontMetrics metrics = QFontMetrics(font());
|
||||
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);
|
||||
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));
|
||||
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));
|
||||
|
||||
painter->drawText((width() - rect.width())/2, border,
|
||||
rect.width(), rect.height(),
|
||||
painter->drawText((width() - qrect.width())/2, border,
|
||||
qrect.width(), qrect.height(),
|
||||
Qt::AlignCenter | Qt::TextWordWrap, infoText);
|
||||
}
|
||||
|
||||
@ -3068,7 +3068,7 @@ void DefaultViewPort::setSize(QSize size_)
|
||||
|
||||
#ifdef HAVE_QT_OPENGL
|
||||
|
||||
OpenGlViewPort::OpenGlViewPort(QWidget* parent) : QGLWidget(parent), size(-1, -1)
|
||||
OpenGlViewPort::OpenGlViewPort(QWidget* _parent) : QGLWidget(_parent), size(-1, -1)
|
||||
{
|
||||
mouseCallback = 0;
|
||||
mouseData = 0;
|
||||
@ -3381,26 +3381,26 @@ void OpenGlViewPort::initializeGL()
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
|
||||
#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
|
||||
std::auto_ptr<GlFuncTab_QT> glFuncTab(new GlFuncTab_QT);
|
||||
std::auto_ptr<GlFuncTab_QT> qglFuncTab(new GlFuncTab_QT);
|
||||
#endif
|
||||
|
||||
// Load extensions
|
||||
|
||||
glFuncTab->glGenBuffersExt = (PFNGLGENBUFFERSPROC)context()->getProcAddress("glGenBuffers");
|
||||
glFuncTab->glDeleteBuffersExt = (PFNGLDELETEBUFFERSPROC)context()->getProcAddress("glDeleteBuffers");
|
||||
glFuncTab->glBufferDataExt = (PFNGLBUFFERDATAPROC)context()->getProcAddress("glBufferData");
|
||||
glFuncTab->glBufferSubDataExt = (PFNGLBUFFERSUBDATAPROC)context()->getProcAddress("glBufferSubData");
|
||||
glFuncTab->glBindBufferExt = (PFNGLBINDBUFFERPROC)context()->getProcAddress("glBindBuffer");
|
||||
glFuncTab->glMapBufferExt = (PFNGLMAPBUFFERPROC)context()->getProcAddress("glMapBuffer");
|
||||
glFuncTab->glUnmapBufferExt = (PFNGLUNMAPBUFFERPROC)context()->getProcAddress("glUnmapBuffer");
|
||||
qglFuncTab->glGenBuffersExt = (PFNGLGENBUFFERSPROC)context()->getProcAddress("glGenBuffers");
|
||||
qglFuncTab->glDeleteBuffersExt = (PFNGLDELETEBUFFERSPROC)context()->getProcAddress("glDeleteBuffers");
|
||||
qglFuncTab->glBufferDataExt = (PFNGLBUFFERDATAPROC)context()->getProcAddress("glBufferData");
|
||||
qglFuncTab->glBufferSubDataExt = (PFNGLBUFFERSUBDATAPROC)context()->getProcAddress("glBufferSubData");
|
||||
qglFuncTab->glBindBufferExt = (PFNGLBINDBUFFERPROC)context()->getProcAddress("glBindBuffer");
|
||||
qglFuncTab->glMapBufferExt = (PFNGLMAPBUFFERPROC)context()->getProcAddress("glMapBuffer");
|
||||
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)
|
||||
@ -3420,58 +3420,58 @@ void OpenGlViewPort::paintGL()
|
||||
CV_CheckGlError();
|
||||
}
|
||||
|
||||
void OpenGlViewPort::mousePressEvent(QMouseEvent* event)
|
||||
void OpenGlViewPort::mousePressEvent(QMouseEvent* evnt)
|
||||
{
|
||||
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);
|
||||
|
||||
QGLWidget::mousePressEvent(event);
|
||||
QGLWidget::mousePressEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
void OpenGlViewPort::mouseReleaseEvent(QMouseEvent* event)
|
||||
void OpenGlViewPort::mouseReleaseEvent(QMouseEvent* evnt)
|
||||
{
|
||||
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);
|
||||
|
||||
QGLWidget::mouseReleaseEvent(event);
|
||||
QGLWidget::mouseReleaseEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
void OpenGlViewPort::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
void OpenGlViewPort::mouseDoubleClickEvent(QMouseEvent* evnt)
|
||||
{
|
||||
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);
|
||||
|
||||
QGLWidget::mouseDoubleClickEvent(event);
|
||||
QGLWidget::mouseDoubleClickEvent(evnt);
|
||||
}
|
||||
|
||||
|
||||
void OpenGlViewPort::mouseMoveEvent(QMouseEvent* event)
|
||||
void OpenGlViewPort::mouseMoveEvent(QMouseEvent* evnt)
|
||||
{
|
||||
int cv_event = CV_EVENT_MOUSEMOVE, flags = 0;
|
||||
QPoint pt = event->pos();
|
||||
QPoint pt = evnt->pos();
|
||||
|
||||
//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);
|
||||
|
||||
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::MouseButtons buttons = event->buttons();
|
||||
Qt::KeyboardModifiers modifiers = evnt->modifiers();
|
||||
Qt::MouseButtons buttons = evnt->buttons();
|
||||
|
||||
flags = 0;
|
||||
if (modifiers & Qt::ShiftModifier)
|
||||
@ -3489,7 +3489,7 @@ void OpenGlViewPort::icvmouseHandler(QMouseEvent* event, type_mouse_event catego
|
||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||
|
||||
cv_event = CV_EVENT_MOUSEMOVE;
|
||||
switch (event->button())
|
||||
switch (evnt->button())
|
||||
{
|
||||
case Qt::LeftButton:
|
||||
cv_event = tableMouseButtons[category][0];
|
||||
|
@ -55,16 +55,6 @@
|
||||
#include <GL/glu.h>
|
||||
#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
|
||||
// 320x240 size. A better default would be actual size of the image. Problem
|
||||
// is determining desired window size with trackbars while still allowing resizing.
|
||||
|
@ -43,10 +43,6 @@
|
||||
|
||||
#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
|
||||
#ifndef _MULTIMON_USE_SECURE_CRT
|
||||
# define _MULTIMON_USE_SECURE_CRT 0 // some MinGW platforms have no strncpy_s
|
||||
@ -907,7 +903,7 @@ namespace
|
||||
|
||||
void releaseGlContext(CvWindow* window)
|
||||
{
|
||||
CV_FUNCNAME( "releaseGlContext" );
|
||||
//CV_FUNCNAME( "releaseGlContext" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
@ -1907,18 +1903,18 @@ static LRESULT CALLBACK WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||
if( hg_on_preprocess )
|
||||
{
|
||||
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 )
|
||||
return ret;
|
||||
return rethg;
|
||||
}
|
||||
ret = HighGUIProc(hwnd, uMsg, wParam, lParam);
|
||||
|
||||
if(hg_on_postprocess)
|
||||
{
|
||||
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 )
|
||||
return ret;
|
||||
return rethg;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -112,9 +112,9 @@ public:
|
||||
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);
|
||||
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)
|
||||
{
|
||||
|
@ -169,10 +169,6 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
|
||||
* 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_ );
|
||||
IMPLEMENT_LIST( _index, h_ )
|
||||
|
||||
|
@ -1521,7 +1521,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
|
||||
assert( k < ssize.width*2 );
|
||||
xofs[k].di = dx*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 )
|
||||
|
@ -43,11 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -453,11 +453,6 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4244 )
|
||||
#endif
|
||||
|
||||
typedef ushort HT;
|
||||
|
||||
/**
|
||||
@ -569,7 +564,7 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
|
||||
for( c = 0; c < cn; c++ )
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
@ -628,7 +623,7 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
|
||||
if ( luc[c][k] <= j-r )
|
||||
{
|
||||
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] );
|
||||
|
||||
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 )
|
||||
{
|
||||
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] );
|
||||
|
||||
if ( luc[c][k] < j+r+1 )
|
||||
@ -733,11 +728,6 @@ medianBlur_8u_O1( const Mat& _src, Mat& _dst, int ksize )
|
||||
#undef COP
|
||||
}
|
||||
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( default: 4244 )
|
||||
#endif
|
||||
|
||||
static void
|
||||
medianBlur_8u_Om( const Mat& _src, Mat& _dst, int m )
|
||||
{
|
||||
|
@ -2826,7 +2826,7 @@ template<class Distance>
|
||||
class CV_EXPORTS BruteForceMatcher : public BFMatcher
|
||||
{
|
||||
public:
|
||||
BruteForceMatcher( Distance d = Distance() ) : BFMatcher(Distance::normType, false) {}
|
||||
BruteForceMatcher( Distance d = Distance() ) : BFMatcher(Distance::normType, false) {(void)d;}
|
||||
virtual ~BruteForceMatcher() {}
|
||||
};
|
||||
|
||||
|
@ -41,18 +41,9 @@
|
||||
|
||||
#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 <map>
|
||||
#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]))
|
||||
|
||||
|
@ -53,10 +53,6 @@
|
||||
#include "assert.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
|
||||
// in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog.,
|
||||
// pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html
|
||||
@ -140,6 +136,8 @@ private:
|
||||
bool operator() (const __instype & lhs) const {
|
||||
return deref(ctor(lhs), dim) <= deref(ctor(pivot), dim);
|
||||
}
|
||||
private:
|
||||
median_pr& operator=(const median_pr&);
|
||||
};
|
||||
|
||||
template < class __instype, class __valuector >
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -206,7 +206,6 @@ CvBlobTrackerAuto1::~CvBlobTrackerAuto1()
|
||||
void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
{
|
||||
int CurBlobNum = 0;
|
||||
int i;
|
||||
IplImage* pFG = pMask;
|
||||
|
||||
/* Bump frame counter: */
|
||||
@ -268,15 +267,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBT)
|
||||
{
|
||||
int i;
|
||||
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: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
int BlobID = CV_BLOB_ID(pB);
|
||||
int i = m_pBT->GetBlobIndexByID(BlobID);
|
||||
m_pBT->ProcessBlob(i, pB, pImg, pFG);
|
||||
int idx = m_pBT->GetBlobIndexByID(BlobID);
|
||||
m_pBT->ProcessBlob(idx, pB, pImg, pFG);
|
||||
pB->ID = BlobID;
|
||||
}
|
||||
CurBlobNum = m_pBT->GetBlobNum();
|
||||
@ -286,9 +284,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
/* This part should be removed: */
|
||||
if(m_BTReal && m_pBT)
|
||||
{ /* Update blob list (detect new blob for real blob tracker): */
|
||||
int i;
|
||||
|
||||
for(i=m_pBT->GetBlobNum(); i>0; --i)
|
||||
for(int i=m_pBT->GetBlobNum(); i>0; --i)
|
||||
{ /* Update data of tracked blob list: */
|
||||
CvBlob* pB = m_pBT->GetBlob(i-1);
|
||||
if(pB && m_BlobList.GetBlobByID(CV_BLOB_ID(pB)) == NULL )
|
||||
@ -301,7 +297,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
} /* Next blob. */
|
||||
|
||||
/* Delete blobs: */
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
if(pB && m_pBT->GetBlobByID(CV_BLOB_ID(pB)) == NULL )
|
||||
@ -315,15 +311,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBTPostProc)
|
||||
{ /* Post-processing module: */
|
||||
int i;
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
m_pBTPostProc->AddBlob(pB);
|
||||
}
|
||||
m_pBTPostProc->Process();
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
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))
|
||||
{ /* Add new blob to tracker and blob list: */
|
||||
int i;
|
||||
IplImage* pMask = pFG;
|
||||
IplImage* pmask = pFG;
|
||||
|
||||
/*if(0)if(NewBlobList.GetBlobNum()>0 && pFG )
|
||||
{// erode FG mask (only for FG_0 and MS1||MS2)
|
||||
pMask = cvCloneImage(pFG);
|
||||
cvErode(pFG,pMask,NULL,2);
|
||||
pmask = cvCloneImage(pFG);
|
||||
cvErode(pFG,pmask,NULL,2);
|
||||
}*/
|
||||
|
||||
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)
|
||||
{
|
||||
CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pMask );
|
||||
CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pmask );
|
||||
if(pB)
|
||||
{
|
||||
NewB.blob = pB[0];
|
||||
@ -449,7 +444,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
}
|
||||
} /* 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. */
|
||||
|
||||
@ -460,7 +455,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBTGen)
|
||||
{ /* 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: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
m_pBTGen->AddBlob(pB);
|
||||
|
@ -175,7 +175,6 @@ public:
|
||||
{
|
||||
CvSeq* cnts;
|
||||
CvSeq* cnt;
|
||||
int i;
|
||||
//CvMat* pMC = NULL;
|
||||
|
||||
if(m_BlobList.GetBlobNum() <= 0 ) return;
|
||||
@ -219,7 +218,7 @@ public:
|
||||
cvReleaseImage(&pBin);
|
||||
}
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Predict new blob position. */
|
||||
CvBlob* pB = NULL;
|
||||
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
|
||||
@ -237,11 +236,10 @@ public:
|
||||
|
||||
if(m_BlobList.GetBlobNum()>0 && m_BlobListNew.GetBlobNum()>0)
|
||||
{ /* Resolve new blob to old: */
|
||||
int i,j;
|
||||
int NOld = m_BlobList.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: */
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
|
||||
pF->Collision = 0;
|
||||
@ -249,12 +247,12 @@ public:
|
||||
} /* Set 0 collision. */
|
||||
|
||||
/* Create correspondence records: */
|
||||
for(j=0; j<NNew; ++j)
|
||||
for(int j=0; j<NNew; ++j)
|
||||
{
|
||||
CvBlob* pB1 = m_BlobListNew.GetBlob(j);
|
||||
DefBlobTrackerCR* pFLast = NULL;
|
||||
|
||||
for(i=0; i<NOld; i++)
|
||||
for(int i=0; i<NOld; i++)
|
||||
{ /* Check intersection: */
|
||||
int Intersection = 0;
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
|
||||
@ -276,14 +274,13 @@ public:
|
||||
} /* Check next new blob. */
|
||||
} /* 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. */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)pB;
|
||||
int BlobID = CV_BLOB_ID(pB);
|
||||
//CvBlob* pBBest = NULL;
|
||||
//double DistBest = -1;
|
||||
int j;
|
||||
|
||||
if(pBT->pResolver)
|
||||
{
|
||||
@ -309,7 +306,7 @@ public:
|
||||
CvBlob* pBBest = NULL;
|
||||
double DistBest = -1;
|
||||
double CMax = 0;
|
||||
for(j=pBT->pBlobHyp->GetBlobNum();j>0;--j)
|
||||
for(int j=pBT->pBlobHyp->GetBlobNum();j>0;--j)
|
||||
{ /* Find best CC: */
|
||||
CvBlob* pBNew = pBT->pBlobHyp->GetBlob(j-1);
|
||||
if(pBT->pResolver)
|
||||
@ -354,8 +351,7 @@ public:
|
||||
if(m_Wnd)
|
||||
{
|
||||
IplImage* pI = cvCloneImage(pImg);
|
||||
int i;
|
||||
for(i=m_BlobListNew.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobListNew.GetBlobNum(); i>0; --i)
|
||||
{ /* Draw each new CC: */
|
||||
CvBlob* pB = m_BlobListNew.GetBlob(i-1);
|
||||
CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB));
|
||||
@ -369,7 +365,7 @@ public:
|
||||
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: */
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
|
||||
CvBlob* pB = &(pF->BlobPredict);
|
||||
|
@ -395,7 +395,7 @@ public:
|
||||
|
||||
{ /* Mean shift in scale space: */
|
||||
float news = 0;
|
||||
float sum = 0;
|
||||
float sum1 = 0;
|
||||
float scale;
|
||||
|
||||
Center = cvPoint(cvRound(m_Blob.x),cvRound(m_Blob.y));
|
||||
@ -407,13 +407,13 @@ public:
|
||||
{
|
||||
double W = cvDotProduct(m_Weights, m_KernelMeanShiftG[si]);;
|
||||
int s = si-SCALE_RANGE;
|
||||
sum += (float)fabs(W);
|
||||
sum1 += (float)fabs(W);
|
||||
news += (float)(s*W);
|
||||
}
|
||||
|
||||
if(sum>0)
|
||||
if(sum1>0)
|
||||
{
|
||||
news /= sum;
|
||||
news /= sum1;
|
||||
}
|
||||
|
||||
scale = (float)pow((double)SCALE_BASE,(double)news);
|
||||
|
@ -74,9 +74,9 @@ public:
|
||||
{
|
||||
float WSum = 0;
|
||||
int i;
|
||||
int index = m_Frame % TIME_WND;
|
||||
int idx = m_Frame % 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;
|
||||
|
||||
for(i=0; i<size; ++i)
|
||||
|
@ -44,10 +44,6 @@
|
||||
|
||||
#undef quad
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4701 )
|
||||
#endif
|
||||
|
||||
CvCalibFilter::CvCalibFilter()
|
||||
{
|
||||
/* etalon data */
|
||||
@ -93,7 +89,7 @@ CvCalibFilter::~CvCalibFilter()
|
||||
|
||||
|
||||
bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
int pointCount, CvPoint2D32f* points )
|
||||
int pointCount, CvPoint2D32f* _points )
|
||||
{
|
||||
int i, arrSize;
|
||||
|
||||
@ -132,7 +128,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
case CV_CALIB_ETALON_USER:
|
||||
etalonParamCount = 0;
|
||||
|
||||
if( !points || pointCount < 4 )
|
||||
if( !_points || pointCount < 4 )
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
@ -188,9 +184,9 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
{
|
||||
memcpy( etalonParams, params, arrSize );
|
||||
}
|
||||
if (points != NULL)
|
||||
if (_points != NULL)
|
||||
{
|
||||
memcpy( etalonPoints, points, arrSize );
|
||||
memcpy( etalonPoints, _points, arrSize );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -205,7 +201,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
|
||||
CvCalibEtalonType
|
||||
CvCalibFilter::GetEtalon( int* paramCount, const double** params,
|
||||
int* pointCount, const CvPoint2D32f** points ) const
|
||||
int* pointCount, const CvPoint2D32f** _points ) const
|
||||
{
|
||||
if( paramCount )
|
||||
*paramCount = etalonParamCount;
|
||||
@ -216,8 +212,8 @@ CvCalibFilter::GetEtalon( int* paramCount, const double** params,
|
||||
if( pointCount )
|
||||
*pointCount = etalonPointCount;
|
||||
|
||||
if( points )
|
||||
*points = etalonPoints;
|
||||
if( _points )
|
||||
*_points = etalonPoints;
|
||||
|
||||
return etalonType;
|
||||
}
|
||||
|
@ -311,19 +311,19 @@ int RandomizedTree::getIndex(uchar* patch_data) const
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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,
|
||||
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)
|
||||
{
|
||||
init((int)base_set.size(), depth, rng);
|
||||
init((int)base_set.size(), _depth, rng);
|
||||
|
||||
Mat patch;
|
||||
|
||||
@ -381,10 +381,10 @@ void RandomizedTree::freePosteriors(int which)
|
||||
classes_ = -1;
|
||||
}
|
||||
|
||||
void RandomizedTree::init(int num_classes, int depth, RNG &rng)
|
||||
void RandomizedTree::init(int num_classes, int _depth, RNG &rng)
|
||||
{
|
||||
depth_ = depth;
|
||||
num_leaves_ = 1 << depth; // 2**d
|
||||
depth_ = _depth;
|
||||
num_leaves_ = 1 << _depth; // 2**d
|
||||
int num_nodes = num_leaves_ - 1; // 2**d - 1
|
||||
|
||||
// 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++) {
|
||||
float *post = posteriors_[i];
|
||||
char buf[20];
|
||||
for (int i=0; i<classes_; i++) {
|
||||
for (int j=0; j<classes_; j++) {
|
||||
sprintf(buf, "%.10e", *post++);
|
||||
file << buf << ((i<classes_-1) ? " " : "");
|
||||
file << buf << ((j<classes_-1) ? " " : "");
|
||||
}
|
||||
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));
|
||||
for (int i=0; i<num_leaves_; i++) {
|
||||
uchar *post = posteriors2_[i];
|
||||
for (int i=0; i<classes_; i++)
|
||||
file << int(*post++) << (i<classes_-1?" ":"");
|
||||
for (int j=0; j<classes_; j++)
|
||||
file << int(*post++) << (j<classes_-1?" ":"");
|
||||
file << std::endl;
|
||||
}
|
||||
file.close();
|
||||
|
@ -190,79 +190,79 @@ static void icvFindStereoCorrespondenceByBirchfieldDP( uchar* src1, uchar* src2,
|
||||
|
||||
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;
|
||||
int e0 = _edges[0] & 1;
|
||||
_CvDPCell* _cell = cells + x*dispH;
|
||||
|
||||
do
|
||||
{
|
||||
int s = dsi[d*imgW+x];
|
||||
int _s = dsi[dp*imgW+x];
|
||||
int sum[3];
|
||||
|
||||
//check left step
|
||||
sum[0] = _cell[d-dispH].sum - param2;
|
||||
sum[0] = _cell[dp-dispH].sum - param2;
|
||||
|
||||
//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;
|
||||
|
||||
sum[2] = _cell[d-1-dispH].sum + param1;
|
||||
sum[2] = _cell[dp-1-dispH].sum + param1;
|
||||
|
||||
t = sum[1] < sum[0];
|
||||
|
||||
//choose local-optimal pass
|
||||
if( sum[t] <= sum[2] )
|
||||
{
|
||||
_cell[d].step = (uchar)t;
|
||||
_cell[d].sum = sum[t] + s;
|
||||
_cell[dp].step = (uchar)t;
|
||||
_cell[dp].sum = sum[t] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_DIAG;
|
||||
_cell[d].sum = sum[2] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_DIAG;
|
||||
_cell[dp].sum = sum[2] + _s;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sum[0] <= sum[1] )
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_UP;
|
||||
_cell[d].sum = sum[1] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_UP;
|
||||
_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] )
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_DIAG;
|
||||
_cell[d].sum = sum[2] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_DIAG;
|
||||
_cell[dp].sum = sum[2] + _s;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
}
|
||||
while( --d );
|
||||
while( --dp );
|
||||
}// for x
|
||||
|
||||
//extract optimal way and fill disparity image
|
||||
|
@ -206,7 +206,7 @@ icvJacobiEigens_32f(float *A, float *V, float *E, int n, float eps)
|
||||
//
|
||||
// Returns: CV_NO_ERR or error code
|
||||
//
|
||||
// Notes:
|
||||
// Notes:
|
||||
//F*/
|
||||
static CvStatus CV_STDCALL
|
||||
icvCalcCovarMatrixEx_8u32fR( int nObjects, void *input, int objStep1,
|
||||
@ -539,8 +539,7 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
|
||||
/* Buffer size determination */
|
||||
if( ioFlags )
|
||||
{
|
||||
int size = icvDefaultBufferSize();
|
||||
ioBufSize = MIN( size, n );
|
||||
ioBufSize = MIN( icvDefaultBufferSize(), n );
|
||||
}
|
||||
|
||||
/* memory allocation (if necesseay) */
|
||||
@ -695,13 +694,13 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
|
||||
|
||||
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 )
|
||||
imax = m1;
|
||||
|
||||
for( i = 0; i < eigSize.width * (imax - imin); i++ )
|
||||
((float *) buffer)[i] = 0.f;
|
||||
for(int k = 0; k < eigSize.width * (imax - imin); k++ )
|
||||
((float *) buffer)[k] = 0.f;
|
||||
|
||||
for( io = 0; io < nObjects; io++ )
|
||||
{
|
||||
@ -1313,7 +1312,7 @@ cvCalcEigenObjects( int nObjects,
|
||||
int ioBufSize,
|
||||
void* userData,
|
||||
CvTermCriteria* calcLimit,
|
||||
IplImage* avg,
|
||||
IplImage* avg,
|
||||
float* eigVals )
|
||||
{
|
||||
float *avg_data;
|
||||
@ -1570,7 +1569,7 @@ cvCalcDecompCoeff( IplImage * obj, IplImage * eigObj, IplImage * avg )
|
||||
avg_data, avg_step, obj_size );
|
||||
|
||||
__END__;
|
||||
|
||||
|
||||
return coeff;
|
||||
}
|
||||
|
||||
@ -1598,9 +1597,9 @@ CV_IMPL void
|
||||
cvEigenDecomposite( IplImage* obj,
|
||||
int nEigObjs,
|
||||
void* eigInput,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
IplImage* avg,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
IplImage* avg,
|
||||
float* coeffs )
|
||||
{
|
||||
float *avg_data;
|
||||
@ -1716,7 +1715,7 @@ cvEigenProjection( void* eigInput,
|
||||
int nEigObjs,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
float* coeffs,
|
||||
float* coeffs,
|
||||
IplImage* avg,
|
||||
IplImage* proj )
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ bool CvEM::train( const CvMat* _samples, const CvMat* _sample_idx,
|
||||
Mat samples = cvarrToMat(_samples), labels0, labels;
|
||||
if( _labels )
|
||||
labels0 = labels = cvarrToMat(_labels);
|
||||
|
||||
|
||||
bool isOk = train(samples, Mat(), _params, _labels ? &labels : 0);
|
||||
CV_Assert( labels0.data == labels.data );
|
||||
|
||||
@ -202,8 +202,8 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
|
||||
{
|
||||
CV_Assert(_sample_idx.empty());
|
||||
Mat prbs, weights, means, logLikelihoods;
|
||||
std::vector<Mat> covsHdrs;
|
||||
init_params(_params, prbs, weights, means, covsHdrs);
|
||||
std::vector<Mat> covshdrs;
|
||||
init_params(_params, prbs, weights, means, covshdrs);
|
||||
|
||||
emObj = EM(_params.nclusters, _params.cov_mat_type, _params.term_crit);
|
||||
bool isOk = false;
|
||||
@ -211,14 +211,14 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
|
||||
isOk = emObj.train(_samples,
|
||||
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
|
||||
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);
|
||||
else if( _params.start_step == EM::START_M_STEP )
|
||||
isOk = emObj.trainM(_samples, prbs,
|
||||
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
|
||||
else
|
||||
CV_Error(CV_StsBadArg, "Bad start type of EM algorithm");
|
||||
|
||||
|
||||
if(isOk)
|
||||
{
|
||||
logLikelihood = sum(logLikelihoods).val[0];
|
||||
|
@ -117,11 +117,11 @@ static void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStora
|
||||
for(cnt_cur=0; cnt_cur<clasters->total; ++cnt_cur)
|
||||
{
|
||||
CvRect rect;
|
||||
CvSeq* cnt;
|
||||
CvSeq* cont;
|
||||
int k = *(int*)cvGetSeqElem( clasters, cnt_cur );
|
||||
if(k!=claster_cur) continue;
|
||||
cnt = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur );
|
||||
rect = ((CvContour*)cnt)->rect;
|
||||
cont = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur );
|
||||
rect = ((CvContour*)cont)->rect;
|
||||
|
||||
if(rect_res.height<0)
|
||||
{
|
||||
@ -399,7 +399,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
if(Good)
|
||||
do{ /* For each configuration: */
|
||||
CvBlob* pBL[EBD_FRAME_NUM];
|
||||
int Good = 1;
|
||||
int good = 1;
|
||||
double Error = 0;
|
||||
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++;
|
||||
|
||||
/* Check intersection last blob with existed: */
|
||||
if(Good && pOldBlobList)
|
||||
if(good && pOldBlobList)
|
||||
{ /* Check intersection last blob with existed: */
|
||||
int 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);
|
||||
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))))
|
||||
Good = 0;
|
||||
good = 0;
|
||||
}
|
||||
} /* Check intersection last blob with existed. */
|
||||
|
||||
/* Check distance to image border: */
|
||||
if(Good)
|
||||
if(good)
|
||||
{ /* Check distance to image border: */
|
||||
CvBlob* pB = pBNew;
|
||||
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);
|
||||
|
||||
if(dx < 1.1 || dy < 1.1) Good = 0;
|
||||
if(dx < 1.1 || dy < 1.1) good = 0;
|
||||
} /* Check distance to image border. */
|
||||
|
||||
/* Check uniform motion: */
|
||||
if(Good)
|
||||
if(good)
|
||||
{
|
||||
int N = EBD_FRAME_NUM;
|
||||
float sum[2] = {0,0};
|
||||
@ -466,13 +466,13 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
if( Error > S.width*0.01 ||
|
||||
fabs(a[0])>S.width*0.1 ||
|
||||
fabs(a[1])>S.height*0.1)
|
||||
Good = 0;
|
||||
good = 0;
|
||||
|
||||
} /* Check configuration. */
|
||||
|
||||
|
||||
/* New best trajectory: */
|
||||
if(Good && (BestError == -1 || BestError > Error))
|
||||
if(good && (BestError == -1 || BestError > Error))
|
||||
{
|
||||
for(i=0; i<EBD_FRAME_NUM; ++i)
|
||||
{
|
||||
@ -491,7 +491,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
|
||||
if(i==EBD_FRAME_NUM)finish=1;
|
||||
|
||||
} while(!finish); /* Check next time configuration of connected components. */
|
||||
} while(!finish); /* Check next time configuration of connected components. */
|
||||
|
||||
#if 0
|
||||
{/**/
|
||||
|
@ -2729,8 +2729,7 @@ static int icvSelectBestRt( int numImages,
|
||||
/* allocate memory for 64d data */
|
||||
int totalNum = 0;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < numImages; i++ )
|
||||
for(int i = 0; i < numImages; i++ )
|
||||
{
|
||||
totalNum += numPoints[i];
|
||||
}
|
||||
@ -2828,8 +2827,7 @@ static int icvSelectBestRt( int numImages,
|
||||
points2 = (CvPoint3D64d*)calloc(numberPnt,sizeof(CvPoint3D64d));
|
||||
|
||||
/* Transform object points to first camera position */
|
||||
int i;
|
||||
for( i = 0; i < numberPnt; i++ )
|
||||
for(int i = 0; i < numberPnt; i++ )
|
||||
{
|
||||
/* Create second camera point */
|
||||
CvPoint3D64d tmpPoint;
|
||||
@ -2859,8 +2857,6 @@ static int icvSelectBestRt( int numImages,
|
||||
dy = tmpPoint2.y - points1[i].y;
|
||||
dz = tmpPoint2.z - points1[i].z;
|
||||
err = sqrt(dx*dx + dy*dy + dz*dz);*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -3094,8 +3090,7 @@ int icvComputeRestStereoParams(CvStereoCamera *stereoparams)
|
||||
corns[3].x = 0;
|
||||
corns[3].y = (float)(stereoparams->camera[0]->imgSize[1]-1);
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 4; i++ )
|
||||
for(int i = 0; i < 4; i++ )
|
||||
{
|
||||
/* For first camera */
|
||||
icvConvertWarpCoordinates( stereoparams->coeffs[0],
|
||||
|
@ -67,7 +67,7 @@ FaceDetection::FaceDetection()
|
||||
m_iNumLayers = 16;
|
||||
assert(m_iNumLayers <= MAX_LAYERS);
|
||||
m_pFaceList = new FaceDetectionList();
|
||||
|
||||
|
||||
|
||||
|
||||
m_bBoosting = false;
|
||||
@ -87,7 +87,7 @@ FaceDetection::~FaceDetection()
|
||||
|
||||
if (m_mstgRects)
|
||||
cvReleaseMemStorage(&m_mstgRects);
|
||||
|
||||
|
||||
|
||||
}// ~FaceDetection()
|
||||
|
||||
@ -111,7 +111,7 @@ void FaceDetection::FindContours(IplImage* imgGray)
|
||||
m_mstgRects = cvCreateMemStorage();
|
||||
if (NULL == m_mstgRects)
|
||||
return;
|
||||
m_seqRects = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvContourRect), m_mstgRects);
|
||||
m_seqRects = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvContourRect), m_mstgRects);
|
||||
if (NULL == m_seqRects)
|
||||
return;
|
||||
// find contours
|
||||
@ -148,23 +148,23 @@ void FaceDetection::ThresholdingParam(IplImage *imgGray, int iNumLayers, int &iM
|
||||
buffImg += imgGray->widthStep;
|
||||
}
|
||||
// params
|
||||
|
||||
|
||||
for (i = 0; i <= GIST_NUM; i ++)
|
||||
{
|
||||
if (gistImg[i] >= GIST_MIN)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
iMinLevel = i * GIST_STEP;
|
||||
|
||||
|
||||
for (i = GIST_NUM; i >= 0; i --)
|
||||
{
|
||||
if (gistImg[i] >= GIST_MIN)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
iMaxLevel = i * GIST_STEP;
|
||||
|
||||
|
||||
int dLevels = iMaxLevel - iMinLevel;
|
||||
if (dLevels <= 0)
|
||||
{
|
||||
@ -191,12 +191,12 @@ void FaceDetection::ThresholdingParam(IplImage *imgGray, int iNumLayers, int &iM
|
||||
|
||||
void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
{
|
||||
|
||||
|
||||
Face * tmp;
|
||||
|
||||
|
||||
double Max = 0;
|
||||
double CurStat = 0;
|
||||
|
||||
|
||||
FaceData tmpData;
|
||||
if (m_bBoosting)
|
||||
{
|
||||
@ -218,12 +218,12 @@ void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
if (CurStat > Max)
|
||||
Max = CurStat;
|
||||
}
|
||||
|
||||
|
||||
while ( (tmp = m_pFaceList->GetData()) != 0 )
|
||||
{
|
||||
tmp->CreateFace(&tmpData);
|
||||
CurStat = tmp->GetWeight();
|
||||
|
||||
|
||||
if (CurStat == Max)
|
||||
{
|
||||
CvFace tmpFace;
|
||||
@ -232,7 +232,7 @@ void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
tmpFace.RightEyeRect = tmpData.RightEyeRect;
|
||||
cvSeqPush(lpSeq,&tmpFace);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ void FaceDetection::AddContours2Rect(CvSeq *seq, int color, int iLayer)
|
||||
cvSeqPush(m_seqRects, &cr);
|
||||
for (CvSeq* internal = external->v_next; internal; internal = internal->h_next)
|
||||
{
|
||||
cr.r = cvContourBoundingRect(internal, 0);
|
||||
cr.r = cvContourBoundingRect(internal, 0);
|
||||
cr.pCenter.x = cr.r.x + cr.r.width / 2;
|
||||
cr.pCenter.y = cr.r.y + cr.r.height / 2;
|
||||
cr.iNumber = iLayer;
|
||||
@ -294,8 +294,8 @@ void FaceDetection::FindFace(IplImage *img)
|
||||
if (m_bBoosting)
|
||||
PostBoostingFindCandidats(img);
|
||||
else
|
||||
FindCandidats();
|
||||
|
||||
FindCandidats();
|
||||
|
||||
}// void FaceDetection::FindFace(IplImage *img)
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ void FaceDetection::FindCandidats()
|
||||
RFace * lpFace1 = 0;
|
||||
bool bInvalidRect1 = false;
|
||||
CvRect * lpRect1 = NULL;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < m_seqRects->total; i++)
|
||||
@ -320,38 +320,38 @@ void FaceDetection::FindCandidats()
|
||||
3*(double)rect.width/(double)4,
|
||||
(double)rect.width/(double)2,
|
||||
(double)rect.width/(double)2);
|
||||
|
||||
|
||||
|
||||
lpFace1 = new RFace(lpFaceTemplate1);
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
lpRect1 = NULL;
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
*lpRect1 = prect->r;
|
||||
}else
|
||||
{
|
||||
delete lpRect1;
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
*lpRect1 = prect->r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( lpFace1->isFeature(lpRect1) )
|
||||
{
|
||||
{
|
||||
bFound1 = true;
|
||||
bInvalidRect1 = false;
|
||||
}else
|
||||
bInvalidRect1 = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bFound1)
|
||||
{
|
||||
m_pFaceList->AddElem(lpFace1);
|
||||
@ -363,10 +363,10 @@ void FaceDetection::FindCandidats()
|
||||
lpFace1 = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
delete lpFaceTemplate1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
@ -381,10 +381,10 @@ void FaceDetection::FindCandidats()
|
||||
void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
{
|
||||
BoostingFaceTemplate * lpFaceTemplate1 = 0;
|
||||
RFace * lpFace1 = 0;
|
||||
RFace * lpFace1 = 0;
|
||||
bool bInvalidRect1 = false;
|
||||
CvRect * lpRect1 = NULL;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if ( ( !FaceImage->roi ) )
|
||||
@ -392,13 +392,13 @@ void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
else
|
||||
lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(FaceImage->roi->xOffset,FaceImage->roi->yOffset,
|
||||
FaceImage->roi->width,FaceImage->roi->height));
|
||||
|
||||
|
||||
lpFace1 = new RFace(lpFaceTemplate1);
|
||||
|
||||
for (int i = 0; i < m_seqRects->total; i++)
|
||||
{
|
||||
CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
|
||||
|
||||
|
||||
if ( !bInvalidRect1 )
|
||||
{
|
||||
lpRect1 = NULL;
|
||||
@ -410,21 +410,21 @@ void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( lpFace1->isFeature(lpRect1) )
|
||||
{
|
||||
{
|
||||
//bFound1 = true;
|
||||
bInvalidRect1 = false;
|
||||
}else
|
||||
bInvalidRect1 = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_pFaceList->AddElem(lpFace1);
|
||||
lpFace1 = NULL;
|
||||
|
||||
|
||||
delete lpFaceTemplate1;
|
||||
}
|
||||
catch(...)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -182,13 +182,13 @@ void CvImage::show( const char* window_name )
|
||||
|
||||
/////////////////////////////// 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 )
|
||||
{
|
||||
matrix = (CvMat*)cvMemStorageAlloc( storage, sizeof(*matrix) );
|
||||
cvInitMatHeader( matrix, rows, cols, type, alloc_data ?
|
||||
cvMemStorageAlloc( storage, rows*cols*CV_ELEM_SIZE(type) ) : 0 );
|
||||
cvInitMatHeader( matrix, _rows, _cols, _type, alloc_data ?
|
||||
cvMemStorageAlloc( storage, _rows*_cols*CV_ELEM_SIZE(_type) ) : 0 );
|
||||
}
|
||||
else
|
||||
matrix = 0;
|
||||
|
@ -48,10 +48,6 @@
|
||||
#include "_kdtree.hpp"
|
||||
#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 {
|
||||
template <class __scalartype, int __cvtype>
|
||||
struct deref {
|
||||
|
@ -135,13 +135,11 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
|
||||
}
|
||||
/* ----- End test ----- */
|
||||
|
||||
int i;
|
||||
|
||||
/* Allocate memory for derivates */
|
||||
|
||||
double p[12];
|
||||
/* Copy projection matrix */
|
||||
for( i = 0; i < 12; i++ )
|
||||
for(int i = 0; i < 12; i++ )
|
||||
{
|
||||
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[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11];
|
||||
|
||||
int i;
|
||||
/* fill derivate by point */
|
||||
|
||||
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;
|
||||
|
||||
/* fill derivate by projection matrix */
|
||||
for( i = 0; i < 4; i++ )
|
||||
for(int i = 0; i < 4; i++ )
|
||||
{
|
||||
/* derivate for x */
|
||||
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 */
|
||||
|
||||
double p[12];
|
||||
int i;
|
||||
for( i = 0; i < 12; i++ )
|
||||
for(int i = 0; i < 12; i++ )
|
||||
{
|
||||
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[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]);
|
||||
|
||||
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,
|
||||
j, currVisPoint*4+i,
|
||||
@ -863,26 +857,25 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
|
||||
double point3D_dat[3];
|
||||
point3D = cvMat(3,1,CV_64F,point3D_dat);
|
||||
|
||||
int currPoint;
|
||||
int numVis = 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;
|
||||
cvGetCol(points4D,&point4D,currPoint);
|
||||
cvGetCol(points4D,&point4D,curPoint);
|
||||
cvmMul(projMatrs[currImage],&point4D,&point3D);
|
||||
double w = point3D_dat[2];
|
||||
double x = point3D_dat[0] / w;
|
||||
double y = point3D_dat[1] / w;
|
||||
|
||||
dx = cvmGet(projPoints[currImage],0,currPoint) - x;
|
||||
dy = cvmGet(projPoints[currImage],1,currPoint) - y;
|
||||
dx = cvmGet(projPoints[currImage],0,curPoint) - x;
|
||||
dy = cvmGet(projPoints[currImage],1,curPoint) - y;
|
||||
if( projError )
|
||||
{
|
||||
cvmSet(projError[currImage],0,currPoint,dx);
|
||||
cvmSet(projError[currImage],1,currPoint,dy);
|
||||
cvmSet(projError[currImage],0,curPoint,dx);
|
||||
cvmSet(projError[currImage],1,curPoint,dy);
|
||||
}
|
||||
totalError += sqrt(dx*dx+dy*dy);
|
||||
numVis++;
|
||||
@ -1147,10 +1140,8 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
CV_CALL( changeVectorX_points4D = cvCreateMat(4,numPoints,CV_64F));
|
||||
CV_CALL( changeVectorX_projMatrs = cvCreateMat(3,4,CV_64F));
|
||||
|
||||
int currImage;
|
||||
|
||||
/* ----- 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 */
|
||||
if( !CV_IS_MAT(projMatrs[currImage]) )
|
||||
@ -1194,7 +1185,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* ----- End test ----- */
|
||||
|
||||
/* 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( 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) );
|
||||
}
|
||||
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
CV_CALL( matrsUk[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 */
|
||||
double prevError;
|
||||
prevError = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
|
||||
double currNorm = cvNorm(errorProjPoints[currImage]);
|
||||
@ -1325,8 +1316,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
fprintf(file,"projection errors\n");
|
||||
|
||||
/* Print all proejction errors */
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++)
|
||||
for(int currImage = 0; currImage < numImages; currImage++)
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
int numPn = errorProjPoints[currImage]->cols;
|
||||
@ -1419,7 +1409,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
#endif
|
||||
/* 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]);
|
||||
}
|
||||
@ -1459,7 +1449,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
{
|
||||
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) );
|
||||
}
|
||||
@ -1468,7 +1458,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
|
||||
/* 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++ )
|
||||
@ -1485,7 +1475,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
int 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 */
|
||||
{
|
||||
@ -1506,7 +1496,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
cvmMul(matrW,matrTmpSys1,matrSysDeltaP);
|
||||
|
||||
/* 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;
|
||||
cvGetSubRect(matrSysDeltaP,&subMatr,cvRect(currImage*12,currImage*12,12,12));
|
||||
@ -1536,8 +1526,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
FILE* file;
|
||||
file = fopen( TRACK_BUNDLE_FILE_DELTAP ,"w");
|
||||
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
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 */
|
||||
|
||||
/* Compute new P */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@ -1604,7 +1593,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
icvProjPointsStatusFunc(numImages, newVectorX_points4D, newVectorX_projMatrs, pointsPres, projVisPoints);
|
||||
/* Compute error with observed value and computed projection */
|
||||
double newError = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
|
||||
double currNorm = cvNorm(errorProjPoints[currImage]);
|
||||
@ -1643,8 +1632,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* Print all projection errors */
|
||||
#if 0
|
||||
fprintf(file,"projection errors\n");
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++)
|
||||
for(int currImage = 0; currImage < numImages; currImage++)
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
int numPn = errorProjPoints[currImage]->cols;
|
||||
@ -1676,7 +1664,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
double currNorm1 = 0;
|
||||
double currNorm2 = 0;
|
||||
/* 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]);
|
||||
currNorm2 = cvNorm(newVectorX_projMatrs[currImage]);
|
||||
@ -1713,7 +1701,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
|
||||
alpha /= 10;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvCopy(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]);
|
||||
}
|
||||
@ -1745,7 +1733,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/*--------------------------------------------*/
|
||||
/* Optimization complete copy computed params */
|
||||
/* Copy projection matrices */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvCopy(newVectorX_projMatrs[currImage],resultProjMatrs[currImage]);
|
||||
}
|
||||
|
@ -423,8 +423,8 @@ namespace cv{
|
||||
}
|
||||
|
||||
cvAdd(pca_descriptors[0].GetPatch(i), m_samples[i], m_samples[i]);
|
||||
double sum = cvSum(m_samples[i]).val[0];
|
||||
cvConvertScale(m_samples[i], m_samples[i], 1.0/sum);
|
||||
double sm = cvSum(m_samples[i]).val[0];
|
||||
cvConvertScale(m_samples[i], m_samples[i], 1.0/sm);
|
||||
|
||||
#if 0
|
||||
IplImage* test = cvCreateImage(cvSize(12, 12), IPL_DEPTH_8U, 1);
|
||||
@ -1671,7 +1671,6 @@ namespace cv{
|
||||
|
||||
if (! m_pca_descriptors[i].ReadByName(fn, buf))
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "descriptor for pca component %d", i);
|
||||
m_pca_descriptors[i].ReadByName(fn, buf);
|
||||
}
|
||||
|
@ -41,10 +41,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -143,7 +143,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
int norphans = 0, maxOrphans = _maxOrphans;
|
||||
GCVtx** orphans = _orphans;
|
||||
stub.next = nilNode;
|
||||
|
||||
|
||||
// initialize the active queue and the graph vertices
|
||||
for( i = 0; i < nvtx; i++ )
|
||||
{
|
||||
@ -170,7 +170,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
GCVtx* v, *u;
|
||||
int e0 = -1, ei = 0, ej = 0, min_weight, weight;
|
||||
uchar vt;
|
||||
|
||||
|
||||
// grow S & T search trees, find an edge connecting them
|
||||
while( first != nilNode )
|
||||
{
|
||||
@ -262,7 +262,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
v->parent = ORPHAN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
v->weight = (short)(v->weight + min_weight*(1-k*2));
|
||||
if( v->weight == 0 )
|
||||
{
|
||||
@ -277,12 +277,12 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
curr_ts++;
|
||||
while( norphans > 0 )
|
||||
{
|
||||
GCVtx* v = orphans[--norphans];
|
||||
GCVtx* v1 = orphans[--norphans];
|
||||
int d, min_dist = INT_MAX;
|
||||
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 )
|
||||
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;
|
||||
v->dist = min_dist;
|
||||
v1->ts = curr_ts;
|
||||
v1->dist = min_dist;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* no parent is found */
|
||||
v->ts = 0;
|
||||
for( ei = v->first; ei != 0; ei = edges[ei].next )
|
||||
v1->ts = 0;
|
||||
for( ei = v1->first; ei != 0; ei = edges[ei].next )
|
||||
{
|
||||
u = edges[ei].dst;
|
||||
ej = u->parent;
|
||||
@ -349,7 +349,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
u->next = nilNode;
|
||||
last = last->next = u;
|
||||
}
|
||||
if( ej > 0 && edges[ej].dst == v )
|
||||
if( ej > 0 && edges[ej].dst == v1 )
|
||||
{
|
||||
if( norphans >= maxOrphans )
|
||||
maxOrphans = icvGCResizeOrphansBuf( orphans, norphans );
|
||||
@ -387,7 +387,7 @@ CvStereoGCState* cvCreateStereoGCState( int numberOfDisparities, int maxIters )
|
||||
void cvReleaseStereoGCState( CvStereoGCState** _state )
|
||||
{
|
||||
CvStereoGCState* state;
|
||||
|
||||
|
||||
if( !_state && !*_state )
|
||||
return;
|
||||
|
||||
@ -438,7 +438,7 @@ static void icvInitGraySubpix( const CvMat* left, const CvMat* right,
|
||||
CvMat* left3, CvMat* right3 )
|
||||
{
|
||||
int k, x, y, rows = left->rows, cols = left->cols;
|
||||
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
const CvMat* src = k == 0 ? left : right;
|
||||
@ -452,11 +452,11 @@ static void icvInitGraySubpix( const CvMat* left, const CvMat* right,
|
||||
const uchar* sptr_next = y < rows-1 ? sptr + sstep : sptr;
|
||||
uchar* dptr = dst->data.ptr + dst->step*y;
|
||||
int v_prev = sptr[0];
|
||||
|
||||
|
||||
for( x = 0; x < cols; x++, dptr += 3 )
|
||||
{
|
||||
int v = sptr[x], v1, minv = v, maxv = v;
|
||||
|
||||
|
||||
v1 = (v + v_prev)/2;
|
||||
minv = MIN(minv, v1); maxv = MAX(maxv, v1);
|
||||
v1 = (v + sptr_prev[x])/2;
|
||||
@ -492,7 +492,7 @@ icvComputeK( CvStereoGCState* state )
|
||||
{
|
||||
const uchar* lptr = state->left->data.ptr + state->left->step*y;
|
||||
const uchar* rptr = state->right->data.ptr + state->right->step*y;
|
||||
|
||||
|
||||
for( x = 0; x < cols; x++ )
|
||||
{
|
||||
for( d = maxd-1, i = 0; d >= mind; d-- )
|
||||
@ -701,7 +701,7 @@ static int64 icvAlphaExpand( int64 Eprev, int alpha, CvStereoGCState* state, CvS
|
||||
GCVtx** pright = pright0 + pstep*y;
|
||||
const uchar* lr[] = { left, right };
|
||||
const short* dlr[] = { dleft, dright };
|
||||
GCVtx** plr[] = { pleft, pright };
|
||||
GCVtx** plr[] = { pleft, pright };
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
@ -820,12 +820,12 @@ static int64 icvAlphaExpand( int64 Eprev, int alpha, CvStereoGCState* state, CvS
|
||||
GCVtx** pright = pright0 + pstep*y;
|
||||
for( x = 0; x < cols; x++ )
|
||||
{
|
||||
GCVtx* var = pleft[x];
|
||||
if( var && var->parent && var->t )
|
||||
dleft[x] = (short)alpha;
|
||||
GCVtx* var2 = pleft[x];
|
||||
if( var2 && var2->parent && var2->t )
|
||||
dleft[x] = (short)alpha;
|
||||
|
||||
var = pright[x];
|
||||
if( var && var->parent && var->t )
|
||||
var2 = pright[x];
|
||||
if( var2 && var2->parent && var2->t )
|
||||
dright[x] = (short)-alpha;
|
||||
}
|
||||
}
|
||||
@ -903,7 +903,7 @@ CV_IMPL void cvFindStereoCorrespondenceGC( const CvArr* _left, const CvArr* _rig
|
||||
|
||||
icvInitStereoConstTabs();
|
||||
icvInitGraySubpix( left, right, state->left, state->right );
|
||||
|
||||
|
||||
std::vector<int> disp(state->numberOfDisparities);
|
||||
CvMat _disp = cvMat( 1, (int)disp.size(), CV_32S, &disp[0] );
|
||||
cvRange( &_disp, state->minDisparity, state->minDisparity + state->numberOfDisparities );
|
||||
|
@ -500,15 +500,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
int y0=0, y1=pFG->height-1;
|
||||
for(y0=0; y0<pFG->height; ++y0)
|
||||
{
|
||||
CvMat m;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &m, y0));
|
||||
CvMat tmp;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &tmp, y0));
|
||||
if(s.val[0] > 255*7) break;
|
||||
}
|
||||
|
||||
for(y1=pFG->height-1; y1>0; --y1)
|
||||
{
|
||||
CvMat m;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &m, y1));
|
||||
CvMat tmp;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &tmp, y1));
|
||||
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, "Dur", p->FrameNum );
|
||||
{
|
||||
int LastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 );
|
||||
p->FrameNum = MIN(p->FrameNum,LastFrame - p->FrameBegin+1);
|
||||
int lastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 );
|
||||
p->FrameNum = MIN(p->FrameNum,lastFrame - p->FrameBegin+1);
|
||||
}
|
||||
|
||||
icvTestSeqAllocTrans(p);
|
||||
@ -621,8 +621,8 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
|
||||
if(pTransSeq&&KeyFrameNum>1)
|
||||
{
|
||||
int i0,i1,i;
|
||||
for(i=0; i<KeyFrameNum; ++i)
|
||||
int i0,i1;
|
||||
for(int i=0; i<KeyFrameNum; ++i)
|
||||
{
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i);
|
||||
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;)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i1=i0+1; i1<KeyFrameNum && KeyFrames[i1]<0; i1++);
|
||||
|
||||
assert(i1<KeyFrameNum);
|
||||
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));
|
||||
}
|
||||
@ -665,9 +663,9 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
{ /* Only one transform record: */
|
||||
int i;
|
||||
double val;
|
||||
CvFileNode* node = cvGetFileNodeByName( fs, pTN,name);
|
||||
if(node == NULL) continue;
|
||||
val = cvReadReal(node,defv);
|
||||
CvFileNode* fnode = cvGetFileNodeByName( fs, pTN,name);
|
||||
if(fnode == NULL) continue;
|
||||
val = cvReadReal(fnode,defv);
|
||||
|
||||
for(i=0; i<p->TransNum; ++i)
|
||||
{
|
||||
@ -683,15 +681,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
double v0;
|
||||
double v1;
|
||||
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,0);
|
||||
v0 = cvReadRealByName(fs, pTN,name,defv);
|
||||
CvFileNode* pTN1 = (CvFileNode*)cvGetSeqElem(pTransSeq,0);
|
||||
v0 = cvReadRealByName(fs, pTN1,name,defv);
|
||||
|
||||
for(i1=1,i0=0; i1<KeyFrameNum; ++i1)
|
||||
{
|
||||
int f0,f1;
|
||||
int i;
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i1);
|
||||
CvFileNode* pVN = cvGetFileNodeByName(fs,pTN,name);
|
||||
CvFileNode* pTN2 = (CvFileNode*)cvGetSeqElem(pTransSeq,i1);
|
||||
CvFileNode* pVN = cvGetFileNodeByName(fs,pTN2,name);
|
||||
|
||||
if(pVN)v1 = cvReadReal(pVN,defv);
|
||||
else if(pVN == NULL && i1 == KeyFrameNum-1) v1 = defv;
|
||||
|
@ -861,8 +861,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
projMatrs[1] = projMatr2;
|
||||
projMatrs[2] = projMatr3;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
for(int i = 0; i < 3; i++ )
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -951,10 +950,9 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
icvProject4DPoints(recPoints4D,&proj6[2],tmpProjPoints[2]);
|
||||
|
||||
/* Compute distances and number of good points (inliers) */
|
||||
int i;
|
||||
int currImage;
|
||||
numGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
dist = 0;
|
||||
@ -1051,7 +1049,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
CvMat *optStatus;
|
||||
optStatus = cvCreateMat(1,numPoints,CV_64F);
|
||||
int testNumber = 0;
|
||||
for( i=0;i<numPoints;i++ )
|
||||
for(int i=0;i<numPoints;i++ )
|
||||
{
|
||||
cvmSet(optStatus,0,i,(double)bestFlags[i]);
|
||||
testNumber += bestFlags[i];
|
||||
@ -1063,7 +1061,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
CvMat *gPresPoints;
|
||||
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);
|
||||
}
|
||||
@ -1130,7 +1128,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
int currImage;
|
||||
finalGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
/* Choose max distance for each of three points */
|
||||
@ -1178,7 +1176,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
/* Create status */
|
||||
CvMat *optStatus;
|
||||
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]);
|
||||
}
|
||||
@ -1236,7 +1234,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
int currImage;
|
||||
finalGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
/* Choose max distance for each of three points */
|
||||
@ -1662,15 +1660,12 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
|
||||
matrA_dat[7] = s;
|
||||
matrA_dat[8] = -(p+q+r+s+t);
|
||||
|
||||
CvMat matrU;
|
||||
CvMat matrW;
|
||||
CvMat matrV;
|
||||
|
||||
double matrU_dat[3*3];
|
||||
double matrW_dat[3*3];
|
||||
double matrV_dat[3*3];
|
||||
|
||||
matrU = cvMat(3,3,CV_64F,matrU_dat);
|
||||
matrW = cvMat(3,3,CV_64F,matrW_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[5*6+5] = -C2;
|
||||
|
||||
CvMat matrU;
|
||||
CvMat matrW;
|
||||
CvMat matrV;
|
||||
CvMat matrW1;
|
||||
CvMat matrV1;
|
||||
|
||||
double matrU_dat[36];
|
||||
double matrW_dat[36];
|
||||
double matrV_dat[36];
|
||||
double matrW_dat1[36];
|
||||
double matrV_dat1[36];
|
||||
|
||||
matrU = cvMat(6,6,CV_64F,matrU_dat);
|
||||
matrW = cvMat(6,6,CV_64F,matrW_dat);
|
||||
matrV = cvMat(6,6,CV_64F,matrV_dat);
|
||||
matrW1 = cvMat(6,6,CV_64F,matrW_dat1);
|
||||
matrV1 = cvMat(6,6,CV_64F,matrV_dat1);
|
||||
|
||||
/* From svd we need just last vector of V or last row 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];
|
||||
b = matrV_dat[6*5+1];
|
||||
c = matrV_dat[6*5+2];
|
||||
d = matrV_dat[6*5+3];
|
||||
a = matrV_dat1[6*5+0];
|
||||
b = matrV_dat1[6*5+1];
|
||||
c = matrV_dat1[6*5+2];
|
||||
d = matrV_dat1[6*5+3];
|
||||
/* we don't need last two coefficients. Because it just a k1,k2 */
|
||||
|
||||
cvmSet(projMatrCoefs,0,0,a);
|
||||
|
@ -137,7 +137,7 @@ struct CvFaceTracker
|
||||
if (NULL != mstgContours)
|
||||
cvReleaseMemStorage(&mstgContours);
|
||||
};
|
||||
int Init(CvRect* pRects, IplImage* imgGray)
|
||||
int Init(CvRect* pRects, IplImage* imgray)
|
||||
{
|
||||
for (int i = 0; i < NUM_FACE_ELEMENTS; i++)
|
||||
{
|
||||
@ -146,10 +146,10 @@ struct CvFaceTracker
|
||||
ptTempl[i] = face[i].ptCenter;
|
||||
rTempl[i] = face[i].r;
|
||||
}
|
||||
imgGray = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1);
|
||||
imgThresh = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1);
|
||||
imgray = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
|
||||
imgThresh = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
|
||||
mstgContours = cvCreateMemStorage();
|
||||
if ((NULL == imgGray) ||
|
||||
if ((NULL == imgray) ||
|
||||
(NULL == imgThresh) ||
|
||||
(NULL == mstgContours))
|
||||
return FALSE;
|
||||
|
@ -593,11 +593,11 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
|
||||
assert(fn.isSeq());
|
||||
for( int i = 0; i < (int)fn.size(); i+=3 )
|
||||
{
|
||||
string name = fn[i];
|
||||
string nm = fn[i];
|
||||
DatasetParams params;
|
||||
string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
|
||||
string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
|
||||
datasetsParams[name] = params;
|
||||
datasetsParams[nm] = params;
|
||||
}
|
||||
return cvtest::TS::OK;
|
||||
}
|
||||
|
@ -41,10 +41,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -88,10 +88,6 @@ using namespace cv;
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4514 ) /* unreferenced inline functions */
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
typedef float Qfloat;
|
||||
#define QFLOAT_TYPE CV_32F
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -416,7 +416,7 @@ void hysteresisGradient(Mat& magnitude, Mat& quantized_angle,
|
||||
// Only accept the quantization if majority of pixels in the patch agree
|
||||
static const int NEIGHBOR_THRESHOLD = 5;
|
||||
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
|
||||
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 col = 0; col < 16; ++col)
|
||||
dst_ptr[col] += lm_ptr[col];
|
||||
dst_ptr[col] = uchar(dst_ptr[col] + lm_ptr[col]);
|
||||
dst_ptr += 16;
|
||||
lm_ptr += W;
|
||||
}
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -205,8 +205,18 @@ static CvMat *PyCvMat_AsCvMat(PyObject *o)
|
||||
}
|
||||
|
||||
#define cvReleaseIplConvKernel(x) cvReleaseStructuringElement(x)
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4244 )
|
||||
#endif
|
||||
|
||||
#include "generated3.i"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
/* iplimage */
|
||||
|
||||
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;
|
||||
break;
|
||||
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
|
||||
@ -3800,7 +3811,7 @@ static int zero = 0;
|
||||
|
||||
#define CVPY_VALIDATE_DrawChessboardCorners() do { \
|
||||
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)
|
||||
|
||||
#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) \
|
||||
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"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
static PyMethodDef old_methods[] = {
|
||||
|
||||
#if PYTHON_USE_NUMPY
|
||||
|
@ -9,7 +9,7 @@ if(MINGW)
|
||||
endif()
|
||||
|
||||
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
|
||||
|
||||
|
||||
ocv_add_module(ts opencv_core)
|
||||
ocv_glob_module_sources()
|
||||
ocv_module_include_directories()
|
||||
@ -17,9 +17,6 @@ ocv_create_module()
|
||||
|
||||
if(BUILD_SHARED_LIBS AND NOT MINGW)
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
|
||||
if (MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275")
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0)
|
||||
endif()
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include <stdarg.h> // for va_list
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4251 4275 4355 4127 )
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable: 4127 )
|
||||
#endif
|
||||
|
||||
#define GTEST_DONT_DEFINE_FAIL 0
|
||||
|
@ -16843,7 +16843,7 @@ class GTEST_API_ TestPartResultArray {
|
||||
};
|
||||
|
||||
// This interface knows how to report a test part result.
|
||||
class TestPartResultReporterInterface {
|
||||
class GTEST_API_ TestPartResultReporterInterface {
|
||||
public:
|
||||
virtual ~TestPartResultReporterInterface() {}
|
||||
|
||||
|
@ -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/ts/ts.hpp"
|
||||
|
||||
|
@ -36,7 +36,11 @@
|
||||
|
||||
// This line ensures that gtest.h can be compiled on its own, even
|
||||
// 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.
|
||||
// Copyright 2005, Google Inc.
|
||||
|
@ -584,9 +584,17 @@ int64 TestBase::_calibrate()
|
||||
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)
|
||||
{
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
void TestBase::declareArray(SizeVector& sizes, cv::InputOutputArray a, int wtype)
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ struct MOG2Invoker
|
||||
}
|
||||
|
||||
//set the number of modes
|
||||
modesUsed[x] = nmodes;
|
||||
modesUsed[x] = uchar(nmodes);
|
||||
mask[x] = background ? 0 :
|
||||
detectShadows && detectShadowGMM(data, nchannels, nmodes, gmm, mean, Tb, TB, tau) ?
|
||||
shadowVal : 255;
|
||||
@ -571,7 +571,7 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask
|
||||
bgmodelUsedModes.data, nmixtures, (float)learningRate,
|
||||
(float)varThreshold,
|
||||
backgroundRatio, varThresholdGen,
|
||||
fVarInit, fVarMin, fVarMax, -learningRate*fCT, fTau,
|
||||
fVarInit, fVarMin, fVarMax, float(-learningRate*fCT), fTau,
|
||||
bShadowDetection, nShadowDetection));
|
||||
}
|
||||
}
|
||||
|
@ -43,10 +43,6 @@
|
||||
#ifndef __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
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@ -730,8 +730,8 @@ Mat KeypointBasedMotionEstimatorGpu::estimate(const gpu::GpuMat &frame0, const g
|
||||
|
||||
// perform outlier rejection
|
||||
|
||||
IOutlierRejector *outlierRejector = static_cast<IOutlierRejector*>(outlierRejector_);
|
||||
if (!dynamic_cast<NullOutlierRejector*>(outlierRejector))
|
||||
IOutlierRejector *rejector = static_cast<IOutlierRejector*>(outlierRejector_);
|
||||
if (!dynamic_cast<NullOutlierRejector*>(rejector))
|
||||
{
|
||||
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]);
|
||||
hostPoints_ = Mat(1, hostPointsTmp_.size(), CV_32FC2, &hostPointsTmp_[0]);
|
||||
hostPointsPrev_ = Mat(1, (int)hostPointsPrevTmp_.size(), CV_32FC2, &hostPointsPrevTmp_[0]);
|
||||
hostPoints_ = Mat(1, (int)hostPointsTmp_.size(), CV_32FC2, &hostPointsTmp_[0]);
|
||||
}
|
||||
|
||||
// estimate motion
|
||||
|
@ -52,7 +52,7 @@ namespace videostab
|
||||
{
|
||||
|
||||
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.getMat().checkVector(2) == points1.getMat().checkVector(2));
|
||||
|
@ -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);
|
||||
zl = ML(2,0)*x + ML(2,1)*y + ML(2,2);
|
||||
xl /= zl; yl /= zl;
|
||||
wl = idx - k1;
|
||||
wl = float(idx - k1);
|
||||
|
||||
xr = MR(0,0)*x + MR(0,1)*y + MR(0,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);
|
||||
xr /= zr; yr /= zr;
|
||||
wr = k2 - idx;
|
||||
wr = float(k2 - idx);
|
||||
|
||||
mapx_(y,x) = (wr * xl + wl * xr) / (wl + wr);
|
||||
mapy_(y,x) = (wr * yl + wl * yr) / (wl + wr);
|
||||
|
@ -32,23 +32,20 @@ static void help()
|
||||
// define whether to use approximate nearest-neighbor search
|
||||
#define USE_FLANN
|
||||
|
||||
|
||||
IplImage* image = 0;
|
||||
|
||||
#ifdef USE_FLANN
|
||||
static void
|
||||
flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
const CvSeq*, const CvSeq* imageDescriptors, vector<int>& ptpairs )
|
||||
{
|
||||
int length = (int)(objectDescriptors->elem_size/sizeof(float));
|
||||
int length = (int)(objectDescriptors->elem_size/sizeof(float));
|
||||
|
||||
cv::Mat m_object(objectDescriptors->total, length, CV_32F);
|
||||
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
|
||||
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
|
||||
|
||||
|
||||
// copy descriptors
|
||||
// copy descriptors
|
||||
CvSeqReader obj_reader;
|
||||
float* obj_ptr = m_object.ptr<float>(0);
|
||||
float* obj_ptr = m_object.ptr<float>(0);
|
||||
cvStartReadSeq( objectDescriptors, &obj_reader );
|
||||
for(int i = 0; i < objectDescriptors->total; i++ )
|
||||
{
|
||||
@ -58,7 +55,7 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
obj_ptr += length;
|
||||
}
|
||||
CvSeqReader img_reader;
|
||||
float* img_ptr = m_image.ptr<float>(0);
|
||||
float* img_ptr = m_image.ptr<float>(0);
|
||||
cvStartReadSeq( imageDescriptors, &img_reader );
|
||||
for(int i = 0; i < imageDescriptors->total; i++ )
|
||||
{
|
||||
@ -77,10 +74,10 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
int* indices_ptr = m_indices.ptr<int>(0);
|
||||
float* dists_ptr = m_dists.ptr<float>(0);
|
||||
for (int i=0;i<m_indices.rows;++i) {
|
||||
if (dists_ptr[2*i]<0.6*dists_ptr[2*i+1]) {
|
||||
ptpairs.push_back(i);
|
||||
ptpairs.push_back(indices_ptr[2*i]);
|
||||
}
|
||||
if (dists_ptr[2*i]<0.6*dists_ptr[2*i+1]) {
|
||||
ptpairs.push_back(i);
|
||||
ptpairs.push_back(indices_ptr[2*i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
@ -234,7 +231,7 @@ int main(int argc, char** argv)
|
||||
cvNamedWindow("Object", 1);
|
||||
cvNamedWindow("Object Correspond", 1);
|
||||
|
||||
static CvScalar colors[] =
|
||||
static CvScalar colors[] =
|
||||
{
|
||||
{{0,0,255}},
|
||||
{{0,128,255}},
|
||||
|
@ -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();
|
||||
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++ )
|
||||
{
|
||||
double val = var_importance->data.db[i];
|
||||
if( var_desc )
|
||||
{
|
||||
char buf[100];
|
||||
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
|
||||
strncpy( buf, var_desc[i], len );
|
||||
buf[len] = '\0';
|
||||
printf( "%s", buf );
|
||||
}
|
||||
else
|
||||
printf( "var #%d", i );
|
||||
char buf[100];
|
||||
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
|
||||
strncpy( buf, var_desc[i], len );
|
||||
buf[len] = '\0';
|
||||
printf( "%s", buf );
|
||||
printf( ": %g%%\n", val*100. );
|
||||
}
|
||||
}
|
||||
|
||||
static void interactive_classification( CvDTree* dtree, const char** var_desc )
|
||||
static void interactive_classification( CvDTree* dtree )
|
||||
{
|
||||
char input[1000];
|
||||
const CvDTreeNode* root;
|
||||
@ -319,8 +314,8 @@ int main( int argc, char** argv )
|
||||
cvReleaseMat( &missing );
|
||||
cvReleaseMat( &responses );
|
||||
|
||||
print_variable_importance( dtree, var_desc );
|
||||
interactive_classification( dtree, var_desc );
|
||||
print_variable_importance( dtree );
|
||||
interactive_classification( dtree );
|
||||
delete dtree;
|
||||
|
||||
return 0;
|
||||
|
@ -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
|
||||
double maxInput, minInput;
|
||||
minMaxLoc(inputImage, &minInput, &maxInput);
|
||||
std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl
|
||||
;if (firstTimeread)
|
||||
std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
|
||||
|
||||
if (firstTimeread)
|
||||
{
|
||||
/* 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],
|
||||
=> actually using a little less in order to let some more flexibility in range evolves...
|
||||
*/
|
||||
double maxInput, minInput;
|
||||
minMaxLoc(inputImage, &minInput, &maxInput);
|
||||
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
|
||||
globalRescalefactor=(float)(50.0/(maxInput-minInput)); // less than 255 for flexibility... experimental value to be carefull about
|
||||
double maxInput1, minInput1;
|
||||
minMaxLoc(inputImage, &minInput1, &maxInput1);
|
||||
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput1<<", "<<minInput1<<std::endl;
|
||||
globalRescalefactor=(float)(50.0/(maxInput1-minInput1)); // less than 255 for flexibility... experimental value to be carefull about
|
||||
double channelOffset = -1.5*minInput;
|
||||
globalOffset= cv::Scalar(channelOffset, channelOffset, channelOffset, channelOffset);
|
||||
}
|
||||
|
@ -803,9 +803,9 @@ void VocData::calcClassifierPrecRecall(const string& input_file, vector<float>&
|
||||
std::sort(order.begin(),order.end(),orderingSorter());
|
||||
|
||||
/* 2. save ranking results to text file */
|
||||
string input_file_std = checkFilenamePathsep(input_file);
|
||||
size_t fnamestart = input_file_std.rfind("/");
|
||||
string scoregt_file_str = input_file_std.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt";
|
||||
string input_file_std1 = checkFilenamePathsep(input_file);
|
||||
size_t fnamestart = input_file_std1.rfind("/");
|
||||
string scoregt_file_str = input_file_std1.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt";
|
||||
std::ofstream scoregt_file(scoregt_file_str.c_str());
|
||||
if (scoregt_file.is_open())
|
||||
{
|
||||
|
@ -230,13 +230,13 @@ static void findConstrainedCorrespondences(const Mat& _F,
|
||||
{
|
||||
if( i1 == i )
|
||||
continue;
|
||||
Point2f p1 = keypoints1[i1].pt;
|
||||
Point2f pt1 = keypoints1[i1].pt;
|
||||
const float* d11 = descriptors1.ptr<float>(i1);
|
||||
double dist = 0;
|
||||
|
||||
e = p2.x*(F[0]*p1.x + F[1]*p1.y + F[2]) +
|
||||
p2.y*(F[3]*p1.x + F[4]*p1.y + F[5]) +
|
||||
F[6]*p1.x + F[7]*p1.y + F[8];
|
||||
e = p2.x*(F[0]*pt1.x + F[1]*pt1.y + F[2]) +
|
||||
p2.y*(F[3]*pt1.x + F[4]*pt1.y + F[5]) +
|
||||
F[6]*pt1.x + F[7]*pt1.y + F[8];
|
||||
if( fabs(e) > eps )
|
||||
continue;
|
||||
|
||||
|
@ -173,9 +173,9 @@ static void saveCameraParams( const string& filename,
|
||||
{
|
||||
FileStorage fs( filename, FileStorage::WRITE );
|
||||
|
||||
time_t t;
|
||||
time( &t );
|
||||
struct tm *t2 = localtime( &t );
|
||||
time_t tt;
|
||||
time( &tt );
|
||||
struct tm *t2 = localtime( &tt );
|
||||
char buf[1024];
|
||||
strftime( buf, sizeof(buf)-1, "%c", t2 );
|
||||
|
||||
|
@ -48,46 +48,45 @@ static void onMouse( int event, int x, int y, int, void* )
|
||||
static void help()
|
||||
{
|
||||
cout << "\nThis is a demo that shows mean-shift based tracking\n"
|
||||
"You select a color objects such as your face and it tracks it.\n"
|
||||
"This reads from video camera (0 by default, or the camera number the user enters\n"
|
||||
"Usage: \n"
|
||||
" ./camshiftdemo [camera number]\n";
|
||||
"You select a color objects such as your face and it tracks it.\n"
|
||||
"This reads from video camera (0 by default, or the camera number the user enters\n"
|
||||
"Usage: \n"
|
||||
" ./camshiftdemo [camera number]\n";
|
||||
|
||||
cout << "\n\nHot keys: \n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"To initialize tracking, select the object with mouse\n";
|
||||
}
|
||||
|
||||
const char* keys =
|
||||
const char* keys =
|
||||
{
|
||||
"{1| | 0 | camera number}"
|
||||
"{1| | 0 | camera number}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
help();
|
||||
|
||||
VideoCapture cap;
|
||||
Rect trackWindow;
|
||||
RotatedRect trackBox;
|
||||
int hsize = 16;
|
||||
float hranges[] = {0,180};
|
||||
const float* phranges = hranges;
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
int camNum = parser.get<int>("1");
|
||||
|
||||
cap.open(camNum);
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
int camNum = parser.get<int>("1");
|
||||
|
||||
cap.open(camNum);
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
help();
|
||||
help();
|
||||
cout << "***Could not initialize capturing...***\n";
|
||||
cout << "Current parameter's value: \n";
|
||||
parser.printParams();
|
||||
parser.printParams();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -100,7 +99,7 @@ int main( int argc, const char** argv )
|
||||
|
||||
Mat frame, hsv, hue, mask, hist, histimg = Mat::zeros(200, 320, CV_8UC3), backproj;
|
||||
bool paused = false;
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if( !paused )
|
||||
@ -111,7 +110,7 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
|
||||
frame.copyTo(image);
|
||||
|
||||
|
||||
if( !paused )
|
||||
{
|
||||
cvtColor(image, hsv, CV_BGR2HSV);
|
||||
@ -131,7 +130,7 @@ int main( int argc, const char** argv )
|
||||
Mat roi(hue, selection), maskroi(mask, selection);
|
||||
calcHist(&roi, 1, 0, maskroi, hist, 1, &hsize, &phranges);
|
||||
normalize(hist, hist, 0, 255, CV_MINMAX);
|
||||
|
||||
|
||||
trackWindow = selection;
|
||||
trackObject = 1;
|
||||
|
||||
@ -141,7 +140,7 @@ int main( int argc, const char** argv )
|
||||
for( int i = 0; i < hsize; i++ )
|
||||
buf.at<Vec3b>(i) = Vec3b(saturate_cast<uchar>(i*180./hsize), 255, 255);
|
||||
cvtColor(buf, buf, CV_HSV2BGR);
|
||||
|
||||
|
||||
for( int i = 0; i < hsize; i++ )
|
||||
{
|
||||
int val = saturate_cast<int>(hist.at<float>(i)*histimg.rows/255);
|
||||
|
@ -28,9 +28,9 @@ static void help()
|
||||
int main(int,char**)
|
||||
{
|
||||
help();
|
||||
Mat i = Mat::eye(4, 4, CV_64F);
|
||||
i.at<double>(1,1) = CV_PI;
|
||||
cout << "i = " << i << ";" << endl;
|
||||
Mat I = Mat::eye(4, 4, CV_64F);
|
||||
I.at<double>(1,1) = CV_PI;
|
||||
cout << "I = " << I << ";" << endl;
|
||||
|
||||
Mat r = Mat(10, 3, CV_8UC3);
|
||||
randu(r, Scalar::all(0), Scalar::all(255));
|
||||
|
@ -223,8 +223,8 @@ void BaseQualityEvaluator::readAllDatasetsRunParams()
|
||||
isWriteParams = false;
|
||||
FileNode topfn = fs.getFirstTopLevelNode();
|
||||
|
||||
FileNode fn = topfn[DEFAULT_PARAMS];
|
||||
readDefaultRunParams(fn);
|
||||
FileNode pfn = topfn[DEFAULT_PARAMS];
|
||||
readDefaultRunParams(pfn);
|
||||
|
||||
for( int i = 0; i < DATASETS_COUNT; i++ )
|
||||
{
|
||||
@ -280,7 +280,7 @@ bool BaseQualityEvaluator::readDataset( const string& datasetName, vector<Mat>&
|
||||
if( !fs.isOpened() )
|
||||
{
|
||||
cout << "filename " << dirname + filename.str() << endl;
|
||||
FileStorage fs( dirname + filename.str(), FileStorage::READ );
|
||||
FileStorage fs2( dirname + filename.str(), FileStorage::READ );
|
||||
return false;
|
||||
}
|
||||
fs.getFirstTopLevelNode() >> Hs[i];
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user