![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
module demonstrating shape analysis and measurement in 2d case More...
module demonstrating shape analysis and measurement in 2d case
This application computes measurements on 2d shapes from an input image TIFF files couple (a grey level and a binary image).
The application can be called through a command line as follows:
<application_exe_filename> [--inputGreyImgPath <input_grey_image_file_path>] [--inputBinImgPath <input_binary_image_file_path>] [--outputXmlResultPath <output xml result path>]
Arguments:
--inputGreyImgPath optional; specifies the name of the TIFF file, from
which the input grey level image will be loaded; if not
specified by the user, the input image is loaded from
file
<DEV_ROOT>/data/Sample/images/blobs_483x348_UInt8.tif
--inputBinImgPath optional; specifies the name of the TIFF file, from
which the input binary image will be loaded; if not
specified by the user, the input image is loaded from
file
<DEV_ROOT>/data/Sample/images/blobs_483x348_Binary.tif
--outputXmlResultPath optional; specifies the name of the XML file, in
which the output analysis results will be saved; if not
specified by the user, the output results file is saved to
file
<TEMPORARY_IPSDK_DIR>/Sample/shapeAnalysis2d.xmlHere is a snapshot of default input images used by the application and of corresponding output results when application is launched without any argument:
We start by importing all necessary libraries:
Then we define the input parameters.
We load our input grey level and binary images from the associated Tiff file, by calling the function ipsdk::image::file::loadTiffImageFile.
We then apply a connected components algorithm on input binary image (see Connected Component 2d).
A contour based version of this 'labeled' image is then processed. The user should note that a polygonal approximation of contours is processed during previous step (see Label shape extraction 2d).
We then define a geometric calibration which will be used during shape measurement process (see Handling geometric calibration).
At last we define a collection of measures to be processed and we launch the shape analysis (see Shape Analysis 2d).
Measure results can then be individually extracted from returned object measureSet has demonstrated by following code (extracted type must match measure results type, see measure result type associated to Area 2d for example) :
Measure results can also be saved to file using XML file format (for example) using following code :
Or plotted using histogram measure feature (requests matplotlib to be installed):
See the full source listing
1.8.14