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

Function AdjustBuckets

deps/tesseract/classify/cluster.cpp:2266–2279  ·  view source on GitHub ↗

* This routine multiplies each ExpectedCount histogram entry * by NewSampleCount/OldSampleCount so that the histogram * is now adjusted to the new sample count. * @param Buckets histogram data structure to adjust * @param NewSampleCount new sample count to adjust to * @return none * @note Exceptions: none * @note History: Thu Aug 3 14:31:14 1989, DSJ, Created. */

Source from the content-addressed store, hash-verified

2264 * @note History: Thu Aug 3 14:31:14 1989, DSJ, Created.
2265 */
2266void AdjustBuckets(BUCKETS *Buckets, uinT32 NewSampleCount) {
2267 int i;
2268 FLOAT64 AdjustFactor;
2269
2270 AdjustFactor = (((FLOAT64) NewSampleCount) /
2271 ((FLOAT64) Buckets->SampleCount));
2272
2273 for (i = 0; i < Buckets->NumberOfBuckets; i++) {
2274 Buckets->ExpectedCount[i] *= AdjustFactor;
2275 }
2276
2277 Buckets->SampleCount = NewSampleCount;
2278
2279} // AdjustBuckets
2280
2281/**
2282 * This routine sets the bucket counts in the specified histogram

Callers 1

GetBucketsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected