While visual or tactile image data have been conventionally processed via filters or perceptronlike learning machines, the recent advances of computational topology may make it possible to successfully extract the global features from the local pixelwise data. In fact, some inventive algorithms have succeeded in computing the topological invariants, such as the number of objects or holes and irrespective of the shapes and positions of the touches. However, they are mostly offline algorithms aiming at big data. A real-time algorithm for computing topology is also needed for interactive applications such as touch sensors. Here, we propose a fast algorithm to compute the Euler characteristics of touch shapes by using the Poincare-Hopf index for each pixel. We demonstrate that our simple algorithm, implemented solely as logical operations in Arduino, correctly returns and updates the topological invariants of touches in real time.