2014-05-11 23:57:08 +00:00
/*
2014-08-06 13:43:29 +00:00
Copyright ( c ) 2011 - 2014 , Mathieu Labbe - IntRoLab - Universite de Sherbrooke
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
* Redistributions of source code must retain the above copyright
notice , this list of conditions and the following disclaimer .
* Redistributions in binary form must reproduce the above copyright
notice , this list of conditions and the following disclaimer in the
documentation and / or other materials provided with the distribution .
* Neither the name of the Universite de Sherbrooke nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2014-08-11 15:49:53 +00:00
DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
2014-08-06 13:43:29 +00:00
DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES
( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ;
LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
2014-05-11 23:57:08 +00:00
2014-07-31 20:11:46 +00:00
# include "find_object/Settings.h"
2015-01-05 23:11:15 +00:00
# include "find_object/utilite/ULogger.h"
2014-05-11 23:57:08 +00:00
# include "Vocabulary.h"
# include <QtCore/QVector>
2016-05-06 16:54:18 -04:00
# include <QDataStream>
2014-05-11 23:57:08 +00:00
# include <stdio.h>
2015-06-23 16:38:47 -04:00
# if CV_MAJOR_VERSION < 3
2014-10-24 02:46:03 +00:00
# include <opencv2/gpu/gpu.hpp>
2015-06-23 16:38:47 -04:00
# define CVCUDA cv::gpu
# else
# include <opencv2/core/cuda.hpp>
# define CVCUDA cv::cuda
# ifdef HAVE_OPENCV_CUDAFEATURES2D
# include <opencv2/cudafeatures2d.hpp>
# endif
# endif
2014-05-11 23:57:08 +00:00
2014-08-06 13:43:29 +00:00
namespace find_object {
2014-05-11 23:57:08 +00:00
Vocabulary : : Vocabulary ( )
{
}
Vocabulary : : ~ Vocabulary ( )
{
}
void Vocabulary : : clear ( )
{
wordToObjects_ . clear ( ) ;
2015-06-23 18:21:30 -04:00
notIndexedDescriptors_ = cv : : Mat ( ) ;
2014-05-12 22:58:57 +00:00
notIndexedWordIds_ . clear ( ) ;
2015-06-23 18:21:30 -04:00
if ( Settings : : getGeneral_vocabularyFixed ( ) & & Settings : : getGeneral_invertedSearch ( ) )
{
2015-07-07 16:49:38 -04:00
this - > update ( ) ; // if vocabulary structure has changed
2015-06-23 18:21:30 -04:00
// If the dictionary is fixed, don't clear indexed descriptors
return ;
}
indexedDescriptors_ = cv : : Mat ( ) ;
2014-05-11 23:57:08 +00:00
}
2015-07-07 16:49:38 -04:00
void Vocabulary : : save ( QDataStream & streamSessionPtr ) const
2015-01-09 22:44:16 +00:00
{
2015-07-07 16:49:38 -04:00
// save index
streamSessionPtr < < wordToObjects_ ;
// save words
qint64 dataSize = indexedDescriptors_ . elemSize ( ) * indexedDescriptors_ . cols * indexedDescriptors_ . rows ;
streamSessionPtr < < indexedDescriptors_ . rows < <
indexedDescriptors_ . cols < <
indexedDescriptors_ . type ( ) < <
dataSize ;
streamSessionPtr < < QByteArray ( ( char * ) indexedDescriptors_ . data , dataSize ) ;
2015-01-09 22:44:16 +00:00
}
2015-07-07 16:49:38 -04:00
void Vocabulary : : load ( QDataStream & streamSessionPtr )
2015-01-09 22:44:16 +00:00
{
// load index
2015-07-07 16:49:38 -04:00
streamSessionPtr > > wordToObjects_ ;
2015-01-09 22:44:16 +00:00
// load words
int rows , cols , type ;
qint64 dataSize ;
2015-07-07 16:49:38 -04:00
streamSessionPtr > > rows > > cols > > type > > dataSize ;
2015-01-09 22:44:16 +00:00
QByteArray data ;
2015-07-07 16:49:38 -04:00
streamSessionPtr > > data ;
2015-01-09 22:44:16 +00:00
indexedDescriptors_ = cv : : Mat ( rows , cols , type , data . data ( ) ) . clone ( ) ;
update ( ) ;
}
2015-07-07 16:49:38 -04:00
bool Vocabulary : : save ( const QString & filename ) const
{
// save descriptors
cv : : FileStorage fs ( filename . toStdString ( ) , cv : : FileStorage : : WRITE ) ;
if ( fs . isOpened ( ) )
{
fs < < " Descriptors " < < indexedDescriptors_ ;
return true ;
}
else
{
UERROR ( " Failed to open vocabulary file \" %s \" " , filename . toStdString ( ) . c_str ( ) ) ;
}
return false ;
}
bool Vocabulary : : load ( const QString & filename )
{
// save descriptors
cv : : FileStorage fs ( filename . toStdString ( ) , cv : : FileStorage : : READ ) ;
if ( fs . isOpened ( ) )
{
cv : : Mat tmp ;
fs [ " Descriptors " ] > > tmp ;
if ( ! tmp . empty ( ) )
{
// clear index
wordToObjects_ . clear ( ) ;
indexedDescriptors_ = tmp ;
update ( ) ;
return true ;
}
else
{
UERROR ( " Failed to read \" Descriptors \" matrix field (doesn't exist or is empty) from vocabulary file \" %s \" " , filename . toStdString ( ) . c_str ( ) ) ;
}
}
else
{
UERROR ( " Failed to open vocabulary file \" %s \" " , filename . toStdString ( ) . c_str ( ) ) ;
}
return false ;
}
2016-02-01 12:53:16 -05:00
QMultiMap < int , int > Vocabulary : : addWords ( const cv : : Mat & descriptorsIn , int objectId )
2014-05-11 23:57:08 +00:00
{
QMultiMap < int , int > words ;
2016-02-01 12:53:16 -05:00
if ( descriptorsIn . empty ( ) )
2014-05-11 23:57:08 +00:00
{
return words ;
}
2016-02-01 12:53:16 -05:00
cv : : Mat descriptors ;
if ( descriptorsIn . type ( ) = = CV_8U & & Settings : : getNearestNeighbor_7ConvertBinToFloat ( ) )
{
descriptorsIn . convertTo ( descriptors , CV_32F ) ;
}
else
{
descriptors = descriptorsIn ;
}
2015-06-23 18:21:30 -04:00
if ( Settings : : getGeneral_vocabularyIncremental ( ) | | Settings : : getGeneral_vocabularyFixed ( ) )
2014-05-11 23:57:08 +00:00
{
int k = 2 ;
2014-05-12 22:58:57 +00:00
cv : : Mat results ;
cv : : Mat dists ;
2014-05-11 23:57:08 +00:00
bool globalSearch = false ;
2014-05-12 22:58:57 +00:00
if ( ! indexedDescriptors_ . empty ( ) & & indexedDescriptors_ . rows > = ( int ) k )
2014-05-11 23:57:08 +00:00
{
2015-07-07 16:49:38 -04:00
if ( indexedDescriptors_ . type ( ) ! = descriptors . type ( ) | | indexedDescriptors_ . cols ! = descriptors . cols )
{
if ( Settings : : getGeneral_vocabularyFixed ( ) )
{
UERROR ( " Descriptors (type=%d size=%d) to search in vocabulary are not the same type/size as those in the vocabulary (type=%d size=%d)! Empty words returned. " ,
descriptors . type ( ) , descriptors . cols , indexedDescriptors_ . type ( ) , indexedDescriptors_ . cols ) ;
return words ;
}
else
{
UFATAL ( " Descriptors (type=%d size=%d) to search in vocabulary are not the same type/size as those in the vocabulary (type=%d size=%d)! " ,
descriptors . type ( ) , descriptors . cols , indexedDescriptors_ . type ( ) , indexedDescriptors_ . cols ) ;
}
}
2014-10-24 02:46:03 +00:00
this - > search ( descriptors , results , dists , k ) ;
2014-05-12 22:58:57 +00:00
if ( dists . type ( ) = = CV_32S )
{
cv : : Mat temp ;
dists . convertTo ( temp , CV_32F ) ;
dists = temp ;
}
2014-05-11 23:57:08 +00:00
globalSearch = true ;
}
2015-06-23 18:21:30 -04:00
if ( ! Settings : : getGeneral_vocabularyFixed ( ) )
{
notIndexedWordIds_ . reserve ( notIndexedWordIds_ . size ( ) + descriptors . rows ) ;
notIndexedDescriptors_ . reserve ( notIndexedDescriptors_ . rows + descriptors . rows ) ;
}
2014-05-11 23:57:08 +00:00
int matches = 0 ;
for ( int i = 0 ; i < descriptors . rows ; + + i )
{
2014-06-21 00:05:23 +00:00
QMultiMap < float , int > fullResults ; // nearest descriptors sorted by distance
2014-05-13 14:41:36 +00:00
if ( notIndexedDescriptors_ . rows )
2014-05-11 23:57:08 +00:00
{
2015-01-05 23:11:15 +00:00
UASSERT ( notIndexedDescriptors_ . type ( ) = = descriptors . type ( ) & & notIndexedDescriptors_ . cols = = descriptors . cols ) ;
2014-05-12 22:58:57 +00:00
2014-05-11 23:57:08 +00:00
// Check if this descriptor matches with a word not already added to the vocabulary
2014-05-12 22:58:57 +00:00
// Do linear search only
cv : : Mat tmpResults ;
cv : : Mat tmpDists ;
2014-05-11 23:57:08 +00:00
if ( descriptors . type ( ) = = CV_8U )
{
2014-05-12 22:58:57 +00:00
//normType – One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
// preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be
// used with ORB, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB
// when WTA_K==3 or 4 (see ORB::ORB constructor description).
int normType = cv : : NORM_HAMMING ;
if ( Settings : : currentDescriptorType ( ) . compare ( " ORB " ) & &
( Settings : : getFeature2D_ORB_WTA_K ( ) = = 3 | | Settings : : getFeature2D_ORB_WTA_K ( ) = = 4 ) )
{
normType = cv : : NORM_HAMMING2 ;
}
cv : : batchDistance ( descriptors . row ( i ) ,
2014-05-13 14:41:36 +00:00
notIndexedDescriptors_ ,
2014-05-12 22:58:57 +00:00
tmpDists ,
CV_32S ,
tmpResults ,
normType ,
2014-05-13 14:41:36 +00:00
notIndexedDescriptors_ . rows > = k ? k : 1 ,
2014-05-12 22:58:57 +00:00
cv : : Mat ( ) ,
0 ,
false ) ;
2014-05-11 23:57:08 +00:00
}
else
{
2014-05-12 22:58:57 +00:00
cv : : flann : : Index tmpIndex ;
2016-09-03 19:24:54 -04:00
# if CV_MAJOR_VERSION == 2 and CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >= 12
2016-09-22 12:24:25 -04:00
tmpIndex . build ( notIndexedDescriptors_ , cv : : Mat ( ) , cv : : flann : : LinearIndexParams ( ) , cvflann : : FLANN_DIST_L2 ) ;
2016-03-06 14:12:28 -05:00
# else
2016-09-22 12:24:25 -04:00
tmpIndex . build ( notIndexedDescriptors_ , cv : : flann : : LinearIndexParams ( ) , cvflann : : FLANN_DIST_L2 ) ;
2016-03-06 14:12:28 -05:00
# endif
2016-09-22 12:24:25 -04:00
tmpIndex . knnSearch ( descriptors . row ( i ) , tmpResults , tmpDists , notIndexedDescriptors_ . rows > 1 ? k : 1 , cvflann : : FLANN_DIST_L2 ) ;
2014-05-11 23:57:08 +00:00
}
2014-05-12 22:58:57 +00:00
if ( tmpDists . type ( ) = = CV_32S )
2014-05-11 23:57:08 +00:00
{
2014-05-12 22:58:57 +00:00
cv : : Mat temp ;
tmpDists . convertTo ( temp , CV_32F ) ;
tmpDists = temp ;
}
2014-05-13 14:41:36 +00:00
for ( int j = 0 ; j < tmpResults . cols ; + + j )
2014-05-12 22:58:57 +00:00
{
if ( tmpResults . at < int > ( 0 , j ) > = 0 )
{
//printf("local i=%d, j=%d, tmpDist=%f tmpResult=%d\n", i ,j, tmpDists.at<float>(0,j), tmpResults.at<int>(0,j));
2014-05-13 14:41:36 +00:00
fullResults . insert ( tmpDists . at < float > ( 0 , j ) , notIndexedWordIds_ . at ( tmpResults . at < int > ( 0 , j ) ) ) ;
2014-05-12 22:58:57 +00:00
}
2014-05-11 23:57:08 +00:00
}
}
if ( globalSearch )
{
for ( int j = 0 ; j < k ; + + j )
{
2014-05-12 22:58:57 +00:00
if ( results . at < int > ( i , j ) > = 0 )
{
//printf("global i=%d, j=%d, dist=%f\n", i ,j, dists.at<float>(i,j));
fullResults . insert ( dists . at < float > ( i , j ) , results . at < int > ( i , j ) ) ;
}
2014-05-11 23:57:08 +00:00
}
}
2015-06-23 18:21:30 -04:00
bool matched = false ;
if ( Settings : : getNearestNeighbor_3nndrRatioUsed ( ) & &
fullResults . size ( ) > = 2 & &
2014-05-11 23:57:08 +00:00
fullResults . begin ( ) . key ( ) < = Settings : : getNearestNeighbor_4nndrRatio ( ) * ( + + fullResults . begin ( ) ) . key ( ) )
{
2015-06-23 18:21:30 -04:00
matched = true ;
}
if ( ( matched | | ! Settings : : getNearestNeighbor_3nndrRatioUsed ( ) ) & &
Settings : : getNearestNeighbor_5minDistanceUsed ( ) )
{
if ( fullResults . begin ( ) . key ( ) < = Settings : : getNearestNeighbor_6minDistance ( ) )
{
matched = true ;
}
else
{
matched = false ;
}
}
if ( ! matched & & ! Settings : : getNearestNeighbor_3nndrRatioUsed ( ) & & ! Settings : : getNearestNeighbor_5minDistanceUsed ( ) )
{
matched = true ; // no criterion, match to the nearest descriptor
2014-05-11 23:57:08 +00:00
}
2015-06-23 18:21:30 -04:00
if ( matched )
2014-05-11 23:57:08 +00:00
{
words . insert ( fullResults . begin ( ) . value ( ) , i ) ;
2014-07-31 19:02:31 +00:00
wordToObjects_ . insert ( fullResults . begin ( ) . value ( ) , objectId ) ;
2014-05-11 23:57:08 +00:00
+ + matches ;
}
2015-06-23 18:21:30 -04:00
else if ( ! Settings : : getGeneral_invertedSearch ( ) | | ! Settings : : getGeneral_vocabularyFixed ( ) )
2014-05-11 23:57:08 +00:00
{
2014-05-13 14:41:36 +00:00
//concatenate new words
notIndexedWordIds_ . push_back ( indexedDescriptors_ . rows + notIndexedDescriptors_ . rows ) ;
notIndexedDescriptors_ . push_back ( descriptors . row ( i ) ) ;
words . insert ( notIndexedWordIds_ . back ( ) , i ) ;
2014-07-31 19:02:31 +00:00
wordToObjects_ . insert ( notIndexedWordIds_ . back ( ) , objectId ) ;
2014-05-11 23:57:08 +00:00
}
2015-06-23 18:21:30 -04:00
else
{
words . insert ( - 1 , i ) ; // invalid word
}
2014-05-11 23:57:08 +00:00
}
}
else
{
for ( int i = 0 ; i < descriptors . rows ; + + i )
{
2014-07-31 19:02:31 +00:00
wordToObjects_ . insert ( indexedDescriptors_ . rows + notIndexedDescriptors_ . rows + i , objectId ) ;
2014-05-12 22:58:57 +00:00
words . insert ( indexedDescriptors_ . rows + notIndexedDescriptors_ . rows + i , i ) ;
notIndexedWordIds_ . push_back ( indexedDescriptors_ . rows + notIndexedDescriptors_ . rows + i ) ;
2014-05-11 23:57:08 +00:00
}
//just concatenate descriptors
2014-05-13 14:41:36 +00:00
notIndexedDescriptors_ . push_back ( descriptors ) ;
2014-05-11 23:57:08 +00:00
}
return words ;
}
void Vocabulary : : update ( )
{
2014-05-12 22:58:57 +00:00
if ( ! notIndexedDescriptors_ . empty ( ) )
{
2015-01-05 23:11:15 +00:00
if ( ! indexedDescriptors_ . empty ( ) )
{
UASSERT ( indexedDescriptors_ . cols = = notIndexedDescriptors_ . cols & &
indexedDescriptors_ . type ( ) = = notIndexedDescriptors_ . type ( ) ) ;
}
2014-05-12 22:58:57 +00:00
//concatenate descriptors
2014-05-13 14:41:36 +00:00
indexedDescriptors_ . push_back ( notIndexedDescriptors_ ) ;
2014-05-12 22:58:57 +00:00
notIndexedDescriptors_ = cv : : Mat ( ) ;
notIndexedWordIds_ . clear ( ) ;
}
2014-10-24 02:46:03 +00:00
if ( ! indexedDescriptors_ . empty ( ) & & ! Settings : : isBruteForceNearestNeighbor ( ) )
2014-05-11 23:57:08 +00:00
{
cv : : flann : : IndexParams * params = Settings : : createFlannIndexParams ( ) ;
2016-09-03 19:24:54 -04:00
# if CV_MAJOR_VERSION == 2 and CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >= 12
2016-03-06 14:12:28 -05:00
flannIndex_ . build ( indexedDescriptors_ , cv : : Mat ( ) , * params , Settings : : getFlannDistanceType ( ) ) ;
# else
2014-05-12 22:58:57 +00:00
flannIndex_ . build ( indexedDescriptors_ , * params , Settings : : getFlannDistanceType ( ) ) ;
2016-03-06 14:12:28 -05:00
# endif
2014-05-11 23:57:08 +00:00
delete params ;
}
}
2016-02-01 12:53:16 -05:00
void Vocabulary : : search ( const cv : : Mat & descriptorsIn , cv : : Mat & results , cv : : Mat & dists , int k )
2014-05-11 23:57:08 +00:00
{
2014-05-12 22:58:57 +00:00
if ( ! indexedDescriptors_ . empty ( ) )
2014-05-11 23:57:08 +00:00
{
2016-02-01 12:53:16 -05:00
cv : : Mat descriptors ;
if ( descriptorsIn . type ( ) = = CV_8U & & Settings : : getNearestNeighbor_7ConvertBinToFloat ( ) )
{
descriptorsIn . convertTo ( descriptors , CV_32F ) ;
}
else
{
descriptors = descriptorsIn ;
}
2015-01-05 23:11:15 +00:00
UASSERT ( descriptors . type ( ) = = indexedDescriptors_ . type ( ) & & descriptors . cols = = indexedDescriptors_ . cols ) ;
2014-05-12 22:58:57 +00:00
2014-10-24 02:46:03 +00:00
if ( Settings : : isBruteForceNearestNeighbor ( ) )
{
std : : vector < std : : vector < cv : : DMatch > > matches ;
2015-06-23 16:38:47 -04:00
if ( Settings : : getNearestNeighbor_BruteForce_gpu ( ) & & CVCUDA : : getCudaEnabledDeviceCount ( ) )
2014-10-24 02:46:03 +00:00
{
2015-06-23 16:38:47 -04:00
CVCUDA : : GpuMat newDescriptorsGpu ( descriptors ) ;
CVCUDA : : GpuMat lastDescriptorsGpu ( indexedDescriptors_ ) ;
# if CV_MAJOR_VERSION < 3
2014-10-24 02:46:03 +00:00
if ( indexedDescriptors_ . type ( ) = = CV_8U )
{
2015-06-23 16:38:47 -04:00
CVCUDA : : BruteForceMatcher_GPU < cv : : Hamming > gpuMatcher ;
2014-10-24 02:46:03 +00:00
gpuMatcher . knnMatch ( newDescriptorsGpu , lastDescriptorsGpu , matches , k ) ;
}
else
{
2015-06-23 16:38:47 -04:00
CVCUDA : : BruteForceMatcher_GPU < cv : : L2 < float > > gpuMatcher ;
2014-10-24 02:46:03 +00:00
gpuMatcher . knnMatch ( newDescriptorsGpu , lastDescriptorsGpu , matches , k ) ;
}
2015-06-23 16:38:47 -04:00
# else
# ifdef HAVE_OPENCV_CUDAFEATURES2D
cv : : Ptr < cv : : cuda : : DescriptorMatcher > gpuMatcher ;
if ( indexedDescriptors_ . type ( ) = = CV_8U )
{
gpuMatcher = cv : : cuda : : DescriptorMatcher : : createBFMatcher ( cv : : NORM_HAMMING ) ;
gpuMatcher - > knnMatch ( newDescriptorsGpu , lastDescriptorsGpu , matches , k ) ;
}
else
{
gpuMatcher = cv : : cuda : : DescriptorMatcher : : createBFMatcher ( cv : : NORM_L2 ) ;
2017-09-14 21:41:00 -04:00
gpuMatcher - > knnMatch ( newDescriptorsGpu , lastDescriptorsGpu , matches , k ) ;
2015-06-23 16:38:47 -04:00
}
2017-09-14 21:41:00 -04:00
# else
UERROR ( " OpenCV3 is not built with CUDAFEATURES2D module, cannot do brute force matching on GPU! " ) ;
2015-06-23 16:38:47 -04:00
# endif
# endif
2014-10-24 02:46:03 +00:00
}
else
{
cv : : BFMatcher matcher ( indexedDescriptors_ . type ( ) = = CV_8U ? cv : : NORM_HAMMING : cv : : NORM_L2 ) ;
matcher . knnMatch ( descriptors , indexedDescriptors_ , matches , k ) ;
}
//convert back to matrix style
2015-03-02 16:39:48 +00:00
results = cv : : Mat ( ( int ) matches . size ( ) , k , CV_32SC1 ) ;
dists = cv : : Mat ( ( int ) matches . size ( ) , k , CV_32FC1 ) ;
2014-10-24 02:46:03 +00:00
for ( unsigned int i = 0 ; i < matches . size ( ) ; + + i )
{
for ( int j = 0 ; j < k ; + + j )
{
results . at < int > ( i , j ) = matches [ i ] . at ( j ) . trainIdx ;
dists . at < float > ( i , j ) = matches [ i ] . at ( j ) . distance ;
}
}
}
else
{
2017-10-04 10:58:00 -04:00
flannIndex_ . knnSearch ( descriptors , results , dists , k ,
cv : : flann : : SearchParams (
Settings : : getNearestNeighbor_search_checks ( ) ,
Settings : : getNearestNeighbor_search_eps ( ) ,
Settings : : getNearestNeighbor_search_sorted ( ) ) ) ;
2014-10-24 02:46:03 +00:00
}
2014-05-12 22:58:57 +00:00
if ( dists . type ( ) = = CV_32S )
{
cv : : Mat temp ;
dists . convertTo ( temp , CV_32F ) ;
dists = temp ;
}
2014-05-11 23:57:08 +00:00
}
}
2014-08-06 13:43:29 +00:00
} // namespace find_object