Commit b05edca6 authored by Pavel Rojtberg's avatar Pavel Rojtberg Committed by Pavel Rojtberg

aruco: use references instead of pointers in IdentifyCandidatesParallel

parent dfc6bc5e
...@@ -529,9 +529,9 @@ static bool _identifyOneCandidate(Ptr<Dictionary> &dictionary, InputArray _image ...@@ -529,9 +529,9 @@ static bool _identifyOneCandidate(Ptr<Dictionary> &dictionary, InputArray _image
*/ */
class IdentifyCandidatesParallel : public ParallelLoopBody { class IdentifyCandidatesParallel : public ParallelLoopBody {
public: public:
IdentifyCandidatesParallel(const Mat *_grey, InputArrayOfArrays _candidates, IdentifyCandidatesParallel(const Mat& _grey, InputArrayOfArrays _candidates,
InputArrayOfArrays _contours, Ptr<Dictionary> &_dictionary, InputArrayOfArrays _contours, Ptr<Dictionary> &_dictionary,
vector< int > *_idsTmp, vector< char > *_validCandidates, vector< int >& _idsTmp, vector< char >& _validCandidates,
const Ptr<DetectorParameters> &_params) const Ptr<DetectorParameters> &_params)
: grey(_grey), candidates(_candidates), contours(_contours), dictionary(_dictionary), : grey(_grey), candidates(_candidates), contours(_contours), dictionary(_dictionary),
idsTmp(_idsTmp), validCandidates(_validCandidates), params(_params) {} idsTmp(_idsTmp), validCandidates(_validCandidates), params(_params) {}
...@@ -543,9 +543,9 @@ class IdentifyCandidatesParallel : public ParallelLoopBody { ...@@ -543,9 +543,9 @@ class IdentifyCandidatesParallel : public ParallelLoopBody {
for(int i = begin; i < end; i++) { for(int i = begin; i < end; i++) {
int currId; int currId;
Mat currentCandidate = candidates.getMat(i); Mat currentCandidate = candidates.getMat(i);
if(_identifyOneCandidate(dictionary, *grey, currentCandidate, currId, params)) { if(_identifyOneCandidate(dictionary, grey, currentCandidate, currId, params)) {
(*validCandidates)[i] = 1; validCandidates[i] = 1;
(*idsTmp)[i] = currId; idsTmp[i] = currId;
} }
} }
} }
...@@ -553,11 +553,11 @@ class IdentifyCandidatesParallel : public ParallelLoopBody { ...@@ -553,11 +553,11 @@ class IdentifyCandidatesParallel : public ParallelLoopBody {
private: private:
IdentifyCandidatesParallel &operator=(const IdentifyCandidatesParallel &); // to quiet MSVC IdentifyCandidatesParallel &operator=(const IdentifyCandidatesParallel &); // to quiet MSVC
const Mat *grey; const Mat &grey;
InputArrayOfArrays candidates, contours; InputArrayOfArrays candidates, contours;
Ptr<Dictionary> &dictionary; Ptr<Dictionary> &dictionary;
vector< int > *idsTmp; vector< int > &idsTmp;
vector< char > *validCandidates; vector< char > &validCandidates;
const Ptr<DetectorParameters> &params; const Ptr<DetectorParameters> &params;
}; };
...@@ -632,8 +632,8 @@ static void _identifyCandidates(InputArray _image, vector< vector< Point2f > >& ...@@ -632,8 +632,8 @@ static void _identifyCandidates(InputArray _image, vector< vector< Point2f > >&
// this is the parallel call for the previous commented loop (result is equivalent) // this is the parallel call for the previous commented loop (result is equivalent)
parallel_for_(Range(0, ncandidates), parallel_for_(Range(0, ncandidates),
IdentifyCandidatesParallel(&grey, _candidates, _contours, _dictionary, &idsTmp, IdentifyCandidatesParallel(grey, _candidates, _contours, _dictionary, idsTmp,
&validCandidates, params)); validCandidates, params));
for(int i = 0; i < ncandidates; i++) { for(int i = 0; i < ncandidates; i++) {
if(validCandidates[i] == 1) { if(validCandidates[i] == 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment