Corneal confocal laser scanning microscopy is a promising method for in vivo investigation of cellular structures, e. g., of nerve fibers in the sub-basal nerve plexus. During recording, even slight displacements of the focal plane lead to images of adjacent tissue layers. In this work, we propose a closed-loop control of the focal plane. To detect and evaluate the visible tissues, we utilize the Bag of Visual Words approach to implement a customizable image processing pipeline for real-time applications. Furthermore, we show that the proposed model can be trained with small classification datasets and can be applied as a segmentation method. The proposed control loop, including tissue detection, is implemented in a proof-of-concept setup and shows promising results in a first evaluation with a human subject.