Using the Caliper Tool
This section describes the steps you follow to use the Caliper tool.
- Construct a ccAffineRectangle and ccAffineSamplingParams that specify the projection region for the caliper tool.
- Construct a vector that contains pointers one or more scoring functions to determine how edge candidates in the image will be scored.
- Construct a ccCaliperRunParams that specifies the number and position of the expected edges. Add the scoring functions to the ccCaliperRunParams by calling the scoringMethods() function.
- Construct a ccCaliperResultSet to hold the results.
- Call the cfCaliperRun() global function supplying the ccAffineSamplingParams, an input image, the ccCaliperRunParams, and the ccCaliperResultSet.
- Extract the results.
cc2Vect po(20,20),
px(40,20),
py( 20,40);
ccAffineRectangle affRect(po, px, py);
ccAffineSamplingParams sample(affRect, 20,20);
ccScoreContrast aScoringFunction; // Use default values
cmStd vector<ccCaliperScore *> scoringFunctions(1);
scoringFunctions[0] = & aScoringFunction;
// Set the run parameters. Search for one edge, any polarity.
ccCaliperRunParams runParams(0.0, ceDontCare);
runParams.scoringMethods(scoringFunctions);
If you do not specify any scoring function for the ccCaliperRunParams, the ccCaliperRunParams will use a single default-constructed ccScoreContrast to score results.
ccCaliperResultSet rslt;
cfCaliperRun(searchImage, sample, runParams, rslt);
for (int i = 0; i < rslt.results().size(); i++)
{
cogOut << "Caliper result " << i+1 << ": "
<< "Score = " << rslt.results()[i].score()
<< ", "
<< "Model Origin at " << rslt.results()[i].position()
<< std::endl;
for (int j = 0; j < rslt.results()[i].resultEdges().size();
j++)
{
cogOut << " Result edge " << j+1 << ": "
<< "location = "
<< rslt.results()[i].resultEdges()[j].position()
<< std::endl;
}
}