From 41cc083a47d350fe88f3ff0f0809b0e7229f36b2 Mon Sep 17 00:00:00 2001 From: sajalsubodh22 Date: Wed, 27 Sep 2017 20:03:14 +0530 Subject: [PATCH 1/5] Fixed Comments --- common/pipeline/ODDetection.h | 64 ++++++----------------------------- 1 file changed, 11 insertions(+), 53 deletions(-) diff --git a/common/pipeline/ODDetection.h b/common/pipeline/ODDetection.h index ccf1e7a4..218c19e8 100644 --- a/common/pipeline/ODDetection.h +++ b/common/pipeline/ODDetection.h @@ -47,8 +47,8 @@ namespace od /** \brief The base class of all the detection. * - * This is the base class of all the detection classes containing the detection information. All the ODDetector s return a collection of this class (in the form of ODDetections). - * Supports two modes: recognition (with type OD_DETECTION_RECOG) and classification (with type OD_DETECTION_CLASS). Along with the type, ODDetector sets an ID to identify what class or what instance of recognition is detected/recognied. + * This is the base class of all the detection classes containing the detection information. All the ODDetectors return a collection of this class (in the form of ODDetections). + * It supports two modes: recognition (with type OD_DETECTION_RECOG) and classification (with type OD_DETECTION_CLASS). Along with the type, ODDetector sets an ID to identify what class or what instance of recognition is detected/recognied. * * \author Kripasindhu Sarkar * @@ -57,14 +57,12 @@ namespace od { public: - OD_DEFINE_ENUM_WITH_STRING_CONVERSIONS(DetectionType, (OD_DETECTION_RECOG)(OD_DETECTION_CLASS)(OD_DETECTION_NULL)) virtual ~ODDetection() { } - ODDetection(DetectionType const &type_ = OD_DETECTION_NULL, std::string const &id_ = "", double confidence_ = 1) : type_(type_), id_(id_), - confidence_(confidence_) + ODDetection(DetectionType const &type_ = OD_DETECTION_NULL, std::string const &id_ = "", double confidence_ = 1) : type_(type_), id_(id_), confidence_(confidence_) { } void printSelf() @@ -101,8 +99,6 @@ namespace od return confidence_; } - /** \brief Get/Set the confidence of the detection. ODDetector can use this to provide confidence amnong several detections. - */ void setConfidence(double confidence_) { ODDetection::confidence_ = confidence_; @@ -123,6 +119,8 @@ namespace od { public: + /** \brief Making base class destructor virtual guarantees that the object of derived class is destructed properly. + */ virtual ~ODDetection2D() { } @@ -161,7 +159,6 @@ namespace od ODDetection2D::metainfo_image_ = metainfo_image_; } - Eigen::Vector3d location_2d_; cv::Rect bounding_box_2d_; cv::Mat metainfo_image_; @@ -175,6 +172,9 @@ namespace od class ODDetection3D : public virtual ODDetection { public: + + /** \brief Making base class destructor virtual guarantees that the object of derived class is destructed properly. + */ virtual ~ODDetection3D() { } @@ -187,6 +187,7 @@ namespace od { ODDetection3D::location_3d_ = location_; } + void setLocation(cv::Mat const &location_) { cv::cv2eigen(location_, this->location_3d_); @@ -201,6 +202,7 @@ namespace od { ODDetection3D::orientation_ = pose_; } + void setPose(cv::Mat const & pose_cv) { this->orientation_ = Eigen::Map(pose_cv.clone().ptr()); @@ -258,15 +260,6 @@ namespace od typename pcl::PointCloud::Ptr metainfo_cluster_; }; - /** \brief Detection in 2D with complete information. - * - * \author Kripasindhu Sarkar - * - */ - class ODDetectionComplete: public ODDetection2D, public ODDetection3D - { - }; - /** \brief The container class for ODDetection * * \author Kripasindhu Sarkar @@ -330,9 +323,7 @@ namespace od }; - - -/** \brief The container class for ODDetection2D returned by ODDetector2D + /** \brief The container class for ODDetection2D returned by ODDetector2D * * \author Kripasindhu Sarkar * @@ -378,42 +369,9 @@ namespace od { public: - /*ODSceneImage renderMetainfo(ODSceneImage input) - { - //picking up random colors for different detection algorithm, if exist - std::map color_map; - for(int i = 0; i < detections_.size(); i++) - { - if(color_map.find(detections_[i]->getId()) == color_map.end()) - color_map[detections_[i]->getId()] = CV_RGB(rand()%255, rand()%255, rand()%255); - } - - cv::Mat image = input.getCVImage().clone(); - for(int i = 0; i < detections_.size(); i++) - { - ODDetections3D * detection = dynamic_cast(detections_[i]); - cv::rectangle(image, detection->bounding_box_2d_, color_map[detections_[i]->getId()], 2); - } - return ODSceneImage(image); - }*/ - - ODDetection3D * operator[](int i) { return dynamic_cast(detections_[i]); } ODDetection3D * at(int i) { return dynamic_cast(detections_[i]); } }; - /** \brief The container class for ODDetectionComplete returned by ODDetector2DComplete - * - * \author Kripasindhu Sarkar - * - */ - class ODDetectionsComplete: public ODDetections - { - public: - - ODDetectionComplete * operator[](int i) { return dynamic_cast(detections_[i]); } - ODDetectionComplete * at(int i) { return dynamic_cast (detections_[i]); } - }; - } #endif //OPENDETECTION_ODDETECTION_H From 1eae313573e4b97a2f7b15d29eb9ef26d9fdd640 Mon Sep 17 00:00:00 2001 From: sajalsubodh22 Date: Wed, 27 Sep 2017 20:06:57 +0530 Subject: [PATCH 2/5] Included ODDetector.h --- common/pipeline/ODDetector.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/pipeline/ODDetector.cpp b/common/pipeline/ODDetector.cpp index 6aaa81d2..da65e744 100644 --- a/common/pipeline/ODDetector.cpp +++ b/common/pipeline/ODDetector.cpp @@ -28,3 +28,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Created by sarkar on 13.08.15. // +#include "ODDetector.h" \ No newline at end of file From e9881696f1b7deb9d2b0c62d192c65666667bb21 Mon Sep 17 00:00:00 2001 From: sajalsubodh22 Date: Wed, 27 Sep 2017 20:09:21 +0530 Subject: [PATCH 3/5] Added a more readable comment --- common/pipeline/ODDetector.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/pipeline/ODDetector.h b/common/pipeline/ODDetector.h index 5ff482cc..40ec1d5f 100644 --- a/common/pipeline/ODDetector.h +++ b/common/pipeline/ODDetector.h @@ -42,8 +42,9 @@ namespace od { /** \brief The main detector class; all special Detectors derives from this. * - * Provides interface for two important function detect() and detectOmni(). detectOmni() performs a detection/recognition on the entire scene (unsegmented and unprocessed) - * and provides information about the detection as well as its exact location. detect() takes an 'object candidate' or a segmented/processed scene as an input and identifies if the entire scene is a detection. + * Provides interface for two important function detect() and detectOmni(). + * detectOmni() performs a detection/recognition on the entire scene (unsegmented and unprocessed) and provides information about the detection as well as its exact location. + * detect() takes an 'object candidate' or a segmented/processed scene as an input and identifies if the entire scene is a detection. * * \author Kripasindhu Sarkar * From 6cfb42a2d9f2f4590abcc5a7090b7d62919c455a Mon Sep 17 00:00:00 2001 From: sajalsubodh22 Date: Wed, 27 Sep 2017 20:11:56 +0530 Subject: [PATCH 4/5] Removed unnecessay code --- common/pipeline/ODScene.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/pipeline/ODScene.h b/common/pipeline/ODScene.h index 547e7f12..9acdff86 100644 --- a/common/pipeline/ODScene.h +++ b/common/pipeline/ODScene.h @@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef OPENDETECTION_SCENE_H #define OPENDETECTION_SCENE_H -//#include #include #include #include @@ -41,7 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace od { - /** \brief Base class for Scenes. This contains information about the scenes. Scenes can be image scenes or point cloud scenes + /** \brief Base class for Scenes. This contains information about the scenes. Scenes can be image scenes or point cloud scenes. * * \author Kripasindhu Sarkar * @@ -113,8 +112,8 @@ namespace od } protected: - cv::Mat cvimage_; + cv::Mat cvimage_; std::vector keypoints_; cv::Mat descriptors_; bool is_trained_; @@ -166,9 +165,14 @@ namespace od ODScenePointCloud::point_cloud_ = point_cloud_; } - void * getData() { return (void *)point_cloud_.get(); } + void * getData() + { + return (void *)point_cloud_.get(); + } + protected: PointCloudPtr point_cloud_; + }; } From dceca031dd74da477e6338c69f59a32794829fa4 Mon Sep 17 00:00:00 2001 From: sajalsubodh22 Date: Wed, 27 Sep 2017 20:12:49 +0530 Subject: [PATCH 5/5] Apllied standard code spacing --- common/pipeline/ODTrainer.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/pipeline/ODTrainer.h b/common/pipeline/ODTrainer.h index e3fa2c32..ebe9d101 100644 --- a/common/pipeline/ODTrainer.h +++ b/common/pipeline/ODTrainer.h @@ -31,14 +31,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef OPENDETECTION_TRAINER_H #define OPENDETECTION_TRAINER_H -#include +#include #include #include - #include "ODAlgorithmBase.h" #include "ObjectDetector.h" - namespace bf = boost::filesystem; namespace od