From ee5b0cabd06539330ae3a7ce34d4ad83d96ec5d9 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Sun, 7 May 2017 16:08:50 +0200 Subject: [PATCH] [CCV] Added ability to compute feature maps Signed-off-by: Jim Martens --- ccv/sheet4/lab_pyramid.cpp | 9 +++++++++ ccv/sheet4/lab_pyramid.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ccv/sheet4/lab_pyramid.cpp b/ccv/sheet4/lab_pyramid.cpp index 0653121..caac4b5 100644 --- a/ccv/sheet4/lab_pyramid.cpp +++ b/ccv/sheet4/lab_pyramid.cpp @@ -96,6 +96,15 @@ void lab_pyramid::compute_dog(lab_pyramid center, lab_pyramid surround, int numb } } +void lab_pyramid::compute_feature_maps() { + _cs_F_l = across_scale_addition(_cs_contrast_l); + _sc_F_l = across_scale_addition(_sc_contrast_l); + _cs_F_a = across_scale_addition(_cs_contrast_a); + _sc_F_a = across_scale_addition(_sc_contrast_a); + _cs_F_b = across_scale_addition(_cs_contrast_b); + _sc_F_b = across_scale_addition(_sc_contrast_b); +} + cv::Mat lab_pyramid::across_scale_addition(const std::vector &scale_images) { cv::Mat result = scale_images.front(); cv::Size original_size = scale_images.front().size(); diff --git a/ccv/sheet4/lab_pyramid.h b/ccv/sheet4/lab_pyramid.h index 247201d..ce6e6de 100644 --- a/ccv/sheet4/lab_pyramid.h +++ b/ccv/sheet4/lab_pyramid.h @@ -16,6 +16,12 @@ private: static std::vector _sc_contrast_a; static std::vector _cs_contrast_b; static std::vector _sc_contrast_b; + static cv::Mat _cs_F_l; + static cv::Mat _sc_F_l; + static cv::Mat _cs_F_a; + static cv::Mat _cs_F_b; + static cv::Mat _sc_F_a; + static cv::Mat _sc_F_b; static int _number_of_layers; public: const static int COLOR_L = 0; @@ -61,6 +67,12 @@ public: */ void static compute_dog(lab_pyramid center, lab_pyramid surround, int number_of_layers); + /** + * Computes the feature maps. + * Has to be called after compute_dog. + */ + void static compute_feature_maps(); + /** * Takes the scale images, adds them up and returns the result. *