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

Function cvGetImage

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

convert array (CvMat or IplImage) to IplImage

Source from the content-addressed store, hash-verified

2774
2775// convert array (CvMat or IplImage) to IplImage
2776CV_IMPL IplImage*
2777cvGetImage( const CvArr* array, IplImage* img )
2778{
2779 IplImage* result = 0;
2780 const IplImage* src = (const IplImage*)array;
2781 int depth;
2782
2783 if( !img )
2784 CV_Error( CV_StsNullPtr, "" );
2785
2786 if( !CV_IS_IMAGE_HDR(src) )
2787 {
2788 const CvMat* mat = (const CvMat*)src;
2789
2790 if( !CV_IS_MAT_HDR(mat))
2791 CV_Error( CV_StsBadFlag, "" );
2792
2793 if( mat->data.ptr == 0 )
2794 CV_Error( CV_StsNullPtr, "" );
2795
2796 depth = cvIplDepth(mat->type);
2797
2798 cvInitImageHeader( img, cvSize(mat->cols, mat->rows),
2799 depth, CV_MAT_CN(mat->type) );
2800 cvSetData( img, mat->data.ptr, mat->step );
2801
2802 result = img;
2803 }
2804 else
2805 {
2806 result = (IplImage*)src;
2807 }
2808
2809 return result;
2810}
2811
2812
2813/****************************************************************************************\

Callers 1

Calls 4

cvIplDepthFunction · 0.85
cvInitImageHeaderFunction · 0.85
cvSizeFunction · 0.85
cvSetDataFunction · 0.85

Tested by

no test coverage detected