gldetector.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (Modified BSD License)
00003  *
00004  *  Copyright (c) 2012, PAL Robotics, S.L.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of PAL Robotics, S.L. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE. 
00033  *
00034  * @file gldetector.h
00035  * @author Bence Magyar
00036  * @date April 2012
00037  * @version 0.1
00038  * @brief The GLDetector class encapsulates the Recognizer module of BLORT.
00039  * It provides a C++ interface but uses ROS classes for data transfer at some places.
00040  */
00041 
00042 #ifndef GLDetector_H
00043 #define GLDetector_H
00044 
00045 #include <geometry_msgs/Pose.h>
00046 #include <string>
00047 #include <blort_msgs/RecoveryCall.h>
00048 
00049 #include <blort/ThreadObject/RecognizerThread.h>
00050 #include <blort/Recognizer3D/Recognizer3D.h>
00051 #include <blort_ros/DetectorConfig.h>
00052 
00053 #include <blort/ObjectEntry.h>
00054 
00055 namespace blort_ros
00056 {
00057     class GLDetector
00058     {
00059     private:
00060 
00061         // EXPERIMENTAL temporary stuff
00062         int rec3dcounter;
00063         // end of EXPERIMENTAL
00064 
00065         float recovery_conf_threshold; // threshold used in recovery mode to say OK to a pose proposal
00066 
00067         // Create OpenGL Window and Tracker
00068         boost::shared_ptr<blortRecognizer::Recognizer3D> recognizer; // recovery component
00069 
00070         //config files 
00071         std::vector<blort::ObjectEntry> objects;
00072         std::vector<size_t> sift_index;
00073         size_t sift_files_count;
00074 
00075         // Initialise image
00076         IplImage *image_; // iplimage that used be the in former blort tracker module
00077         cv::Mat last_image;
00078 
00079         //reconf GUI hack
00080         bool last_reset;
00081 
00082     public:
00083         GLDetector(const sensor_msgs::CameraInfo& camera_info,
00084                    const std::string& config_root);
00085 
00087         bool recovery(std::vector<std::string> & obj_ids, const cv::Mat& image,
00088                       blort_msgs::RecoveryCall::Response &resp);
00089 
00092         bool recoveryWithLast(std::vector<std::string> & obj_ids, blort_msgs::RecoveryCall::Response &resp);
00093 
00096         void reconfigure(blort_ros::DetectorConfig config);
00097 
00099         cv::Mat getImage();
00100 
00102         void setNNThreshold(double nn_threshold)
00103         { recognizer->setNNThreshold(nn_threshold); }
00104 
00106         void setRansacNPointsToMatch(unsigned int n)
00107         { recognizer->setRansacNPointsToMatch(n); }
00108 
00109         ~GLDetector();
00110 
00111         cv::Mat getDebugImage();
00112 
00113     };
00114 }
00115 
00116 #endif // GLDetector_H


blort_ros
Author(s): Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:39