Quantitative Light-induced Fluorescence (QLF) has been used to measure tooth stain in vitro; however the current analysis method cannot be used in vivo, as it requires regions of interest to be surrounded by unstained tissue. In this study, an algorithm was developed to detect stain on QLF images of teeth captured in vivo. It uses convex hulls to reconstruct an image of the tooth, without stain, based on clean areas of the image, and subtracts the captured image from the reconstruction to find areas darkened by stain. A tooth outline (mask) must be provided to guide the reconstruction. Three versions of the algorithm are tested on images taken during a stain development study, using a range of values for the threshold parameter. The stain employed was produced using Chlorhexidine mouth rinse. The software output correlates well with manual scoring (Pearson's>0.7; p<0.001). The algorithm shows promise for examining groups of patients in an objective and reproducible way, conferring many benefits over clinical visual assessments.