MCPcopy Create free account
hub / github.com/creatale/node-dv / cvGetCols

Function cvGetCols

deps/opencv/modules/core/src/array.cpp:1341–1379  ·  view source on GitHub ↗

Selects array's column span.

Source from the content-addressed store, hash-verified

1339
1340// Selects array's column span.
1341CV_IMPL CvMat*
1342cvGetCols( const CvArr* arr, CvMat* submat, int start_col, int end_col )
1343{
1344 CvMat* res = 0;
1345 CvMat stub, *mat = (CvMat*)arr;
1346 int cols;
1347
1348 if( !CV_IS_MAT( mat ))
1349 mat = cvGetMat( mat, &stub );
1350
1351 if( !submat )
1352 CV_Error( CV_StsNullPtr, "" );
1353
1354 cols = mat->cols;
1355 if( (unsigned)start_col >= (unsigned)cols ||
1356 (unsigned)end_col > (unsigned)cols )
1357 CV_Error( CV_StsOutOfRange, "" );
1358
1359 {
1360 /*
1361 int* refcount = mat->refcount;
1362
1363 if( refcount )
1364 ++*refcount;
1365
1366 cvDecRefData( submat );
1367 */
1368 submat->rows = mat->rows;
1369 submat->cols = end_col - start_col;
1370 submat->step = mat->step;
1371 submat->data.ptr = mat->data.ptr + (size_t)start_col*CV_ELEM_SIZE(mat->type);
1372 submat->type = mat->type & (submat->rows > 1 && submat->cols < cols ? ~CV_MAT_CONT_FLAG : -1);
1373 submat->refcount = 0;
1374 submat->hdr_refcount = 0;
1375 res = submat;
1376 }
1377
1378 return res;
1379}
1380
1381
1382// Selects array diagonal

Callers 2

cvGetColFunction · 0.85
cvUndistortPointsFunction · 0.85

Calls 1

cvGetMatFunction · 0.85

Tested by

no test coverage detected