Fixed some warnings...

git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@35 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
matlabbe 2011-11-23 18:08:33 +00:00
parent acb12ac688
commit a1c5be1d5b
8 changed files with 20 additions and 19 deletions

View File

@ -5,6 +5,7 @@ SET(PROJECT_PREFIX find_object)
ADD_DEFINITIONS(-DPROJECT_PREFIX="${PROJECT_PREFIX}") ADD_DEFINITIONS(-DPROJECT_PREFIX="${PROJECT_PREFIX}")
ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}") ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}")
ADD_DEFINITIONS( "-Wall" )
####################### #######################
# VERSION # VERSION

View File

@ -129,7 +129,7 @@ int main(int argc, char * argv[])
std::vector<cv::Point2f> mpts_1, mpts_2; // Used for homography std::vector<cv::Point2f> mpts_1, mpts_2; // Used for homography
std::vector<int> indexes_1, indexes_2; // Used for homography std::vector<int> indexes_1, indexes_2; // Used for homography
std::vector<uchar> outlier_mask; // Used for homography std::vector<uchar> outlier_mask; // Used for homography
for(unsigned int i=0; i<objectData.rows; ++i) for(int i=0; i<objectData.rows; ++i)
{ {
// Check if this descriptor matches with those of the objects // Check if this descriptor matches with those of the objects
// Apply NNDR // Apply NNDR
@ -144,7 +144,7 @@ int main(int argc, char * argv[])
} }
// FIND HOMOGRAPHY // FIND HOMOGRAPHY
int minInliers = 8; unsigned int minInliers = 8;
if(mpts_1.size() >= minInliers) if(mpts_1.size() >= minInliers)
{ {
time.start(); time.start();
@ -155,7 +155,7 @@ int main(int argc, char * argv[])
outlier_mask); outlier_mask);
printf("Time finding homography = %d ms\n", time.restart()); printf("Time finding homography = %d ms\n", time.restart());
int inliers=0, outliers=0; int inliers=0, outliers=0;
for(int k=0; k<mpts_1.size();++k) for(unsigned int k=0; k<mpts_1.size();++k)
{ {
if(outlier_mask.at(k)) if(outlier_mask.at(k))
{ {
@ -175,7 +175,7 @@ int main(int argc, char * argv[])
QColor color(Qt::green); QColor color(Qt::green);
int alpha = 130; int alpha = 130;
color.setAlpha(alpha); color.setAlpha(alpha);
for(int k=0; k<mpts_1.size();++k) for(unsigned int k=0; k<mpts_1.size();++k)
{ {
if(outlier_mask.at(k)) if(outlier_mask.at(k))
{ {

View File

@ -173,7 +173,7 @@ void AddObjectDialog::setState(int state)
cv::DescriptorExtractor * extractor = Settings::createDescriptorsExtractor(); cv::DescriptorExtractor * extractor = Settings::createDescriptorsExtractor();
extractor->compute(cvImage_, selectedKeypoints, descriptors); extractor->compute(cvImage_, selectedKeypoints, descriptors);
delete extractor; delete extractor;
if(selectedKeypoints.size() != descriptors.rows) if(selectedKeypoints.size() != (unsigned int)descriptors.rows)
{ {
printf("ERROR : keypoints=%lu != descriptors=%d\n", selectedKeypoints.size(), descriptors.rows); printf("ERROR : keypoints=%lu != descriptors=%d\n", selectedKeypoints.size(), descriptors.rows);
} }
@ -231,8 +231,8 @@ void AddObjectDialog::update(const cv::Mat & image)
CvRect AddObjectDialog::computeROI(const std::vector<cv::KeyPoint> & kpts) CvRect AddObjectDialog::computeROI(const std::vector<cv::KeyPoint> & kpts)
{ {
CvRect roi; CvRect roi = cvRect(0,0,0,0);
int x1,x2,h1,h2; int x1=0,x2=0,h1=0,h2=0;
for(unsigned int i=0; i<kpts.size(); ++i) for(unsigned int i=0; i<kpts.size(); ++i)
{ {
float radius = kpts.at(i).size / 2; float radius = kpts.at(i).size / 2;

View File

@ -50,8 +50,8 @@ void Camera::takeImage()
if(img && if(img &&
Settings::getCamera_imageWidth().toInt() && Settings::getCamera_imageWidth().toInt() &&
Settings::getCamera_imageHeight().toInt() && Settings::getCamera_imageHeight().toInt() &&
Settings::getCamera_imageWidth().toInt() != (unsigned int)img->width && Settings::getCamera_imageWidth().toInt() != img->width &&
Settings::getCamera_imageHeight().toInt() != (unsigned int)img->height) Settings::getCamera_imageHeight().toInt() != img->height)
{ {
// declare a destination IplImage object with correct size, depth and channels // declare a destination IplImage object with correct size, depth and channels
cv::Mat imgMat(cvSize(Settings::getCamera_imageWidth().toInt(), Settings::getCamera_imageHeight().toInt()), cv::Mat imgMat(cvSize(Settings::getCamera_imageWidth().toInt(), Settings::getCamera_imageHeight().toInt()),

View File

@ -324,7 +324,7 @@ void MainWindow::update(const cv::Mat & image)
cv::DescriptorExtractor * extractor = Settings::createDescriptorsExtractor(); cv::DescriptorExtractor * extractor = Settings::createDescriptorsExtractor();
extractor->compute(img, keypoints, descriptors); extractor->compute(img, keypoints, descriptors);
delete extractor; delete extractor;
if(keypoints.size() != descriptors.rows) if((int)keypoints.size() != descriptors.rows)
{ {
printf("ERROR : kpt=%lu != descriptors=%d\n", keypoints.size(), descriptors.rows); printf("ERROR : kpt=%lu != descriptors=%d\n", keypoints.size(), descriptors.rows);
} }
@ -359,7 +359,7 @@ void MainWindow::update(const cv::Mat & image)
std::vector<cv::Point2f> mpts_1, mpts_2; std::vector<cv::Point2f> mpts_1, mpts_2;
std::vector<int> indexes_1, indexes_2; std::vector<int> indexes_1, indexes_2;
std::vector<uchar> outlier_mask; std::vector<uchar> outlier_mask;
for(unsigned int i=0; i<dataTree_.rows; ++i) for(int i=0; i<dataTree_.rows; ++i)
{ {
// Check if this descriptor matches with those of the objects // Check if this descriptor matches with those of the objects
// Apply NNDR // Apply NNDR
@ -382,7 +382,7 @@ void MainWindow::update(const cv::Mat & image)
if(i+1 >= dataRange_.at(j)) if(i+1 >= dataRange_.at(j))
{ {
QLabel * label = ui_->dockWidget_objects->findChild<QLabel*>(QString("%1detection").arg(objects_.at(j)->id())); QLabel * label = ui_->dockWidget_objects->findChild<QLabel*>(QString("%1detection").arg(objects_.at(j)->id()));
if(mpts_1.size() >= Settings::getHomography_minimumInliers().toInt()) if(mpts_1.size() >= Settings::getHomography_minimumInliers().toUInt())
{ {
cv::Mat H = findHomography(mpts_1, cv::Mat H = findHomography(mpts_1,
mpts_2, mpts_2,
@ -392,7 +392,7 @@ void MainWindow::update(const cv::Mat & image)
int inliers=0, outliers=0; int inliers=0, outliers=0;
QColor color((Qt::GlobalColor)(j % 12 + 7 )); QColor color((Qt::GlobalColor)(j % 12 + 7 ));
color.setAlpha(alpha); color.setAlpha(alpha);
for(int k=0; k<mpts_1.size();++k) for(unsigned int k=0; k<mpts_1.size();++k)
{ {
if(outlier_mask.at(k)) if(outlier_mask.at(k))
{ {
@ -407,7 +407,7 @@ void MainWindow::update(const cv::Mat & image)
// COLORIZE // COLORIZE
if(inliers >= Settings::getHomography_minimumInliers().toInt()) if(inliers >= Settings::getHomography_minimumInliers().toInt())
{ {
for(int k=0; k<mpts_1.size();++k) for(unsigned int k=0; k<mpts_1.size();++k)
{ {
if(outlier_mask.at(k)) if(outlier_mask.at(k))
{ {

View File

@ -168,7 +168,7 @@ void ObjWidget::setSizedFeatures(bool on)
_sizedFeatures->setChecked(on); _sizedFeatures->setChecked(on);
if(graphicsViewInitialized_) if(graphicsViewInitialized_)
{ {
for(unsigned int i=0; i<keypointItems_.size() && i<keypoints_.size(); ++i) for(unsigned int i=0; i<(unsigned int)keypointItems_.size() && i<keypoints_.size(); ++i)
{ {
float size = 14; float size = 14;
if(on && keypoints_[i].size>14.0f) if(on && keypoints_[i].size>14.0f)
@ -254,7 +254,7 @@ void ObjWidget::resetKptsColor()
rectItems_.clear(); rectItems_.clear();
} }
void ObjWidget::setKptColor(unsigned int index, const QColor & color) void ObjWidget::setKptColor(int index, const QColor & color)
{ {
if(index < kptColors_.size()) if(index < kptColors_.size())
{ {
@ -311,7 +311,7 @@ void ObjWidget::save(QDataStream & streamPtr) const
{ {
streamPtr << id_ << detectorType_ << descriptorType_; streamPtr << id_ << detectorType_ << descriptorType_;
streamPtr << (int)keypoints_.size(); streamPtr << (int)keypoints_.size();
for(int j=0; j<keypoints_.size(); ++j) for(unsigned int j=0; j<keypoints_.size(); ++j)
{ {
streamPtr << keypoints_.at(j).angle << streamPtr << keypoints_.at(j).angle <<
keypoints_.at(j).class_id << keypoints_.at(j).class_id <<

View File

@ -40,7 +40,7 @@ public:
const cv::Mat & descriptors, const cv::Mat & descriptors,
const IplImage * image); const IplImage * image);
void resetKptsColor(); void resetKptsColor();
void setKptColor(unsigned int index, const QColor & color); void setKptColor(int index, const QColor & color);
void setGraphicsViewMode(bool on); void setGraphicsViewMode(bool on);
void setAutoScale(bool autoScale); void setAutoScale(bool autoScale);
void setSizedFeatures(bool on); void setSizedFeatures(bool on);

View File

@ -74,7 +74,7 @@ void ParametersToolBox::setupUi()
if(currentItem == 0 || currentItem->objectName().compare(group) != 0) if(currentItem == 0 || currentItem->objectName().compare(group) != 0)
{ {
currentItem = new QWidget(this); currentItem = new QWidget(this);
int index = this->addItem(currentItem, group); this->addItem(currentItem, group);
currentItem->setObjectName(group); currentItem->setObjectName(group);
QVBoxLayout * layout = new QVBoxLayout(currentItem); QVBoxLayout * layout = new QVBoxLayout(currentItem);
currentItem->setLayout(layout); currentItem->setLayout(layout);