Commit 0236befc authored by Patrick Snape's avatar Patrick Snape

Line descriptor: binary_descriptor - vector.data()

vector.data() does not exist in MSVC<2012, so I changed it to
&vector.front() which has the same effect (pointer to the first
element in the vector).
parent 172fdb31
...@@ -653,7 +653,7 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector<KeyLine>& k ...@@ -653,7 +653,7 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector<KeyLine>& k
uchar* pointerToRow = descriptors.ptr( originalIndex ); uchar* pointerToRow = descriptors.ptr( originalIndex );
/* get LBD data */ /* get LBD data */
float* desVec = sl[k][lineC].descriptor.data(); float* desVec = &sl[k][lineC].descriptor.front();
/* fill current row with binary descriptor */ /* fill current row with binary descriptor */
for ( int comb = 0; comb < 32; comb++ ) for ( int comb = 0; comb < 32; comb++ )
...@@ -1241,7 +1241,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1241,7 +1241,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
/* construct line descriptor */ /* construct line descriptor */
pSingleLine->descriptor.resize( descriptor_size ); pSingleLine->descriptor.resize( descriptor_size );
desVec = pSingleLine->descriptor.data(); desVec = &pSingleLine->descriptor.front();
short desID; short desID;
...@@ -1280,7 +1280,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1280,7 +1280,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
float tempM, tempS; float tempM, tempS;
tempM = 0; tempM = 0;
tempS = 0; tempS = 0;
desVec = pSingleLine->descriptor.data(); desVec = &pSingleLine->descriptor.front();
int base = 0; int base = 0;
for ( short i = 0; i < (short) ( NUM_OF_BANDS * 8 ); ++base, i = (short) ( base * 8 ) ) for ( short i = 0; i < (short) ( NUM_OF_BANDS * 8 ); ++base, i = (short) ( base * 8 ) )
...@@ -1297,7 +1297,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1297,7 +1297,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
tempM = 1 / sqrt( tempM ); tempM = 1 / sqrt( tempM );
tempS = 1 / sqrt( tempS ); tempS = 1 / sqrt( tempS );
desVec = pSingleLine->descriptor.data(); desVec = &pSingleLine->descriptor.front();
base = 0; base = 0;
for ( short i = 0; i < (short) ( NUM_OF_BANDS * 8 ); ++base, i = (short) ( base * 8 ) ) for ( short i = 0; i < (short) ( NUM_OF_BANDS * 8 ); ++base, i = (short) ( base * 8 ) )
{ {
...@@ -1315,7 +1315,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1315,7 +1315,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
* a threshold is used to limit the value of element in the unit feature * a threshold is used to limit the value of element in the unit feature
* vector no larger than this threshold. In Z.Wang's work, a value of 0.4 is found * vector no larger than this threshold. In Z.Wang's work, a value of 0.4 is found
* empirically to be a proper threshold.*/ * empirically to be a proper threshold.*/
desVec = pSingleLine->descriptor.data(); desVec = &pSingleLine->descriptor.front();
for ( short i = 0; i < descriptor_size; i++ ) for ( short i = 0; i < descriptor_size; i++ )
{ {
if( desVec[i] > 0.4 ) if( desVec[i] > 0.4 )
...@@ -1344,7 +1344,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1344,7 +1344,7 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
for ( int g = 0; g < 32; g++ ) for ( int g = 0; g < 32; g++ )
{ {
/* get LBD data */ /* get LBD data */
float* des_Vec = keyLines[lineIDInScaleVec][0].descriptor.data(); float* des_Vec = &keyLines[lineIDInScaleVec][0].descriptor.front();
*pointerToRow = des_Vec[g]; *pointerToRow = des_Vec[g];
pointerToRow++; pointerToRow++;
...@@ -2204,9 +2204,9 @@ int BinaryDescriptor::EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &e ...@@ -2204,9 +2204,9 @@ int BinaryDescriptor::EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &e
edgeChains.xCors.resize( offsetPFirst + offsetPSecond ); edgeChains.xCors.resize( offsetPFirst + offsetPSecond );
edgeChains.yCors.resize( offsetPFirst + offsetPSecond ); edgeChains.yCors.resize( offsetPFirst + offsetPSecond );
edgeChains.sId.resize( offsetPS + 1 ); edgeChains.sId.resize( offsetPS + 1 );
unsigned int *pxCors = edgeChains.xCors.data(); unsigned int *pxCors = &edgeChains.xCors.front();
unsigned int *pyCors = edgeChains.yCors.data(); unsigned int *pyCors = &edgeChains.yCors.front();
unsigned int *psId = edgeChains.sId.data(); unsigned int *psId = &edgeChains.sId.front();
offsetPFirst = 0; offsetPFirst = 0;
offsetPSecond = 0; offsetPSecond = 0;
unsigned int indexInCors = 0; unsigned int indexInCors = 0;
...@@ -2252,12 +2252,12 @@ int BinaryDescriptor::EDLineDetector::EDline( cv::Mat &image, LineChains &lines ...@@ -2252,12 +2252,12 @@ int BinaryDescriptor::EDLineDetector::EDline( cv::Mat &image, LineChains &lines
lines.xCors.resize( linePixelID ); lines.xCors.resize( linePixelID );
lines.yCors.resize( linePixelID ); lines.yCors.resize( linePixelID );
lines.sId.resize( 5 * edges.numOfEdges ); lines.sId.resize( 5 * edges.numOfEdges );
unsigned int *pEdgeXCors = edges.xCors.data(); unsigned int *pEdgeXCors = &edges.xCors.front();
unsigned int *pEdgeYCors = edges.yCors.data(); unsigned int *pEdgeYCors = &edges.yCors.front();
unsigned int *pEdgeSID = edges.sId.data(); unsigned int *pEdgeSID = &edges.sId.front();
unsigned int *pLineXCors = lines.xCors.data(); unsigned int *pLineXCors = &lines.xCors.front();
unsigned int *pLineYCors = lines.yCors.data(); unsigned int *pLineYCors = &lines.yCors.front();
unsigned int *pLineSID = lines.sId.data(); unsigned int *pLineSID = &lines.sId.front();
logNT_ = 2.0 * ( log10( (double) imageWidth ) + log10( (double) imageHeight ) ); logNT_ = 2.0 * ( log10( (double) imageWidth ) + log10( (double) imageHeight ) );
double lineFitErr = 0; //the line fit error; double lineFitErr = 0; //the line fit error;
std::vector<double> lineEquation( 2, 0 ); std::vector<double> lineEquation( 2, 0 );
...@@ -2732,9 +2732,9 @@ int BinaryDescriptor::EDLineDetector::EDline( cv::Mat &image ) ...@@ -2732,9 +2732,9 @@ int BinaryDescriptor::EDLineDetector::EDline( cv::Mat &image )
lineSalience_.resize( lines_.numOfLines ); lineSalience_.resize( lines_.numOfLines );
unsigned char *pgImg = gImgWO_.ptr(); unsigned char *pgImg = gImgWO_.ptr();
unsigned int indexInLineArray; unsigned int indexInLineArray;
unsigned int *pXCor = lines_.xCors.data(); unsigned int *pXCor = &lines_.xCors.front();
unsigned int *pYCor = lines_.yCors.data(); unsigned int *pYCor = &lines_.yCors.front();
unsigned int *pSID = lines_.sId.data(); unsigned int *pSID = &lines_.sId.front();
for ( unsigned int i = 0; i < lineSalience_.size(); i++ ) for ( unsigned int i = 0; i < lineSalience_.size(); i++ )
{ {
int salience = 0; int salience = 0;
......
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