Commit 87c2b819 authored by Olexa Bilaniuk's avatar Olexa Bilaniuk

Bug fixes in mask output.

Previously, the output mask of inliers could remain completely
uninitialized. This fix is the first part of a solution.
parent b90800f0
...@@ -286,7 +286,7 @@ static bool createAndRunRHORegistrator(double confidence, ...@@ -286,7 +286,7 @@ static bool createAndRunRHORegistrator(double confidence,
OutputArray _tempMask){ OutputArray _tempMask){
Mat src = _src.getMat(); Mat src = _src.getMat();
Mat dst = _dst.getMat(); Mat dst = _dst.getMat();
Mat tempMask = _tempMask.getMat(); Mat tempMask;
bool result; bool result;
double beta = 0.35;/* 0.35 is a value that often works. */ double beta = 0.35;/* 0.35 is a value that often works. */
...@@ -294,10 +294,7 @@ static bool createAndRunRHORegistrator(double confidence, ...@@ -294,10 +294,7 @@ static bool createAndRunRHORegistrator(double confidence,
Mat tmpH = Mat(3, 3, CV_32FC1); Mat tmpH = Mat(3, 3, CV_32FC1);
/* Create output mask. */ /* Create output mask. */
if(!tempMask.data){ tempMask = Mat(npoints, 1, CV_8U);
tempMask = Mat(npoints, 1, CV_8U);
}
/** /**
* Make use of the RHO estimator API. * Make use of the RHO estimator API.
......
...@@ -512,6 +512,9 @@ static inline int sacInitRun(RHO_HEST_REFC* p){ ...@@ -512,6 +512,9 @@ static inline int sacInitRun(RHO_HEST_REFC* p){
return 0; return 0;
} }
memset(p->best.inl, 0, p->arg.N);
memset(p->curr.inl, 0, p->arg.N);
/** /**
* LevMarq workspace alloc. * LevMarq workspace alloc.
* *
...@@ -1155,6 +1158,9 @@ static inline void sacUpdateBounds(RHO_HEST_REFC* p){ ...@@ -1155,6 +1158,9 @@ static inline void sacUpdateBounds(RHO_HEST_REFC* p){
static inline void sacOutputModel(RHO_HEST_REFC* p){ static inline void sacOutputModel(RHO_HEST_REFC* p){
if(sacIsBestModelGoodEnough(p)){ if(sacIsBestModelGoodEnough(p)){
memcpy(p->arg.finalH, p->best.H, HSIZE); memcpy(p->arg.finalH, p->best.H, HSIZE);
if(p->arg.inl != p->best.inl){
memcpy(p->arg.inl, p->best.inl, p->arg.N);
}
}else{ }else{
sacOutputZeroH(p); sacOutputZeroH(p);
} }
......
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