Fix conversion warnings

This commit is contained in:
Simon Giraudot 2018-06-26 09:56:11 +02:00
parent a1df51aafb
commit 566e84f154
3 changed files with 5 additions and 5 deletions

View File

@ -158,14 +158,14 @@ public:
std::size_t nb_samples = 0;
for (std::size_t i = 0; i < ground_truth.size(); ++ i)
if (ground_truth[i] != -1)
if (int(ground_truth[i]) != -1)
++ nb_samples;
cv::Mat training_features (int(nb_samples), int(m_features.size()), CV_32FC1);
cv::Mat training_labels (int(nb_samples), 1, CV_32FC1);
for (std::size_t i = 0, index = 0; i < ground_truth.size(); ++ i)
if (ground_truth[i] != -1)
if (int(ground_truth[i]) != -1)
{
for (std::size_t f = 0; f < m_features.size(); ++ f)
training_features.at<float>(int(index), int(f)) = m_features[f]->value(i);

View File

@ -311,7 +311,7 @@ public:
std::vector<std::vector<std::size_t> > training_sets (m_labels.size());
std::size_t nb_tot = 0;
for (std::size_t i = 0; i < ground_truth.size(); ++ i)
if (ground_truth[i] != -1)
if (int(ground_truth[i]) != -1)
{
training_sets[std::size_t(ground_truth[i])].push_back (i);
++ nb_tot;

View File

@ -202,9 +202,9 @@ void Surface_mesh_item_classification::train
BOOST_FOREACH(face_descriptor fd, faces(*(m_mesh->polyhedron())))
{
training[fd] = m_training[fd];
if (training[fd] != -1)
if (training[fd] != std::size_t(-1))
{
nb_label[std::size_t(training[fd])] ++;
nb_label[training[fd]] ++;
++ nb_total;
}
}