1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Several type of formal refactoring:

1. someMatrix.data -> someMatrix.prt()
2. someMatrix.data + someMatrix.step * lineIndex -> someMatrix.ptr( lineIndex )
3. (SomeType*) someMatrix.data -> someMatrix.ptr<SomeType>()
4. someMatrix.data -> !someMatrix.empty() ( or !someMatrix.data -> someMatrix.empty() ) in logical expressions
This commit is contained in:
Adil Ibragimov
2014-08-13 15:08:27 +04:00
parent 30111a786a
commit 8a4a1bb018
134 changed files with 988 additions and 986 deletions
+8 -8
View File
@@ -1150,19 +1150,19 @@ public:
size_t esz = weights[0].elemSize();
fs << "input_scale" << "[";
fs.writeRaw("d", weights[0].data, weights[0].total()*esz);
fs.writeRaw("d", weights[0].ptr(), weights[0].total()*esz);
fs << "]" << "output_scale" << "[";
fs.writeRaw("d", weights[l_count].data, weights[l_count].total()*esz);
fs.writeRaw("d", weights[l_count].ptr(), weights[l_count].total()*esz);
fs << "]" << "inv_output_scale" << "[";
fs.writeRaw("d", weights[l_count+1].data, weights[l_count+1].total()*esz);
fs.writeRaw("d", weights[l_count+1].ptr(), weights[l_count+1].total()*esz);
fs << "]" << "weights" << "[";
for( i = 1; i < l_count; i++ )
{
fs << "[";
fs.writeRaw("d", weights[i].data, weights[i].total()*esz);
fs.writeRaw("d", weights[i].ptr(), weights[i].total()*esz);
fs << "]";
}
fs << "]";
@@ -1250,18 +1250,18 @@ public:
size_t esz = weights[0].elemSize();
FileNode w = fn["input_scale"];
w.readRaw("d", weights[0].data, weights[0].total()*esz);
w.readRaw("d", weights[0].ptr(), weights[0].total()*esz);
w = fn["output_scale"];
w.readRaw("d", weights[l_count].data, weights[l_count].total()*esz);
w.readRaw("d", weights[l_count].ptr(), weights[l_count].total()*esz);
w = fn["inv_output_scale"];
w.readRaw("d", weights[l_count+1].data, weights[l_count+1].total()*esz);
w.readRaw("d", weights[l_count+1].ptr(), weights[l_count+1].total()*esz);
FileNodeIterator w_it = fn["weights"].begin();
for( i = 1; i < l_count; i++, ++w_it )
(*w_it).readRaw("d", weights[i].data, weights[i].total()*esz);
(*w_it).readRaw("d", weights[i].ptr(), weights[i].total()*esz);
trained = true;
}
+1 -1
View File
@@ -762,7 +762,7 @@ public:
else
{
Mat mask(1, nsamples, CV_8U);
uchar* mptr = mask.data;
uchar* mptr = mask.ptr();
for( i = 0; i < nsamples; i++ )
mptr[i] = (uchar)(i < count);
trainSampleIdx.create(1, count, CV_32S);
+1 -1
View File
@@ -97,7 +97,7 @@ float StatModel::calcError( const Ptr<TrainData>& data, bool testerr, OutputArra
err += fabs(val - val0) > FLT_EPSILON;
else
err += (val - val0)*(val - val0);
if( resp.data )
if( !resp.empty() )
resp.at<float>(i) = val;
/*if( i < 100 )
{
+1 -1
View File
@@ -205,7 +205,7 @@ public:
vidx = &_vidx;
cls_labels = &_cls_labels;
results = &_results;
results_prob = _results_prob.data ? &_results_prob : 0;
results_prob = !_results_prob.empty() ? &_results_prob : 0;
rawOutput = _rawOutput;
}