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

Function cvPtr3D

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

Returns pointer to specified element of 3d array

Source from the content-addressed store, hash-verified

1836
1837// Returns pointer to specified element of 3d array
1838CV_IMPL uchar*
1839cvPtr3D( const CvArr* arr, int z, int y, int x, int* _type )
1840{
1841 uchar* ptr = 0;
1842 if( CV_IS_MATND( arr ))
1843 {
1844 CvMatND* mat = (CvMatND*)arr;
1845
1846 if( mat->dims != 3 ||
1847 (unsigned)z >= (unsigned)(mat->dim[0].size) ||
1848 (unsigned)y >= (unsigned)(mat->dim[1].size) ||
1849 (unsigned)x >= (unsigned)(mat->dim[2].size) )
1850 CV_Error( CV_StsOutOfRange, "index is out of range" );
1851
1852 ptr = mat->data.ptr + (size_t)z*mat->dim[0].step +
1853 (size_t)y*mat->dim[1].step + x*mat->dim[2].step;
1854
1855 if( _type )
1856 *_type = CV_MAT_TYPE(mat->type);
1857 }
1858 else if( CV_IS_SPARSE_MAT( arr ))
1859 {
1860 int idx[] = { z, y, x };
1861 ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, _type, 1, 0 );
1862 }
1863 else
1864 {
1865 CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" );
1866 }
1867
1868 return ptr;
1869}
1870
1871
1872// Returns pointer to specified element of n-d array

Callers 4

cvGet3DFunction · 0.85
cvGetReal3DFunction · 0.85
cvSet3DFunction · 0.85
cvSetReal3DFunction · 0.85

Calls 1

icvGetNodePtrFunction · 0.85

Tested by

no test coverage detected