We have developed a machine vision-based method for automatically tracking deformations in the body wall to monitor ecdysis behaviors in the hornworm, Manduca sexta. The method utilizes naturally-occurring features on the animal's body (spiracles) and is highly accurate (>95% success in tracking). Moreover, it is robust to unanticipated changes in the animal's position and in lighting, and in the event tracking of specific features is lost, tracking can be reestablished within a few cycles without input from the user. We have paired our tracking technique with electromyography (EMG) and have also compared our in vivo results to fictive motor patterns recorded from isolated nerve cords. We found no major difference in the cycle periods of contractions during naturally-occurring ecdysis compared to ecdysis initiated prematurely through injection of the peptide Ecdysis-Triggering Hormone (ETH), and we confirmed that the ecdysis period in vivo is statistically similar to that of the fictive motor pattern.