Commit 729737dd authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 96ea9a0d d4e02869
...@@ -194,7 +194,7 @@ void CharucoBoard::_getNearestMarkerCorners() { ...@@ -194,7 +194,7 @@ void CharucoBoard::_getNearestMarkerCorners() {
double sqDistance; double sqDistance;
Point3f distVector = charucoCorner - center; Point3f distVector = charucoCorner - center;
sqDistance = distVector.x * distVector.x + distVector.y * distVector.y; sqDistance = distVector.x * distVector.x + distVector.y * distVector.y;
if(j == 0 || fabs(sqDistance - minDist) < 0.0001) { if(j == 0 || fabs(sqDistance - minDist) < cv::pow(0.01 * _squareLength, 2)) {
// if same minimum distance (or first iteration), add to nearestMarkerIdx vector // if same minimum distance (or first iteration), add to nearestMarkerIdx vector
nearestMarkerIdx[i].push_back(j); nearestMarkerIdx[i].push_back(j);
minDist = sqDistance; minDist = sqDistance;
......
...@@ -538,7 +538,48 @@ void CV_CharucoDiamondDetection::run(int) { ...@@ -538,7 +538,48 @@ void CV_CharucoDiamondDetection::run(int) {
} }
} }
/**
* @brief Check charuco board creation
*/
class CV_CharucoBoardCreation : public cvtest::BaseTest {
public:
CV_CharucoBoardCreation();
protected:
void run(int);
};
CV_CharucoBoardCreation::CV_CharucoBoardCreation() {}
void CV_CharucoBoardCreation::run(int)
{
Ptr<aruco::Dictionary> dictionary = aruco::getPredefinedDictionary(aruco::DICT_5X5_250);
int n = 6;
float markerSizeFactor = 0.5f;
for (float squareSize_mm = 5.0f; squareSize_mm < 35.0f; squareSize_mm += 0.1f)
{
Ptr<aruco::CharucoBoard> board_meters = aruco::CharucoBoard::create(
n, n, squareSize_mm*1e-3f, squareSize_mm * markerSizeFactor * 1e-3f, dictionary);
Ptr<aruco::CharucoBoard> board_millimeters = aruco::CharucoBoard::create(
n, n, squareSize_mm, squareSize_mm * markerSizeFactor, dictionary);
for (size_t i = 0; i < board_meters->nearestMarkerIdx.size(); i++)
{
if (board_meters->nearestMarkerIdx[i].size() != board_millimeters->nearestMarkerIdx[i].size() ||
board_meters->nearestMarkerIdx[i][0] != board_millimeters->nearestMarkerIdx[i][0])
{
ts->printf(cvtest::TS::LOG,
cv::format("Charuco board topology is sensitive to scale with squareSize=%.1f\n",
squareSize_mm).c_str());
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
break;
}
}
}
}
TEST(CV_CharucoDetection, accuracy) { TEST(CV_CharucoDetection, accuracy) {
...@@ -546,7 +587,6 @@ TEST(CV_CharucoDetection, accuracy) { ...@@ -546,7 +587,6 @@ TEST(CV_CharucoDetection, accuracy) {
test.safe_run(); test.safe_run();
} }
TEST(CV_CharucoPoseEstimation, accuracy) { TEST(CV_CharucoPoseEstimation, accuracy) {
CV_CharucoPoseEstimation test; CV_CharucoPoseEstimation test;
test.safe_run(); test.safe_run();
...@@ -557,4 +597,9 @@ TEST(CV_CharucoDiamondDetection, accuracy) { ...@@ -557,4 +597,9 @@ TEST(CV_CharucoDiamondDetection, accuracy) {
test.safe_run(); test.safe_run();
} }
TEST(CV_CharucoBoardCreation, accuracy) {
CV_CharucoBoardCreation test;
test.safe_run();
}
}} // namespace }} // namespace
...@@ -62,6 +62,16 @@ public: ...@@ -62,6 +62,16 @@ public:
/// @overload /// @overload
CV_WRAP_AS(setBackgroundColor) virtual void setBackground(const Scalar& color) = 0; CV_WRAP_AS(setBackgroundColor) virtual void setBackground(const Scalar& color) = 0;
/**
* enable an ordered chain of full-screen post processing effects
*
* this way you can add distortion or SSAO effects.
* The effects themselves must be defined inside Ogre .compositor scripts.
* @see addResourceLocation
* @param names compositor names that will be applied in order of appearance
*/
CV_WRAP virtual void setCompositors(const std::vector<String>& names) = 0;
/** /**
* place an entity of an mesh in the scene * place an entity of an mesh in the scene
* *
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <OgreApplicationContext.h> #include <OgreApplicationContext.h>
#include <OgreCameraMan.h> #include <OgreCameraMan.h>
#include <OgreRectangle2D.h> #include <OgreRectangle2D.h>
#include <OgreCompositorManager.h>
#include <opencv2/calib3d.hpp> #include <opencv2/calib3d.hpp>
...@@ -339,6 +340,23 @@ public: ...@@ -339,6 +340,23 @@ public:
bgplane->setVisible(true); bgplane->setVisible(true);
} }
void setCompositors(const std::vector<String>& names)
{
Viewport* vp = frameSrc->getViewport(0);
CompositorManager& cm = CompositorManager::getSingleton();
cm.removeCompositorChain(vp); // remove previous configuration
for(size_t i = 0; i < names.size(); i++)
{
if (!cm.addCompositor(vp, names[i])) {
LogManager::getSingleton().logError("Failed to add compositor: " + names[i]);
continue;
}
cm.setCompositorEnabled(vp, names[i], true);
}
}
void setBackground(const Scalar& color) void setBackground(const Scalar& color)
{ {
// hide background plane // hide background plane
......
...@@ -135,6 +135,7 @@ HorizontalIIRFilter(Mat &img, Mat &dst, const Range &r, double alphaDerive) ...@@ -135,6 +135,7 @@ HorizontalIIRFilter(Mat &img, Mat &dst, const Range &r, double alphaDerive)
j = cols - 1; j = cols - 1;
g2[j] = (a3 + a4)* *c1; g2[j] = (a3 + a4)* *c1;
j--; j--;
c1--;
g2[j] = (a3 + a4) * c1[1] + b1 * g2[j + 1]; g2[j] = (a3 + a4) * c1[1] + b1 * g2[j + 1];
j--; j--;
c1--; c1--;
...@@ -160,16 +161,18 @@ public: ...@@ -160,16 +161,18 @@ public:
dst(d), dst(d),
alphaDerive(ald), alphaDerive(ald),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientDericheYCols");
type = dst.depth();
CV_CheckType(type, type==CV_32FC1, "Wrong output type for GradientDericheYCols");
}
void Verbose(bool b) { verbose = b; } void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_8SC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl; std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
switch (img.depth()) { switch (img.depth()) {
case CV_8U: case CV_8U:
VerticalIIRFilter<uchar>(img,dst,range, alphaDerive); VerticalIIRFilter<uchar>(img,dst,range, alphaDerive);
...@@ -183,6 +186,9 @@ public: ...@@ -183,6 +186,9 @@ public:
case CV_16S: case CV_16S:
VerticalIIRFilter<short>(img, dst, range, alphaDerive); VerticalIIRFilter<short>(img, dst, range, alphaDerive);
break; break;
case CV_32F:
VerticalIIRFilter<float>(img, dst, range, alphaDerive);
break;
default: default:
return; return;
} }
...@@ -207,12 +213,15 @@ public: ...@@ -207,12 +213,15 @@ public:
dst(d), dst(d),
alphaMoyenne(alm), alphaMoyenne(alm),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientDericheYRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheYRows");
}
void Verbose(bool b) { verbose = b; } void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_32FC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl; std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *f1, *f2; float *f1, *f2;
...@@ -280,12 +289,15 @@ public: ...@@ -280,12 +289,15 @@ public:
dst(d), dst(d),
alphaMoyenne(alm), alphaMoyenne(alm),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientDericheXCols");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheXCols");
}
void Verbose(bool b) { verbose = b; } void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_32FC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl; std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *f1, *f2; float *f1, *f2;
...@@ -355,12 +367,15 @@ public: ...@@ -355,12 +367,15 @@ public:
dst(d), dst(d),
alphaDerive(ald), alphaDerive(ald),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientDericheXRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientDericheXRows");
}
void Verbose(bool b) { verbose = b; } void Verbose(bool b) { verbose = b; }
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_8SC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl; std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
...@@ -377,6 +392,9 @@ public: ...@@ -377,6 +392,9 @@ public:
case CV_16S: case CV_16S:
HorizontalIIRFilter<short>(img, dst, range, alphaDerive); HorizontalIIRFilter<short>(img, dst, range, alphaDerive);
break; break;
case CV_32F:
HorizontalIIRFilter<float>(img, dst, range, alphaDerive);
break;
default: default:
return; return;
} }
......
...@@ -143,12 +143,15 @@ public: ...@@ -143,12 +143,15 @@ public:
a(aa), a(aa),
w(ww), w(ww),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientPaillouY");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouYCols");
}
void Verbose(bool b){verbose=b;} void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_8UC1 || img.depth()==CV_16SC1 || img.depth()==CV_16UC1);
CV_Assert(dst.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl; std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl;
...@@ -162,9 +165,12 @@ public: ...@@ -162,9 +165,12 @@ public:
case CV_16S : case CV_16S :
VerticalIIRFilter<short>(img, dst, range, a, w); VerticalIIRFilter<short>(img, dst, range, a, w);
break; break;
case CV_16U : case CV_16U:
VerticalIIRFilter<short>(img, dst, range, a, w); VerticalIIRFilter<short>(img, dst, range, a, w);
break; break;
case CV_32F:
VerticalIIRFilter<float>(img, dst, range, a, w);
break;
default : default :
return ; return ;
} }
...@@ -191,11 +197,15 @@ public: ...@@ -191,11 +197,15 @@ public:
a(aa), a(aa),
w(ww), w(ww),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientPaillouYRows");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouYRows");
}
void Verbose(bool b){verbose=b;} void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl; std::cout << getThreadNum()<<"# :Start from row " << range.start << " to " << range.end-1<<" ("<<range.end-range.start<<" loops)" << std::endl;
float *iy,*iy0; float *iy,*iy0;
...@@ -261,11 +271,15 @@ public: ...@@ -261,11 +271,15 @@ public:
a(aa), a(aa),
w(ww), w(ww),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong input type for GradientPaillouXCols");
type = dst.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouXCols");
}
void Verbose(bool b){verbose=b;} void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
CV_Assert(img.depth()==CV_32FC1);
if (verbose) if (verbose)
std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl; std::cout << getThreadNum() << "# :Start from row " << range.start << " to " << range.end - 1 << " (" << range.end - range.start << " loops)" << std::endl;
float *iy, *iy0; float *iy, *iy0;
...@@ -331,7 +345,12 @@ public: ...@@ -331,7 +345,12 @@ public:
a(aa), a(aa),
w(ww), w(ww),
verbose(false) verbose(false)
{} {
int type = img.depth();
CV_CheckType(type, type == CV_8UC1 || type == CV_8SC1 || type == CV_16SC1 || type == CV_16UC1 || type == CV_32FC1, "Wrong input type for GradientPaillouXRows");
type = im1.depth();
CV_CheckType(type, type == CV_32FC1, "Wrong output type for GradientPaillouXRows");
}
void Verbose(bool b){verbose=b;} void Verbose(bool b){verbose=b;}
virtual void operator()(const Range& range) const CV_OVERRIDE virtual void operator()(const Range& range) const CV_OVERRIDE
{ {
...@@ -349,9 +368,12 @@ public: ...@@ -349,9 +368,12 @@ public:
case CV_16S : case CV_16S :
HorizontalIIRFilter<short>(img, im1, range, a, w); HorizontalIIRFilter<short>(img, im1, range, a, w);
break; break;
case CV_16U : case CV_16U:
HorizontalIIRFilter<ushort>(img, im1, range, a, w); HorizontalIIRFilter<ushort>(img, im1, range, a, w);
break; break;
case CV_32F:
HorizontalIIRFilter<float>(img, im1, range, a, w);
break;
default : default :
return ; return ;
} }
......
...@@ -231,7 +231,7 @@ if __name__ == '__main__': ...@@ -231,7 +231,7 @@ if __name__ == '__main__':
state = load_json(args.state) state = load_json(args.state)
algorithm_list = parse_sequence(args.algorithms) algorithm_list = parse_sequence(args.algorithms)
img_range = map(int, parse_sequence(args.range)) img_range = list(map(int, parse_sequence(args.range)))
if len(img_range)!=2: if len(img_range)!=2:
print("Error: Please specify the -r parameter in form <first_image_index>,<last_image_index>") print("Error: Please specify the -r parameter in form <first_image_index>,<last_image_index>")
sys.exit(1) sys.exit(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