Number of vertex in graph associated to skeleton 2d.
Skeleton 2d number of vertex measure is based on skeleton 2d measure (see [Concept] Skeleton 2d). This measure allows to count number of vertices composing a shape 2d skeleton.
Searched vertex type can be customized (setting measure parameter ipsdk::geom::eSkeletonVertexCategory) :
- eSVC_Internal for internal vertex without leaf connection
- eSVC_Junction for vertex connected at least to three other vertices (in most of cases this parameter give equivalent results to eSVC_Internal parameter)
- eSVC_Slab for vertex connected exactly to two other vertices
- eSVC_EndPoint for vertex connected exactly to one other vertice
- eSVC_All for all vertices without exception
Here is an example of measure results for different skeleton 2d holes processing policy and different searched vertex types.
Number of vertex in graph associated to skeleton 2d
Measure synthesis :
Measure Type | Measure Unit Type | Parameter Type | Result Type | Shape Requirements |
Generic
|
None
|
Skeleton2dNbVertexMsrParams |
Value (ipsdk::ipUInt32)
|
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.createGeometricCalibration2d(1,1,'px'))
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "Skeleton2dNbVertexMsr", shapeanalysis.createSkeleton2dNbVertexMsrParams(PyIPSDK.eSHP_Ignored, PyIPSDK.eSVC_All))
outMeasureSet = shapeanalysis.labelAnalysis2d(inGreyImg, inLabelImg2d, inMeasureInfoSet2d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("Skeleton2dNbVertexMsr")
outMsrValues = outMsr.getMeasureResult().getColl(0)
print("First label measurement equal " + str(outMsrValues[1]))
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, "Skeleton2dNbVertexMsr", createSkeleton2dNbVertexMsrParams(skeleton2dHolesPolicy, skeletonVertexCategory));
MeasureSetPtr pOutMeasureSet =
shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
const MeasureConstPtr& pSkeleton2dNbVertexOutMsr = pOutMeasureSet->getMeasure("Skeleton2dNbVertexMsr");
const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipUInt32>& outResults = static_cast<const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipUInt32>&>(pSkeleton2dNbVertexOutMsr->getMeasureResult());