mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-21 06:11:09 +08:00
Testing line_descriptor, reg, rgbd
This commit is contained in:
@@ -50,7 +50,6 @@ using namespace cv::line_descriptor;
|
|||||||
|
|
||||||
const std::string LINE_DESCRIPTOR_DIR = "line_descriptor";
|
const std::string LINE_DESCRIPTOR_DIR = "line_descriptor";
|
||||||
const std::string IMAGE_FILENAME = "cameraman.jpg";
|
const std::string IMAGE_FILENAME = "cameraman.jpg";
|
||||||
const std::string DESCRIPTORS_DIR = LINE_DESCRIPTOR_DIR + "/descriptors";
|
|
||||||
|
|
||||||
template<class Distance>
|
template<class Distance>
|
||||||
class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
||||||
@@ -120,7 +119,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
|||||||
Mat readDescriptors()
|
Mat readDescriptors()
|
||||||
{
|
{
|
||||||
Mat descriptors;
|
Mat descriptors;
|
||||||
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/descriptors/" + fs_name, FileStorage::READ );
|
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/" + fs_name, FileStorage::READ );
|
||||||
fs["descriptors"] >> descriptors;
|
fs["descriptors"] >> descriptors;
|
||||||
|
|
||||||
return descriptors;
|
return descriptors;
|
||||||
@@ -128,7 +127,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
|||||||
|
|
||||||
bool writeDescriptors( Mat& descs )
|
bool writeDescriptors( Mat& descs )
|
||||||
{
|
{
|
||||||
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/descriptors/" + fs_name, FileStorage::WRITE );
|
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/" + fs_name, FileStorage::WRITE );
|
||||||
fs << "descriptors" << descs;
|
fs << "descriptors" << descs;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -270,7 +269,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<KeyLine> keylines;
|
std::vector<KeyLine> keylines;
|
||||||
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/detectors/edl_detector_keylines_cameraman.yaml", FileStorage::READ );
|
FileStorage fs( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/edl_detector_keylines_cameraman.yaml", FileStorage::READ );
|
||||||
if( fs.isOpened() )
|
if( fs.isOpened() )
|
||||||
{
|
{
|
||||||
//read( fs.getFirstTopLevelNode(), keypoints );
|
//read( fs.getFirstTopLevelNode(), keypoints );
|
||||||
@@ -326,7 +325,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ts->printf( cvtest::TS::LOG, "Compute and write keylines.\n" );
|
ts->printf( cvtest::TS::LOG, "Compute and write keylines.\n" );
|
||||||
fs.open( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/detectors/edl_detector_keylines_cameraman.yaml", FileStorage::WRITE );
|
fs.open( std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/edl_detector_keylines_cameraman.yaml", FileStorage::WRITE );
|
||||||
if( fs.isOpened() )
|
if( fs.isOpened() )
|
||||||
{
|
{
|
||||||
bd->detect( img, keylines );
|
bd->detect( img, keylines );
|
||||||
|
@@ -50,7 +50,6 @@ using namespace cv::line_descriptor;
|
|||||||
|
|
||||||
const std::string LINE_DESCRIPTOR_DIR = "line_descriptor";
|
const std::string LINE_DESCRIPTOR_DIR = "line_descriptor";
|
||||||
const std::string IMAGE_FILENAME = "cameraman.jpg";
|
const std::string IMAGE_FILENAME = "cameraman.jpg";
|
||||||
const std::string DETECTOR_DIR = LINE_DESCRIPTOR_DIR + "/detectors";
|
|
||||||
|
|
||||||
class CV_BinaryDescriptorDetectorTest : public cvtest::BaseTest
|
class CV_BinaryDescriptorDetectorTest : public cvtest::BaseTest
|
||||||
{
|
{
|
||||||
@@ -256,7 +255,7 @@ void CV_BinaryDescriptorDetectorTest::regressionTest()
|
|||||||
{
|
{
|
||||||
assert( bd );
|
assert( bd );
|
||||||
std::string imgFilename = std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/" + IMAGE_FILENAME;
|
std::string imgFilename = std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/" + IMAGE_FILENAME;
|
||||||
std::string resFilename = std::string( ts->get_data_path() ) + DETECTOR_DIR + "/" + fs_name + ".yaml";
|
std::string resFilename = std::string( ts->get_data_path() ) + LINE_DESCRIPTOR_DIR + "/" + fs_name + ".yaml";
|
||||||
|
|
||||||
// Read the test image.
|
// Read the test image.
|
||||||
Mat image = imread( imgFilename );
|
Mat image = imread( imgFilename );
|
||||||
|
@@ -43,4 +43,4 @@
|
|||||||
|
|
||||||
#include "test_precomp.hpp"
|
#include "test_precomp.hpp"
|
||||||
|
|
||||||
CV_TEST_MAIN("reg")
|
CV_TEST_MAIN("cv")
|
||||||
|
@@ -244,7 +244,7 @@ void RegTest::testProjective()
|
|||||||
|
|
||||||
void RegTest::loadImage()
|
void RegTest::loadImage()
|
||||||
{
|
{
|
||||||
const string imageName = cvtest::TS::ptr()->get_data_path() + "home.png";
|
const string imageName = cvtest::TS::ptr()->get_data_path() + "reg/home.png";
|
||||||
|
|
||||||
img1 = imread(imageName, -1);
|
img1 = imread(imageName, -1);
|
||||||
ASSERT_TRUE(img1.data != 0);
|
ASSERT_TRUE(img1.data != 0);
|
||||||
|
@@ -173,7 +173,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
Ptr<OdometryFrame> frame_prev = Ptr<OdometryFrame>(new OdometryFrame()),
|
Ptr<OdometryFrame> frame_prev = Ptr<OdometryFrame>(new OdometryFrame()),
|
||||||
frame_curr = Ptr<OdometryFrame>(new OdometryFrame());
|
frame_curr = Ptr<OdometryFrame>(new OdometryFrame());
|
||||||
Ptr<Odometry> odometry = Odometry::create("RGBD." + string(argv[3]) + "Odometry");
|
Ptr<Odometry> odometry = Odometry::create(string(argv[3]) + "Odometry");
|
||||||
if(odometry.empty())
|
if(odometry.empty())
|
||||||
{
|
{
|
||||||
cout << "Can not create Odometry algorithm. Check the passed odometry name." << endl;
|
cout << "Can not create Odometry algorithm. Check the passed odometry name." << endl;
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
#include "test_precomp.hpp"
|
#include "test_precomp.hpp"
|
||||||
|
|
||||||
CV_TEST_MAIN("rgbd")
|
CV_TEST_MAIN("cv")
|
||||||
|
@@ -450,7 +450,7 @@ protected:
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TEST(Rgbd_Normals, compute)
|
TEST(DISABLED_Rgbd_Normals, compute)
|
||||||
{
|
{
|
||||||
cv::rgbd::CV_RgbdNormalsTest test;
|
cv::rgbd::CV_RgbdNormalsTest test;
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
|
@@ -175,8 +175,8 @@ protected:
|
|||||||
|
|
||||||
bool CV_OdometryTest::readData(Mat& image, Mat& depth) const
|
bool CV_OdometryTest::readData(Mat& image, Mat& depth) const
|
||||||
{
|
{
|
||||||
std::string imageFilename = std::string(ts->get_data_path()) + "/odometry/rgb.png";
|
std::string imageFilename = ts->get_data_path() + "rgbd/rgb.png";
|
||||||
std::string depthFilename = std::string(ts->get_data_path()) + "/odometry/depth.png";
|
std::string depthFilename = ts->get_data_path() + "rgbd/depth.png";
|
||||||
|
|
||||||
image = imread(imageFilename, 0);
|
image = imread(imageFilename, 0);
|
||||||
depth = imread(depthFilename, -1);
|
depth = imread(depthFilename, -1);
|
||||||
@@ -286,7 +286,7 @@ void CV_OdometryTest::run(int)
|
|||||||
Rodrigues(calcR, calcRvec);
|
Rodrigues(calcR, calcRvec);
|
||||||
calcRvec = calcRvec.reshape(rvec.channels(), rvec.rows);
|
calcRvec = calcRvec.reshape(rvec.channels(), rvec.rows);
|
||||||
Mat calcTvec = calcRt(Rect(3,0,1,3));
|
Mat calcTvec = calcRt(Rect(3,0,1,3));
|
||||||
|
|
||||||
#if SHOW_DEBUG_IMAGES
|
#if SHOW_DEBUG_IMAGES
|
||||||
imshow("image", image);
|
imshow("image", image);
|
||||||
imshow("warpedImage", warpedImage);
|
imshow("warpedImage", warpedImage);
|
||||||
@@ -296,7 +296,7 @@ void CV_OdometryTest::run(int)
|
|||||||
waitKey();
|
waitKey();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// compare rotation
|
// compare rotation
|
||||||
double rdiffnorm = norm(rvec - calcRvec),
|
double rdiffnorm = norm(rvec - calcRvec),
|
||||||
rnorm = norm(rvec);
|
rnorm = norm(rvec);
|
||||||
@@ -338,18 +338,18 @@ void CV_OdometryTest::run(int)
|
|||||||
|
|
||||||
TEST(RGBD_Odometry_Rgbd, algorithmic)
|
TEST(RGBD_Odometry_Rgbd, algorithmic)
|
||||||
{
|
{
|
||||||
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RGBD.RgbdOdometry"), 0.99, 0.94);
|
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdOdometry"), 0.99, 0.94);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RGBD_Odometry_ICP, algorithmic)
|
TEST(DISABLED_RGBD_Odometry_ICP, algorithmic)
|
||||||
{
|
{
|
||||||
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RGBD.ICPOdometry"), 0.99, 0.99);
|
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("ICPOdometry"), 0.99, 0.99);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RGBD_Odometry_RgbdICP, algorithmic)
|
TEST(DISABLED_RGBD_Odometry_RgbdICP, algorithmic)
|
||||||
{
|
{
|
||||||
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RGBD.RgbdICPOdometry"), 0.99, 0.99);
|
cv::rgbd::CV_OdometryTest test(cv::rgbd::Odometry::create("RgbdICPOdometry"), 0.99, 0.99);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
BIN
modules/rgbd/testdata/rgbd/odometry/depth.png
vendored
BIN
modules/rgbd/testdata/rgbd/odometry/depth.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 120 KiB |
BIN
modules/rgbd/testdata/rgbd/odometry/rgb.png
vendored
BIN
modules/rgbd/testdata/rgbd/odometry/rgb.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 511 KiB |
Reference in New Issue
Block a user