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

Function minMaxLoc

deps/opencv/modules/core/src/matrix.cpp:4182–4242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4180}
4181
4182void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _minidx, int* _maxidx )
4183{
4184 SparseMatConstIterator it = src.begin();
4185 size_t i, N = src.nzcount(), d = src.hdr ? src.hdr->dims : 0;
4186 int type = src.type();
4187 const int *minidx = 0, *maxidx = 0;
4188
4189 if( type == CV_32F )
4190 {
4191 float minval = FLT_MAX, maxval = -FLT_MAX;
4192 for( i = 0; i < N; i++, ++it )
4193 {
4194 float v = *(const float*)it.ptr;
4195 if( v < minval )
4196 {
4197 minval = v;
4198 minidx = it.node()->idx;
4199 }
4200 if( v > maxval )
4201 {
4202 maxval = v;
4203 maxidx = it.node()->idx;
4204 }
4205 }
4206 if( _minval )
4207 *_minval = minval;
4208 if( _maxval )
4209 *_maxval = maxval;
4210 }
4211 else if( type == CV_64F )
4212 {
4213 double minval = DBL_MAX, maxval = -DBL_MAX;
4214 for( i = 0; i < N; i++, ++it )
4215 {
4216 double v = *(const double*)it.ptr;
4217 if( v < minval )
4218 {
4219 minval = v;
4220 minidx = it.node()->idx;
4221 }
4222 if( v > maxval )
4223 {
4224 maxval = v;
4225 maxidx = it.node()->idx;
4226 }
4227 }
4228 if( _minval )
4229 *_minval = minval;
4230 if( _maxval )
4231 *_maxval = maxval;
4232 }
4233 else
4234 CV_Error( CV_StsUnsupportedFormat, "Only 32f and 64f are supported" );
4235
4236 if( _minidx )
4237 for( i = 0; i < d; i++ )
4238 _minidx[i] = minidx[i];
4239 if( _maxidx )

Callers 5

convert.cppFile · 0.85
cvMinMaxLocFunction · 0.85
bilateralFilter_32fFunction · 0.85
goodFeaturesToTrackMethod · 0.85
phaseCorrelateResMethod · 0.85

Calls 4

nzcountMethod · 0.80
nodeMethod · 0.80
beginMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected