circle of minimum radius enclosing shape
This measure allows to compute enclosing circle of minimum radius for each shape.
Given a shape, algorithm will compute coordinates of the circle enclosing shape with minimum radius :
Here is an example of enclosing circle of minimum radius computation on a grey scale image:
circle of minimum radius enclosing shape
Measure synthesis :
Measure Type | Measure Unit Type | Parameter Type | Result Type | Shape Requirements |
Geometry 2d
|
None
|
None
|
Custom
|
Boundary Approximation
|
See Shape measurement for additional information on these pictograms Example of Python code :
Generic example in 2d case :
import PyIPSDK
import PyIPSDK.IPSDKIPLShapeAnalysis as shapeanalysis
inMeasureInfoSet2d = PyIPSDK.createMeasureInfoSet2d()
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "MinEnclosingCircle2dMsr")
outMeasureSet = shapeanalysis.labelAnalysis2d(inGreyImg, inLabelImg2d, inMeasureInfoSet2d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("MinEnclosingCircle2dMsr")
outMsrValues = outMsr.getMeasureResult().getColl(0)
print("First label estimation radius : " + str(outMsrValues[1].getRadius()))
print("First label estimation center : " + str(outMsrValues[1].centerX()) + ", " + str(outMsrValues[1].centerY()))
Example of C++ code :
Example informations
Associated library
IPSDKIPLShapeAnalysis
Code Example
Shape2dCollPtr pShape2dColl = boost::make_shared<Shape2dColl>();
IPSDK_REQUIRE(readFromXmlFile(inputShape2dCollPath, *pShape2dColl) == true);
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
createMeasureInfo(pMeasureInfoSet, "MinEnclosingCircle2dMsr");
MeasureSetPtr pOutMeasureSet =
shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
const MeasureConstPtr& pMinEnclosingCircle2dOutMsr = pOutMeasureSet->getMeasure("MinEnclosingCircle2dMsr");
const Circle2dMsrResults& outResults = static_cast<const Circle2dMsrResults&>(pMinEnclosingCircle2dOutMsr->getMeasureResult());