mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
This commit is contained in:
parent
1d7b9750c0
commit
cc1c613313
@ -285,11 +285,11 @@ void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat>& oppo
|
||||
// Calculate the channels of the opponent color space
|
||||
{
|
||||
// (R - G) / sqrt(2)
|
||||
MatConstIterator_<char> rIt = bgrChannels[2].begin<char>();
|
||||
MatConstIterator_<char> gIt = bgrChannels[1].begin<char>();
|
||||
MatIterator_<char> dstIt = opponentChannels[0].begin<char>();
|
||||
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<char>(); ++rIt, ++gIt, ++dstIt )
|
||||
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;
|
||||
@ -299,12 +299,12 @@ void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat>& oppo
|
||||
}
|
||||
{
|
||||
// (R + G - 2B)/sqrt(6)
|
||||
MatConstIterator_<char> rIt = bgrChannels[2].begin<char>();
|
||||
MatConstIterator_<char> gIt = bgrChannels[1].begin<char>();
|
||||
MatConstIterator_<char> bIt = bgrChannels[0].begin<char>();
|
||||
MatIterator_<char> dstIt = opponentChannels[1].begin<char>();
|
||||
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<char>(); ++rIt, ++gIt, ++bIt, ++dstIt )
|
||||
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 );
|
||||
@ -315,12 +315,12 @@ void convertBGRImageToOpponentColorSpace( const Mat& bgrImage, vector<Mat>& oppo
|
||||
}
|
||||
{
|
||||
// (R + G + B)/sqrt(3)
|
||||
MatConstIterator_<char> rIt = bgrChannels[2].begin<char>();
|
||||
MatConstIterator_<char> gIt = bgrChannels[1].begin<char>();
|
||||
MatConstIterator_<char> bIt = bgrChannels[0].begin<char>();
|
||||
MatIterator_<char> dstIt = opponentChannels[2].begin<char>();
|
||||
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);
|
||||
for( ; dstIt != opponentChannels[2].end<char>(); ++rIt, ++gIt, ++bIt, ++dstIt )
|
||||
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 );
|
||||
|
@ -403,6 +403,8 @@ protected:
|
||||
if( calcDescriptors.rows != (int)keypoints.size() )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "Count of computed descriptors and keypoints count must be equal.\n" );
|
||||
ts->printf( cvtest::TS::LOG, "Count of keypoints is %d.\n", (int)keypoints.size() );
|
||||
ts->printf( cvtest::TS::LOG, "Count of computed descriptors is %d.\n", calcDescriptors.rows );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
|
||||
return;
|
||||
}
|
||||
@ -410,6 +412,10 @@ protected:
|
||||
if( calcDescriptors.cols != dextractor->descriptorSize() || calcDescriptors.type() != dextractor->descriptorType() )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "Incorrect descriptor size or descriptor type.\n" );
|
||||
ts->printf( cvtest::TS::LOG, "Expected size is %d.\n", dextractor->descriptorSize() );
|
||||
ts->printf( cvtest::TS::LOG, "Calculated size is %d.\n", calcDescriptors.cols );
|
||||
ts->printf( cvtest::TS::LOG, "Expected type is %d.\n", dextractor->descriptorType() );
|
||||
ts->printf( cvtest::TS::LOG, "Calculated type is %d.\n", calcDescriptors.type() );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user