|
|
|
@ -2032,39 +2032,24 @@ void cv::transpose( InputArray _src, OutputArray _dst ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////// completeSymm /////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void cv::completeSymm( InputOutputArray _m, bool LtoR ) |
|
|
|
|
{ |
|
|
|
|
Mat m = _m.getMat(); |
|
|
|
|
CV_Assert( m.dims <= 2 ); |
|
|
|
|
size_t step = m.step, esz = m.elemSize(); |
|
|
|
|
CV_Assert( m.dims <= 2 && m.rows == m.cols ); |
|
|
|
|
|
|
|
|
|
int i, j, nrows = m.rows, type = m.type(); |
|
|
|
|
int j0 = 0, j1 = nrows; |
|
|
|
|
CV_Assert( m.rows == m.cols ); |
|
|
|
|
int rows = m.rows; |
|
|
|
|
int j0 = 0, j1 = rows; |
|
|
|
|
|
|
|
|
|
if( type == CV_32FC1 || type == CV_32SC1 ) |
|
|
|
|
uchar* data = m.data; |
|
|
|
|
for( int i = 0; i < rows; i++ ) |
|
|
|
|
{ |
|
|
|
|
int* data = (int*)m.data; |
|
|
|
|
size_t step = m.step/sizeof(data[0]); |
|
|
|
|
for( i = 0; i < nrows; i++ ) |
|
|
|
|
{ |
|
|
|
|
if( !LtoR ) j1 = i; else j0 = i+1; |
|
|
|
|
for( j = j0; j < j1; j++ ) |
|
|
|
|
data[i*step + j] = data[j*step + i]; |
|
|
|
|
} |
|
|
|
|
if( !LtoR ) j1 = i; else j0 = i+1; |
|
|
|
|
for( int j = j0; j < j1; j++ ) |
|
|
|
|
memcpy(data + (i*step + j*esz), data + (j*step + i*esz), esz); |
|
|
|
|
} |
|
|
|
|
else if( type == CV_64FC1 ) |
|
|
|
|
{ |
|
|
|
|
double* data = (double*)m.data; |
|
|
|
|
size_t step = m.step/sizeof(data[0]); |
|
|
|
|
for( i = 0; i < nrows; i++ ) |
|
|
|
|
{ |
|
|
|
|
if( !LtoR ) j1 = i; else j0 = i+1; |
|
|
|
|
for( j = j0; j < j1; j++ ) |
|
|
|
|
data[i*step + j] = data[j*step + i]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
CV_Error( CV_StsUnsupportedFormat, "" ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|