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

Function cvGetRawData

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

Retrieves essential information about image ROI or CvMat data

Source from the content-addressed store, hash-verified

999
1000// Retrieves essential information about image ROI or CvMat data
1001CV_IMPL void
1002cvGetRawData( const CvArr* arr, uchar** data, int* step, CvSize* roi_size )
1003{
1004 if( CV_IS_MAT( arr ))
1005 {
1006 CvMat *mat = (CvMat*)arr;
1007
1008 if( step )
1009 *step = mat->step;
1010
1011 if( data )
1012 *data = mat->data.ptr;
1013
1014 if( roi_size )
1015 *roi_size = cvGetMatSize( mat );
1016 }
1017 else if( CV_IS_IMAGE( arr ))
1018 {
1019 IplImage* img = (IplImage*)arr;
1020
1021 if( step )
1022 *step = img->widthStep;
1023
1024 if( data )
1025 *data = cvPtr2D( img, 0, 0 );
1026
1027 if( roi_size )
1028 {
1029 if( img->roi )
1030 {
1031 *roi_size = cvSize( img->roi->width, img->roi->height );
1032 }
1033 else
1034 {
1035 *roi_size = cvSize( img->width, img->height );
1036 }
1037 }
1038 }
1039 else if( CV_IS_MATND( arr ))
1040 {
1041 CvMatND* mat = (CvMatND*)arr;
1042
1043 if( !CV_IS_MAT_CONT( mat->type ))
1044 CV_Error( CV_StsBadArg, "Only continuous nD arrays are supported here" );
1045
1046 if( data )
1047 *data = mat->data.ptr;
1048
1049 if( roi_size || step )
1050 {
1051 int i, size1 = mat->dim[0].size, size2 = 1;
1052
1053 if( mat->dims > 2 )
1054 for( i = 1; i < mat->dims; i++ )
1055 size1 *= mat->dim[i].size;
1056 else
1057 size2 = mat->dim[1].size;
1058

Callers

nothing calls this directly

Calls 3

cvGetMatSizeFunction · 0.85
cvPtr2DFunction · 0.85
cvSizeFunction · 0.85

Tested by

no test coverage detected