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

Function cvGetRows

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

Selects array's row span.

Source from the content-addressed store, hash-verified

1287
1288// Selects array's row span.
1289CV_IMPL CvMat*
1290cvGetRows( const CvArr* arr, CvMat* submat,
1291 int start_row, int end_row, int delta_row )
1292{
1293 CvMat* res = 0;
1294 CvMat stub, *mat = (CvMat*)arr;
1295
1296 if( !CV_IS_MAT( mat ))
1297 mat = cvGetMat( mat, &stub );
1298
1299 if( !submat )
1300 CV_Error( CV_StsNullPtr, "" );
1301
1302 if( (unsigned)start_row >= (unsigned)mat->rows ||
1303 (unsigned)end_row > (unsigned)mat->rows || delta_row <= 0 )
1304 CV_Error( CV_StsOutOfRange, "" );
1305
1306 {
1307 /*
1308 int* refcount = mat->refcount;
1309
1310 if( refcount )
1311 ++*refcount;
1312
1313 cvDecRefData( submat );
1314 */
1315 if( delta_row == 1 )
1316 {
1317 submat->rows = end_row - start_row;
1318 submat->step = mat->step;
1319 }
1320 else
1321 {
1322 submat->rows = (end_row - start_row + delta_row - 1)/delta_row;
1323 submat->step = mat->step * delta_row;
1324 }
1325
1326 submat->cols = mat->cols;
1327 submat->step &= submat->rows > 1 ? -1 : 0;
1328 submat->data.ptr = mat->data.ptr + (size_t)start_row*mat->step;
1329 submat->type = (mat->type | (submat->rows == 1 ? CV_MAT_CONT_FLAG : 0)) &
1330 (delta_row != 1 && submat->rows > 1 ? ~CV_MAT_CONT_FLAG : -1);
1331 submat->refcount = 0;
1332 submat->hdr_refcount = 0;
1333 res = submat;
1334 }
1335
1336 return res;
1337}
1338
1339
1340// Selects array's column span.

Callers 1

cvGetRowFunction · 0.85

Calls 1

cvGetMatFunction · 0.85

Tested by

no test coverage detected