Visual Servoing Platform
version 3.2.0 under development (2019-01-22)
|
This tutorial will show you how to automatically threshold, binarize an image using different methods:
These functions have been ported from the Auto Threshold ImageJ plugin and you can refer to the corresponding documentation for more information.
The following example also available in tutorial-autothreshold.cpp will demonstrate on a sample image the result of each of these methods:
These functions are provided in a vp:: namespace and accessible using this include:
The code to use is pretty straightword:
The following image presents the results for each method:
The function vp::autoThreshold(vpImage<unsigned char> &, const vp::vpAutoThresholdMethod &, const unsigned char, const unsigned char) has two parameters to specify the pixel values to use for the background and the foreground. By default, it is (see vpImageTools::binarise(vpImage<Type> &, Type, Type, Type, Type, Type, const bool)):
You can now read the Tutorial: Contours extraction from a binary image, to learn how to extract the contours from a binary image.