Merged the trunk r8852:8880
This commit is contained in:
@@ -134,49 +134,43 @@ static void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat
|
||||
|
||||
// Calculate the channels of the opponent color space
|
||||
{
|
||||
// (R - G) / sqrt(2)
|
||||
// (R - G)/sqrt(2), but converted to the destination data type
|
||||
MatConstIterator_<signed char> rIt = bgrChannels[2].begin<signed char>();
|
||||
MatConstIterator_<signed char> gIt = bgrChannels[1].begin<signed char>();
|
||||
MatIterator_<unsigned char> dstIt = opponentChannels[0].begin<unsigned char>();
|
||||
float factor = 1.f / sqrt(2.f);
|
||||
for( ; dstIt != opponentChannels[0].end<unsigned char>(); ++rIt, ++gIt, ++dstIt )
|
||||
{
|
||||
int value = static_cast<int>( static_cast<float>(static_cast<int>(*gIt)-static_cast<int>(*rIt)) * factor );
|
||||
if( value < 0 ) value = 0;
|
||||
if( value > 255 ) value = 255;
|
||||
(*dstIt) = static_cast<unsigned char>(value);
|
||||
float value = 0.5f * (static_cast<int>(*gIt) -
|
||||
static_cast<int>(*rIt) + 255);
|
||||
(*dstIt) = static_cast<unsigned char>(value + 0.5f);
|
||||
}
|
||||
}
|
||||
{
|
||||
// (R + G - 2B)/sqrt(6)
|
||||
// (R + G - 2B)/sqrt(6), but converted to the destination data type
|
||||
MatConstIterator_<signed char> rIt = bgrChannels[2].begin<signed char>();
|
||||
MatConstIterator_<signed char> gIt = bgrChannels[1].begin<signed char>();
|
||||
MatConstIterator_<signed char> bIt = bgrChannels[0].begin<signed char>();
|
||||
MatIterator_<unsigned char> dstIt = opponentChannels[1].begin<unsigned char>();
|
||||
float factor = 1.f / sqrt(6.f);
|
||||
for( ; dstIt != opponentChannels[1].end<unsigned char>(); ++rIt, ++gIt, ++bIt, ++dstIt )
|
||||
{
|
||||
int value = static_cast<int>( static_cast<float>(static_cast<int>(*rIt) + static_cast<int>(*gIt) - 2*static_cast<int>(*bIt)) *
|
||||
factor );
|
||||
if( value < 0 ) value = 0;
|
||||
if( value > 255 ) value = 255;
|
||||
(*dstIt) = static_cast<unsigned char>(value);
|
||||
float value = 0.25f * (static_cast<int>(*rIt) + static_cast<int>(*gIt) -
|
||||
2*static_cast<int>(*bIt) + 510);
|
||||
(*dstIt) = static_cast<unsigned char>(value + 0.5f);
|
||||
}
|
||||
}
|
||||
{
|
||||
// (R + G + B)/sqrt(3)
|
||||
// (R + G + B)/sqrt(3), but converted to the destination data type
|
||||
MatConstIterator_<signed char> rIt = bgrChannels[2].begin<signed char>();
|
||||
MatConstIterator_<signed char> gIt = bgrChannels[1].begin<signed char>();
|
||||
MatConstIterator_<signed char> bIt = bgrChannels[0].begin<signed char>();
|
||||
MatIterator_<unsigned char> dstIt = opponentChannels[2].begin<unsigned char>();
|
||||
float factor = 1.f / sqrt(3.f);
|
||||
float factor = 1.f/3.f;
|
||||
for( ; dstIt != opponentChannels[2].end<unsigned char>(); ++rIt, ++gIt, ++bIt, ++dstIt )
|
||||
{
|
||||
int value = static_cast<int>( static_cast<float>(static_cast<int>(*rIt) + static_cast<int>(*gIt) + static_cast<int>(*bIt)) *
|
||||
factor );
|
||||
if( value < 0 ) value = 0;
|
||||
if( value > 255 ) value = 255;
|
||||
(*dstIt) = static_cast<unsigned char>(value);
|
||||
float value = factor * (static_cast<int>(*rIt) +
|
||||
static_cast<int>(*gIt) +
|
||||
static_cast<int>(*bIt));
|
||||
(*dstIt) = static_cast<unsigned char>(value + 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -274,14 +274,14 @@ void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat
|
||||
// allocate descriptor memory, estimate orientations, extract descriptors
|
||||
if( !extAll ) {
|
||||
// extract the best comparisons only
|
||||
descriptors = cv::Mat::zeros(keypoints.size(), FREAK_NB_PAIRS/8, CV_8U);
|
||||
descriptors = cv::Mat::zeros((int)keypoints.size(), FREAK_NB_PAIRS/8, CV_8U);
|
||||
#if CV_SSE2
|
||||
__m128i* ptr= (__m128i*) (descriptors.data+(keypoints.size()-1)*descriptors.step[0]);
|
||||
// binary: 10000000 => char: 128 or hex: 0x80
|
||||
const __m128i binMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80);
|
||||
const __m128i binMask = _mm_set_epi8('\x80', '\x80', '\x80', '\x80',
|
||||
'\x80', '\x80', '\x80', '\x80',
|
||||
'\x80', '\x80', '\x80', '\x80',
|
||||
'\x80', '\x80', '\x80', '\x80');
|
||||
#else
|
||||
std::bitset<FREAK_NB_PAIRS>* ptr = (std::bitset<FREAK_NB_PAIRS>*) (descriptors.data+(keypoints.size()-1)*descriptors.step[0]);
|
||||
#endif
|
||||
@@ -390,7 +390,7 @@ void FREAK::computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat
|
||||
}
|
||||
}
|
||||
else { // extract all possible comparisons for selection
|
||||
descriptors = cv::Mat::zeros(keypoints.size(), 128, CV_8U);
|
||||
descriptors = cv::Mat::zeros((int)keypoints.size(), 128, CV_8U);
|
||||
std::bitset<1024>* ptr = (std::bitset<1024>*) (descriptors.data+(keypoints.size()-1)*descriptors.step[0]);
|
||||
|
||||
for( size_t k = keypoints.size(); k--; ) {
|
||||
@@ -522,16 +522,16 @@ vector<int> FREAK::selectPairs(const std::vector<Mat>& images
|
||||
Mat descriptorsFloat = Mat::zeros(descriptors.rows, 903, CV_32F);
|
||||
|
||||
std::bitset<1024>* ptr = (std::bitset<1024>*) (descriptors.data+(descriptors.rows-1)*descriptors.step[0]);
|
||||
for( size_t m = descriptors.rows; m--; ) {
|
||||
for( size_t n = 903; n--; ) {
|
||||
for( int m = descriptors.rows; m--; ) {
|
||||
for( int n = 903; n--; ) {
|
||||
if( ptr->test(n) == true )
|
||||
descriptorsFloat.at<float>(m,n)=1.0;
|
||||
descriptorsFloat.at<float>(m,n)=1.0f;
|
||||
}
|
||||
--ptr;
|
||||
}
|
||||
|
||||
std::vector<PairStat> pairStat;
|
||||
for( size_t n = 903; n--; ) {
|
||||
for( int n = 903; n--; ) {
|
||||
// the higher the variance, the better --> mean = 0.5
|
||||
PairStat tmp = { fabs( mean(descriptorsFloat.col(n))[0]-0.5 ) ,n};
|
||||
pairStat.push_back(tmp);
|
||||
|
@@ -997,7 +997,7 @@ TEST( Features2d_Detector_Harris, regression )
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_MSER, regression )
|
||||
TEST( Features2d_Detector_MSER, DISABLED_regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-mser", FeatureDetector::create("MSER") );
|
||||
test.safe_run();
|
||||
|
@@ -203,5 +203,5 @@ void CV_MserTest::run(int)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Features2d_MSER, regression) { CV_MserTest test; test.safe_run(); }
|
||||
TEST(Features2d_MSER, DISABLED_regression) { CV_MserTest test; test.safe_run(); }
|
||||
|
||||
|
Reference in New Issue
Block a user