diff --git a/modules/viz/src/clouds.cpp b/modules/viz/src/clouds.cpp index b7c8bbb212..c2c78d5523 100644 --- a/modules/viz/src/clouds.cpp +++ b/modules/viz/src/clouds.cpp @@ -347,7 +347,7 @@ cv::viz::WMesh::WMesh(const Mesh &mesh) source->SetColorCloudNormalsTCoords(mesh.cloud, mesh.colors, mesh.normals, mesh.tcoords); source->Update(); - Mat lookup_buffer(1, mesh.cloud.total(), CV_32SC1); + Mat lookup_buffer(1, (int)mesh.cloud.total(), CV_32SC1); int *lookup = lookup_buffer.ptr(); for(int y = 0, index = 0; y < mesh.cloud.rows; ++y) { diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp index 2b34f56389..8329f52f12 100644 --- a/modules/viz/src/precomp.hpp +++ b/modules/viz/src/precomp.hpp @@ -267,8 +267,8 @@ namespace cv vtkSmartPointer scalars = vtkSmartPointer::New(); scalars->SetName("Colors"); scalars->SetNumberOfComponents(3); - scalars->SetNumberOfTuples(size); - scalars->SetArray(color_data->val, size * 3, 0); + scalars->SetNumberOfTuples((vtkIdType)size); + scalars->SetArray(color_data->val, (vtkIdType)(size * 3), 0); return scalars; } diff --git a/modules/viz/src/shapes.cpp b/modules/viz/src/shapes.cpp index f3d24f757c..171470d812 100644 --- a/modules/viz/src/shapes.cpp +++ b/modules/viz/src/shapes.cpp @@ -390,21 +390,21 @@ cv::viz::WPolyLine::WPolyLine(InputArray _points, const Color &color) vtkSmartPointer points = vtkSmartPointer::New(); points->SetDataType(_points.depth() == CV_32F ? VTK_FLOAT : VTK_DOUBLE); - points->SetNumberOfPoints(total); + points->SetNumberOfPoints((vtkIdType)total); if (_points.depth() == CV_32F) for(size_t i = 0; i < total; ++i, fpoints += s_chs) - points->SetPoint(i, fpoints); + points->SetPoint((vtkIdType)i, fpoints); if (_points.depth() == CV_64F) for(size_t i = 0; i < total; ++i, dpoints += s_chs) - points->SetPoint(i, dpoints); + points->SetPoint((vtkIdType)i, dpoints); vtkSmartPointer cell_array = vtkSmartPointer::New(); - cell_array->Allocate(cell_array->EstimateSize(1, total)); - cell_array->InsertNextCell(total); + cell_array->Allocate(cell_array->EstimateSize(1, (int)total)); + cell_array->InsertNextCell((int)total); for(size_t i = 0; i < total; ++i) - cell_array->InsertCellPoint(i); + cell_array->InsertCellPoint((vtkIdType)i); vtkSmartPointer scalars = VtkUtils::FillScalars(total, color); diff --git a/modules/viz/src/vizcore.cpp b/modules/viz/src/vizcore.cpp index b8cad1ca68..b4332a860a 100644 --- a/modules/viz/src/vizcore.cpp +++ b/modules/viz/src/vizcore.cpp @@ -278,11 +278,11 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int if (traj.depth() == CV_32F) for(size_t i = 0, index = max(0, start); i < traj.total(); ++i, ++index) - writePose(cv::format(files_format.c_str(), index), traj.at(i), tag); + writePose(cv::format(files_format.c_str(), index), traj.at((int)i), tag); if (traj.depth() == CV_64F) for(size_t i = 0, index = max(0, start); i < traj.total(); ++i, ++index) - writePose(cv::format(files_format.c_str(), index), traj.at(i), tag); + writePose(cv::format(files_format.c_str(), index), traj.at((int)i), tag); } CV_Assert(!"Unsupported array kind"); diff --git a/modules/viz/src/vtk/vtkCloudMatSink.cpp b/modules/viz/src/vtk/vtkCloudMatSink.cpp index 7f47022c34..8bd1011323 100644 --- a/modules/viz/src/vtk/vtkCloudMatSink.cpp +++ b/modules/viz/src/vtk/vtkCloudMatSink.cpp @@ -79,11 +79,11 @@ void cv::viz::vtkCloudMatSink::WriteData() if (cloud.depth() == CV_32F) for(size_t i = 0; i < cloud.total(); ++i) - *fdata++ = Vec3d(points_Data->GetPoint(i)); + *fdata++ = Vec3d(points_Data->GetPoint((vtkIdType)i)); if (cloud.depth() == CV_64F) for(size_t i = 0; i < cloud.total(); ++i) - *ddata++ = Vec3d(points_Data->GetPoint(i)); + *ddata++ = Vec3d(points_Data->GetPoint((vtkIdType)i)); } else cloud.release(); @@ -101,7 +101,7 @@ void cv::viz::vtkCloudMatSink::WriteData() Mat buffer(cloud.size(), CV_64FC(channels)); Vec3d *cptr = buffer.ptr(); for(size_t i = 0; i < buffer.total(); ++i) - *cptr++ = Vec3d(scalars_data->GetTuple(i)); + *cptr++ = Vec3d(scalars_data->GetTuple((vtkIdType)i)); buffer.convertTo(colors, CV_8U, vtktype == VTK_FLOAT || VTK_FLOAT == VTK_DOUBLE ? 255.0 : 1.0); } @@ -121,7 +121,7 @@ void cv::viz::vtkCloudMatSink::WriteData() Mat buffer(cloud.size(), CV_64FC(channels)); Vec3d *cptr = buffer.ptr(); for(size_t i = 0; i < buffer.total(); ++i) - *cptr++ = Vec3d(normals_data->GetTuple(i)); + *cptr++ = Vec3d(normals_data->GetTuple((vtkIdType)i)); buffer.convertTo(normals, vtktype == VTK_FLOAT ? CV_32F : CV_64F); } @@ -140,7 +140,7 @@ void cv::viz::vtkCloudMatSink::WriteData() Mat buffer(cloud.size(), CV_64FC2); Vec2d *cptr = buffer.ptr(); for(size_t i = 0; i < buffer.total(); ++i) - *cptr++ = Vec2d(coords_data->GetTuple(i)); + *cptr++ = Vec2d(coords_data->GetTuple((vtkIdType)i)); buffer.convertTo(tcoords, vtktype == VTK_FLOAT ? CV_32F : CV_64F); diff --git a/modules/viz/src/vtk/vtkCloudMatSource.cpp b/modules/viz/src/vtk/vtkCloudMatSource.cpp index 74d01bbd01..1d8ab7894c 100644 --- a/modules/viz/src/vtk/vtkCloudMatSource.cpp +++ b/modules/viz/src/vtk/vtkCloudMatSource.cpp @@ -185,8 +185,8 @@ int cv::viz::vtkCloudMatSource::filterNanCopy(const Mat& cloud) CV_DbgAssert(DataType<_Tp>::depth == cloud.depth()); points = vtkSmartPointer::New(); points->SetDataType(VtkDepthTraits<_Tp>::data_type); - points->Allocate(cloud.total()); - points->SetNumberOfPoints(cloud.total()); + points->Allocate((vtkIdType)cloud.total()); + points->SetNumberOfPoints((vtkIdType)cloud.total()); int s_chs = cloud.channels(); int total = 0; diff --git a/modules/viz/src/vtk/vtkTrajectorySource.cpp b/modules/viz/src/vtk/vtkTrajectorySource.cpp index e098a1d553..2036e09af3 100644 --- a/modules/viz/src/vtk/vtkTrajectorySource.cpp +++ b/modules/viz/src/vtk/vtkTrajectorySource.cpp @@ -64,19 +64,19 @@ void cv::viz::vtkTrajectorySource::SetTrajectory(InputArray _traj) points = vtkSmartPointer::New(); points->SetDataType(VTK_DOUBLE); - points->SetNumberOfPoints(total); + points->SetNumberOfPoints((vtkIdType)total); tensors = vtkSmartPointer::New(); tensors->SetNumberOfComponents(9); - tensors->SetNumberOfTuples(total); + tensors->SetNumberOfTuples((vtkIdType)total); for(size_t i = 0; i < total; ++i, ++dpath) { Matx33d R = dpath->rotation().t(); // transposed because of - tensors->SetTuple(i, R.val); // column major order + tensors->SetTuple((vtkIdType)i, R.val); // column major order Vec3d p = dpath->translation(); - points->SetPoint(i, p.val); + points->SetPoint((vtkIdType)i, p.val); } } @@ -85,7 +85,7 @@ cv::Mat cv::viz::vtkTrajectorySource::ExtractPoints(InputArray _traj) CV_Assert(_traj.kind() == _InputArray::STD_VECTOR || _traj.kind() == _InputArray::MAT); CV_Assert(_traj.type() == CV_32FC(16) || _traj.type() == CV_64FC(16)); - Mat points(1, _traj.total(), CV_MAKETYPE(_traj.depth(), 3)); + Mat points(1, (int)_traj.total(), CV_MAKETYPE(_traj.depth(), 3)); const Affine3d* dpath = _traj.getMat().ptr(); const Affine3f* fpath = _traj.getMat().ptr(); diff --git a/modules/viz/test/tests_simple.cpp b/modules/viz/test/tests_simple.cpp index f84b60a475..c595affba7 100644 --- a/modules/viz/test/tests_simple.cpp +++ b/modules/viz/test/tests_simple.cpp @@ -81,7 +81,7 @@ TEST(Viz, show_cloud_masked) Mat dragon_cloud = readCloud(get_dragon_ply_file_path()); Vec3f qnan = Vec3f::all(std::numeric_limits::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(i) = qnan; @@ -170,7 +170,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])); @@ -194,7 +194,7 @@ TEST(Viz, show_textured_mesh) TEST(Viz, show_polyline) { Mat polyline(1, 32, CV_64FC3); - for(size_t i = 0; i < polyline.total(); ++i) + for(int i = 0; i < (int)polyline.total(); ++i) polyline.at(i) = Vec3d(i/16.0, cos(i * CV_PI/6), sin(i * CV_PI/6)); Viz3d viz("show_polyline"); @@ -222,13 +222,14 @@ TEST(Viz, show_sampled_normals) TEST(Viz, show_trajectories) { std::vector path = generate_test_trajectory(), 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 +260,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(); }