mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 11:26:25 +02:00
[CCV] Removed obsolete fusion functions
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -1,44 +1,6 @@
|
|||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/opencv.hpp>
|
||||||
#include "includes/fusion.h"
|
#include "includes/fusion.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the mean fusion of two feature maps.
|
|
||||||
*
|
|
||||||
* @param f_on_off feature map on off
|
|
||||||
* @param f_off_on feature map off on
|
|
||||||
* @return conspicuity map
|
|
||||||
*/
|
|
||||||
cv::Mat mean_fusion(cv::Mat f_on_off, cv::Mat f_off_on) {
|
|
||||||
cv::Mat C_l = 0.5 * (f_on_off + f_off_on);
|
|
||||||
double max_on_off;
|
|
||||||
double max_off_on;
|
|
||||||
cv::minMaxLoc(f_on_off, nullptr, &max_on_off);
|
|
||||||
cv::minMaxLoc(f_off_on, nullptr, &max_off_on);
|
|
||||||
double max = max_on_off >= max_off_on ? max_on_off : max_off_on;
|
|
||||||
cv::normalize(C_l, C_l, 0, max, cv::NORM_MINMAX, -1);
|
|
||||||
|
|
||||||
return C_l.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the max fusion of two feature maps.
|
|
||||||
*
|
|
||||||
* @param f_on_off feature map on off
|
|
||||||
* @param f_off_on feature map off on
|
|
||||||
* @return conspicuity map
|
|
||||||
*/
|
|
||||||
cv::Mat max_fusion(cv::Mat f_on_off, cv::Mat f_off_on) {
|
|
||||||
cv::Mat C_l = cv::max(f_on_off, f_off_on);
|
|
||||||
double max_on_off;
|
|
||||||
double max_off_on;
|
|
||||||
cv::minMaxLoc(f_on_off, nullptr, &max_on_off);
|
|
||||||
cv::minMaxLoc(f_off_on, nullptr, &max_off_on);
|
|
||||||
double max = max_on_off >= max_off_on ? max_on_off : max_off_on;
|
|
||||||
cv::normalize(C_l, C_l, 0, max, cv::NORM_MINMAX, -1);
|
|
||||||
|
|
||||||
return C_l.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the mean fusion.
|
* Returns the mean fusion.
|
||||||
*
|
*
|
||||||
@ -101,49 +63,3 @@ cv::Mat max_fusion_generic(const std::vector<cv::Mat> feature_maps) {
|
|||||||
|
|
||||||
return C.clone();
|
return C.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Computes the saliency map using mean fusion.
|
|
||||||
*
|
|
||||||
* @param C_l conspicuity map for L channel
|
|
||||||
* @param C_a conspicuity map for A channel
|
|
||||||
* @param C_b conspicuity map for B channel
|
|
||||||
* @return saliency map
|
|
||||||
*/
|
|
||||||
cv::Mat mean_fusion_saliency(cv::Mat C_l, cv::Mat C_a, cv::Mat C_b) {
|
|
||||||
cv::Mat S = (1 / 3.0) * (C_l + C_a + C_b);
|
|
||||||
double max_C_l;
|
|
||||||
double max_C_a;
|
|
||||||
double max_C_b;
|
|
||||||
cv::minMaxLoc(C_l, nullptr, &max_C_l);
|
|
||||||
cv::minMaxLoc(C_a, nullptr, &max_C_a);
|
|
||||||
cv::minMaxLoc(C_b, nullptr, &max_C_b);
|
|
||||||
double max = max_C_l >= max_C_a ? (max_C_l >= max_C_b ? max_C_l : max_C_b) : (max_C_a >= max_C_b ? max_C_a : max_C_b);
|
|
||||||
cv::normalize(S, S, 0, max, cv::NORM_MINMAX, -1);
|
|
||||||
|
|
||||||
return S;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Computes the saliency map using max fusion.
|
|
||||||
*
|
|
||||||
* @param C_l conspicuity map for L channel
|
|
||||||
* @param C_a conspicuity map for A channel
|
|
||||||
* @param C_b conspicuity map for B channel
|
|
||||||
* @return saliency map
|
|
||||||
*/
|
|
||||||
cv::Mat max_fusion_saliency(cv::Mat C_l, cv::Mat C_a, cv::Mat C_b) {
|
|
||||||
cv::Mat S = cv::max(C_l, C_a);
|
|
||||||
S = cv::max(S, C_b);
|
|
||||||
|
|
||||||
double max_C_l;
|
|
||||||
double max_C_a;
|
|
||||||
double max_C_b;
|
|
||||||
cv::minMaxLoc(C_l, nullptr, &max_C_l);
|
|
||||||
cv::minMaxLoc(C_a, nullptr, &max_C_a);
|
|
||||||
cv::minMaxLoc(C_b, nullptr, &max_C_b);
|
|
||||||
double max = max_C_l >= max_C_a ? (max_C_l >= max_C_b ? max_C_l : max_C_b) : (max_C_a >= max_C_b ? max_C_a : max_C_b);
|
|
||||||
cv::normalize(S, S, 0, max, cv::NORM_MINMAX, -1);
|
|
||||||
|
|
||||||
return S;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
#ifndef SHEET6_FUSION_H
|
#ifndef SHEET6_FUSION_H
|
||||||
#define SHEET6_FUSION_H
|
#define SHEET6_FUSION_H
|
||||||
|
|
||||||
cv::Mat mean_fusion(cv::Mat f_on_off, cv::Mat f_off_on);
|
|
||||||
cv::Mat max_fusion(cv::Mat f_on_off, cv::Mat f_off_on);
|
|
||||||
cv::Mat mean_fusion_generic(const std::vector<cv::Mat> feature_maps);
|
cv::Mat mean_fusion_generic(const std::vector<cv::Mat> feature_maps);
|
||||||
cv::Mat max_fusion_generic(const std::vector<cv::Mat> feature_maps);
|
cv::Mat max_fusion_generic(const std::vector<cv::Mat> feature_maps);
|
||||||
cv::Mat mean_fusion_saliency(cv::Mat C_l, cv::Mat C_a, cv::Mat C_b);
|
|
||||||
cv::Mat max_fusion_saliency(cv::Mat C_l, cv::Mat C_a, cv::Mat C_b);
|
|
||||||
|
|
||||||
#endif //SHEET6_FUSION_H
|
#endif //SHEET6_FUSION_H
|
||||||
|
|||||||
Reference in New Issue
Block a user