Remove all using directives for STL namespace and members
Made all STL usages explicit to be able automatically find all usages of particular class or function.
This commit is contained in:
@@ -989,13 +989,13 @@ static void func_new(int i, int j, Mat& point_params, Mat& cam_params, Mat& esti
|
||||
func(i,j,&_point_params,&_cam_params,&_estim,data);
|
||||
};
|
||||
|
||||
void LevMarqSparse::bundleAdjust( vector<Point3d>& points, //positions of points in global coordinate system (input and output)
|
||||
const vector<vector<Point2d> >& imagePoints, //projections of 3d points for every camera
|
||||
const vector<vector<int> >& visibility, //visibility of 3d points for every camera
|
||||
vector<Mat>& cameraMatrix, //intrinsic matrices of all cameras (input and output)
|
||||
vector<Mat>& R, //rotation matrices of all cameras (input and output)
|
||||
vector<Mat>& T, //translation vector of all cameras (input and output)
|
||||
vector<Mat>& distCoeffs, //distortion coefficients of all cameras (input and output)
|
||||
void LevMarqSparse::bundleAdjust( std::vector<Point3d>& points, //positions of points in global coordinate system (input and output)
|
||||
const std::vector<std::vector<Point2d> >& imagePoints, //projections of 3d points for every camera
|
||||
const std::vector<std::vector<int> >& visibility, //visibility of 3d points for every camera
|
||||
std::vector<Mat>& cameraMatrix, //intrinsic matrices of all cameras (input and output)
|
||||
std::vector<Mat>& R, //rotation matrices of all cameras (input and output)
|
||||
std::vector<Mat>& T, //translation vector of all cameras (input and output)
|
||||
std::vector<Mat>& distCoeffs, //distortion coefficients of all cameras (input and output)
|
||||
const TermCriteria& criteria,
|
||||
BundleAdjustCallback cb, void* user_data) {
|
||||
//,enum{MOTION_AND_STRUCTURE,MOTION,STRUCTURE})
|
||||
|
@@ -180,7 +180,7 @@ void BasicRetinaFilter::setLPfilterParameters(const float beta, const float tau,
|
||||
}
|
||||
|
||||
float _temp = (1.0f+_beta)/(2.0f*_mu*_alpha);
|
||||
float a = _filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
float a = _filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)std::sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
_filteringCoeficientsTable[1+tableOffset]=(1.0f-a)*(1.0f-a)*(1.0f-a)*(1.0f-a)/(1.0f+_beta);
|
||||
_filteringCoeficientsTable[2+tableOffset] =tau;
|
||||
|
||||
@@ -210,17 +210,17 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CentredAccuracy(const floa
|
||||
|
||||
float _alpha=0.8f;
|
||||
float _temp = (1.0f+_beta)/(2.0f*_mu*_alpha);
|
||||
float a=_filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
float a=_filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)std::sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
_filteringCoeficientsTable[tableOffset+1]=(1.0f-a)*(1.0f-a)*(1.0f-a)*(1.0f-a)/(1.0f+_beta);
|
||||
_filteringCoeficientsTable[tableOffset+2] =tau;
|
||||
|
||||
float commonFactor=alpha0/(float)sqrt(_halfNBcolumns*_halfNBcolumns+_halfNBrows*_halfNBrows+1.0f);
|
||||
float commonFactor=alpha0/(float)std::sqrt(_halfNBcolumns*_halfNBcolumns+_halfNBrows*_halfNBrows+1.0f);
|
||||
//memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels());
|
||||
for (unsigned int idColumn=0;idColumn<_halfNBcolumns; ++idColumn)
|
||||
for (unsigned int idRow=0;idRow<_halfNBrows; ++idRow)
|
||||
{
|
||||
// computing local spatial constant
|
||||
float localSpatialConstantValue=commonFactor*sqrt((float)(idColumn*idColumn)+(float)(idRow*idRow));
|
||||
float localSpatialConstantValue=commonFactor*std::sqrt((float)(idColumn*idColumn)+(float)(idRow*idRow));
|
||||
if (localSpatialConstantValue>1.0f)
|
||||
localSpatialConstantValue=1.0f;
|
||||
|
||||
@@ -236,7 +236,7 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CentredAccuracy(const floa
|
||||
_progressiveGain[_halfNBcolumns-1+idColumn+_filterOutput.getNBcolumns()*(_halfNBrows-1-idRow)]=localGain;
|
||||
_progressiveGain[_halfNBcolumns-1-idColumn+_filterOutput.getNBcolumns()*(_halfNBrows-1-idRow)]=localGain;
|
||||
|
||||
//std::cout<<commonFactor<<", "<<sqrt((_halfNBcolumns-1-idColumn)+(_halfNBrows-idRow-1))<<", "<<(_halfNBcolumns-1-idColumn)<<", "<<(_halfNBrows-idRow-1)<<", "<<localSpatialConstantValue<<std::endl;
|
||||
//std::cout<<commonFactor<<", "<<std::sqrt((_halfNBcolumns-1-idColumn)+(_halfNBrows-idRow-1))<<", "<<(_halfNBcolumns-1-idColumn)<<", "<<(_halfNBrows-idRow-1)<<", "<<localSpatialConstantValue<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CustomAccuracy(const float
|
||||
}
|
||||
unsigned int tableOffset=filterIndex*3;
|
||||
float _temp = (1.0f+_beta)/(2.0f*_mu*_alpha);
|
||||
float a=_filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
float a=_filteringCoeficientsTable[tableOffset] = 1.0f + _temp - (float)std::sqrt( (1.0f+_temp)*(1.0f+_temp) - 1.0f);
|
||||
_filteringCoeficientsTable[tableOffset+1]=(1.0f-a)*(1.0f-a)*(1.0f-a)*(1.0f-a)/(1.0f+_beta);
|
||||
_filteringCoeficientsTable[tableOffset+2] =tau;
|
||||
|
||||
@@ -286,7 +286,7 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CustomAccuracy(const float
|
||||
float localGain=(1.0f-localSpatialConstantValue)*(1.0f-localSpatialConstantValue)*(1.0f-localSpatialConstantValue)*(1.0f-localSpatialConstantValue)/(1.0f+_beta);
|
||||
_progressiveGain[index]=localGain;
|
||||
|
||||
//std::cout<<commonFactor<<", "<<sqrt((_halfNBcolumns-1-idColumn)+(_halfNBrows-idRow-1))<<", "<<(_halfNBcolumns-1-idColumn)<<", "<<(_halfNBrows-idRow-1)<<", "<<localSpatialConstantValue<<std::endl;
|
||||
//std::cout<<commonFactor<<", "<<std::sqrt((_halfNBcolumns-1-idColumn)+(_halfNBrows-idRow-1))<<", "<<(_halfNBcolumns-1-idColumn)<<", "<<(_halfNBrows-idRow-1)<<", "<<localSpatialConstantValue<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -112,7 +112,6 @@
|
||||
|
||||
//#define __BASIC_RETINA_ELEMENT_DEBUG
|
||||
|
||||
//using namespace std;
|
||||
namespace cv
|
||||
{
|
||||
class BasicRetinaFilter
|
||||
|
@@ -90,7 +90,7 @@ Mat BOWMSCTrainer::cluster(const Mat& _descriptors) const {
|
||||
|
||||
Mat icovar = Mat::eye(_descriptors.cols,_descriptors.cols,_descriptors.type());
|
||||
|
||||
vector<Mat> initialCentres;
|
||||
std::vector<Mat> initialCentres;
|
||||
initialCentres.push_back(_descriptors.row(0));
|
||||
for (int i = 1; i < _descriptors.rows; i++) {
|
||||
double minDist = DBL_MAX;
|
||||
|
@@ -54,8 +54,6 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
using std::queue;
|
||||
|
||||
typedef std::pair<int,int> coordinate_t;
|
||||
typedef float orientation_t;
|
||||
typedef std::vector<coordinate_t> template_coords_t;
|
||||
@@ -824,7 +822,7 @@ ChamferMatcher::Template::Template(Mat& edge_image, float scale_) : addr_width(-
|
||||
}
|
||||
|
||||
|
||||
vector<int>& ChamferMatcher::Template::getTemplateAddresses(int width)
|
||||
std::vector<int>& ChamferMatcher::Template::getTemplateAddresses(int width)
|
||||
{
|
||||
if (addr_width!=width) {
|
||||
addr.resize(coords.size());
|
||||
|
@@ -73,7 +73,7 @@ void ChowLiuTree::add(const Mat& imgDescriptor) {
|
||||
|
||||
}
|
||||
|
||||
void ChowLiuTree::add(const vector<Mat>& _imgDescriptors) {
|
||||
void ChowLiuTree::add(const std::vector<Mat>& _imgDescriptors) {
|
||||
for (size_t i = 0; i < _imgDescriptors.size(); i++) {
|
||||
add(_imgDescriptors[i]);
|
||||
}
|
||||
@@ -164,10 +164,10 @@ cv::Mat ChowLiuTree::buildTree(int root_word, std::list<info> &edges) {
|
||||
//independence from a parent node.
|
||||
|
||||
//find all children and do the same
|
||||
vector<int> nextqs = extractChildren(edges, q);
|
||||
std::vector<int> nextqs = extractChildren(edges, q);
|
||||
|
||||
int pq = q;
|
||||
vector<int>::iterator nextq;
|
||||
std::vector<int>::iterator nextq;
|
||||
for(nextq = nextqs.begin(); nextq != nextqs.end(); nextq++) {
|
||||
recAddToTree(cltree, *nextq, pq, edges);
|
||||
}
|
||||
@@ -186,16 +186,16 @@ void ChowLiuTree::recAddToTree(cv::Mat &cltree, int q, int pq,
|
||||
cltree.at<double>(3, q) = CP(q, true, pq, false);
|
||||
|
||||
//find all children and do the same
|
||||
vector<int> nextqs = extractChildren(remaining_edges, q);
|
||||
std::vector<int> nextqs = extractChildren(remaining_edges, q);
|
||||
|
||||
pq = q;
|
||||
vector<int>::iterator nextq;
|
||||
std::vector<int>::iterator nextq;
|
||||
for(nextq = nextqs.begin(); nextq != nextqs.end(); nextq++) {
|
||||
recAddToTree(cltree, *nextq, pq, remaining_edges);
|
||||
}
|
||||
}
|
||||
|
||||
vector<int> ChowLiuTree::extractChildren(std::list<info> &remaining_edges, int q) {
|
||||
std::vector<int> ChowLiuTree::extractChildren(std::list<info> &remaining_edges, int q) {
|
||||
|
||||
std::vector<int> children;
|
||||
std::list<info>::iterator edge = remaining_edges.begin();
|
||||
@@ -225,16 +225,16 @@ double ChowLiuTree::calcMutInfo(int word1, int word2) {
|
||||
double accumulation = 0;
|
||||
|
||||
double P00 = JP(word1, false, word2, false);
|
||||
if(P00) accumulation += P00 * log(P00 / (P(word1, false)*P(word2, false)));
|
||||
if(P00) accumulation += P00 * std::log(P00 / (P(word1, false)*P(word2, false)));
|
||||
|
||||
double P01 = JP(word1, false, word2, true);
|
||||
if(P01) accumulation += P01 * log(P01 / (P(word1, false)*P(word2, true)));
|
||||
if(P01) accumulation += P01 * std::log(P01 / (P(word1, false)*P(word2, true)));
|
||||
|
||||
double P10 = JP(word1, true, word2, false);
|
||||
if(P10) accumulation += P10 * log(P10 / (P(word1, true)*P(word2, false)));
|
||||
if(P10) accumulation += P10 * std::log(P10 / (P(word1, true)*P(word2, false)));
|
||||
|
||||
double P11 = JP(word1, true, word2, true);
|
||||
if(P11) accumulation += P11 * log(P11 / (P(word1, true)*P(word2, true)));
|
||||
if(P11) accumulation += P11 * std::log(P11 / (P(word1, true)*P(word2, true)));
|
||||
|
||||
return accumulation;
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ static void sortMatrixRowsByIndices(InputArray _src, InputArray _indices, Output
|
||||
if(_indices.getMat().type() != CV_32SC1)
|
||||
CV_Error(CV_StsUnsupportedFormat, "cv::sortRowsByIndices only works on integer indices!");
|
||||
Mat src = _src.getMat();
|
||||
vector<int> indices = _indices.getMat();
|
||||
std::vector<int> indices = _indices.getMat();
|
||||
_dst.create(src.rows, src.cols, src.type());
|
||||
Mat dst = _dst.getMat();
|
||||
for(size_t idx = 0; idx < indices.size(); idx++) {
|
||||
@@ -76,7 +76,7 @@ Mat interp1_(const Mat& X_, const Mat& Y_, const Mat& XI)
|
||||
{
|
||||
int n = XI.rows;
|
||||
// sort input table
|
||||
vector<int> sort_indices = argsort(X_);
|
||||
std::vector<int> sort_indices = argsort(X_);
|
||||
|
||||
Mat X = sortMatrixRowsByIndices(X_,sort_indices);
|
||||
Mat Y = sortMatrixRowsByIndices(Y_,sort_indices);
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include "opencv2/contrib/hybridtracker.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
CvMeanShiftTracker::CvMeanShiftTracker(CvMeanShiftTrackerParams _params) : params(_params)
|
||||
{
|
||||
|
@@ -43,7 +43,6 @@
|
||||
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
static inline cv::Point2f centerRect(const cv::Rect& r)
|
||||
{
|
||||
@@ -71,7 +70,7 @@ class cv::DetectionBasedTracker::SeparateDetectionWork
|
||||
public:
|
||||
SeparateDetectionWork(cv::DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector);
|
||||
virtual ~SeparateDetectionWork();
|
||||
bool communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions);
|
||||
bool communicateWithDetectingThread(const Mat& imageGray, std::vector<Rect>& rectsWhereRegions);
|
||||
bool run();
|
||||
void stop();
|
||||
void resetTracking();
|
||||
@@ -227,7 +226,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
|
||||
{
|
||||
static double freq = getTickFrequency();
|
||||
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- start");
|
||||
vector<Rect> objects;
|
||||
std::vector<Rect> objects;
|
||||
|
||||
CV_Assert(stateThread==STATE_THREAD_WORKING_SLEEPING);
|
||||
pthread_mutex_lock(&mutex);
|
||||
@@ -385,7 +384,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()
|
||||
|
||||
}
|
||||
|
||||
bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread(const Mat& imageGray, vector<Rect>& rectsWhereRegions)
|
||||
bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread(const Mat& imageGray, std::vector<Rect>& rectsWhereRegions)
|
||||
{
|
||||
static double freq = getTickFrequency();
|
||||
|
||||
@@ -499,7 +498,7 @@ void DetectionBasedTracker::process(const Mat& imageGray)
|
||||
|
||||
Mat imageDetect=imageGray;
|
||||
|
||||
vector<Rect> rectsWhereRegions;
|
||||
std::vector<Rect> rectsWhereRegions;
|
||||
bool shouldHandleResult=false;
|
||||
if (!separateDetectionWork.empty()) {
|
||||
shouldHandleResult = separateDetectionWork->communicateWithDetectingThread(imageGray, rectsWhereRegions);
|
||||
@@ -535,7 +534,7 @@ void DetectionBasedTracker::process(const Mat& imageGray)
|
||||
}
|
||||
LOGI("DetectionBasedTracker::process: tracked objects num==%d", (int)trackedObjects.size());
|
||||
|
||||
vector<Rect> detectedObjectsInRegions;
|
||||
std::vector<Rect> detectedObjectsInRegions;
|
||||
|
||||
LOGD("DetectionBasedTracker::process: rectsWhereRegions.size()=%d", (int)rectsWhereRegions.size());
|
||||
for(size_t i=0; i < rectsWhereRegions.size(); i++) {
|
||||
@@ -610,7 +609,7 @@ void cv::DetectionBasedTracker::resetTracking()
|
||||
trackedObjects.clear();
|
||||
}
|
||||
|
||||
void cv::DetectionBasedTracker::updateTrackedObjects(const vector<Rect>& detectedObjects)
|
||||
void cv::DetectionBasedTracker::updateTrackedObjects(const std::vector<Rect>& detectedObjects)
|
||||
{
|
||||
enum {
|
||||
NEW_RECTANGLE=-1,
|
||||
@@ -625,7 +624,7 @@ void cv::DetectionBasedTracker::updateTrackedObjects(const vector<Rect>& detecte
|
||||
trackedObjects[i].numDetectedFrames++;
|
||||
}
|
||||
|
||||
vector<int> correspondence(detectedObjects.size(), NEW_RECTANGLE);
|
||||
std::vector<int> correspondence(detectedObjects.size(), NEW_RECTANGLE);
|
||||
correspondence.clear();
|
||||
correspondence.resize(detectedObjects.size(), NEW_RECTANGLE);
|
||||
|
||||
@@ -831,7 +830,7 @@ Rect cv::DetectionBasedTracker::calcTrackedObjectPositionToShow(int i, ObjectSta
|
||||
return res;
|
||||
}
|
||||
|
||||
void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, vector<Rect>& detectedObjectsInRegions)
|
||||
void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, std::vector<Rect>& detectedObjectsInRegions)
|
||||
{
|
||||
Rect r0(Point(), img.size());
|
||||
Rect r1 = scale_rect(r, innerParameters.coeffTrackingWindowSize);
|
||||
@@ -844,7 +843,7 @@ void cv::DetectionBasedTracker::detectInRegion(const Mat& img, const Rect& r, ve
|
||||
|
||||
int d = cvRound(std::min(r.width, r.height) * innerParameters.coeffObjectSizeToTrack);
|
||||
|
||||
vector<Rect> tmpobjects;
|
||||
std::vector<Rect> tmpobjects;
|
||||
|
||||
Mat img1(img, r1);//subimage for rectangle -- without data copying
|
||||
LOGD("DetectionBasedTracker::detectInRegion: img1.size()=%d x %d, d=%d",
|
||||
|
@@ -21,11 +21,9 @@
|
||||
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) {
|
||||
inline void readFileNodeList(const FileNode& fn, std::vector<_Tp>& result) {
|
||||
if (fn.type() == FileNode::SEQ) {
|
||||
for (FileNodeIterator it = fn.begin(); it != fn.end();) {
|
||||
_Tp item;
|
||||
@@ -37,10 +35,10 @@ inline void readFileNodeList(const FileNode& fn, vector<_Tp>& result) {
|
||||
|
||||
// Writes the a list of given items to a cv::FileStorage.
|
||||
template<typename _Tp>
|
||||
inline void writeFileNodeList(FileStorage& fs, const string& name,
|
||||
const vector<_Tp>& items) {
|
||||
inline void writeFileNodeList(FileStorage& fs, const std::string& name,
|
||||
const std::vector<_Tp>& items) {
|
||||
// typedefs
|
||||
typedef typename vector<_Tp>::const_iterator constVecIterator;
|
||||
typedef typename std::vector<_Tp>::const_iterator constVecIterator;
|
||||
// write the elements in item to fs
|
||||
fs << name << "[";
|
||||
for (constVecIterator it = items.begin(); it != items.end(); ++it) {
|
||||
@@ -52,7 +50,7 @@ inline void writeFileNodeList(FileStorage& fs, const string& name,
|
||||
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) {
|
||||
string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< vector<...> >).";
|
||||
std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// number of samples
|
||||
@@ -68,7 +66,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
for(unsigned int i = 0; i < 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());
|
||||
std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// get a hold of the current row
|
||||
@@ -86,13 +84,13 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
|
||||
// Removes duplicate elements in a given vector.
|
||||
template<typename _Tp>
|
||||
inline vector<_Tp> remove_dups(const vector<_Tp>& src) {
|
||||
typedef typename set<_Tp>::const_iterator constSetIterator;
|
||||
typedef typename vector<_Tp>::const_iterator constVecIterator;
|
||||
set<_Tp> set_elems;
|
||||
inline std::vector<_Tp> remove_dups(const std::vector<_Tp>& src) {
|
||||
typedef typename std::set<_Tp>::const_iterator constSetIterator;
|
||||
typedef typename std::vector<_Tp>::const_iterator constVecIterator;
|
||||
std::set<_Tp> set_elems;
|
||||
for (constVecIterator it = src.begin(); it != src.end(); ++it)
|
||||
set_elems.insert(*it);
|
||||
vector<_Tp> elems;
|
||||
std::vector<_Tp> elems;
|
||||
for (constSetIterator it = set_elems.begin(); it != set_elems.end(); ++it)
|
||||
elems.push_back(*it);
|
||||
return elems;
|
||||
@@ -106,7 +104,7 @@ class Eigenfaces : public FaceRecognizer
|
||||
private:
|
||||
int _num_components;
|
||||
double _threshold;
|
||||
vector<Mat> _projections;
|
||||
std::vector<Mat> _projections;
|
||||
Mat _labels;
|
||||
Mat _eigenvectors;
|
||||
Mat _eigenvalues;
|
||||
@@ -162,7 +160,7 @@ private:
|
||||
Mat _eigenvectors;
|
||||
Mat _eigenvalues;
|
||||
Mat _mean;
|
||||
vector<Mat> _projections;
|
||||
std::vector<Mat> _projections;
|
||||
Mat _labels;
|
||||
|
||||
public:
|
||||
@@ -220,7 +218,7 @@ private:
|
||||
int _neighbors;
|
||||
double _threshold;
|
||||
|
||||
vector<Mat> _histograms;
|
||||
std::vector<Mat> _histograms;
|
||||
Mat _labels;
|
||||
|
||||
// Computes a LBPH model with images in src and
|
||||
@@ -307,11 +305,11 @@ void FaceRecognizer::update(InputArrayOfArrays src, InputArray labels ) {
|
||||
return;
|
||||
}
|
||||
|
||||
string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
|
||||
std::string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
|
||||
CV_Error(CV_StsNotImplemented, error_msg);
|
||||
}
|
||||
|
||||
void FaceRecognizer::save(const string& filename) const {
|
||||
void FaceRecognizer::save(const std::string& filename) const {
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
if (!fs.isOpened())
|
||||
CV_Error(CV_StsError, "File can't be opened for writing!");
|
||||
@@ -319,7 +317,7 @@ void FaceRecognizer::save(const string& filename) const {
|
||||
fs.release();
|
||||
}
|
||||
|
||||
void FaceRecognizer::load(const string& filename) {
|
||||
void FaceRecognizer::load(const std::string& filename) {
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
CV_Error(CV_StsError, "File can't be opened for writing!");
|
||||
@@ -332,17 +330,17 @@ void FaceRecognizer::load(const string& filename) {
|
||||
//------------------------------------------------------------------------------
|
||||
void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
|
||||
if(_src.total() == 0) {
|
||||
string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
} else if(_local_labels.getMat().type() != CV_32SC1) {
|
||||
string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// make sure data has correct size
|
||||
if(_src.total() > 1) {
|
||||
for(int i = 1; i < static_cast<int>(_src.total()); i++) {
|
||||
if(_src.getMat(i-1).total() != _src.getMat(i).total()) {
|
||||
string error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
|
||||
std::string error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
|
||||
CV_Error(CV_StsUnsupportedFormat, error_message);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +354,7 @@ void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
|
||||
int n = data.rows;
|
||||
// assert there are as much samples as labels
|
||||
if(static_cast<int>(labels.total()) != n) {
|
||||
string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
|
||||
std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// clear existing model data
|
||||
@@ -387,11 +385,11 @@ void Eigenfaces::predict(InputArray _src, int &minClass, double &minDist) const
|
||||
// make sure the user is passing correct data
|
||||
if(_projections.empty()) {
|
||||
// throw error if no data (or simply return -1?)
|
||||
string error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
|
||||
std::string error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
|
||||
CV_Error(CV_StsError, error_message);
|
||||
} else if(_eigenvectors.rows != static_cast<int>(src.total())) {
|
||||
// check data alignment just for clearer exception messages
|
||||
string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
|
||||
std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// project into PCA subspace
|
||||
@@ -441,17 +439,17 @@ void Eigenfaces::save(FileStorage& fs) const {
|
||||
//------------------------------------------------------------------------------
|
||||
void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
|
||||
if(src.total() == 0) {
|
||||
string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
} else if(_lbls.getMat().type() != CV_32SC1) {
|
||||
string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// make sure data has correct size
|
||||
if(src.total() > 1) {
|
||||
for(int i = 1; i < static_cast<int>(src.total()); i++) {
|
||||
if(src.getMat(i-1).total() != src.getMat(i).total()) {
|
||||
string error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
|
||||
std::string error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
|
||||
CV_Error(CV_StsUnsupportedFormat, error_message);
|
||||
}
|
||||
}
|
||||
@@ -463,17 +461,17 @@ void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
|
||||
int N = data.rows;
|
||||
// make sure labels are passed in correct shape
|
||||
if(labels.total() != (size_t) N) {
|
||||
string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
|
||||
std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
} else if(labels.rows != 1 && labels.cols != 1) {
|
||||
string error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
|
||||
std::string error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// clear existing model data
|
||||
_labels.release();
|
||||
_projections.clear();
|
||||
// safely copy from cv::Mat to std::vector
|
||||
vector<int> ll;
|
||||
std::vector<int> ll;
|
||||
for(unsigned int i = 0; i < labels.total(); i++) {
|
||||
ll.push_back(labels.at<int>(i));
|
||||
}
|
||||
@@ -507,10 +505,10 @@ void Fisherfaces::predict(InputArray _src, int &minClass, double &minDist) const
|
||||
// check data alignment just for clearer exception messages
|
||||
if(_projections.empty()) {
|
||||
// throw error if no data (or simply return -1?)
|
||||
string error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
|
||||
std::string error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
} else if(src.total() != (size_t) _eigenvectors.rows) {
|
||||
string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
|
||||
std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// project into LDA subspace
|
||||
@@ -642,7 +640,7 @@ static void elbp(InputArray src, OutputArray dst, int radius, int neighbors)
|
||||
case CV_32FC1: elbp_<float>(src,dst, radius, neighbors); break;
|
||||
case CV_64FC1: elbp_<double>(src,dst, radius, neighbors); break;
|
||||
default:
|
||||
string error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
|
||||
std::string error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
|
||||
CV_Error(CV_StsNotImplemented, error_msg);
|
||||
break;
|
||||
}
|
||||
@@ -770,24 +768,24 @@ void LBPH::update(InputArrayOfArrays _in_src, InputArray _in_labels) {
|
||||
|
||||
void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserveData) {
|
||||
if(_in_src.kind() != _InputArray::STD_VECTOR_MAT && _in_src.kind() != _InputArray::STD_VECTOR_VECTOR) {
|
||||
string error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< vector<...> >).";
|
||||
std::string error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
if(_in_src.total() == 0) {
|
||||
string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
CV_Error(CV_StsUnsupportedFormat, error_message);
|
||||
} else if(_in_labels.getMat().type() != CV_32SC1) {
|
||||
string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
|
||||
CV_Error(CV_StsUnsupportedFormat, error_message);
|
||||
}
|
||||
// get the vector of matrices
|
||||
vector<Mat> src;
|
||||
std::vector<Mat> src;
|
||||
_in_src.getMatVector(src);
|
||||
// get the label matrix
|
||||
Mat labels = _in_labels.getMat();
|
||||
// check if data is well- aligned
|
||||
if(labels.total() != src.size()) {
|
||||
string error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
|
||||
std::string error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// if this model should be trained without preserving old data, delete old model data
|
||||
@@ -818,7 +816,7 @@ void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserv
|
||||
void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
|
||||
if(_histograms.empty()) {
|
||||
// throw error if no data (or simply return -1?)
|
||||
string error_message = "This LBPH model is not computed yet. Did you call the train method?";
|
||||
std::string error_message = "This LBPH model is not computed yet. Did you call the train method?";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
Mat src = _src.getMat();
|
||||
|
@@ -98,8 +98,8 @@ Rect CvFeatureTracker::updateTrackingWindow(Mat image)
|
||||
Rect CvFeatureTracker::updateTrackingWindowWithSIFT(Mat image)
|
||||
{
|
||||
ittr++;
|
||||
vector<KeyPoint> prev_keypoints, curr_keypoints;
|
||||
vector<Point2f> prev_keys, curr_keys;
|
||||
std::vector<KeyPoint> prev_keypoints, curr_keypoints;
|
||||
std::vector<Point2f> prev_keys, curr_keys;
|
||||
Mat prev_desc, curr_desc;
|
||||
|
||||
Rect window = prev_trackwindow;
|
||||
@@ -149,8 +149,8 @@ Rect CvFeatureTracker::updateTrackingWindowWithFlow(Mat image)
|
||||
Size subPixWinSize(10,10), winSize(31,31);
|
||||
Mat image_bw;
|
||||
TermCriteria termcrit(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03);
|
||||
vector<uchar> status;
|
||||
vector<float> err;
|
||||
std::vector<uchar> status;
|
||||
std::vector<float> err;
|
||||
|
||||
cvtColor(image, image_bw, CV_BGR2GRAY);
|
||||
cvtColor(prev_image, prev_image_bw, CV_BGR2GRAY);
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include "opencv2/contrib/hybridtracker.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
CvHybridTrackerParams::CvHybridTrackerParams(float _ft_tracker_weight, float _ms_tracker_weight,
|
||||
CvFeatureTrackerParams _ft_params,
|
||||
@@ -83,7 +82,7 @@ CvHybridTracker::~CvHybridTracker() {
|
||||
inline float CvHybridTracker::getL2Norm(Point2f p1, Point2f p2) {
|
||||
float distance = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y
|
||||
- p2.y);
|
||||
return sqrt(distance);
|
||||
return std::sqrt(distance);
|
||||
}
|
||||
|
||||
Mat CvHybridTracker::getDistanceProjection(Mat image, Point2f center) {
|
||||
|
@@ -193,7 +193,7 @@ bool ImageLogPolProjection::_initLogRetinaSampling(const double reductionFactor,
|
||||
//double rlim=1.0/reductionFactor*(minDimension/2.0+samplingStrenght);
|
||||
|
||||
// input frame dimensions INdependent log sampling:
|
||||
_azero=(1.0+reductionFactor*sqrt(samplingStrenght))/(reductionFactor*reductionFactor*samplingStrenght-1.0);
|
||||
_azero=(1.0+reductionFactor*std::sqrt(samplingStrenght))/(reductionFactor*reductionFactor*samplingStrenght-1.0);
|
||||
_alim=(1.0+_azero)/reductionFactor;
|
||||
#ifdef IMAGELOGPOLPROJECTION_DEBUG
|
||||
std::cout<<"ImageLogPolProjection::initLogRetinaSampling: rlim= "<<rlim<<std::endl;
|
||||
@@ -223,10 +223,10 @@ bool ImageLogPolProjection::_initLogRetinaSampling(const double reductionFactor,
|
||||
// get the pixel position in the original picture
|
||||
|
||||
// -> input frame dimensions dependent log sampling:
|
||||
//double scale = samplingStrenght/(rlim-(double)sqrt(idRow*idRow+idColumn*idColumn));
|
||||
//double scale = samplingStrenght/(rlim-(double)std::sqrt(idRow*idRow+idColumn*idColumn));
|
||||
|
||||
// -> input frame dimensions INdependent log sampling:
|
||||
double scale=getOriginalRadiusLength((double)sqrt((double)(idRow*idRow+idColumn*idColumn)));
|
||||
double scale=getOriginalRadiusLength((double)std::sqrt((double)(idRow*idRow+idColumn*idColumn)));
|
||||
#ifdef IMAGELOGPOLPROJECTION_DEBUG
|
||||
std::cout<<"ImageLogPolProjection::initLogRetinaSampling: scale= "<<scale<<std::endl;
|
||||
std::cout<<"ImageLogPolProjection::initLogRetinaSampling: scale2= "<<scale2<<std::endl;
|
||||
@@ -243,7 +243,7 @@ bool ImageLogPolProjection::_initLogRetinaSampling(const double reductionFactor,
|
||||
|
||||
// manage border effects
|
||||
double length=u*u+v*v;
|
||||
double radiusRatio=sqrt(rMax/length);
|
||||
double radiusRatio=std::sqrt(rMax/length);
|
||||
|
||||
#ifdef IMAGELOGPOLPROJECTION_DEBUG
|
||||
std::cout<<"ImageLogPolProjection::(inputH, inputW)="<<halfInputRows<<", "<<halfInputColumns<<", Rmax2="<<rMax<<std::endl;
|
||||
@@ -362,14 +362,14 @@ bool ImageLogPolProjection::_initLogPolarCortexSampling(const double reductionFa
|
||||
|
||||
//std::cout<<"ImageLogPolProjection::Starting cortex projection"<<std::endl;
|
||||
// compute transformation, get theta and Radius in reagrd of the output sampled pixel
|
||||
double diagonalLenght=sqrt((double)(_outputNBcolumns*_outputNBcolumns+_outputNBrows*_outputNBrows));
|
||||
double diagonalLenght=std::sqrt((double)(_outputNBcolumns*_outputNBcolumns+_outputNBrows*_outputNBrows));
|
||||
for (unsigned int radiusIndex=0;radiusIndex<_outputNBcolumns;++radiusIndex)
|
||||
for(unsigned int orientationIndex=0;orientationIndex<_outputNBrows;++orientationIndex)
|
||||
{
|
||||
double x=1.0+sinh(radiusAxis[radiusIndex])*cos(orientationAxis[orientationIndex]);
|
||||
double y=sinh(radiusAxis[radiusIndex])*sin(orientationAxis[orientationIndex]);
|
||||
// get the input picture coordinate
|
||||
double R=diagonalLenght*sqrt(x*x+y*y)/(5.0+sqrt(x*x+y*y));
|
||||
double R=diagonalLenght*std::sqrt(x*x+y*y)/(5.0+std::sqrt(x*x+y*y));
|
||||
double theta=atan2(y,x);
|
||||
// convert input polar coord into cartesian/C compatble coordinate
|
||||
unsigned int columnIndex=(unsigned int)(cos(theta)*R)+halfInputColumns;
|
||||
|
@@ -24,20 +24,15 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
using std::map;
|
||||
using std::set;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
// Removes duplicate elements in a given vector.
|
||||
template<typename _Tp>
|
||||
inline vector<_Tp> remove_dups(const vector<_Tp>& src) {
|
||||
typedef typename set<_Tp>::const_iterator constSetIterator;
|
||||
typedef typename vector<_Tp>::const_iterator constVecIterator;
|
||||
set<_Tp> set_elems;
|
||||
inline std::vector<_Tp> remove_dups(const std::vector<_Tp>& src) {
|
||||
typedef typename std::set<_Tp>::const_iterator constSetIterator;
|
||||
typedef typename std::vector<_Tp>::const_iterator constVecIterator;
|
||||
std::set<_Tp> set_elems;
|
||||
for (constVecIterator it = src.begin(); it != src.end(); ++it)
|
||||
set_elems.insert(*it);
|
||||
vector<_Tp> elems;
|
||||
std::vector<_Tp> elems;
|
||||
for (constSetIterator it = set_elems.begin(); it != set_elems.end(); ++it)
|
||||
elems.push_back(*it);
|
||||
return elems;
|
||||
@@ -47,7 +42,7 @@ static Mat argsort(InputArray _src, bool ascending=true)
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
if (src.rows != 1 && src.cols != 1) {
|
||||
string error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
|
||||
std::string error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
|
||||
@@ -59,7 +54,7 @@ static Mat argsort(InputArray _src, bool ascending=true)
|
||||
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) {
|
||||
string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< vector<...> >).";
|
||||
std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// number of samples
|
||||
@@ -75,7 +70,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
|
||||
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, (int)d, (int)src.getMat(i).total());
|
||||
std::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
|
||||
@@ -95,7 +90,7 @@ static void sortMatrixColumnsByIndices(InputArray _src, InputArray _indices, Out
|
||||
CV_Error(CV_StsUnsupportedFormat, "cv::sortColumnsByIndices only works on integer indices!");
|
||||
}
|
||||
Mat src = _src.getMat();
|
||||
vector<int> indices = _indices.getMat();
|
||||
std::vector<int> indices = _indices.getMat();
|
||||
_dst.create(src.rows, src.cols, src.type());
|
||||
Mat dst = _dst.getMat();
|
||||
for(size_t idx = 0; idx < indices.size(); idx++) {
|
||||
@@ -183,12 +178,12 @@ Mat subspaceProject(InputArray _W, InputArray _mean, InputArray _src) {
|
||||
int d = src.cols;
|
||||
// make sure the data has the correct shape
|
||||
if(W.rows != d) {
|
||||
string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
|
||||
std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// make sure mean is correct if not empty
|
||||
if(!mean.empty() && (mean.total() != (size_t) d)) {
|
||||
string error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
|
||||
std::string error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// create temporary matrices
|
||||
@@ -221,12 +216,12 @@ Mat subspaceReconstruct(InputArray _W, InputArray _mean, InputArray _src)
|
||||
int d = src.cols;
|
||||
// make sure the data has the correct shape
|
||||
if(W.cols != d) {
|
||||
string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
|
||||
std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// make sure mean is correct if not empty
|
||||
if(!mean.empty() && (mean.total() != (size_t) W.rows)) {
|
||||
string error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
|
||||
std::string error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// initalize temporary matrices
|
||||
@@ -330,7 +325,7 @@ private:
|
||||
int n1 = nn - 1;
|
||||
int low = 0;
|
||||
int high = nn - 1;
|
||||
double eps = pow(2.0, -52.0);
|
||||
double eps = std::pow(2.0, -52.0);
|
||||
double exshift = 0.0;
|
||||
double p = 0, q = 0, r = 0, s = 0, z = 0, t, w, x, y;
|
||||
|
||||
@@ -342,7 +337,7 @@ private:
|
||||
d[i] = H[i][i];
|
||||
e[i] = 0.0;
|
||||
}
|
||||
for (int j = max(i - 1, 0); j < nn; j++) {
|
||||
for (int j = std::max(i - 1, 0); j < nn; j++) {
|
||||
norm = norm + std::abs(H[i][j]);
|
||||
}
|
||||
}
|
||||
@@ -380,7 +375,7 @@ private:
|
||||
w = H[n1][n1 - 1] * H[n1 - 1][n1];
|
||||
p = (H[n1 - 1][n1 - 1] - H[n1][n1]) / 2.0;
|
||||
q = p * p + w;
|
||||
z = sqrt(std::abs(q));
|
||||
z = std::sqrt(std::abs(q));
|
||||
H[n1][n1] = H[n1][n1] + exshift;
|
||||
H[n1 - 1][n1 - 1] = H[n1 - 1][n1 - 1] + exshift;
|
||||
x = H[n1][n1];
|
||||
@@ -404,7 +399,7 @@ private:
|
||||
s = std::abs(x) + std::abs(z);
|
||||
p = x / s;
|
||||
q = z / s;
|
||||
r = sqrt(p * p + q * q);
|
||||
r = std::sqrt(p * p + q * q);
|
||||
p = p / r;
|
||||
q = q / r;
|
||||
|
||||
@@ -475,7 +470,7 @@ private:
|
||||
s = (y - x) / 2.0;
|
||||
s = s * s + w;
|
||||
if (s > 0) {
|
||||
s = sqrt(s);
|
||||
s = std::sqrt(s);
|
||||
if (y < x) {
|
||||
s = -s;
|
||||
}
|
||||
@@ -539,7 +534,7 @@ private:
|
||||
if (x == 0.0) {
|
||||
break;
|
||||
}
|
||||
s = sqrt(p * p + q * q + r * r);
|
||||
s = std::sqrt(p * p + q * q + r * r);
|
||||
if (p < 0) {
|
||||
s = -s;
|
||||
}
|
||||
@@ -570,7 +565,7 @@ private:
|
||||
|
||||
// Column modification
|
||||
|
||||
for (int i = 0; i <= min(n1, k + 3); i++) {
|
||||
for (int i = 0; i <= std::min(n1, k + 3); i++) {
|
||||
p = x * H[i][k] + y * H[i][k + 1];
|
||||
if (notlast) {
|
||||
p = p + z * H[i][k + 2];
|
||||
@@ -721,7 +716,7 @@ private:
|
||||
|
||||
// Overflow control
|
||||
|
||||
t = max(std::abs(H[i][n1 - 1]), std::abs(H[i][n1]));
|
||||
t = std::max(std::abs(H[i][n1 - 1]), std::abs(H[i][n1]));
|
||||
if ((eps * t) * t > 1) {
|
||||
for (int j = i; j <= n1; j++) {
|
||||
H[j][n1 - 1] = H[j][n1 - 1] / t;
|
||||
@@ -748,7 +743,7 @@ private:
|
||||
for (int j = nn - 1; j >= low; j--) {
|
||||
for (int i = low; i <= high; i++) {
|
||||
z = 0.0;
|
||||
for (int k = low; k <= min(j, high); k++) {
|
||||
for (int k = low; k <= std::min(j, high); k++) {
|
||||
z = z + V[i][k] * H[k][j];
|
||||
}
|
||||
V[i][j] = z;
|
||||
@@ -782,7 +777,7 @@ private:
|
||||
ort[i] = H[i][m - 1] / scale;
|
||||
h += ort[i] * ort[i];
|
||||
}
|
||||
double g = sqrt(h);
|
||||
double g = std::sqrt(h);
|
||||
if (ort[m] > 0) {
|
||||
g = -g;
|
||||
}
|
||||
@@ -941,7 +936,7 @@ public:
|
||||
//------------------------------------------------------------------------------
|
||||
// Linear Discriminant Analysis implementation
|
||||
//------------------------------------------------------------------------------
|
||||
void LDA::save(const string& filename) const {
|
||||
void LDA::save(const std::string& filename) const {
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
if (!fs.isOpened()) {
|
||||
CV_Error(CV_StsError, "File can't be opened for writing!");
|
||||
@@ -951,7 +946,7 @@ void LDA::save(const string& filename) const {
|
||||
}
|
||||
|
||||
// Deserializes this object from a given filename.
|
||||
void LDA::load(const string& filename) {
|
||||
void LDA::load(const std::string& filename) {
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
CV_Error(CV_StsError, "File can't be opened for writing!");
|
||||
@@ -978,7 +973,7 @@ void LDA::load(const FileStorage& fs) {
|
||||
void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
// get data
|
||||
Mat src = _src.getMat();
|
||||
vector<int> labels;
|
||||
std::vector<int> labels;
|
||||
// safely copy the labels
|
||||
{
|
||||
Mat tmp = _lbls.getMat();
|
||||
@@ -991,9 +986,9 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
// ensure working matrix is double precision
|
||||
src.convertTo(data, CV_64FC1);
|
||||
// maps the labels, so they're ascending: [0,1,...,C]
|
||||
vector<int> mapped_labels(labels.size());
|
||||
vector<int> num2label = remove_dups(labels);
|
||||
map<int, int> label2num;
|
||||
std::vector<int> mapped_labels(labels.size());
|
||||
std::vector<int> num2label = remove_dups(labels);
|
||||
std::map<int, int> label2num;
|
||||
for (int i = 0; i < (int)num2label.size(); i++)
|
||||
label2num[num2label[i]] = i;
|
||||
for (size_t i = 0; i < labels.size(); i++)
|
||||
@@ -1006,19 +1001,19 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
// we can't do a LDA on one class, what do you
|
||||
// want to separate from each other then?
|
||||
if(C == 1) {
|
||||
string error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
|
||||
std::string error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// throw error if less labels, than samples
|
||||
if (labels.size() != static_cast<size_t>(N)) {
|
||||
string error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
|
||||
std::string error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
}
|
||||
// warn if within-classes scatter matrix becomes singular
|
||||
if (N < D) {
|
||||
cout << "Warning: Less observations than feature dimension given!"
|
||||
<< "Computation will probably fail."
|
||||
<< endl;
|
||||
std::cout << "Warning: Less observations than feature dimension given!"
|
||||
<< "Computation will probably fail."
|
||||
<< std::endl;
|
||||
}
|
||||
// clip number of components to be a valid number
|
||||
if ((_num_components <= 0) || (_num_components > (C - 1))) {
|
||||
@@ -1027,8 +1022,8 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
// holds the mean over all classes
|
||||
Mat meanTotal = Mat::zeros(1, D, data.type());
|
||||
// holds the mean for each class
|
||||
vector<Mat> meanClass(C);
|
||||
vector<int> numClass(C);
|
||||
std::vector<Mat> meanClass(C);
|
||||
std::vector<int> numClass(C);
|
||||
// initialize
|
||||
for (int i = 0; i < C; i++) {
|
||||
numClass[i] = 0;
|
||||
@@ -1076,7 +1071,7 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
// reshape eigenvalues, so they are stored by column
|
||||
_eigenvalues = _eigenvalues.reshape(1, 1);
|
||||
// get sorted indices descending by their eigenvalue
|
||||
vector<int> sorted_indices = argsort(_eigenvalues, false);
|
||||
std::vector<int> sorted_indices = argsort(_eigenvalues, false);
|
||||
// now sort eigenvalues and eigenvectors accordingly
|
||||
_eigenvalues = sortMatrixColumnsByIndices(_eigenvalues, sorted_indices);
|
||||
_eigenvectors = sortMatrixColumnsByIndices(_eigenvectors, sorted_indices);
|
||||
@@ -1094,7 +1089,7 @@ void LDA::compute(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
lda(_src.getMat(), _lbls);
|
||||
break;
|
||||
default:
|
||||
string error_message= format("InputArray Datatype %d is not supported.", _src.kind());
|
||||
std::string error_message= format("InputArray Datatype %d is not supported.", _src.kind());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
break;
|
||||
}
|
||||
|
@@ -75,13 +75,13 @@ LogPolar_Interp::LogPolar_Interp(int w, int h, Point2i center, int _R, double _r
|
||||
int rtmp;
|
||||
|
||||
if (center.x<=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
else if (center.x>=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
else if (center.x>=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
else //if (center.x<=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
|
||||
M=2*rtmp; N=2*rtmp;
|
||||
|
||||
@@ -97,8 +97,8 @@ LogPolar_Interp::LogPolar_Interp(int w, int h, Point2i center, int _R, double _r
|
||||
|
||||
if (sp){
|
||||
int jc=M/2-1, ic=N/2-1;
|
||||
int _romax=min(ic, jc);
|
||||
double _a=exp(log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
int _romax=std::min(ic, jc);
|
||||
double _a=std::exp(std::log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
S=(int) floor(2*CV_PI/(_a-1)+0.5);
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ void LogPolar_Interp::create_map(int _M, int _n, int _R, int _s, double _ro0)
|
||||
ro0=_ro0;
|
||||
|
||||
int jc=N/2-1, ic=M/2-1;
|
||||
romax=min(ic, jc);
|
||||
a=exp(log((double)romax/(double)ro0)/(double)R);
|
||||
romax=std::min(ic, jc);
|
||||
a=std::exp(std::log((double)romax/(double)ro0)/(double)R);
|
||||
q=((double)S)/(2*CV_PI);
|
||||
|
||||
Rsri = Mat::zeros(S,R,CV_32FC1);
|
||||
@@ -129,8 +129,8 @@ void LogPolar_Interp::create_map(int _M, int _n, int _R, int _s, double _ro0)
|
||||
{
|
||||
for(int u=0; u<R; u++)
|
||||
{
|
||||
Rsri.at<float>(v,u)=(float)(ro0*pow(a,u)*sin(v/q)+jc);
|
||||
Csri.at<float>(v,u)=(float)(ro0*pow(a,u)*cos(v/q)+ic);
|
||||
Rsri.at<float>(v,u)=(float)(ro0*std::pow(a,u)*sin(v/q)+jc);
|
||||
Csri.at<float>(v,u)=(float)(ro0*std::pow(a,u)*cos(v/q)+ic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void LogPolar_Interp::create_map(int _M, int _n, int _R, int _s, double _ro0)
|
||||
ETAyx.at<float>(j,i)=(float)(q*theta);
|
||||
|
||||
double ro2=(j-jc)*(j-jc)+(i-ic)*(i-ic);
|
||||
CSIyx.at<float>(j,i)=(float)(0.5*log(ro2/(ro0*ro0))/log(a));
|
||||
CSIyx.at<float>(j,i)=(float)(0.5*std::log(ro2/(ro0*ro0))/std::log(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,13 +221,13 @@ LogPolar_Overlapping::LogPolar_Overlapping(int w, int h, Point2i center, int _R,
|
||||
int rtmp;
|
||||
|
||||
if (center.x<=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
else if (center.x>=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
else if (center.x>=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
else //if (center.x<=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
|
||||
M=2*rtmp; N=2*rtmp;
|
||||
|
||||
@@ -244,8 +244,8 @@ LogPolar_Overlapping::LogPolar_Overlapping(int w, int h, Point2i center, int _R,
|
||||
|
||||
if (sp){
|
||||
int jc=M/2-1, ic=N/2-1;
|
||||
int _romax=min(ic, jc);
|
||||
double _a=exp(log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
int _romax=std::min(ic, jc);
|
||||
double _a=std::exp(std::log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
S=(int) floor(2*CV_PI/(_a-1)+0.5);
|
||||
}
|
||||
|
||||
@@ -261,8 +261,8 @@ void LogPolar_Overlapping::create_map(int _M, int _n, int _R, int _s, double _ro
|
||||
ro0=_ro0;
|
||||
|
||||
int jc=N/2-1, ic=M/2-1;
|
||||
romax=min(ic, jc);
|
||||
a=exp(log((double)romax/(double)ro0)/(double)R);
|
||||
romax=std::min(ic, jc);
|
||||
a=std::exp(std::log((double)romax/(double)ro0)/(double)R);
|
||||
q=((double)S)/(2*CV_PI);
|
||||
ind1=0;
|
||||
|
||||
@@ -279,8 +279,8 @@ void LogPolar_Overlapping::create_map(int _M, int _n, int _R, int _s, double _ro
|
||||
{
|
||||
for(int u=0; u<R; u++)
|
||||
{
|
||||
Rsri.at<float>(v,u)=(float)(ro0*pow(a,u)*sin(v/q)+jc);
|
||||
Csri.at<float>(v,u)=(float)(ro0*pow(a,u)*cos(v/q)+ic);
|
||||
Rsri.at<float>(v,u)=(float)(ro0*std::pow(a,u)*sin(v/q)+jc);
|
||||
Csri.at<float>(v,u)=(float)(ro0*std::pow(a,u)*cos(v/q)+ic);
|
||||
Rsr[v*R+u]=(int)floor(Rsri.at<float>(v,u));
|
||||
Csr[v*R+u]=(int)floor(Csri.at<float>(v,u));
|
||||
}
|
||||
@@ -290,7 +290,7 @@ void LogPolar_Overlapping::create_map(int _M, int _n, int _R, int _s, double _ro
|
||||
|
||||
for(int i=0; i<R; i++)
|
||||
{
|
||||
Wsr[i]=ro0*(a-1)*pow(a,i-1);
|
||||
Wsr[i]=ro0*(a-1)*std::pow(a,i-1);
|
||||
if((Wsr[i]>1)&&(done==false))
|
||||
{
|
||||
ind1=i;
|
||||
@@ -314,7 +314,7 @@ void LogPolar_Overlapping::create_map(int _M, int _n, int _R, int _s, double _ro
|
||||
ETAyx.at<float>(j,i)=(float)(q*theta);
|
||||
|
||||
double ro2=(j-jc)*(j-jc)+(i-ic)*(i-ic);
|
||||
CSIyx.at<float>(j,i)=(float)(0.5*log(ro2/(ro0*ro0))/log(a));
|
||||
CSIyx.at<float>(j,i)=(float)(0.5*std::log(ro2/(ro0*ro0))/std::log(a));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ void LogPolar_Overlapping::create_map(int _M, int _n, int _R, int _s, double _ro
|
||||
for(int j=0; j<2*w+1; j++)
|
||||
for(int i=0; i<2*w+1; i++)
|
||||
{
|
||||
(w_ker_2D[v*R+u].weights)[j*(2*w+1)+i]=exp(-(pow(i-w-dx, 2)+pow(j-w-dy, 2))/(2*sigma*sigma));
|
||||
(w_ker_2D[v*R+u].weights)[j*(2*w+1)+i]=std::exp(-(std::pow(i-w-dx, 2)+std::pow(j-w-dy, 2))/(2*sigma*sigma));
|
||||
tot+=(w_ker_2D[v*R+u].weights)[j*(2*w+1)+i];
|
||||
}
|
||||
for(int j=0; j<(2*w+1); j++)
|
||||
@@ -351,7 +351,7 @@ const Mat LogPolar_Overlapping::to_cortical(const Mat &source)
|
||||
remap(source_border,out,Csri,Rsri,INTER_LINEAR);
|
||||
|
||||
int wm=w_ker_2D[R-1].w;
|
||||
vector<int> IMG((M+2*wm+1)*(N+2*wm+1), 0);
|
||||
std::vector<int> IMG((M+2*wm+1)*(N+2*wm+1), 0);
|
||||
|
||||
for(int j=0; j<N; j++)
|
||||
for(int i=0; i<M; i++)
|
||||
@@ -388,8 +388,8 @@ const Mat LogPolar_Overlapping::to_cartesian(const Mat &source)
|
||||
|
||||
int wm=w_ker_2D[R-1].w;
|
||||
|
||||
vector<double> IMG((N+2*wm+1)*(M+2*wm+1), 0.);
|
||||
vector<double> NOR((N+2*wm+1)*(M+2*wm+1), 0.);
|
||||
std::vector<double> IMG((N+2*wm+1)*(M+2*wm+1), 0.);
|
||||
std::vector<double> NOR((N+2*wm+1)*(M+2*wm+1), 0.);
|
||||
|
||||
for(int v=0; v<S; v++)
|
||||
for(int u=ind1; u<R; u++)
|
||||
@@ -416,7 +416,7 @@ const Mat LogPolar_Overlapping::to_cartesian(const Mat &source)
|
||||
{
|
||||
/*if(NOR[(M+2*wm+1)*j+i]>0)
|
||||
ret[M*(j-wm)+i-wm]=(int) floor(IMG[(M+2*wm+1)*j+i]+0.5);*/
|
||||
//int ro=(int)floor(sqrt((double)((j-wm-yc)*(j-wm-yc)+(i-wm-xc)*(i-wm-xc))));
|
||||
//int ro=(int)floor(std::sqrt((double)((j-wm-yc)*(j-wm-yc)+(i-wm-xc)*(i-wm-xc))));
|
||||
int csi=(int) floor(CSIyx.at<float>(j-wm,i-wm));
|
||||
|
||||
if((csi>=(ind1-(w_ker_2D[ind1]).w))&&(csi<R))
|
||||
@@ -446,13 +446,13 @@ LogPolar_Adjacent::LogPolar_Adjacent(int w, int h, Point2i center, int _R, doubl
|
||||
int rtmp;
|
||||
|
||||
if (center.x<=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)(w-center.x)*(w-center.x));
|
||||
else if (center.x>=w/2 && center.y>=h/2)
|
||||
rtmp=(int)sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)center.y*center.y + (float)center.x*center.x);
|
||||
else if (center.x>=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)center.x*center.x);
|
||||
else //if (center.x<=w/2 && center.y<=h/2)
|
||||
rtmp=(int)sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
rtmp=(int)std::sqrt((float)(h-center.y)*(h-center.y) + (float)(w-center.x)*(w-center.x));
|
||||
|
||||
M=2*rtmp; N=2*rtmp;
|
||||
|
||||
@@ -468,8 +468,8 @@ LogPolar_Adjacent::LogPolar_Adjacent(int w, int h, Point2i center, int _R, doubl
|
||||
|
||||
if (sp){
|
||||
int jc=M/2-1, ic=N/2-1;
|
||||
int _romax=min(ic, jc);
|
||||
double _a=exp(log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
int _romax=std::min(ic, jc);
|
||||
double _a=std::exp(std::log((double)(_romax/2-1)/(double)ro0)/(double)R);
|
||||
S=(int) floor(2*CV_PI/(_a-1)+0.5);
|
||||
}
|
||||
|
||||
@@ -484,9 +484,9 @@ void LogPolar_Adjacent::create_map(int _M, int _n, int _R, int _s, double _ro0,
|
||||
R=_R;
|
||||
S=_s;
|
||||
ro0=_ro0;
|
||||
romax=min(M/2.0, N/2.0);
|
||||
romax=std::min(M/2.0, N/2.0);
|
||||
|
||||
a=exp(log(romax/ro0)/(double)R);
|
||||
a=std::exp(std::log(romax/ro0)/(double)R);
|
||||
q=S/(2*CV_PI);
|
||||
|
||||
A.resize(R*S);
|
||||
@@ -572,7 +572,7 @@ const Mat LogPolar_Adjacent::to_cortical(const Mat &source)
|
||||
Mat source_border;
|
||||
copyMakeBorder(source,source_border,top,bottom,left,right,BORDER_CONSTANT,Scalar(0));
|
||||
|
||||
vector<double> map(R*S, 0.);
|
||||
std::vector<double> map(R*S, 0.);
|
||||
|
||||
for(int j=0; j<N; j++)
|
||||
for(int i=0; i<M; i++)
|
||||
@@ -597,7 +597,7 @@ const Mat LogPolar_Adjacent::to_cortical(const Mat &source)
|
||||
|
||||
const Mat LogPolar_Adjacent::to_cartesian(const Mat &source)
|
||||
{
|
||||
vector<double> map(M*N, 0.);
|
||||
std::vector<double> map(M*N, 0.);
|
||||
|
||||
for(int j=0; j<N; j++)
|
||||
for(int i=0; i<M; i++)
|
||||
@@ -621,7 +621,7 @@ const Mat LogPolar_Adjacent::to_cartesian(const Mat &source)
|
||||
|
||||
bool LogPolar_Adjacent::get_uv(double x, double y, int&u, int&v)
|
||||
{
|
||||
double ro=sqrt(x*x+y*y), theta;
|
||||
double ro=std::sqrt(x*x+y*y), theta;
|
||||
if(x>0)
|
||||
theta=atan(y/x);
|
||||
else
|
||||
@@ -635,7 +635,7 @@ bool LogPolar_Adjacent::get_uv(double x, double y, int&u, int&v)
|
||||
}
|
||||
else
|
||||
{
|
||||
u= (int) floor(log(ro/ro0)/log(a));
|
||||
u= (int) floor(std::log(ro/ro0)/std::log(a));
|
||||
if(theta>=0)
|
||||
v= (int) floor(q*theta);
|
||||
else
|
||||
|
@@ -144,7 +144,7 @@ void MagnoRetinaFilter::resize(const unsigned int NBrows, const unsigned int NBc
|
||||
|
||||
void MagnoRetinaFilter::setCoefficientsTable(const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float localAdaptIntegration_tau, const float localAdaptIntegration_k )
|
||||
{
|
||||
_temporalCoefficient=(float)exp(-1.0f/amacrinCellsTemporalCutFrequency);
|
||||
_temporalCoefficient=(float)std::exp(-1.0f/amacrinCellsTemporalCutFrequency);
|
||||
// the first set of parameters is dedicated to the low pass filtering property of the ganglion cells
|
||||
BasicRetinaFilter::setLPfilterParameters(parasolCells_beta, parasolCells_tau, parasolCells_k, 0);
|
||||
// the second set of parameters is dedicated to the ganglion cells output intergartion for their local adaptation property
|
||||
|
@@ -101,7 +101,7 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
void fillMinMax(const vector<Point3f>& points, Octree::Node& node)
|
||||
void fillMinMax(const std::vector<Point3f>& points, Octree::Node& node)
|
||||
{
|
||||
node.x_max = node.y_max = node.z_max = std::numeric_limits<float>::min();
|
||||
node.x_min = node.y_min = node.z_min = std::numeric_limits<float>::max();
|
||||
@@ -171,7 +171,7 @@ namespace cv
|
||||
{
|
||||
}
|
||||
|
||||
Octree::Octree(const vector<Point3f>& points3d, int maxLevels, int _minPoints)
|
||||
Octree::Octree(const std::vector<Point3f>& points3d, int maxLevels, int _minPoints)
|
||||
{
|
||||
buildTree(points3d, maxLevels, _minPoints);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ namespace cv
|
||||
{
|
||||
}
|
||||
|
||||
void Octree::getPointsWithinSphere(const Point3f& center, float radius, vector<Point3f>& out) const
|
||||
void Octree::getPointsWithinSphere(const Point3f& center, float radius, std::vector<Point3f>& out) const
|
||||
{
|
||||
out.clear();
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace cv
|
||||
}
|
||||
}
|
||||
|
||||
void Octree::buildTree(const vector<Point3f>& points3d, int maxLevels, int _minPoints)
|
||||
void Octree::buildTree(const std::vector<Point3f>& points3d, int maxLevels, int _minPoints)
|
||||
{
|
||||
assert((size_t)maxLevels * 8 < MAX_STACK_SIZE);
|
||||
points.resize(points3d.size());
|
||||
@@ -286,9 +286,9 @@ namespace cv
|
||||
{
|
||||
size_t size = nodes[nodeInd].end - nodes[nodeInd].begin;
|
||||
|
||||
vector<size_t> boxBorders(MAX_LEAFS+1, 0);
|
||||
vector<size_t> boxIndices(size);
|
||||
vector<Point3f> tempPoints(size);
|
||||
std::vector<size_t> boxBorders(MAX_LEAFS+1, 0);
|
||||
std::vector<size_t> boxIndices(size);
|
||||
std::vector<Point3f> tempPoints(size);
|
||||
|
||||
for (int i = nodes[nodeInd].begin, j = 0; i < nodes[nodeInd].end; ++i, ++j)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ namespace cv
|
||||
for (size_t i = 1; i < boxBorders.size(); ++i)
|
||||
boxBorders[i] += boxBorders[i-1];
|
||||
|
||||
vector<size_t> writeInds(boxBorders.begin(), boxBorders.end());
|
||||
std::vector<size_t> writeInds(boxBorders.begin(), boxBorders.end());
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
|
@@ -61,7 +61,7 @@ namespace cv {
|
||||
namespace of2 {
|
||||
|
||||
static double logsumexp(double a, double b) {
|
||||
return a > b ? log(1 + exp(b - a)) + a : log(1 + exp(a - b)) + b;
|
||||
return a > b ? std::log(1 + std::exp(b - a)) + a : std::log(1 + std::exp(a - b)) + b;
|
||||
}
|
||||
|
||||
FabMap::FabMap(const Mat& _clTree, double _PzGe,
|
||||
@@ -103,14 +103,14 @@ const std::vector<cv::Mat>& FabMap::getTestImgDescriptors() const {
|
||||
|
||||
void FabMap::addTraining(const Mat& queryImgDescriptor) {
|
||||
CV_Assert(!queryImgDescriptor.empty());
|
||||
vector<Mat> queryImgDescriptors;
|
||||
std::vector<Mat> queryImgDescriptors;
|
||||
for (int i = 0; i < queryImgDescriptor.rows; i++) {
|
||||
queryImgDescriptors.push_back(queryImgDescriptor.row(i));
|
||||
}
|
||||
addTraining(queryImgDescriptors);
|
||||
}
|
||||
|
||||
void FabMap::addTraining(const vector<Mat>& queryImgDescriptors) {
|
||||
void FabMap::addTraining(const std::vector<Mat>& queryImgDescriptors) {
|
||||
for (size_t i = 0; i < queryImgDescriptors.size(); i++) {
|
||||
CV_Assert(!queryImgDescriptors[i].empty());
|
||||
CV_Assert(queryImgDescriptors[i].rows == 1);
|
||||
@@ -122,7 +122,7 @@ void FabMap::addTraining(const vector<Mat>& queryImgDescriptors) {
|
||||
|
||||
void FabMap::add(const cv::Mat& queryImgDescriptor) {
|
||||
CV_Assert(!queryImgDescriptor.empty());
|
||||
vector<Mat> queryImgDescriptors;
|
||||
std::vector<Mat> queryImgDescriptors;
|
||||
for (int i = 0; i < queryImgDescriptor.rows; i++) {
|
||||
queryImgDescriptors.push_back(queryImgDescriptor.row(i));
|
||||
}
|
||||
@@ -140,10 +140,10 @@ void FabMap::add(const std::vector<cv::Mat>& queryImgDescriptors) {
|
||||
}
|
||||
|
||||
void FabMap::compare(const Mat& queryImgDescriptor,
|
||||
vector<IMatch>& matches, bool addQuery,
|
||||
std::vector<IMatch>& matches, bool addQuery,
|
||||
const Mat& mask) {
|
||||
CV_Assert(!queryImgDescriptor.empty());
|
||||
vector<Mat> queryImgDescriptors;
|
||||
std::vector<Mat> queryImgDescriptors;
|
||||
for (int i = 0; i < queryImgDescriptor.rows; i++) {
|
||||
queryImgDescriptors.push_back(queryImgDescriptor.row(i));
|
||||
}
|
||||
@@ -151,16 +151,16 @@ void FabMap::compare(const Mat& queryImgDescriptor,
|
||||
}
|
||||
|
||||
void FabMap::compare(const Mat& queryImgDescriptor,
|
||||
const Mat& testImgDescriptor, vector<IMatch>& matches,
|
||||
const Mat& testImgDescriptor, std::vector<IMatch>& matches,
|
||||
const Mat& mask) {
|
||||
CV_Assert(!queryImgDescriptor.empty());
|
||||
vector<Mat> queryImgDescriptors;
|
||||
std::vector<Mat> queryImgDescriptors;
|
||||
for (int i = 0; i < queryImgDescriptor.rows; i++) {
|
||||
queryImgDescriptors.push_back(queryImgDescriptor.row(i));
|
||||
}
|
||||
|
||||
CV_Assert(!testImgDescriptor.empty());
|
||||
vector<Mat> _testImgDescriptors;
|
||||
std::vector<Mat> _testImgDescriptors;
|
||||
for (int i = 0; i < testImgDescriptor.rows; i++) {
|
||||
_testImgDescriptors.push_back(testImgDescriptor.row(i));
|
||||
}
|
||||
@@ -169,18 +169,18 @@ void FabMap::compare(const Mat& queryImgDescriptor,
|
||||
}
|
||||
|
||||
void FabMap::compare(const Mat& queryImgDescriptor,
|
||||
const vector<Mat>& _testImgDescriptors,
|
||||
vector<IMatch>& matches, const Mat& mask) {
|
||||
const std::vector<Mat>& _testImgDescriptors,
|
||||
std::vector<IMatch>& matches, const Mat& mask) {
|
||||
CV_Assert(!queryImgDescriptor.empty());
|
||||
vector<Mat> queryImgDescriptors;
|
||||
std::vector<Mat> queryImgDescriptors;
|
||||
for (int i = 0; i < queryImgDescriptor.rows; i++) {
|
||||
queryImgDescriptors.push_back(queryImgDescriptor.row(i));
|
||||
}
|
||||
compare(queryImgDescriptors,_testImgDescriptors,matches,mask);
|
||||
}
|
||||
|
||||
void FabMap::compare(const vector<Mat>& queryImgDescriptors,
|
||||
vector<IMatch>& matches, bool addQuery, const Mat& /*mask*/) {
|
||||
void FabMap::compare(const std::vector<Mat>& queryImgDescriptors,
|
||||
std::vector<IMatch>& matches, bool addQuery, const Mat& /*mask*/) {
|
||||
|
||||
// TODO: add first query if empty (is this necessary)
|
||||
|
||||
@@ -199,9 +199,9 @@ void FabMap::compare(const vector<Mat>& queryImgDescriptors,
|
||||
}
|
||||
}
|
||||
|
||||
void FabMap::compare(const vector<Mat>& queryImgDescriptors,
|
||||
const vector<Mat>& _testImgDescriptors,
|
||||
vector<IMatch>& matches, const Mat& /*mask*/) {
|
||||
void FabMap::compare(const std::vector<Mat>& queryImgDescriptors,
|
||||
const std::vector<Mat>& _testImgDescriptors,
|
||||
std::vector<IMatch>& matches, const Mat& /*mask*/) {
|
||||
|
||||
CV_Assert(!(flags & MOTION_MODEL));
|
||||
for (size_t i = 0; i < _testImgDescriptors.size(); i++) {
|
||||
@@ -225,10 +225,10 @@ void FabMap::compare(const vector<Mat>& queryImgDescriptors,
|
||||
}
|
||||
|
||||
void FabMap::compareImgDescriptor(const Mat& queryImgDescriptor,
|
||||
int queryIndex, const vector<Mat>& _testImgDescriptors,
|
||||
vector<IMatch>& matches) {
|
||||
int queryIndex, const std::vector<Mat>& _testImgDescriptors,
|
||||
std::vector<IMatch>& matches) {
|
||||
|
||||
vector<IMatch> queryMatches;
|
||||
std::vector<IMatch> queryMatches;
|
||||
queryMatches.push_back(IMatch(queryIndex,-1,
|
||||
getNewPlaceLikelihood(queryImgDescriptor),0));
|
||||
getLikelihoods(queryImgDescriptor,_testImgDescriptors,queryMatches);
|
||||
@@ -240,7 +240,7 @@ void FabMap::compareImgDescriptor(const Mat& queryImgDescriptor,
|
||||
}
|
||||
|
||||
void FabMap::getLikelihoods(const Mat& /*queryImgDescriptor*/,
|
||||
const vector<Mat>& /*testImgDescriptors*/, vector<IMatch>& /*matches*/) {
|
||||
const std::vector<Mat>& /*testImgDescriptors*/, std::vector<IMatch>& /*matches*/) {
|
||||
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ double FabMap::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
for (int q = 0; q < clTree.cols; q++) {
|
||||
zq = queryImgDescriptor.at<float>(0,q) > 0;
|
||||
|
||||
logP += log(Pzq(q, false) * PzqGeq(zq, false) +
|
||||
logP += std::log(Pzq(q, false) * PzqGeq(zq, false) +
|
||||
Pzq(q, true) * PzqGeq(zq, true));
|
||||
}
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ double FabMap::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
beta = Pzq(q, !zq) * PzqGeq(zq, true) * PzqGzpq(q, zq, zpq);
|
||||
p += Pzq(q, true) * beta / (alpha + beta);
|
||||
|
||||
logP += log(p);
|
||||
logP += std::log(p);
|
||||
}
|
||||
}
|
||||
return logP;
|
||||
@@ -279,7 +279,7 @@ double FabMap::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
CV_Assert(!trainingImgDescriptors.empty());
|
||||
CV_Assert(numSamples > 0);
|
||||
|
||||
vector<Mat> sampledImgDescriptors;
|
||||
std::vector<Mat> sampledImgDescriptors;
|
||||
|
||||
// TODO: this method can result in the same sample being added
|
||||
// multiple times. Is this desired?
|
||||
@@ -289,7 +289,7 @@ double FabMap::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
sampledImgDescriptors.push_back(trainingImgDescriptors[index]);
|
||||
}
|
||||
|
||||
vector<IMatch> matches;
|
||||
std::vector<IMatch> matches;
|
||||
getLikelihoods(queryImgDescriptor,sampledImgDescriptors,matches);
|
||||
|
||||
double averageLogLikelihood = -DBL_MAX + matches.front().likelihood + 1;
|
||||
@@ -298,34 +298,34 @@ double FabMap::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
logsumexp(matches[i].likelihood, averageLogLikelihood);
|
||||
}
|
||||
|
||||
return averageLogLikelihood - log((double)numSamples);
|
||||
return averageLogLikelihood - std::log((double)numSamples);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FabMap::normaliseDistribution(vector<IMatch>& matches) {
|
||||
void FabMap::normaliseDistribution(std::vector<IMatch>& matches) {
|
||||
CV_Assert(!matches.empty());
|
||||
|
||||
if (flags & MOTION_MODEL) {
|
||||
|
||||
matches[0].match = matches[0].likelihood + log(Pnew);
|
||||
matches[0].match = matches[0].likelihood + std::log(Pnew);
|
||||
|
||||
if (priorMatches.size() > 2) {
|
||||
matches[1].match = matches[1].likelihood;
|
||||
matches[1].match += log(
|
||||
matches[1].match += std::log(
|
||||
(2 * (1-mBias) * priorMatches[1].match +
|
||||
priorMatches[1].match +
|
||||
2 * mBias * priorMatches[2].match) / 3);
|
||||
for (size_t i = 2; i < priorMatches.size()-1; i++) {
|
||||
matches[i].match = matches[i].likelihood;
|
||||
matches[i].match += log(
|
||||
matches[i].match += std::log(
|
||||
(2 * (1-mBias) * priorMatches[i-1].match +
|
||||
priorMatches[i].match +
|
||||
2 * mBias * priorMatches[i+1].match)/3);
|
||||
}
|
||||
matches[priorMatches.size()-1].match =
|
||||
matches[priorMatches.size()-1].likelihood;
|
||||
matches[priorMatches.size()-1].match += log(
|
||||
matches[priorMatches.size()-1].match += std::log(
|
||||
(2 * (1-mBias) * priorMatches[priorMatches.size()-2].match +
|
||||
priorMatches[priorMatches.size()-1].match +
|
||||
2 * mBias * priorMatches[priorMatches.size()-1].match)/3);
|
||||
@@ -348,7 +348,7 @@ void FabMap::normaliseDistribution(vector<IMatch>& matches) {
|
||||
|
||||
//normalise
|
||||
for (size_t i = 0; i < matches.size(); i++) {
|
||||
matches[i].match = exp(matches[i].match - logsum);
|
||||
matches[i].match = std::exp(matches[i].match - logsum);
|
||||
}
|
||||
|
||||
//smooth final probabilities
|
||||
@@ -368,7 +368,7 @@ void FabMap::normaliseDistribution(vector<IMatch>& matches) {
|
||||
logsum = logsumexp(logsum, matches[i].likelihood);
|
||||
}
|
||||
for (size_t i = 0; i < matches.size(); i++) {
|
||||
matches[i].match = exp(matches[i].likelihood - logsum);
|
||||
matches[i].match = std::exp(matches[i].likelihood - logsum);
|
||||
}
|
||||
for (size_t i = 0; i < matches.size(); i++) {
|
||||
matches[i].match = sFactor*matches[i].match +
|
||||
@@ -444,7 +444,7 @@ FabMap1::~FabMap1() {
|
||||
}
|
||||
|
||||
void FabMap1::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
const vector<Mat>& testImageDescriptors, vector<IMatch>& matches) {
|
||||
const std::vector<Mat>& testImageDescriptors, std::vector<IMatch>& matches) {
|
||||
|
||||
for (size_t i = 0; i < testImageDescriptors.size(); i++) {
|
||||
bool zq, zpq, Lzq;
|
||||
@@ -455,7 +455,7 @@ void FabMap1::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
zpq = queryImgDescriptor.at<float>(0,pq(q)) > 0;
|
||||
Lzq = testImageDescriptors[i].at<float>(0,q) > 0;
|
||||
|
||||
logP += log((this->*PzGL)(q, zq, zpq, Lzq));
|
||||
logP += std::log((this->*PzGL)(q, zq, zpq, Lzq));
|
||||
|
||||
}
|
||||
matches.push_back(IMatch(0,(int)i,logP,0));
|
||||
@@ -467,7 +467,7 @@ FabMapLUT::FabMapLUT(const Mat& _clTree, double _PzGe, double _PzGNe,
|
||||
FabMap(_clTree, _PzGe, _PzGNe, _flags, _numSamples), precision(_precision) {
|
||||
|
||||
int nWords = clTree.cols;
|
||||
double precFactor = (double)pow(10.0, precision);
|
||||
double precFactor = (double)std::pow(10.0, precision);
|
||||
|
||||
table = new int[nWords][8];
|
||||
|
||||
@@ -478,7 +478,7 @@ FabMap(_clTree, _PzGe, _PzGNe, _flags, _numSamples), precision(_precision) {
|
||||
bool zq = (bool) ((i >> 1) & 0x01);
|
||||
bool zpq = (bool) (i & 1);
|
||||
|
||||
table[q][i] = -(int)(log((this->*PzGL)(q, zq, zpq, Lzq))
|
||||
table[q][i] = -(int)(std::log((this->*PzGL)(q, zq, zpq, Lzq))
|
||||
* precFactor);
|
||||
}
|
||||
}
|
||||
@@ -489,9 +489,9 @@ FabMapLUT::~FabMapLUT() {
|
||||
}
|
||||
|
||||
void FabMapLUT::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
const vector<Mat>& testImageDescriptors, vector<IMatch>& matches) {
|
||||
const std::vector<Mat>& testImageDescriptors, std::vector<IMatch>& matches) {
|
||||
|
||||
double precFactor = (double)pow(10.0, -precision);
|
||||
double precFactor = (double)std::pow(10.0, -precision);
|
||||
|
||||
for (size_t i = 0; i < testImageDescriptors.size(); i++) {
|
||||
unsigned long long int logP = 0;
|
||||
@@ -517,13 +517,13 @@ FabMapFBO::~FabMapFBO() {
|
||||
}
|
||||
|
||||
void FabMapFBO::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
const vector<Mat>& testImageDescriptors, vector<IMatch>& matches) {
|
||||
const std::vector<Mat>& testImageDescriptors, std::vector<IMatch>& matches) {
|
||||
|
||||
std::multiset<WordStats> wordData;
|
||||
setWordStatistics(queryImgDescriptor, wordData);
|
||||
|
||||
vector<int> matchIndices;
|
||||
vector<IMatch> queryMatches;
|
||||
std::vector<int> matchIndices;
|
||||
std::vector<IMatch> queryMatches;
|
||||
|
||||
for (size_t i = 0; i < testImageDescriptors.size(); i++) {
|
||||
queryMatches.push_back(IMatch(0,(int)i,0,0));
|
||||
@@ -544,7 +544,7 @@ void FabMapFBO::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
bool Lzq =
|
||||
testImageDescriptors[matchIndices[i]].at<float>(0,wordIter->q) > 0;
|
||||
queryMatches[matchIndices[i]].likelihood +=
|
||||
log((this->*PzGL)(wordIter->q,zq,zpq,Lzq));
|
||||
std::log((this->*PzGL)(wordIter->q,zq,zpq,Lzq));
|
||||
currBest =
|
||||
std::max(queryMatches[matchIndices[i]].likelihood, currBest);
|
||||
}
|
||||
@@ -553,9 +553,9 @@ void FabMapFBO::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
continue;
|
||||
|
||||
double delta = std::max(limitbisection(wordIter->V, wordIter->M),
|
||||
-log(rejectionThreshold));
|
||||
-std::log(rejectionThreshold));
|
||||
|
||||
vector<int>::iterator matchIter = matchIndices.begin();
|
||||
std::vector<int>::iterator matchIter = matchIndices.begin();
|
||||
while (matchIter != matchIndices.end()) {
|
||||
if (currBest - queryMatches[*matchIter].likelihood > delta) {
|
||||
queryMatches[*matchIter].likelihood = bailedOut;
|
||||
@@ -568,7 +568,7 @@ void FabMapFBO::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
|
||||
for (size_t i = 0; i < queryMatches.size(); i++) {
|
||||
if (queryMatches[i].likelihood == bailedOut) {
|
||||
queryMatches[i].likelihood = currBest + log(rejectionThreshold);
|
||||
queryMatches[i].likelihood = currBest + std::log(rejectionThreshold);
|
||||
}
|
||||
}
|
||||
matches.insert(matches.end(), queryMatches.begin(), queryMatches.end());
|
||||
@@ -595,11 +595,11 @@ void FabMapFBO::setWordStatistics(const Mat& queryImgDescriptor,
|
||||
zq = queryImgDescriptor.at<float>(0,wordIter->q) > 0;
|
||||
zpq = queryImgDescriptor.at<float>(0,pq(wordIter->q)) > 0;
|
||||
|
||||
d = log((this->*PzGL)(wordIter->q, zq, zpq, true)) -
|
||||
log((this->*PzGL)(wordIter->q, zq, zpq, false));
|
||||
d = std::log((this->*PzGL)(wordIter->q, zq, zpq, true)) -
|
||||
std::log((this->*PzGL)(wordIter->q, zq, zpq, false));
|
||||
|
||||
V += pow(d, 2.0) * 2 *
|
||||
(Pzq(wordIter->q, true) - pow(Pzq(wordIter->q, true), 2.0));
|
||||
V += std::pow(d, 2.0) * 2 *
|
||||
(Pzq(wordIter->q, true) - std::pow(Pzq(wordIter->q, true), 2.0));
|
||||
M = std::max(M, fabs(d));
|
||||
|
||||
wordIter->V = V;
|
||||
@@ -631,8 +631,8 @@ double FabMapFBO::limitbisection(double v, double m) {
|
||||
|
||||
double FabMapFBO::bennettInequality(double v, double m, double delta) {
|
||||
double DMonV = delta * m / v;
|
||||
double f_delta = log(DMonV + sqrt(pow(DMonV, 2.0) + 1));
|
||||
return exp((v / pow(m, 2.0))*(cosh(f_delta) - 1 - DMonV * f_delta));
|
||||
double f_delta = std::log(DMonV + std::sqrt(std::pow(DMonV, 2.0) + 1));
|
||||
return std::exp((v / std::pow(m, 2.0))*(cosh(f_delta) - 1 - DMonV * f_delta));
|
||||
}
|
||||
|
||||
bool FabMapFBO::compInfo(const WordStats& first, const WordStats& second) {
|
||||
@@ -647,13 +647,13 @@ FabMap(_clTree, _PzGe, _PzGNe, _flags) {
|
||||
children.resize(clTree.cols);
|
||||
|
||||
for (int q = 0; q < clTree.cols; q++) {
|
||||
d1.push_back(log((this->*PzGL)(q, false, false, true) /
|
||||
d1.push_back(std::log((this->*PzGL)(q, false, false, true) /
|
||||
(this->*PzGL)(q, false, false, false)));
|
||||
d2.push_back(log((this->*PzGL)(q, false, true, true) /
|
||||
d2.push_back(std::log((this->*PzGL)(q, false, true, true) /
|
||||
(this->*PzGL)(q, false, true, false)) - d1[q]);
|
||||
d3.push_back(log((this->*PzGL)(q, true, false, true) /
|
||||
d3.push_back(std::log((this->*PzGL)(q, true, false, true) /
|
||||
(this->*PzGL)(q, true, false, false))- d1[q]);
|
||||
d4.push_back(log((this->*PzGL)(q, true, true, true) /
|
||||
d4.push_back(std::log((this->*PzGL)(q, true, true, true) /
|
||||
(this->*PzGL)(q, true, true, false))- d1[q]);
|
||||
children[pq(q)].push_back(q);
|
||||
}
|
||||
@@ -664,7 +664,7 @@ FabMap2::~FabMap2() {
|
||||
}
|
||||
|
||||
|
||||
void FabMap2::addTraining(const vector<Mat>& queryImgDescriptors) {
|
||||
void FabMap2::addTraining(const std::vector<Mat>& queryImgDescriptors) {
|
||||
for (size_t i = 0; i < queryImgDescriptors.size(); i++) {
|
||||
CV_Assert(!queryImgDescriptors[i].empty());
|
||||
CV_Assert(queryImgDescriptors[i].rows == 1);
|
||||
@@ -676,7 +676,7 @@ void FabMap2::addTraining(const vector<Mat>& queryImgDescriptors) {
|
||||
}
|
||||
|
||||
|
||||
void FabMap2::add(const vector<Mat>& queryImgDescriptors) {
|
||||
void FabMap2::add(const std::vector<Mat>& queryImgDescriptors) {
|
||||
for (size_t i = 0; i < queryImgDescriptors.size(); i++) {
|
||||
CV_Assert(!queryImgDescriptors[i].empty());
|
||||
CV_Assert(queryImgDescriptors[i].rows == 1);
|
||||
@@ -688,15 +688,15 @@ void FabMap2::add(const vector<Mat>& queryImgDescriptors) {
|
||||
}
|
||||
|
||||
void FabMap2::getLikelihoods(const Mat& queryImgDescriptor,
|
||||
const vector<Mat>& testImageDescriptors, vector<IMatch>& matches) {
|
||||
const std::vector<Mat>& testImageDescriptors, std::vector<IMatch>& matches) {
|
||||
|
||||
if (&testImageDescriptors == &testImgDescriptors) {
|
||||
getIndexLikelihoods(queryImgDescriptor, testDefaults, testInvertedMap,
|
||||
matches);
|
||||
} else {
|
||||
CV_Assert(!(flags & MOTION_MODEL));
|
||||
vector<double> defaults;
|
||||
std::map<int, vector<int> > invertedMap;
|
||||
std::vector<double> defaults;
|
||||
std::map<int, std::vector<int> > invertedMap;
|
||||
for (size_t i = 0; i < testImageDescriptors.size(); i++) {
|
||||
addToIndex(testImageDescriptors[i],defaults,invertedMap);
|
||||
}
|
||||
@@ -708,7 +708,7 @@ double FabMap2::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
|
||||
CV_Assert(!trainingImgDescriptors.empty());
|
||||
|
||||
vector<IMatch> matches;
|
||||
std::vector<IMatch> matches;
|
||||
getIndexLikelihoods(queryImgDescriptor, trainingDefaults,
|
||||
trainingInvertedMap, matches);
|
||||
|
||||
@@ -718,13 +718,13 @@ double FabMap2::getNewPlaceLikelihood(const Mat& queryImgDescriptor) {
|
||||
logsumexp(matches[i].likelihood, averageLogLikelihood);
|
||||
}
|
||||
|
||||
return averageLogLikelihood - log((double)trainingDefaults.size());
|
||||
return averageLogLikelihood - std::log((double)trainingDefaults.size());
|
||||
|
||||
}
|
||||
|
||||
void FabMap2::addToIndex(const Mat& queryImgDescriptor,
|
||||
vector<double>& defaults,
|
||||
std::map<int, vector<int> >& invertedMap) {
|
||||
std::vector<double>& defaults,
|
||||
std::map<int, std::vector<int> >& invertedMap) {
|
||||
defaults.push_back(0);
|
||||
for (int q = 0; q < clTree.cols; q++) {
|
||||
if (queryImgDescriptor.at<float>(0,q) > 0) {
|
||||
@@ -736,10 +736,10 @@ void FabMap2::addToIndex(const Mat& queryImgDescriptor,
|
||||
|
||||
void FabMap2::getIndexLikelihoods(const Mat& queryImgDescriptor,
|
||||
std::vector<double>& defaults,
|
||||
std::map<int, vector<int> >& invertedMap,
|
||||
std::map<int, std::vector<int> >& invertedMap,
|
||||
std::vector<IMatch>& matches) {
|
||||
|
||||
vector<int>::iterator LwithI, child;
|
||||
std::vector<int>::iterator LwithI, child;
|
||||
|
||||
std::vector<double> likelihoods = defaults;
|
||||
|
||||
|
@@ -206,7 +206,7 @@ namespace cv
|
||||
{
|
||||
for (j=0;j<(int)_photoreceptorsPrefilter.getNBcolumns();++j)
|
||||
{
|
||||
float distanceToCenter=sqrt(((float)(i-halfRows)*(i-halfRows)+(j-halfColumns)*(j-halfColumns)));
|
||||
float distanceToCenter=std::sqrt(((float)(i-halfRows)*(i-halfRows)+(j-halfColumns)*(j-halfColumns)));
|
||||
if (distanceToCenter<minDistance)
|
||||
{
|
||||
float a=*(hybridParvoMagnoCoefTablePTR++)=0.5f+0.5f*(float)cos(CV_PI*distanceToCenter/minDistance);
|
||||
|
@@ -57,7 +57,7 @@
|
||||
#include "opencv2/core/internal.hpp"
|
||||
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3
|
||||
# ifdef ANDROID
|
||||
template <typename Scalar> Scalar log2(Scalar v) { using std::log; return log(v)/log(Scalar(2)); }
|
||||
template <typename Scalar> Scalar log2(Scalar v) { return std::log(v)/std::log(Scalar(2)); }
|
||||
# endif
|
||||
# if defined __GNUC__ && defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wshadow"
|
||||
@@ -172,7 +172,7 @@ static void warpImage( const Mat& image, const Mat& depth,
|
||||
{
|
||||
const Rect rect = Rect(0, 0, image.cols, image.rows);
|
||||
|
||||
vector<Point2f> points2d;
|
||||
std::vector<Point2f> points2d;
|
||||
Mat cloud, transformedCloud;
|
||||
|
||||
cvtDepth2Cloud( depth, cloud, cameraMatrix );
|
||||
@@ -310,11 +310,11 @@ static
|
||||
void buildPyramids( const Mat& image0, const Mat& image1,
|
||||
const Mat& depth0, const Mat& depth1,
|
||||
const Mat& cameraMatrix, int sobelSize, double sobelScale,
|
||||
const vector<float>& minGradMagnitudes,
|
||||
vector<Mat>& pyramidImage0, vector<Mat>& pyramidDepth0,
|
||||
vector<Mat>& pyramidImage1, vector<Mat>& pyramidDepth1,
|
||||
vector<Mat>& pyramid_dI_dx1, vector<Mat>& pyramid_dI_dy1,
|
||||
vector<Mat>& pyramidTexturedMask1, vector<Mat>& pyramidCameraMatrix )
|
||||
const std::vector<float>& minGradMagnitudes,
|
||||
std::vector<Mat>& pyramidImage0, std::vector<Mat>& pyramidDepth0,
|
||||
std::vector<Mat>& pyramidImage1, std::vector<Mat>& pyramidDepth1,
|
||||
std::vector<Mat>& pyramid_dI_dx1, std::vector<Mat>& pyramid_dI_dy1,
|
||||
std::vector<Mat>& pyramidTexturedMask1, std::vector<Mat>& pyramidCameraMatrix )
|
||||
{
|
||||
const int pyramidMaxLevel = (int)minGradMagnitudes.size() - 1;
|
||||
|
||||
@@ -535,10 +535,10 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
|
||||
minGradientMagnitudes.size() == iterCounts.size() );
|
||||
CV_Assert( initRt.empty() || (initRt.type()==CV_64FC1 && initRt.size()==Size(4,4) ) );
|
||||
|
||||
vector<int> defaultIterCounts;
|
||||
vector<float> defaultMinGradMagnitudes;
|
||||
vector<int> const* iterCountsPtr = &iterCounts;
|
||||
vector<float> const* minGradientMagnitudesPtr = &minGradientMagnitudes;
|
||||
std::vector<int> defaultIterCounts;
|
||||
std::vector<float> defaultMinGradMagnitudes;
|
||||
std::vector<int> const* iterCountsPtr = &iterCounts;
|
||||
std::vector<float> const* minGradientMagnitudesPtr = &minGradientMagnitudes;
|
||||
|
||||
if( iterCounts.empty() || minGradientMagnitudes.empty() )
|
||||
{
|
||||
@@ -560,7 +560,7 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
|
||||
|
||||
preprocessDepth( depth0, depth1, validMask0, validMask1, minDepth, maxDepth );
|
||||
|
||||
vector<Mat> pyramidImage0, pyramidDepth0,
|
||||
std::vector<Mat> pyramidImage0, pyramidDepth0,
|
||||
pyramidImage1, pyramidDepth1, pyramid_dI_dx1, pyramid_dI_dy1, pyramidTexturedMask1,
|
||||
pyramidCameraMatrix;
|
||||
buildPyramids( image0, image1, depth0, depth1, cameraMatrix, sobelSize, sobelScale, *minGradientMagnitudesPtr,
|
||||
|
@@ -145,8 +145,8 @@ void SelfSimDescriptor::SSD(const Mat& img, Point pt, Mat& ssd) const
|
||||
}
|
||||
|
||||
|
||||
void SelfSimDescriptor::compute(const Mat& img, vector<float>& descriptors, Size winStride,
|
||||
const vector<Point>& locations) const
|
||||
void SelfSimDescriptor::compute(const Mat& img, std::vector<float>& descriptors, Size winStride,
|
||||
const std::vector<Point>& locations) const
|
||||
{
|
||||
CV_Assert( img.depth() == CV_8U );
|
||||
|
||||
@@ -156,7 +156,7 @@ void SelfSimDescriptor::compute(const Mat& img, vector<float>& descriptors, Size
|
||||
int i, nwindows = locations.empty() ? gridSize.width*gridSize.height : (int)locations.size();
|
||||
int border = largeSize/2 + smallSize/2;
|
||||
int fsize = (int)getDescriptorSize();
|
||||
vector<float> tempFeature(fsize+1);
|
||||
std::vector<float> tempFeature(fsize+1);
|
||||
descriptors.resize(fsize*nwindows + 1);
|
||||
Mat ssd(largeSize, largeSize, CV_32F), mappingMask;
|
||||
computeLogPolarMapping(mappingMask);
|
||||
|
@@ -49,17 +49,9 @@
|
||||
#include <set>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
/********************************* local utility *********************************/
|
||||
|
||||
namespace cv
|
||||
{
|
||||
using std::log;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::sqrt;
|
||||
}
|
||||
namespace
|
||||
{
|
||||
const static Scalar colors[] =
|
||||
@@ -85,13 +77,20 @@ namespace
|
||||
};
|
||||
size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
|
||||
|
||||
#if (defined __cplusplus && __cplusplus > 199711L) || defined _STLPORT_MAJOR
|
||||
#else
|
||||
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
|
||||
#endif
|
||||
namespace {
|
||||
|
||||
void computeNormals( const Octree& Octree, const vector<Point3f>& centers, vector<Point3f>& normals,
|
||||
vector<uchar>& mask, float normalRadius, int minNeighbors = 20)
|
||||
template<class FwIt, class T> inline void _iota(FwIt first, FwIt last, T value)
|
||||
{
|
||||
#if (defined __cplusplus && __cplusplus > 199711L) || defined _STLPORT_MAJOR
|
||||
std::iota(first, last, value);
|
||||
#else
|
||||
while(first != last) *first++ = value++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void computeNormals( const Octree& Octree, const std::vector<Point3f>& centers, std::vector<Point3f>& normals,
|
||||
std::vector<uchar>& mask, float normalRadius, int minNeighbors = 20)
|
||||
{
|
||||
size_t normals_size = centers.size();
|
||||
normals.resize(normals_size);
|
||||
@@ -105,7 +104,7 @@ void computeNormals( const Octree& Octree, const vector<Point3f>& centers, vecto
|
||||
mask[m] = 1;
|
||||
}
|
||||
|
||||
vector<Point3f> buffer;
|
||||
std::vector<Point3f> buffer;
|
||||
buffer.reserve(128);
|
||||
SVD svd;
|
||||
|
||||
@@ -223,8 +222,8 @@ inline __m128i _mm_mullo_epi32_emul(const __m128i& a, __m128i& b)
|
||||
|
||||
#endif
|
||||
|
||||
void computeSpinImages( const Octree& Octree, const vector<Point3f>& points, const vector<Point3f>& normals,
|
||||
vector<uchar>& mask, Mat& spinImages, int imageWidth, float binSize)
|
||||
void computeSpinImages( const Octree& Octree, const std::vector<Point3f>& points, const std::vector<Point3f>& normals,
|
||||
std::vector<uchar>& mask, Mat& spinImages, int imageWidth, float binSize)
|
||||
{
|
||||
float pixelsPerMeter = 1.f / binSize;
|
||||
float support = imageWidth * binSize;
|
||||
@@ -243,12 +242,12 @@ void computeSpinImages( const Octree& Octree, const vector<Point3f>& points, con
|
||||
int nthreads = getNumThreads();
|
||||
int i;
|
||||
|
||||
vector< vector<Point3f> > pointsInSpherePool(nthreads);
|
||||
std::vector< std::vector<Point3f> > pointsInSpherePool(nthreads);
|
||||
for(i = 0; i < nthreads; i++)
|
||||
pointsInSpherePool[i].reserve(2048);
|
||||
|
||||
float halfSuppport = support / 2;
|
||||
float searchRad = support * sqrt(5.f) / 2; // sqrt(sup*sup + (sup/2) * (sup/2) )
|
||||
float searchRad = support * std::sqrt(5.f) / 2; // std::sqrt(sup*sup + (sup/2) * (sup/2) )
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for num_threads(nthreads)
|
||||
@@ -259,7 +258,7 @@ void computeSpinImages( const Octree& Octree, const vector<Point3f>& points, con
|
||||
continue;
|
||||
|
||||
int t = cvGetThreadNum();
|
||||
vector<Point3f>& pointsInSphere = pointsInSpherePool[t];
|
||||
std::vector<Point3f>& pointsInSphere = pointsInSpherePool[t];
|
||||
|
||||
const Point3f& center = points[i];
|
||||
Octree.getPointsWithinSphere(center, searchRad, pointsInSphere);
|
||||
@@ -398,7 +397,7 @@ void computeSpinImages( const Octree& Octree, const vector<Point3f>& points, con
|
||||
if (beta >= support || beta < 0)
|
||||
continue;
|
||||
|
||||
alpha = sqrt( (new_center.x - pt.x) * (new_center.x - pt.x) +
|
||||
alpha = std::sqrt( (new_center.x - pt.x) * (new_center.x - pt.x) +
|
||||
(new_center.y - pt.y) * (new_center.y - pt.y) );
|
||||
|
||||
float n1f = beta * pixelsPerMeter;
|
||||
@@ -432,7 +431,7 @@ void computeSpinImages( const Octree& Octree, const vector<Point3f>& points, con
|
||||
const Point3f cv::Mesh3D::allzero(0.f, 0.f, 0.f);
|
||||
|
||||
cv::Mesh3D::Mesh3D() { resolution = -1; }
|
||||
cv::Mesh3D::Mesh3D(const vector<Point3f>& _vtx)
|
||||
cv::Mesh3D::Mesh3D(const std::vector<Point3f>& _vtx)
|
||||
{
|
||||
resolution = -1;
|
||||
vtx.resize(_vtx.size());
|
||||
@@ -450,14 +449,14 @@ float cv::Mesh3D::estimateResolution(float /*tryRatio*/)
|
||||
const int minReasonable = 10;
|
||||
|
||||
int tryNum = static_cast<int>(tryRatio * vtx.size());
|
||||
tryNum = min(max(tryNum, minReasonable), (int)vtx.size());
|
||||
tryNum = std::min(std::max(tryNum, minReasonable), (int)vtx.size());
|
||||
|
||||
CvMat desc = cvMat((int)vtx.size(), 3, CV_32F, &vtx[0]);
|
||||
CvFeatureTree* tr = cvCreateKDTree(&desc);
|
||||
|
||||
vector<double> dist(tryNum * neighbors);
|
||||
vector<int> inds(tryNum * neighbors);
|
||||
vector<Point3f> query;
|
||||
std::vector<double> dist(tryNum * neighbors);
|
||||
std::vector<int> inds(tryNum * neighbors);
|
||||
std::vector<Point3f> query;
|
||||
|
||||
RNG& rng = theRNG();
|
||||
for(int i = 0; i < tryNum; ++i)
|
||||
@@ -476,7 +475,7 @@ float cv::Mesh3D::estimateResolution(float /*tryRatio*/)
|
||||
|
||||
dist.resize(remove(dist.begin(), dist.end(), invalid_dist) - dist.begin());
|
||||
|
||||
sort(dist, less<double>());
|
||||
sort(dist, std::less<double>());
|
||||
|
||||
return resolution = (float)dist[ dist.size() / 2 ];
|
||||
#else
|
||||
@@ -489,49 +488,49 @@ float cv::Mesh3D::estimateResolution(float /*tryRatio*/)
|
||||
void cv::Mesh3D::computeNormals(float normalRadius, int minNeighbors)
|
||||
{
|
||||
buildOctree();
|
||||
vector<uchar> mask;
|
||||
std::vector<uchar> mask;
|
||||
::computeNormals(octree, vtx, normals, mask, normalRadius, minNeighbors);
|
||||
}
|
||||
|
||||
void cv::Mesh3D::computeNormals(const vector<int>& subset, float normalRadius, int minNeighbors)
|
||||
void cv::Mesh3D::computeNormals(const std::vector<int>& subset, float normalRadius, int minNeighbors)
|
||||
{
|
||||
buildOctree();
|
||||
vector<uchar> mask(vtx.size(), 0);
|
||||
std::vector<uchar> mask(vtx.size(), 0);
|
||||
for(size_t i = 0; i < subset.size(); ++i)
|
||||
mask[subset[i]] = 1;
|
||||
::computeNormals(octree, vtx, normals, mask, normalRadius, minNeighbors);
|
||||
}
|
||||
|
||||
void cv::Mesh3D::writeAsVrml(const String& file, const vector<Scalar>& _colors) const
|
||||
void cv::Mesh3D::writeAsVrml(const std::string& file, const std::vector<Scalar>& _colors) const
|
||||
{
|
||||
ofstream ofs(file.c_str());
|
||||
std::ofstream ofs(file.c_str());
|
||||
|
||||
ofs << "#VRML V2.0 utf8" << endl;
|
||||
ofs << "Shape" << std::endl << "{" << endl;
|
||||
ofs << "geometry PointSet" << endl << "{" << endl;
|
||||
ofs << "coord Coordinate" << endl << "{" << endl;
|
||||
ofs << "point[" << endl;
|
||||
ofs << "#VRML V2.0 utf8" << std::endl;
|
||||
ofs << "Shape" << std::endl << "{" << std::endl;
|
||||
ofs << "geometry PointSet" << std::endl << "{" << std::endl;
|
||||
ofs << "coord Coordinate" << std::endl << "{" << std::endl;
|
||||
ofs << "point[" << std::endl;
|
||||
|
||||
for(size_t i = 0; i < vtx.size(); ++i)
|
||||
ofs << vtx[i].x << " " << vtx[i].y << " " << vtx[i].z << endl;
|
||||
ofs << vtx[i].x << " " << vtx[i].y << " " << vtx[i].z << std::endl;
|
||||
|
||||
ofs << "]" << endl; //point[
|
||||
ofs << "}" << endl; //Coordinate{
|
||||
ofs << "]" << std::endl; //point[
|
||||
ofs << "}" << std::endl; //Coordinate{
|
||||
|
||||
if (vtx.size() == _colors.size())
|
||||
{
|
||||
ofs << "color Color" << endl << "{" << endl;
|
||||
ofs << "color[" << endl;
|
||||
ofs << "color Color" << std::endl << "{" << std::endl;
|
||||
ofs << "color[" << std::endl;
|
||||
|
||||
for(size_t i = 0; i < _colors.size(); ++i)
|
||||
ofs << (float)_colors[i][2] << " " << (float)_colors[i][1] << " " << (float)_colors[i][0] << endl;
|
||||
ofs << (float)_colors[i][2] << " " << (float)_colors[i][1] << " " << (float)_colors[i][0] << std::endl;
|
||||
|
||||
ofs << "]" << endl; //color[
|
||||
ofs << "}" << endl; //color Color{
|
||||
ofs << "]" << std::endl; //color[
|
||||
ofs << "}" << std::endl; //color Color{
|
||||
}
|
||||
|
||||
ofs << "}" << endl; //PointSet{
|
||||
ofs << "}" << endl; //Shape{
|
||||
ofs << "}" << std::endl; //PointSet{
|
||||
ofs << "}" << std::endl; //Shape{
|
||||
}
|
||||
|
||||
|
||||
@@ -624,7 +623,7 @@ bool cv::SpinImageModel::spinCorrelation(const Mat& spin1, const Mat& spin2, flo
|
||||
if (Nsum11 == sum1sum1 || Nsum22 == sum2sum2)
|
||||
return false;
|
||||
|
||||
double corr = (Nsum12 - sum1 * sum2) / sqrt( (Nsum11 - sum1sum1) * (Nsum22 - sum2sum2) );
|
||||
double corr = (Nsum12 - sum1 * sum2) / std::sqrt( (Nsum11 - sum1sum1) * (Nsum22 - sum2sum2) );
|
||||
double atanh = Math::atanh(corr);
|
||||
result = (float)( atanh * atanh - lambda * ( 1.0 / (N - 3) ) );
|
||||
return true;
|
||||
@@ -636,13 +635,13 @@ inline Point2f cv::SpinImageModel::calcSpinMapCoo(const Point3f& p, const Point3
|
||||
float normalNorm = (float)norm(n);
|
||||
float beta = PmV.dot(n) / normalNorm;
|
||||
float pmcNorm = (float)norm(PmV);
|
||||
float alpha = sqrt( pmcNorm * pmcNorm - beta * beta);
|
||||
float alpha = std::sqrt( pmcNorm * pmcNorm - beta * beta);
|
||||
return Point2f(alpha, beta);*/
|
||||
|
||||
float pmv_x = p.x - v.x, pmv_y = p.y - v.y, pmv_z = p.z - v.z;
|
||||
|
||||
float beta = (pmv_x * n.x + pmv_y + n.y + pmv_z * n.z) / sqrt(n.x * n.x + n.y * n.y + n.z * n.z);
|
||||
float alpha = sqrt( pmv_x * pmv_x + pmv_y * pmv_y + pmv_z * pmv_z - beta * beta);
|
||||
float beta = (pmv_x * n.x + pmv_y + n.y + pmv_z * n.z) / std::sqrt(n.x * n.x + n.y * n.y + n.z * n.z);
|
||||
float alpha = std::sqrt( pmv_x * pmv_x + pmv_y * pmv_y + pmv_z * pmv_z - beta * beta);
|
||||
return Point2f(alpha, beta);
|
||||
}
|
||||
|
||||
@@ -664,7 +663,7 @@ inline float cv::SpinImageModel::geometricConsistency(const Point3f& pointScene1
|
||||
|
||||
double gc12 = 2 * norm(Sm1_to_m2 - Ss1_to_s2) / (n_Sm1_to_m2 + n_Ss1_to_s2 ) ;
|
||||
|
||||
return (float)max(gc12, gc21);
|
||||
return (float)std::max(gc12, gc21);
|
||||
}
|
||||
|
||||
inline float cv::SpinImageModel::groupingCreteria(const Point3f& pointScene1, const Point3f& normalScene1,
|
||||
@@ -682,15 +681,15 @@ inline float cv::SpinImageModel::groupingCreteria(const Point3f& pointScene1, co
|
||||
double n_Ss2_to_s1 = norm(Ss2_to_s1 = calcSpinMapCoo(pointScene2, pointScene1, normalScene1));
|
||||
|
||||
double gc21 = 2 * norm(Sm2_to_m1 - Ss2_to_s1) / (n_Sm2_to_m1 + n_Ss2_to_s1 );
|
||||
double wgc21 = gc21 / (1 - exp( -(n_Sm2_to_m1 + n_Ss2_to_s1) * gamma05_inv ) );
|
||||
double wgc21 = gc21 / (1 - std::exp( -(n_Sm2_to_m1 + n_Ss2_to_s1) * gamma05_inv ) );
|
||||
|
||||
double n_Sm1_to_m2 = norm(Sm1_to_m2 = calcSpinMapCoo(pointModel1, pointModel2, normalModel2));
|
||||
double n_Ss1_to_s2 = norm(Ss1_to_s2 = calcSpinMapCoo(pointScene1, pointScene2, normalScene2));
|
||||
|
||||
double gc12 = 2 * norm(Sm1_to_m2 - Ss1_to_s2) / (n_Sm1_to_m2 + n_Ss1_to_s2 );
|
||||
double wgc12 = gc12 / (1 - exp( -(n_Sm1_to_m2 + n_Ss1_to_s2) * gamma05_inv ) );
|
||||
double wgc12 = gc12 / (1 - std::exp( -(n_Sm1_to_m2 + n_Ss1_to_s2) * gamma05_inv ) );
|
||||
|
||||
return (float)max(wgc12, wgc21);
|
||||
return (float)std::max(wgc12, wgc21);
|
||||
}
|
||||
|
||||
|
||||
@@ -703,7 +702,7 @@ cv::SpinImageModel::SpinImageModel(const Mesh3D& _mesh) : mesh(_mesh) , out(0)
|
||||
cv::SpinImageModel::SpinImageModel() : out(0) { defaultParams(); }
|
||||
cv::SpinImageModel::~SpinImageModel() {}
|
||||
|
||||
void cv::SpinImageModel::setLogger(ostream* log) { out = log; }
|
||||
void cv::SpinImageModel::setLogger(std::ostream* log) { out = log; }
|
||||
|
||||
void cv::SpinImageModel::defaultParams()
|
||||
{
|
||||
@@ -723,14 +722,14 @@ void cv::SpinImageModel::defaultParams()
|
||||
Mat cv::SpinImageModel::packRandomScaledSpins(bool separateScale, size_t xCount, size_t yCount) const
|
||||
{
|
||||
int spinNum = (int)getSpinCount();
|
||||
int num = min(spinNum, (int)(xCount * yCount));
|
||||
int num = std::min(spinNum, (int)(xCount * yCount));
|
||||
|
||||
if (num == 0)
|
||||
return Mat();
|
||||
|
||||
RNG& rng = theRNG();
|
||||
|
||||
vector<Mat> spins;
|
||||
std::vector<Mat> spins;
|
||||
for(int i = 0; i < num; ++i)
|
||||
spins.push_back(getSpinImage( rng.next() % spinNum ).reshape(1, imageWidth));
|
||||
|
||||
@@ -750,7 +749,7 @@ Mat cv::SpinImageModel::packRandomScaledSpins(bool separateScale, size_t xCount,
|
||||
{
|
||||
double m;
|
||||
minMaxLoc(spins[i], 0, &m);
|
||||
totalMax = max(m, totalMax);
|
||||
totalMax = std::max(m, totalMax);
|
||||
}
|
||||
|
||||
for(int i = 0; i < num; ++i)
|
||||
@@ -787,7 +786,7 @@ Mat cv::SpinImageModel::packRandomScaledSpins(bool separateScale, size_t xCount,
|
||||
|
||||
void cv::SpinImageModel::selectRandomSubset(float ratio)
|
||||
{
|
||||
ratio = min(max(ratio, 0.f), 1.f);
|
||||
ratio = std::min(std::max(ratio, 0.f), 1.f);
|
||||
|
||||
size_t vtxSize = mesh.vtx.size();
|
||||
size_t setSize = static_cast<size_t>(vtxSize * ratio);
|
||||
@@ -799,14 +798,14 @@ void cv::SpinImageModel::selectRandomSubset(float ratio)
|
||||
else if (setSize == vtxSize)
|
||||
{
|
||||
subset.resize(vtxSize);
|
||||
iota(subset.begin(), subset.end(), 0);
|
||||
_iota(subset.begin(), subset.end(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RNG& rnd = theRNG();
|
||||
|
||||
vector<size_t> left(vtxSize);
|
||||
iota(left.begin(), left.end(), (size_t)0);
|
||||
std::vector<size_t> left(vtxSize);
|
||||
_iota(left.begin(), left.end(), (size_t)0);
|
||||
|
||||
subset.resize(setSize);
|
||||
for(size_t i = 0; i < setSize; ++i)
|
||||
@@ -817,20 +816,20 @@ void cv::SpinImageModel::selectRandomSubset(float ratio)
|
||||
left[pos] = left.back();
|
||||
left.resize(left.size() - 1);
|
||||
}
|
||||
sort(subset, less<int>());
|
||||
sort(subset, std::less<int>());
|
||||
}
|
||||
}
|
||||
|
||||
void cv::SpinImageModel::setSubset(const vector<int>& ss)
|
||||
void cv::SpinImageModel::setSubset(const std::vector<int>& ss)
|
||||
{
|
||||
subset = ss;
|
||||
}
|
||||
|
||||
void cv::SpinImageModel::repackSpinImages(const vector<uchar>& mask, Mat& _spinImages, bool reAlloc) const
|
||||
void cv::SpinImageModel::repackSpinImages(const std::vector<uchar>& mask, Mat& _spinImages, bool reAlloc) const
|
||||
{
|
||||
if (reAlloc)
|
||||
{
|
||||
size_t spinCount = mask.size() - count(mask.begin(), mask.end(), (uchar)0);
|
||||
size_t spinCount = mask.size() - std::count(mask.begin(), mask.end(), (uchar)0);
|
||||
Mat newImgs((int)spinCount, _spinImages.cols, _spinImages.type());
|
||||
|
||||
int pos = 0;
|
||||
@@ -846,7 +845,7 @@ void cv::SpinImageModel::repackSpinImages(const vector<uchar>& mask, Mat& _spinI
|
||||
{
|
||||
int last = (int)mask.size();
|
||||
|
||||
int dest = (int)(find(mask.begin(), mask.end(), (uchar)0) - mask.begin());
|
||||
int dest = (int)(std::find(mask.begin(), mask.end(), (uchar)0) - mask.begin());
|
||||
if (dest == last)
|
||||
return;
|
||||
|
||||
@@ -879,21 +878,21 @@ void cv::SpinImageModel::compute()
|
||||
{
|
||||
mesh.computeNormals(normalRadius, minNeighbors);
|
||||
subset.resize(mesh.vtx.size());
|
||||
iota(subset.begin(), subset.end(), 0);
|
||||
_iota(subset.begin(), subset.end(), 0);
|
||||
}
|
||||
else
|
||||
mesh.computeNormals(subset, normalRadius, minNeighbors);
|
||||
|
||||
vector<uchar> mask(mesh.vtx.size(), 0);
|
||||
std::vector<uchar> mask(mesh.vtx.size(), 0);
|
||||
for(size_t i = 0; i < subset.size(); ++i)
|
||||
if (mesh.normals[subset[i]] == Mesh3D::allzero)
|
||||
subset[i] = -1;
|
||||
else
|
||||
mask[subset[i]] = 1;
|
||||
subset.resize( remove(subset.begin(), subset.end(), -1) - subset.begin() );
|
||||
subset.resize( std::remove(subset.begin(), subset.end(), -1) - subset.begin() );
|
||||
|
||||
vector<Point3f> vtx;
|
||||
vector<Point3f> normals;
|
||||
std::vector<Point3f> vtx;
|
||||
std::vector<Point3f> normals;
|
||||
for(size_t i = 0; i < mask.size(); ++i)
|
||||
if(mask[i])
|
||||
{
|
||||
@@ -901,7 +900,7 @@ void cv::SpinImageModel::compute()
|
||||
normals.push_back(mesh.normals[i]);
|
||||
}
|
||||
|
||||
vector<uchar> spinMask(vtx.size(), 1);
|
||||
std::vector<uchar> spinMask(vtx.size(), 1);
|
||||
computeSpinImages( mesh.octree, vtx, normals, spinMask, spinImages, imageWidth, binSize);
|
||||
repackSpinImages(spinMask, spinImages);
|
||||
|
||||
@@ -909,19 +908,19 @@ void cv::SpinImageModel::compute()
|
||||
for(size_t i = 0; i < mask.size(); ++i)
|
||||
if(mask[i])
|
||||
if (spinMask[mask_pos++] == 0)
|
||||
subset.resize( remove(subset.begin(), subset.end(), (int)i) - subset.begin() );
|
||||
subset.resize( std::remove(subset.begin(), subset.end(), (int)i) - subset.begin() );
|
||||
}
|
||||
|
||||
void cv::SpinImageModel::matchSpinToModel(const Mat& spin, vector<int>& indeces, vector<float>& corrCoeffs, bool useExtremeOutliers) const
|
||||
void cv::SpinImageModel::matchSpinToModel(const Mat& spin, std::vector<int>& indeces, std::vector<float>& corrCoeffs, bool useExtremeOutliers) const
|
||||
{
|
||||
const SpinImageModel& model = *this;
|
||||
|
||||
indeces.clear();
|
||||
corrCoeffs.clear();
|
||||
|
||||
vector<float> corrs(model.spinImages.rows);
|
||||
vector<uchar> masks(model.spinImages.rows);
|
||||
vector<float> cleanCorrs;
|
||||
std::vector<float> corrs(model.spinImages.rows);
|
||||
std::vector<uchar> masks(model.spinImages.rows);
|
||||
std::vector<float> cleanCorrs;
|
||||
cleanCorrs.reserve(model.spinImages.rows);
|
||||
|
||||
for(int i = 0; i < model.spinImages.rows; ++i)
|
||||
@@ -936,7 +935,7 @@ void cv::SpinImageModel::matchSpinToModel(const Mat& spin, vector<int>& indeces,
|
||||
if(total < 5)
|
||||
return;
|
||||
|
||||
sort(cleanCorrs, less<float>());
|
||||
sort(cleanCorrs, std::less<float>());
|
||||
|
||||
float lower_fourth = cleanCorrs[(1 * total) / 4 - 1];
|
||||
float upper_fourth = cleanCorrs[(3 * total) / 4 - 0];
|
||||
@@ -971,7 +970,7 @@ struct Match
|
||||
operator float() const { return measure; }
|
||||
};
|
||||
|
||||
typedef set<size_t> group_t;
|
||||
typedef std::set<size_t> group_t;
|
||||
typedef group_t::iterator iter;
|
||||
typedef group_t::const_iterator citer;
|
||||
|
||||
@@ -986,10 +985,10 @@ struct WgcHelper
|
||||
float Wgc(const size_t corespInd, const group_t& group) const
|
||||
{
|
||||
const float* wgcLine = mat.ptr<float>((int)corespInd);
|
||||
float maximum = numeric_limits<float>::min();
|
||||
float maximum = std::numeric_limits<float>::min();
|
||||
|
||||
for(citer pos = group.begin(); pos != group.end(); ++pos)
|
||||
maximum = max(wgcLine[*pos], maximum);
|
||||
maximum = std::max(wgcLine[*pos], maximum);
|
||||
|
||||
return maximum;
|
||||
}
|
||||
@@ -999,7 +998,7 @@ private:
|
||||
|
||||
}
|
||||
|
||||
void cv::SpinImageModel::match(const SpinImageModel& scene, vector< vector<Vec2i> >& result)
|
||||
void cv::SpinImageModel::match(const SpinImageModel& scene, std::vector< std::vector<Vec2i> >& result)
|
||||
{
|
||||
if (mesh.vtx.empty())
|
||||
throw Mesh3D::EmptyMeshException();
|
||||
@@ -1007,8 +1006,8 @@ private:
|
||||
result.clear();
|
||||
|
||||
SpinImageModel& model = *this;
|
||||
const float infinity = numeric_limits<float>::infinity();
|
||||
const float float_max = numeric_limits<float>::max();
|
||||
const float infinity = std::numeric_limits<float>::infinity();
|
||||
const float float_max = std::numeric_limits<float>::max();
|
||||
|
||||
/* estimate gamma */
|
||||
if (model.gamma == 0.f)
|
||||
@@ -1021,40 +1020,40 @@ private:
|
||||
/* estimate lambda */
|
||||
if (model.lambda == 0.f)
|
||||
{
|
||||
vector<int> nonzero(model.spinImages.rows);
|
||||
std::vector<int> nonzero(model.spinImages.rows);
|
||||
for(int i = 0; i < model.spinImages.rows; ++i)
|
||||
nonzero[i] = countNonZero(model.spinImages.row(i));
|
||||
sort(nonzero, less<int>());
|
||||
sort(nonzero, std::less<int>());
|
||||
model.lambda = static_cast<float>( nonzero[ nonzero.size()/2 ] ) / 2;
|
||||
}
|
||||
|
||||
TickMeter corr_timer;
|
||||
corr_timer.start();
|
||||
vector<Match> allMatches;
|
||||
std::vector<Match> allMatches;
|
||||
for(int i = 0; i < scene.spinImages.rows; ++i)
|
||||
{
|
||||
vector<int> indeces;
|
||||
vector<float> coeffs;
|
||||
std::vector<int> indeces;
|
||||
std::vector<float> coeffs;
|
||||
matchSpinToModel(scene.spinImages.row(i), indeces, coeffs);
|
||||
for(size_t t = 0; t < indeces.size(); ++t)
|
||||
allMatches.push_back(Match(i, indeces[t], coeffs[t]));
|
||||
|
||||
if (out) if (i % 100 == 0) *out << "Comparing scene spinimage " << i << " of " << scene.spinImages.rows << endl;
|
||||
if (out) if (i % 100 == 0) *out << "Comparing scene spinimage " << i << " of " << scene.spinImages.rows << std::endl;
|
||||
}
|
||||
corr_timer.stop();
|
||||
if (out) *out << "Spin correlation time = " << corr_timer << endl;
|
||||
if (out) *out << "Matches number = " << allMatches.size() << endl;
|
||||
if (out) *out << "Spin correlation time = " << corr_timer << std::endl;
|
||||
if (out) *out << "Matches number = " << allMatches.size() << std::endl;
|
||||
|
||||
if(allMatches.empty())
|
||||
return;
|
||||
|
||||
/* filtering by similarity measure */
|
||||
const float fraction = 0.5f;
|
||||
float maxMeasure = max_element(allMatches.begin(), allMatches.end(), less<float>())->measure;
|
||||
float maxMeasure = max_element(allMatches.begin(), allMatches.end(), std::less<float>())->measure;
|
||||
allMatches.erase(
|
||||
remove_if(allMatches.begin(), allMatches.end(), bind2nd(less<float>(), maxMeasure * fraction)),
|
||||
remove_if(allMatches.begin(), allMatches.end(), bind2nd(std::less<float>(), maxMeasure * fraction)),
|
||||
allMatches.end());
|
||||
if (out) *out << "Matches number [filtered by similarity measure] = " << allMatches.size() << endl;
|
||||
if (out) *out << "Matches number [filtered by similarity measure] = " << allMatches.size() << std::endl;
|
||||
|
||||
int matchesSize = (int)allMatches.size();
|
||||
if(matchesSize == 0)
|
||||
@@ -1101,16 +1100,16 @@ private:
|
||||
allMatches[i].measure = infinity;
|
||||
}
|
||||
allMatches.erase(
|
||||
remove_if(allMatches.begin(), allMatches.end(), bind2nd(equal_to<float>(), infinity)),
|
||||
std::remove_if(allMatches.begin(), allMatches.end(), std::bind2nd(std::equal_to<float>(), infinity)),
|
||||
allMatches.end());
|
||||
if (out) *out << "Matches number [filtered by geometric consistency] = " << allMatches.size() << endl;
|
||||
if (out) *out << "Matches number [filtered by geometric consistency] = " << allMatches.size() << std::endl;
|
||||
|
||||
|
||||
matchesSize = (int)allMatches.size();
|
||||
if(matchesSize == 0)
|
||||
return;
|
||||
|
||||
if (out) *out << "grouping ..." << endl;
|
||||
if (out) *out << "grouping ..." << std::endl;
|
||||
|
||||
Mat groupingMat((int)matchesSize, (int)matchesSize, CV_32F);
|
||||
groupingMat = Scalar(0);
|
||||
@@ -1153,13 +1152,13 @@ private:
|
||||
for(int i = 0; i < matchesSize; ++i)
|
||||
allMatchesInds.insert(i);
|
||||
|
||||
vector<float> buf(matchesSize);
|
||||
std::vector<float> buf(matchesSize);
|
||||
float *buf_beg = &buf[0];
|
||||
vector<group_t> groups;
|
||||
std::vector<group_t> groups;
|
||||
|
||||
for(int g = 0; g < matchesSize; ++g)
|
||||
{
|
||||
if (out) if (g % 100 == 0) *out << "G = " << g << endl;
|
||||
if (out) if (g % 100 == 0) *out << "G = " << g << std::endl;
|
||||
|
||||
group_t left = allMatchesInds;
|
||||
group_t group;
|
||||
@@ -1174,7 +1173,7 @@ private:
|
||||
break;
|
||||
|
||||
std::transform(left.begin(), left.end(), buf_beg, WgcHelper(group, groupingMat));
|
||||
size_t minInd = min_element(buf_beg, buf_beg + left_size) - buf_beg;
|
||||
size_t minInd = std::min_element(buf_beg, buf_beg + left_size) - buf_beg;
|
||||
|
||||
if (buf[minInd] < model.T_GroupingCorespondances) /* can add corespondance to group */
|
||||
{
|
||||
@@ -1197,7 +1196,7 @@ private:
|
||||
{
|
||||
const group_t& group = groups[i];
|
||||
|
||||
vector< Vec2i > outgrp;
|
||||
std::vector< Vec2i > outgrp;
|
||||
for(citer pos = group.begin(); pos != group.end(); ++pos)
|
||||
{
|
||||
const Match& m = allMatches[*pos];
|
||||
|
@@ -144,11 +144,11 @@ void StereoVar::VariationalSolver(Mat &I1, Mat &I2, Mat &I2x, Mat &u, int level)
|
||||
|
||||
|
||||
if (flags & USE_SMART_ID) {
|
||||
double scale = pow(pyrScale, (double) level) * (1 + pyrScale);
|
||||
double scale = std::pow(pyrScale, (double) level) * (1 + pyrScale);
|
||||
N = (int) (N / scale);
|
||||
}
|
||||
|
||||
double scale = pow(pyrScale, (double) level);
|
||||
double scale = std::pow(pyrScale, (double) level);
|
||||
Fi /= (float) scale;
|
||||
l *= (float) scale;
|
||||
|
||||
@@ -284,7 +284,7 @@ void StereoVar::VCycle_MyFAS(Mat &I1, Mat &I2, Mat &I2x, Mat &_u, int level)
|
||||
|
||||
void StereoVar::FMG(Mat &I1, Mat &I2, Mat &I2x, Mat &u, int level)
|
||||
{
|
||||
double scale = pow(pyrScale, (double) level);
|
||||
double scale = std::pow(pyrScale, (double) level);
|
||||
CvSize frmSize = cvSize((int) (u.cols * scale + 0.5), (int) (u.rows * scale + 0.5));
|
||||
Mat I1_h, I2_h, I2x_h, u_h;
|
||||
|
||||
@@ -336,7 +336,7 @@ void StereoVar::autoParams()
|
||||
|
||||
if (maxD) {
|
||||
levels = 0;
|
||||
while ( pow(pyrScale, levels) * maxD > 1.5) levels ++;
|
||||
while ( std::pow(pyrScale, levels) * maxD > 1.5) levels ++;
|
||||
levels++;
|
||||
}
|
||||
|
||||
|
@@ -322,7 +322,7 @@ namespace cv
|
||||
double diff=(*(bufferPTR++)-meanValue);
|
||||
standardDeviation+=diff*diff;
|
||||
}
|
||||
return sqrt(standardDeviation/this->size());
|
||||
return std::sqrt(standardDeviation/this->size());
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -513,7 +513,7 @@ namespace cv
|
||||
stdValue+=inputMinusMean*inputMinusMean;
|
||||
}
|
||||
|
||||
stdValue=sqrt(stdValue/((type)_NBpixels));
|
||||
stdValue=std::sqrt(stdValue/((type)_NBpixels));
|
||||
// adjust luminance in regard of mean and std value;
|
||||
inputOutputBufferPTR=inputOutputBuffer;
|
||||
for (size_t index=0;index<_NBpixels;++index, ++inputOutputBufferPTR)
|
||||
|
Reference in New Issue
Block a user