This paper presents a real-time hand segmentation method that is based on background subtraction and color information. A hand, as foreground, is extracted from an image by background subtraction where unit gradient vectors (UGVs) are used instead of image intensities. The UGV-based method is more stable under dynamic lighting conditions because the UGVs are invariant to changes in illumination. Meanwhile, the hand is also detected using color information. These two method results lead into the final hand segmentation. Experimental results show that the proposed method can segment a hand in an image robustly under various lighting conditions. We have implemented the proposed method using a low-cost embedded board Raspberry Pi.