eyetracker-ng 0.1-1 documentation

camera Module

«  analysis Module   ::   Contents   ::   gui Module  »

camera Module

Camera module is used to interact with video cameras and display the results of image processing algorithms implemented in analysis module.

camera Module

class eyetracker.camera.camera.Camera(camera, dic=None)[source]

Bases: object

Communicate with the camera.

Class governing the communication with the camera.


camera : int

the index of the camera, best taken from func lookForCameras, from eyetracker.camera.capture

dic : dic{propID value}

to check corresponding propIDs check opencv documentation under the term VideoCapture. They will be set in the moment of object creation.


Closes cap, you can reopen it with self.reOpen.


Read frame from camera.


frame : np.array

frame from camera


Reopens cap.


Set camera parameters.

Parameters:kwargs : {propID

Function looks for cameras available cameras.


dic : {Camera_i , index}

where i is the 1,2,3 etc. and index is an int corresponding to the camera that should be passed on to cv2.VideoCapture or to class Camera from eyetracker.camera.camera.

display Module

eyetracker.camera.display.displayImage(image, where='new')[source]

Display image in new or existing window.

Function displays the image in a new window or in the pointed window. Returns the displayed image as a numpy array.


image : np.array

numpy array being an image to be displayed

where : string

name of the window as string in which the image is to be displayed, not providing the name will create a new one


key: int :

number representation of the key that was pressed during the image display

eyetracker.camera.display.drawGlint(image, where_pupil, numberOfGlints, glints_stack)[source]

Find and draw glint on image.

Function takes an image, converts it to grayscale if it is not, detects glint and draws it on a new image.


image : np.array

image where the glint is to be detected

where_pupil : np.array

coordinates of pupil on a given image

numberOfGlints : int

number of points to find on an image


color image : np.array

returns a numpy array in a bgr scale with the glint marked in blue

eyetracker.camera.display.drawPupil(image, thres, pupils_stack, numberOfPupils)[source]

Find and draw pupil on image.

Function takes an image, applies ‘trunc’ threshold(cv2.THRESH_TRUNC), detects pupil and draws it on a new image.


image : np.array

image where the pupil is to be detected

thres : int

value of the threshold


cimage : np.array

returns a numpy array in a bgr scale with the pupil marked in red

«  analysis Module   ::   Contents   ::   gui Module  »