mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
fixed size_t/int conversion warnings
This commit is contained in:
parent
998aefd1d1
commit
17fea0dd0a
@ -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<int>();
|
||||
for(int y = 0, index = 0; y < mesh.cloud.rows; ++y)
|
||||
{
|
||||
|
@ -267,8 +267,8 @@ namespace cv
|
||||
vtkSmartPointer<vtkUnsignedCharArray> scalars = vtkSmartPointer<vtkUnsignedCharArray>::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;
|
||||
}
|
||||
|
||||
|
@ -390,21 +390,21 @@ cv::viz::WPolyLine::WPolyLine(InputArray _points, const Color &color)
|
||||
|
||||
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::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<vtkCellArray> cell_array = vtkSmartPointer<vtkCellArray>::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<vtkUnsignedCharArray> scalars = VtkUtils::FillScalars(total, color);
|
||||
|
||||
|
@ -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<Affine3f>(i), tag);
|
||||
writePose(cv::format(files_format.c_str(), index), traj.at<Affine3f>((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<Affine3d>(i), tag);
|
||||
writePose(cv::format(files_format.c_str(), index), traj.at<Affine3d>((int)i), tag);
|
||||
}
|
||||
|
||||
CV_Assert(!"Unsupported array kind");
|
||||
|
@ -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<Vec3d>();
|
||||
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<Vec3d>();
|
||||
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<Vec2d>();
|
||||
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);
|
||||
|
||||
|
@ -185,8 +185,8 @@ int cv::viz::vtkCloudMatSource::filterNanCopy(const Mat& cloud)
|
||||
CV_DbgAssert(DataType<_Tp>::depth == cloud.depth());
|
||||
points = vtkSmartPointer<vtkPoints>::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;
|
||||
|
@ -64,19 +64,19 @@ void cv::viz::vtkTrajectorySource::SetTrajectory(InputArray _traj)
|
||||
|
||||
points = vtkSmartPointer<vtkPoints>::New();
|
||||
points->SetDataType(VTK_DOUBLE);
|
||||
points->SetNumberOfPoints(total);
|
||||
points->SetNumberOfPoints((vtkIdType)total);
|
||||
|
||||
tensors = vtkSmartPointer<vtkDoubleArray>::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<Affine3d>();
|
||||
const Affine3f* fpath = _traj.getMat().ptr<Affine3f>();
|
||||
|
||||
|
@ -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<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;
|
||||
|
||||
@ -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<Vec3d>(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<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 +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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user