Camera-based cap control with artificial intelligence