External interface converted to use OpenCV Ptr<> smart pointer.
This commit is contained in:
parent
f592321771
commit
408f93340a
@ -303,7 +303,7 @@ static bool createAndRunRHORegistrator(double confidence,
|
|||||||
* initialized, used, then finalized.
|
* initialized, used, then finalized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RHO_HEST_REFC* p = rhoRefCInit();
|
Ptr<RHO_HEST_REFC> p = rhoRefCInit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional. Ideally, the context would survive across calls to
|
* Optional. Ideally, the context would survive across calls to
|
||||||
@ -339,12 +339,6 @@ static bool createAndRunRHORegistrator(double confidence,
|
|||||||
NULL,
|
NULL,
|
||||||
(float*)tmpH.data);
|
(float*)tmpH.data);
|
||||||
|
|
||||||
/**
|
|
||||||
* Cleanup.
|
|
||||||
*/
|
|
||||||
|
|
||||||
rhoRefCFini(p);
|
|
||||||
|
|
||||||
/* Convert float homography to double precision. */
|
/* Convert float homography to double precision. */
|
||||||
tmpH.convertTo(_H, CV_64FC1);
|
tmpH.convertTo(_H, CV_64FC1);
|
||||||
|
|
||||||
|
@ -298,12 +298,13 @@ static inline void sacSub8x1 (float* Hout,
|
|||||||
* @return A pointer to the context if successful; NULL if an error occured.
|
* @return A pointer to the context if successful; NULL if an error occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RHO_HEST_REFC* rhoRefCInit(void){
|
Ptr<RHO_HEST_REFC> rhoRefCInit(void){
|
||||||
RHO_HEST_REFC* p = new RHO_HEST_REFC;
|
Ptr<RHO_HEST_REFC> p = Ptr<RHO_HEST_REFC>(new RHO_HEST_REFC);
|
||||||
|
|
||||||
if(!p->initialize()){
|
if(p){
|
||||||
delete p;
|
if(!p->initialize()){
|
||||||
p = NULL;
|
p = Ptr<RHO_HEST_REFC>((RHO_HEST_REFC*)NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -314,7 +315,7 @@ RHO_HEST_REFC* rhoRefCInit(void){
|
|||||||
* External access to non-randomness table resize.
|
* External access to non-randomness table resize.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rhoRefCEnsureCapacity(RHO_HEST_REFC* p, unsigned N, double beta){
|
int rhoRefCEnsureCapacity(Ptr<RHO_HEST_REFC> p, unsigned N, double beta){
|
||||||
return p->sacEnsureCapacity(N, beta);
|
return p->sacEnsureCapacity(N, beta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,22 +324,11 @@ int rhoRefCEnsureCapacity(RHO_HEST_REFC* p, unsigned N, double beta){
|
|||||||
* Seeds the internal PRNG with the given seed.
|
* Seeds the internal PRNG with the given seed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void rhoRefCSeed(RHO_HEST_REFC* p, unsigned long long seed){
|
void rhoRefCSeed(Ptr<RHO_HEST_REFC> p, unsigned long long seed){
|
||||||
p->fastSeed((uint64_t)seed);
|
p->fastSeed((uint64_t)seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* External access to context destructor.
|
|
||||||
*
|
|
||||||
* @param [in] p The initialized estimator context to finalize.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void rhoRefCFini(RHO_HEST_REFC* p){
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimates the homography using the given context, matches and parameters to
|
* Estimates the homography using the given context, matches and parameters to
|
||||||
* PROSAC.
|
* PROSAC.
|
||||||
@ -368,20 +358,20 @@ void rhoRefCFini(RHO_HEST_REFC* p){
|
|||||||
* inliers for acceptance was reached; 0 otherwise.
|
* inliers for acceptance was reached; 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned rhoRefC(RHO_HEST_REFC* p, /* Homography estimation context. */
|
unsigned rhoRefC(Ptr<RHO_HEST_REFC> p, /* Homography estimation context. */
|
||||||
const float* src, /* Source points */
|
const float* src, /* Source points */
|
||||||
const float* dst, /* Destination points */
|
const float* dst, /* Destination points */
|
||||||
char* inl, /* Inlier mask */
|
char* inl, /* Inlier mask */
|
||||||
unsigned N, /* = src.length = dst.length = inl.length */
|
unsigned N, /* = src.length = dst.length = inl.length */
|
||||||
float maxD, /* Works: 3.0 */
|
float maxD, /* Works: 3.0 */
|
||||||
unsigned maxI, /* Works: 2000 */
|
unsigned maxI, /* Works: 2000 */
|
||||||
unsigned rConvg, /* Works: 2000 */
|
unsigned rConvg, /* Works: 2000 */
|
||||||
double cfd, /* Works: 0.995 */
|
double cfd, /* Works: 0.995 */
|
||||||
unsigned minInl, /* Minimum: 4 */
|
unsigned minInl, /* Minimum: 4 */
|
||||||
double beta, /* Works: 0.35 */
|
double beta, /* Works: 0.35 */
|
||||||
unsigned flags, /* Works: 0 */
|
unsigned flags, /* Works: 0 */
|
||||||
const float* guessH, /* Extrinsic guess, NULL if none provided */
|
const float* guessH, /* Extrinsic guess, NULL if none provided */
|
||||||
float* finalH){ /* Final result. */
|
float* finalH){ /* Final result. */
|
||||||
return p->rhoRefC(src, dst, inl, N, maxD, maxI, rConvg, cfd, minInl, beta,
|
return p->rhoRefC(src, dst, inl, N, maxD, maxI, rConvg, cfd, minInl, beta,
|
||||||
flags, guessH, finalH);
|
flags, guessH, finalH);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Includes */
|
/* Includes */
|
||||||
|
#include <opencv2/core.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ typedef struct RHO_HEST_REFC RHO_HEST_REFC;
|
|||||||
* @return A pointer to the context if successful; NULL if an error occured.
|
* @return A pointer to the context if successful; NULL if an error occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RHO_HEST_REFC* rhoRefCInit(void);
|
Ptr<RHO_HEST_REFC> rhoRefCInit(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +115,7 @@ RHO_HEST_REFC* rhoRefCInit(void);
|
|||||||
* @return 0 if successful; non-zero if an error occured.
|
* @return 0 if successful; non-zero if an error occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rhoRefCEnsureCapacity(RHO_HEST_REFC* p, unsigned N, double beta);
|
int rhoRefCEnsureCapacity(Ptr<RHO_HEST_REFC> p, unsigned N, double beta);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -129,18 +130,7 @@ int rhoRefCEnsureCapacity(RHO_HEST_REFC* p, unsigned N, double beta);
|
|||||||
* @param [in] seed The 64-bit integer seed.
|
* @param [in] seed The 64-bit integer seed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void rhoRefCSeed(RHO_HEST_REFC* p, unsigned long long seed);
|
void rhoRefCSeed(Ptr<RHO_HEST_REFC> p, unsigned long long seed);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finalize the estimator context, by freeing the aligned buffers used
|
|
||||||
* internally.
|
|
||||||
*
|
|
||||||
* @param [in] p The initialized estimator context to finalize.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void rhoRefCFini(RHO_HEST_REFC* p);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,20 +240,20 @@ void rhoRefCFini(RHO_HEST_REFC* p);
|
|||||||
* inliers for acceptance was reached; 0 otherwise.
|
* inliers for acceptance was reached; 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned rhoRefC(RHO_HEST_REFC* p, /* Homography estimation context. */
|
unsigned rhoRefC(Ptr<RHO_HEST_REFC> p, /* Homography estimation context. */
|
||||||
const float* src, /* Source points */
|
const float* src, /* Source points */
|
||||||
const float* dst, /* Destination points */
|
const float* dst, /* Destination points */
|
||||||
char* inl, /* Inlier mask */
|
char* inl, /* Inlier mask */
|
||||||
unsigned N, /* = src.length = dst.length = inl.length */
|
unsigned N, /* = src.length = dst.length = inl.length */
|
||||||
float maxD, /* 3.0 */
|
float maxD, /* 3.0 */
|
||||||
unsigned maxI, /* 2000 */
|
unsigned maxI, /* 2000 */
|
||||||
unsigned rConvg, /* 2000 */
|
unsigned rConvg, /* 2000 */
|
||||||
double cfd, /* 0.995 */
|
double cfd, /* 0.995 */
|
||||||
unsigned minInl, /* 4 */
|
unsigned minInl, /* 4 */
|
||||||
double beta, /* 0.35 */
|
double beta, /* 0.35 */
|
||||||
unsigned flags, /* 0 */
|
unsigned flags, /* 0 */
|
||||||
const float* guessH, /* Extrinsic guess, NULL if none provided */
|
const float* guessH, /* Extrinsic guess, NULL if none provided */
|
||||||
float* finalH); /* Final result. */
|
float* finalH); /* Final result. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user