mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 11:26:25 +02:00
[CCV] Added generic mean and max fusion functions
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -39,6 +39,62 @@ cv::Mat max_fusion(cv::Mat f_on_off, cv::Mat f_off_on) {
|
||||
return C_l.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mean fusion.
|
||||
*
|
||||
* @param feature_maps vector of feature maps
|
||||
* @return conspicuity map
|
||||
*/
|
||||
cv::Mat mean_fusion_generic(const std::vector<cv::Mat> feature_maps) {
|
||||
unsigned long number_of_features = feature_maps.size();
|
||||
cv::Mat sum_of_features;
|
||||
double max = -1;
|
||||
for (auto& f : feature_maps) {
|
||||
sum_of_features += f;
|
||||
double max_value;
|
||||
cv::minMaxLoc(f, nullptr, &max_value);
|
||||
if (max_value >= max) {
|
||||
max = max_value;
|
||||
}
|
||||
}
|
||||
cv::Mat C = 1/number_of_features * sum_of_features;
|
||||
cv::normalize(C, C, 0, max, cv::NORM_MINMAX, -1);
|
||||
|
||||
return C.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the max fusion.
|
||||
*
|
||||
* @param feature_maps vector of feature maps
|
||||
* @return conspicuity map
|
||||
*/
|
||||
cv::Mat max_fusion_generic(const std::vector<cv::Mat> feature_maps) {
|
||||
unsigned long number_of_features = feature_maps.size();
|
||||
cv::Mat C;
|
||||
bool first_value = true;
|
||||
|
||||
double max = -1;
|
||||
for (auto& f : feature_maps) {
|
||||
double max_value;
|
||||
cv::minMaxLoc(f, nullptr, &max_value);
|
||||
if (max_value >= max) {
|
||||
max = max_value;
|
||||
}
|
||||
|
||||
if (first_value) {
|
||||
C = f;
|
||||
first_value = false;
|
||||
}
|
||||
else {
|
||||
C = cv::max(C, f);
|
||||
}
|
||||
}
|
||||
cv::normalize(C, C, 0, max, cv::NORM_MINMAX, -1);
|
||||
|
||||
return C.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the saliency map using mean fusion.
|
||||
*
|
||||
@ -48,7 +104,7 @@ cv::Mat max_fusion(cv::Mat f_on_off, cv::Mat f_off_on) {
|
||||
* @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);
|
||||
cv::Mat S = (1 / 3.0) * (C_l + C_a + C_b);
|
||||
double max_C_l;
|
||||
double max_C_a;
|
||||
double max_C_b;
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
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 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user