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

Function cvCreateHist

deps/opencv/modules/imgproc/src/histogram.cpp:2160–2191  ·  view source on GitHub ↗

Creates new histogram */

Source from the content-addressed store, hash-verified

2158
2159/* Creates new histogram */
2160CvHistogram *
2161cvCreateHist( int dims, int *sizes, CvHistType type, float** ranges, int uniform )
2162{
2163 CvHistogram *hist = 0;
2164
2165 if( (unsigned)dims > CV_MAX_DIM )
2166 CV_Error( CV_BadOrder, "Number of dimensions is out of range" );
2167
2168 if( !sizes )
2169 CV_Error( CV_HeaderIsNull, "Null <sizes> pointer" );
2170
2171 hist = (CvHistogram *)cvAlloc( sizeof( CvHistogram ));
2172 hist->type = CV_HIST_MAGIC_VAL + ((int)type & 1);
2173 if (uniform) hist->type|= CV_HIST_UNIFORM_FLAG;
2174 hist->thresh2 = 0;
2175 hist->bins = 0;
2176 if( type == CV_HIST_ARRAY )
2177 {
2178 hist->bins = cvInitMatNDHeader( &hist->mat, dims, sizes,
2179 CV_HIST_DEFAULT_TYPE );
2180 cvCreateData( hist->bins );
2181 }
2182 else if( type == CV_HIST_SPARSE )
2183 hist->bins = cvCreateSparseMat( dims, sizes, CV_HIST_DEFAULT_TYPE );
2184 else
2185 CV_Error( CV_StsBadArg, "Invalid histogram type" );
2186
2187 if( ranges )
2188 cvSetHistBinRanges( hist, ranges, uniform );
2189
2190 return hist;
2191}
2192
2193
2194/* Creates histogram wrapping header for given array */

Callers 1

cvCopyHistFunction · 0.85

Calls 4

cvAllocFunction · 0.85
cvInitMatNDHeaderFunction · 0.85
cvCreateDataFunction · 0.85
cvSetHistBinRangesFunction · 0.85

Tested by

no test coverage detected