Please see the following blog post for more details about this code cvui: A GUI lib built on top of OpenCV drawing primitives