1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge remote-tracking branch 'origin/2.4' into merge-2.4

Conflicts:
	modules/imgproc/src/opencl/precornerdetect.cl
	modules/nonfree/perf/perf_main.cpp
	modules/nonfree/perf/perf_surf.ocl.cpp
	modules/ocl/src/arithm.cpp
	modules/ocl/src/gftt.cpp
	modules/ocl/src/opencl/arithm_bitwise.cl
	modules/ocl/src/opencl/arithm_bitwise_binary_scalar_mask.cl
	modules/ocl/src/opencl/arithm_minMax.cl
	modules/ocl/src/opencl/arithm_nonzero.cl
	modules/ocl/src/opencl/arithm_sum.cl
	modules/ocl/test/test_arithm.cpp
	modules/viz/src/precomp.hpp
	modules/viz/src/vizcore.cpp
	modules/viz/src/vtk/vtkCloudMatSink.h
	modules/viz/src/vtk/vtkXYZReader.cpp
	modules/viz/src/vtk/vtkXYZReader.h
	modules/viz/test/test_precomp.hpp
This commit is contained in:
Roman Donchenko
2014-03-17 14:14:07 +04:00
34 changed files with 2130 additions and 869 deletions
+42 -12
View File
@@ -52,6 +52,7 @@ TEST(Viz, show_cloud_bluberry)
Affine3d pose = Affine3d().rotate(Vec3d(0, 0.8, 0));
Viz3d viz("show_cloud_bluberry");
viz.setBackgroundColor(Color::black());
viz.showWidget("coosys", WCoordinateSystem());
viz.showWidget("dragon", WCloud(dragon_cloud, Color::bluberry()), pose);
@@ -81,7 +82,7 @@ TEST(Viz, show_cloud_masked)
Mat dragon_cloud = readCloud(get_dragon_ply_file_path());
Vec3f qnan = Vec3f::all(std::numeric_limits<float>::quiet_NaN());
for(size_t i = 0; i < dragon_cloud.total(); ++i)
for(int i = 0; i < (int)dragon_cloud.total(); ++i)
if (i % 15 != 0)
dragon_cloud.at<Vec3f>(i) = qnan;
@@ -102,6 +103,7 @@ TEST(Viz, show_cloud_collection)
ccol.addCloud(cloud, Color::white(), Affine3d().translate(Vec3d(0, 0, 0)).rotate(Vec3d(CV_PI/2, 0, 0)));
ccol.addCloud(cloud, Color::blue(), Affine3d().translate(Vec3d(1, 0, 0)));
ccol.addCloud(cloud, Color::red(), Affine3d().translate(Vec3d(2, 0, 0)));
ccol.finalize();
Viz3d viz("show_cloud_collection");
viz.setBackgroundColor(Color::mlab());
@@ -154,6 +156,27 @@ TEST(Viz, show_mesh_random_colors)
viz.spin();
}
TEST(Viz, show_widget_merger)
{
WWidgetMerger merger;
merger.addWidget(WCube(Vec3d::all(0.0), Vec3d::all(1.0), true, Color::gold()));
RNG& rng = theRNG();
for(int i = 0; i < 77; ++i)
{
Vec3b c;
rng.fill(c, RNG::NORMAL, Scalar::all(128), Scalar::all(48), true);
merger.addWidget(WSphere(Vec3d(c)*(1.0/255.0), 7.0/255.0, 10, Color(c[2], c[1], c[0])));
}
merger.finalize();
Viz3d viz("show_mesh_random_color");
viz.showWidget("coo", WCoordinateSystem());
viz.showWidget("merger", merger);
viz.showWidget("text2d", WText("Widget merger", Point(20, 20), 20, Color::green()));
viz.spin();
}
TEST(Viz, show_textured_mesh)
{
Mat lena = imread(Path::combine(cvtest::TS::ptr()->get_data_path(), "lena.png"));
@@ -170,7 +193,7 @@ TEST(Viz, show_textured_mesh)
tcoords.push_back(Vec2d(1.0, i/64.0));
}
for(size_t i = 0; i < points.size()/2-1; ++i)
for(int i = 0; i < (int)points.size()/2-1; ++i)
{
int polys[] = {3, 2*i, 2*i+1, 2*i+2, 3, 2*i+1, 2*i+2, 2*i+3};
polygons.insert(polygons.end(), polys, polys + sizeof(polys)/sizeof(polys[0]));
@@ -193,12 +216,18 @@ TEST(Viz, show_textured_mesh)
TEST(Viz, show_polyline)
{
Mat polyline(1, 32, CV_64FC3);
for(size_t i = 0; i < polyline.total(); ++i)
const Color palette[] = { Color::red(), Color::green(), Color::blue(), Color::gold(), Color::raspberry(), Color::bluberry(), Color::lime() };
size_t palette_size = sizeof(palette)/sizeof(palette[0]);
Mat polyline(1, 32, CV_64FC3), colors(1, 32, CV_8UC3);
for(int i = 0; i < (int)polyline.total(); ++i)
{
polyline.at<Vec3d>(i) = Vec3d(i/16.0, cos(i * CV_PI/6), sin(i * CV_PI/6));
colors.at<Vec3b>(i) = palette[i & palette_size];
}
Viz3d viz("show_polyline");
viz.showWidget("polyline", WPolyLine(Mat(polyline), Color::apricot()));
viz.showWidget("polyline", WPolyLine(polyline, colors));
viz.showWidget("coosys", WCoordinateSystem());
viz.showWidget("text2d", WText("Polyline", Point(20, 20), 20, Color::green()));
viz.spin();
@@ -222,13 +251,14 @@ TEST(Viz, show_sampled_normals)
TEST(Viz, show_trajectories)
{
std::vector<Affine3d> path = generate_test_trajectory<double>(), sub0, sub1, sub2, sub3, sub4, sub5;
int size =(int)path.size();
Mat(path).rowRange(0, path.size()/10+1).copyTo(sub0);
Mat(path).rowRange(path.size()/10, path.size()/5+1).copyTo(sub1);
Mat(path).rowRange(path.size()/5, 11*path.size()/12).copyTo(sub2);
Mat(path).rowRange(11*path.size()/12, path.size()).copyTo(sub3);
Mat(path).rowRange(3*path.size()/4, 33*path.size()/40).copyTo(sub4);
Mat(path).rowRange(33*path.size()/40, 9*path.size()/10).copyTo(sub5);
Mat(path).rowRange(0, size/10+1).copyTo(sub0);
Mat(path).rowRange(size/10, size/5+1).copyTo(sub1);
Mat(path).rowRange(size/5, 11*size/12).copyTo(sub2);
Mat(path).rowRange(11*size/12, size).copyTo(sub3);
Mat(path).rowRange(3*size/4, 33*size/40).copyTo(sub4);
Mat(path).rowRange(33*size/40, 9*size/10).copyTo(sub5);
Matx33d K(1024.0, 0.0, 320.0, 0.0, 1024.0, 240.0, 0.0, 0.0, 1.0);
Viz3d viz("show_trajectories");
@@ -259,7 +289,7 @@ TEST(Viz, show_trajectory_reposition)
Viz3d viz("show_trajectory_reposition_to_origin");
viz.showWidget("coos", WCoordinateSystem());
viz.showWidget("sub3", WTrajectory(Mat(path).rowRange(0, path.size()/3), WTrajectory::BOTH, 0.2, Color::brown()), path.front().inv());
viz.showWidget("sub3", WTrajectory(Mat(path).rowRange(0, (int)path.size()/3), WTrajectory::BOTH, 0.2, Color::brown()), path.front().inv());
viz.showWidget("text2d", WText("Trajectory resposition to origin", Point(20, 20), 20, Color::green()));
viz.spin();
}