Commit 8fa8fa80 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #233 from vpisarev/features2d_fixes

Features2d fixes
parents c9fb3913 0f38313f
...@@ -351,7 +351,7 @@ void RetinaOCLImpl::setupIPLMagnoChannel(const bool normaliseOutput, const float ...@@ -351,7 +351,7 @@ void RetinaOCLImpl::setupIPLMagnoChannel(const bool normaliseOutput, const float
_retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k; _retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k;
} }
void RetinaOCLImpl::run(const InputArray input) void RetinaOCLImpl::run(InputArray input)
{ {
oclMat &inputMatToConvert = getOclMatRef(input); oclMat &inputMatToConvert = getOclMatRef(input);
bool colorMode = convertToColorPlanes(inputMatToConvert, _inputBuffer); bool colorMode = convertToColorPlanes(inputMatToConvert, _inputBuffer);
......
...@@ -78,7 +78,7 @@ class CV_EXPORTS Saliency : public virtual Algorithm ...@@ -78,7 +78,7 @@ class CV_EXPORTS Saliency : public virtual Algorithm
* \param saliencyMap The computed saliency map. * \param saliencyMap The computed saliency map.
* \return true if the saliency map is computed, false otherwise * \return true if the saliency map is computed, false otherwise
*/ */
bool computeSaliency( const InputArray image, OutputArray saliencyMap ); bool computeSaliency( InputArray image, OutputArray saliencyMap );
/** /**
* \brief Get the name of the specific saliency type * \brief Get the name of the specific saliency type
...@@ -88,7 +88,7 @@ class CV_EXPORTS Saliency : public virtual Algorithm ...@@ -88,7 +88,7 @@ class CV_EXPORTS Saliency : public virtual Algorithm
protected: protected:
virtual bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap ) = 0; virtual bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap ) = 0;
String className; String className;
}; };
...@@ -114,7 +114,7 @@ class CV_EXPORTS StaticSaliency : public virtual Saliency ...@@ -114,7 +114,7 @@ class CV_EXPORTS StaticSaliency : public virtual Saliency
*/ */
bool computeBinaryMap( const Mat& saliencyMap, Mat& binaryMap ); bool computeBinaryMap( const Mat& saliencyMap, Mat& binaryMap );
protected: protected:
virtual bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap )=0; virtual bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap )=0;
}; };
...@@ -123,7 +123,7 @@ class CV_EXPORTS MotionSaliency : public virtual Saliency ...@@ -123,7 +123,7 @@ class CV_EXPORTS MotionSaliency : public virtual Saliency
{ {
protected: protected:
virtual bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap )=0; virtual bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap )=0;
}; };
...@@ -132,7 +132,7 @@ class CV_EXPORTS Objectness : public virtual Saliency ...@@ -132,7 +132,7 @@ class CV_EXPORTS Objectness : public virtual Saliency
{ {
protected: protected:
virtual bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap )=0; virtual bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap )=0;
}; };
......
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
} }
protected: protected:
bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap ); bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap );
int resImWidth; int resImWidth;
int resImHeight; int resImHeight;
...@@ -154,7 +154,7 @@ protected: ...@@ -154,7 +154,7 @@ protected:
The saliency map is given by a single *Mat* (one for each frame of an hypothetical video The saliency map is given by a single *Mat* (one for each frame of an hypothetical video
stream). stream).
*/ */
bool computeSaliencyImpl( const InputArray image, OutputArray saliencyMap ); bool computeSaliencyImpl( InputArray image, OutputArray saliencyMap );
private: private:
...@@ -268,7 +268,7 @@ protected: ...@@ -268,7 +268,7 @@ protected:
specialized algorithm, the objectnessBoundingBox is a *vector\<Vec4i\>*. Each bounding box is specialized algorithm, the objectnessBoundingBox is a *vector\<Vec4i\>*. Each bounding box is
represented by a *Vec4i* for (minX, minY, maxX, maxY). represented by a *Vec4i* for (minX, minY, maxX, maxY).
*/ */
bool computeSaliencyImpl( const InputArray image, OutputArray objectnessBoundingBox ); bool computeSaliencyImpl( InputArray image, OutputArray objectnessBoundingBox );
private: private:
......
...@@ -460,7 +460,7 @@ void ObjectnessBING::write() const ...@@ -460,7 +460,7 @@ void ObjectnessBING::write() const
} }
bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray objectnessBoundingBox ) bool ObjectnessBING::computeSaliencyImpl( InputArray image, OutputArray objectnessBoundingBox )
{ {
ValStructVec<float, Vec4i> finalBoxes; ValStructVec<float, Vec4i> finalBoxes;
getObjBndBoxesForSingleImage( image.getMat(), finalBoxes, 250 ); getObjBndBoxesForSingleImage( image.getMat(), finalBoxes, 250 );
......
...@@ -501,7 +501,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, ...@@ -501,7 +501,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask,
return true; return true;
} }
bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( const InputArray image, OutputArray saliencyMap ) bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( InputArray image, OutputArray saliencyMap )
{ {
Mat highResBFMask; Mat highResBFMask;
Mat lowResBFMask; Mat lowResBFMask;
......
...@@ -62,7 +62,7 @@ Ptr<Saliency> Saliency::create( const String& saliencyType ) ...@@ -62,7 +62,7 @@ Ptr<Saliency> Saliency::create( const String& saliencyType )
return Ptr<Saliency>(); return Ptr<Saliency>();
} }
bool Saliency::computeSaliency( const InputArray image, OutputArray saliencyMap ) bool Saliency::computeSaliency( InputArray image, OutputArray saliencyMap )
{ {
if( image.empty() ) if( image.empty() )
return false; return false;
......
...@@ -73,7 +73,7 @@ void StaticSaliencySpectralResidual::write( cv::FileStorage& /*fs*/) const ...@@ -73,7 +73,7 @@ void StaticSaliencySpectralResidual::write( cv::FileStorage& /*fs*/) const
//params.write( fs ); //params.write( fs );
} }
bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image, OutputArray saliencyMap ) bool StaticSaliencySpectralResidual::computeSaliencyImpl( InputArray image, OutputArray saliencyMap )
{ {
Mat grayTemp, grayDown; Mat grayTemp, grayDown;
std::vector<Mat> mv; std::vector<Mat> mv;
......
...@@ -1240,3 +1240,31 @@ TEST(DISABLED_Features2d_SURF_using_mask, regression) ...@@ -1240,3 +1240,31 @@ TEST(DISABLED_Features2d_SURF_using_mask, regression)
FeatureDetectorUsingMaskTest test(SURF::create()); FeatureDetectorUsingMaskTest test(SURF::create());
test.safe_run(); test.safe_run();
} }
TEST( XFeatures2d_DescriptorExtractor, batch )
{
string path = string(cvtest::TS::ptr()->get_data_path() + "detectors_descriptors_evaluation/images_datasets/graf");
vector<Mat> imgs, descriptors;
vector<vector<KeyPoint> > keypoints;
int i, n = 6;
Ptr<SIFT> sift = SIFT::create();
for( i = 0; i < n; i++ )
{
string imgname = format("%s/img%d.png", path.c_str(), i+1);
Mat img = imread(imgname, 0);
imgs.push_back(img);
}
sift->detect(imgs, keypoints);
sift->compute(imgs, keypoints, descriptors);
ASSERT_EQ((int)keypoints.size(), n);
ASSERT_EQ((int)descriptors.size(), n);
for( i = 0; i < n; i++ )
{
EXPECT_GT((int)keypoints[i].size(), 100);
EXPECT_GT(descriptors[i].rows, 100);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment