Text and drawing
In the previous section, we used a simple user interface to get input values by a trackbar. However, in many applications, the user has to point locations and regions on the image and mark them with text labels. For this purpose, the highgui
module provides a set of drawing functions along with mouse event handling.
The drawThings
code example shows an easy application to mark positions on an input image. The positions are marked with a red circle and a black text label next to it. The following screenshot displays the window with the input image and the marked positions on it. To mark each position on the image, the user uses has to click the left mouse button over it. In other application, the marked position could be the obtained points or regions from an algorithm applied to the input image.
Next, we show the example code where some pieces of code have been omitted for simplicity, since they are duplicated in other previous examples:
// (omitted for simplicity) #define...