Merge pull request #1736 from gdemarcq:staticSaliencyFineGrained_corrections

* Correction for computeBinaryMap crash:
- the function staticSaliencyFineGrained::computeSaliency() outputs a
normalized floating point image
- Add an assert in StaticSaliency::computeBinaryMap in order to check
image depth (must be CV_32F)

* - Change assert in cv::Saliency::StaticSaliency::computeBinaryMap()
- Change normalization factor in cv::Saliency::StaticSaliencyFineGrained::computeSaliencyImpl()
pull/1743/head^2 3.4.3
gdemarcq 6 years ago committed by Alexander Alekhin
parent 1070e7042a
commit 1f6d6f0626
  1. 1
      modules/saliency/src/staticSaliency.cpp
  2. 2
      modules/saliency/src/staticSaliencyFineGrained.cpp

@ -53,6 +53,7 @@ namespace saliency
bool StaticSaliency::computeBinaryMap( InputArray _saliencyMap, OutputArray _binaryMap )
{
Mat saliencyMap = _saliencyMap.getMat();
CV_CheckTypeEQ(saliencyMap.type(), CV_32FC1, "");
Mat labels = Mat::zeros( saliencyMap.rows * saliencyMap.cols, 1, 1 );
Mat samples = Mat_<float>( saliencyMap.rows * saliencyMap.cols, 1 );
Mat centers;

@ -66,7 +66,7 @@ bool StaticSaliencyFineGrained::computeSaliencyImpl(InputArray image, OutputArra
{
Mat dst(Size(image.getMat().cols, image.getMat().rows), CV_8UC1);
calcIntensityChannel(image.getMat(), dst);
dst.copyTo(saliencyMap);
dst.convertTo(saliencyMap, CV_32F, 1.0f/255.0f); // values are in range [0; 1]
#ifdef SALIENCY_DEBUG
// visualize saliency map

Loading…
Cancel
Save