From 3003bf5338e4c7962248e943ba3ece1482a96879 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Sun, 7 May 2017 15:49:07 +0200 Subject: [PATCH] [CCV] Added across scale addition method Signed-off-by: Jim Martens --- ccv/sheet4/lab_pyramid.cpp | 11 +++++++++++ ccv/sheet4/lab_pyramid.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/ccv/sheet4/lab_pyramid.cpp b/ccv/sheet4/lab_pyramid.cpp index c21e384..0653121 100644 --- a/ccv/sheet4/lab_pyramid.cpp +++ b/ccv/sheet4/lab_pyramid.cpp @@ -96,6 +96,17 @@ void lab_pyramid::compute_dog(lab_pyramid center, lab_pyramid surround, int numb } } +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(); + for (unsigned long i = 1; i < scale_images.size(); i++) { + cv::Mat resized_image; + cv::resize(scale_images.at(i), resized_image, original_size, 0, 0, cv::INTER_CUBIC); + result += resized_image; + } + return result; +} + void lab_pyramid::visualize_dog() { for (unsigned long layer = 0; layer < _number_of_layers; layer++) { cv::namedWindow("CS L"); diff --git a/ccv/sheet4/lab_pyramid.h b/ccv/sheet4/lab_pyramid.h index 0ae957d..247201d 100644 --- a/ccv/sheet4/lab_pyramid.h +++ b/ccv/sheet4/lab_pyramid.h @@ -61,6 +61,14 @@ public: */ void static compute_dog(lab_pyramid center, lab_pyramid surround, int number_of_layers); + /** + * Takes the scale images, adds them up and returns the result. + * + * @param scale_images the scale images + * @return the sum of the scale images + */ + cv::Mat static across_scale_addition(const std::vector& scale_images); + /** * Visualizes the center-surround and surround-center contrasts. They have to be computed first. */