![]() |
IPSDK
4_1_0_2
IPSDK : Image Processing Software Development Kit
|
module demonstrating the automatic binarization on a grey-level image using Otsu's method More...
module demonstrating the automatic binarization on a grey-level image using Otsu's method
This application applies Otsu's binarization on a grey-level input image loaded from a given input TIFF file, and saves the result in a given TIFF file.
The application can be called through a command line as follows:
<application_exe_filename> [--inputImgFilePath <input_image_file_path>] [--outputImgFilePath <output_image_file_path>]
Arguments:
--inputImgFilePath optional; specifies the name of the TIFF file, from
which the input image will be loaded; if not
specified by the user, the input image is loaded from
file
<DEV_ROOT>/data/Sample/images/Lena_510x509_UInt8.tif
--outputImgFilePath optional; specifies the name of the TIFF file, in
which the output image resulting from the
Otsu's binarization will be saved;
if not specified by the user, the output image is
saved in file
<TEMPORARY_IPSDK_DIR>/Sample/otsu.tifHere is a snapshot of default input image used by the application and of corresponding output image when application is launched without any argument:
We start by importing all necessary libraries:
Then we define the input parameters.
We load our input image from the associated Tiff file, by calling the function ipsdk::image::file::loadTiffImageFile.
We then apply the Otsu thresholding calculation on the input image.
Lastly, we save the image resulting from the operation to the Tiff file.
See the full source listing
1.8.14