As far as I understand, you want to find a smile based on the color difference between teeth and skin, right? This probably makes sense, since the intensity of the pixels on the lips is very different from the pixels on the teeth. If so, I would suggest two approaches.
First you need to calculate the Laplacian face region transformation. The coordinates with the maximum values ββof the Laplacian will correspond to the largest difference in intensities of neighboring pixels. I think the smile contains the most contrasting pixels. You must select the threshold again, but in this case it does not depend on the lighting conditions.
The second idea is similar to the first, except that you need to compare the pixels with the average of all the pixels in the face. Here, pixels whose values ββare relatively large relative to the average are treated as teeth pixels. By the way, something like cvAdaptiveThreshold might help.
source share