This paper presents a human drowsiness detection algorithm in real time using computer vision. Drowsiness is a state whose consequences can be very dangerous for vehicle drivers, air traffic controllers, nuclear plant controllers, etc. In 2018 in Ecuador, 353 traffic accidents were reported for driving while drowsy. The algorithm that we present obtains frontal images of the driver using an infrared camera, then performs automatic face detection using the Viola-Jones algorithm. After this, the eye portion is extracted and the classification between open and closed eye is done with two methods: a) method based on the extraction of maximums and minimums of horizontal and vertical edges of the eye and b) using a multilayer perceptron (MLP) neural network. Finally, it makes the detection of drowsiness during the time the eyes were closed within a time interval. For the open and close eye classification using the first method we obtain 84% of accuracy and for the second method using the MLP we obtain 97% of accuracy, including test images under dark conditions.