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

Function NewSimpleProto

deps/tesseract/classify/cluster.cpp:1606–1624  ·  view source on GitHub ↗

* This routine allocates memory to hold a simple prototype * data structure, i.e. one without independent distributions * and variances for each dimension. * @param N number of dimensions * @param Cluster cluster to be made into a prototype * @return Pointer to new simple prototype * @note Exceptions: None * @note History: 6/19/89, DSJ, Created. */

Source from the content-addressed store, hash-verified

1604 * @note History: 6/19/89, DSJ, Created.
1605 */
1606PROTOTYPE *NewSimpleProto(inT16 N, CLUSTER *Cluster) {
1607 PROTOTYPE *Proto;
1608 int i;
1609
1610 Proto = (PROTOTYPE *) Emalloc (sizeof (PROTOTYPE));
1611 Proto->Mean = (FLOAT32 *) Emalloc (N * sizeof (FLOAT32));
1612
1613 for (i = 0; i < N; i++)
1614 Proto->Mean[i] = Cluster->Mean[i];
1615 Proto->Distrib = NULL;
1616
1617 Proto->Significant = TRUE;
1618 Proto->Merged = FALSE;
1619 Proto->Style = spherical;
1620 Proto->NumSamples = Cluster->SampleCount;
1621 Proto->Cluster = Cluster;
1622 Proto->Cluster->Prototype = TRUE;
1623 return (Proto);
1624} // NewSimpleProto
1625
1626/**
1627 * This routine returns TRUE if the specified covariance

Callers 2

NewSphericalProtoFunction · 0.85
NewEllipticalProtoFunction · 0.85

Calls 1

EmallocFunction · 0.85

Tested by

no test coverage detected