Class reference

class lampixapp.LampixApp[source]

Base class for all lampix applications. New Apps need to inherit this in order to be included by the ApplicationManager in the list of apps to be instantiated and which can be managed using the web interface.

RegisterComponents(applicationManager)[source]

Called on all applications so that they register the services they provide with the ApplicationManager

activateApp()[source]

Called when the application is activated

appDataUpdated(appDataBlob)[source]

gets called when the state of the app changes on the administration server :return:

deactivateApp()[source]

Called when the application is deactivated

class lampixapp.MetaHandler[source]

Replaces the Metaclass of LampixApp in order to ensure that the base class methods are called.

lampixapp.ensure_parent_call(methname, super_instance, instance)[source]

Ensures that a method in the parent class is called by all derived classes, is used in MetaHandler :param methname: Name of the method :param super_instance: Instance of parent class :param instance: Instance of deriving class :return:

class applicationmanager.RequiredFeature(feature, assertion=<function NoAssertion at 0x75cbe930>)[source]

An attribute descriptor to “declare” required features

class cameraeventsource.CameraEventProcessor(ev)[source]

Does the image processing tasks which take longer, on a different thread. Any SurfaceWatcher can request a long running task by setting the needDeferredProcessing flag to True

class cameraeventsource.CameraEventSource[source]

Watches for movement on registered surfaces and triggers an event if movement has happened. In order to register for watching movement you have to create a subclass of SurfaceWatcher and set a mask.

AddWatcher(watcher)[source]

Adds a watcher to the list of active watchers. Only after being added and active will a Watcher receive onMovement calls. :param watcher: The watcher to be added :return:

Loop()[source]

The main loop doing movement detection and calling onMovement on registered SurfaceWatchers :return:

MeasureWatcherIntersection(other)[source]

Measure how many pixels (1s) are common between this watcher and another one. :param other: The other watcher :return: The amount of common pixels

RemoveWatcher(watcher)[source]

Remove a watcher from the list of active watchers. The Watcher will not receive onMovement calls anymore. :param watcher: The watcher to be removed :return:

UpdateGUI(qp)[source]

Call Update on all registered watchers :param qp: The drawing context. :return:

class cameraeventsource.SurfaceWatcher(name, mask=None)[source]

This is the base class for all entities that watch for movement on a given area of the desk. Derived objects get notified when something moves over their registered area and also when their registered area returns to its base state

ClearMask()[source]

Clears the mask of this SurfaceWatcher, making it not react anymore to any movement. :return:

SetBaseFrame(frame)[source]

Set the base frame for this SurfaceWatcher. This is what the SurfaceWatcher can see when nothing obstructs its view, so its normal state. For example, a Button’s normal state is the image of the projected button without any finger on it. Currently not used. :param frame: :return:

SetMask(mask)[source]

Set the mask for movement detection based on a numpy array which contains 1 for every pixel for which one wants to detect movement. It is advisable to set masks as small as possible, this reduces processing time. :param rect: the numpy array for the mask, should contain only 1s and 0s. :return:

UpdateMask()[source]

Should be called after a new mask is set manually. Updates the masks bounding box. The bounding box is used to reduce computing time when movement is searched for on the whole FOV. Usually gets called automatically when using setMask. :return:

activate()[source]

Activates this element, triggering an UI update if necessary :return:

deactivate()[source]

Deactivates this element, triggering an UI update if necessary :return:

deferredProcessing()[source]

Overload if you need to do some processor intensive image processing outside of the video thread. Set the needDeferredProcessing flag within onMovements, in order to have this method called by the framework. :return: nothing

getName()[source]

Retrieves the name of the SurfaceWatcher :return:

getWantMOGDiff()[source]

Overload and return True if you want movement to be triggered by the MOG detector, not simple diff. :return:

keyPress(keyString)[source]

Gets called in case someone pressd a key (on systems which have a keyboard) :return:

onBrowserChanged(activeElements)[source]

Gets called in case someone pressd a key (on systems which have a keyboard) :return:

onMovement(movement, baseDifference, frame, rawFrame, colorFrame, segFrame)[source]

called when something has happened to this watched area :param movement: there was some movement on the are :param baseDifference: the area is different from its base state :param frame: the last seen frame :return:

onWatcherAdded()[source]

overload if you need to react when this watcher gets added and active here you could set up other related watchers, etc. :return:

onWatcherRemoved()[source]

overload if you need to react when this watcher gets deactivated and removed here you could remove other related watchers, etc. :return:

setMaskFromRect(rect)[source]

Set the mask for movement detection based on a polygon. This is the easiest way of doing this. You can set more complex masks using SetMask :param rect: the rectangle :return:

update(qp)[source]

Overload this if you need to paint something based on the state of this UI element. Useful for projected stuff, not useful if you are just watching for things and not projecting stuff. Gets called from the ui thread. :param qp: QT paint context :return: nothing

class cameraconnectedobject.CameraConnectedObject(resolution=(640, 480))[source]

Each class which needs to capture frames from the PICamera inherits this class Singleton might be another good pattern for this.

static capture_papers(papers)[source]

Triggers capturing of high resolution images of papers. Can be called from another thread. :param papers: rectangles surrounding all interesting pieces of paper (or other objects) :return: Nothing directly. The high resolution images of all the papers on the desk are set when the next frame is captured, see _captureframe().

class coordinatetransformer.CoordinateTransformer(cameraCoords, projectorCoords)[source]

transforms between 2 coordinate systems, usually of projector and camera TODO: we have to rename the coordinate systems here, we actually also use this class for transforming between high res camera (and name it projector) and low res camera

PointToCamera(projectorPoint)[source]

Projects from camera coordinates to desk coordinates :param projectorPoint: point in display coordinates, can actually also be a list of points :return:

PointToProjector(cameraPoints)[source]

Projects from camera coordinates to desk coordinates :param cameraPoint: point in camera coordinates, should actually also be a list of points, so each x is pfrom[0][0][0] and each y is pfrom[0][0][1] if you have something like this [[1,2][3,4][5,3]] in a np array use .reshape(-1, 1, 2) to get the right shape for this function :return:

class perspectivecropper.PerspectiveCropper(image, rect)[source]

A perspective cropper for images taken with the same camera in 2 resolutions

class perspectivecropper.PerspectiveCropperBase[source]

Base class for all perspective croppers. These objects transform (warp) images between two coordinate systems. We have more classes in the hierarchy as we are experimenting with different physical camera setups, which need different math.

class perspectivecropper.PerspectiveCropperDifferentCamera(bigimage, rect, trafo)[source]

A perspective cropper for images taken with the 2 different cameras in 2 resolutions Crops the image of a piece of paper out of a bigger scene image, works on two images taken from different sensors, needs a calibration image between the two sensors

ProjectPointsInverse(coords)[source]

we have the high res paper coordinates and want the coordinates in video camera coords

class perspectivecropper.PerspectiveCropperSameCamera(bigimage, rect)[source]

crops the image of a piece of paper out of a bigger scene image works on two images taken from the SAME image sensor, in 2 resolutions cuts a piece out of a high resolution image which represents a piece of paper (document) takes as an input the rectangle which represents the piece of paper within the low resolution image TODO: check duplication

ProjectPointsInverse(coords)[source]

we have the paper coordinates in still image coordinate system and want the coordinates in video camera coords

class cameraeventsource.CameraEventProcessor(ev)[source]

Does the image processing tasks which take longer, on a different thread. Any SurfaceWatcher can request a long running task by setting the needDeferredProcessing flag to True

class cameraeventsource.CameraEventSource[source]

Watches for movement on registered surfaces and triggers an event if movement has happened. In order to register for watching movement you have to create a subclass of SurfaceWatcher and set a mask.

AddWatcher(watcher)[source]

Adds a watcher to the list of active watchers. Only after being added and active will a Watcher receive onMovement calls. :param watcher: The watcher to be added :return:

Loop()[source]

The main loop doing movement detection and calling onMovement on registered SurfaceWatchers :return:

MeasureWatcherIntersection(other)[source]

Measure how many pixels (1s) are common between this watcher and another one. :param other: The other watcher :return: The amount of common pixels

RemoveWatcher(watcher)[source]

Remove a watcher from the list of active watchers. The Watcher will not receive onMovement calls anymore. :param watcher: The watcher to be removed :return:

UpdateGUI(qp)[source]

Call Update on all registered watchers :param qp: The drawing context. :return:

class cameraeventsource.SurfaceWatcher(name, mask=None)[source]

This is the base class for all entities that watch for movement on a given area of the desk. Derived objects get notified when something moves over their registered area and also when their registered area returns to its base state

ClearMask()[source]

Clears the mask of this SurfaceWatcher, making it not react anymore to any movement. :return:

SetBaseFrame(frame)[source]

Set the base frame for this SurfaceWatcher. This is what the SurfaceWatcher can see when nothing obstructs its view, so its normal state. For example, a Button’s normal state is the image of the projected button without any finger on it. Currently not used. :param frame: :return:

SetMask(mask)[source]

Set the mask for movement detection based on a numpy array which contains 1 for every pixel for which one wants to detect movement. It is advisable to set masks as small as possible, this reduces processing time. :param rect: the numpy array for the mask, should contain only 1s and 0s. :return:

UpdateMask()[source]

Should be called after a new mask is set manually. Updates the masks bounding box. The bounding box is used to reduce computing time when movement is searched for on the whole FOV. Usually gets called automatically when using setMask. :return:

activate()[source]

Activates this element, triggering an UI update if necessary :return:

deactivate()[source]

Deactivates this element, triggering an UI update if necessary :return:

deferredProcessing()[source]

Overload if you need to do some processor intensive image processing outside of the video thread. Set the needDeferredProcessing flag within onMovements, in order to have this method called by the framework. :return: nothing

getName()[source]

Retrieves the name of the SurfaceWatcher :return:

getWantMOGDiff()[source]

Overload and return True if you want movement to be triggered by the MOG detector, not simple diff. :return:

keyPress(keyString)[source]

Gets called in case someone pressd a key (on systems which have a keyboard) :return:

onBrowserChanged(activeElements)[source]

Gets called in case someone pressd a key (on systems which have a keyboard) :return:

onMovement(movement, baseDifference, frame, rawFrame, colorFrame, segFrame)[source]

called when something has happened to this watched area :param movement: there was some movement on the are :param baseDifference: the area is different from its base state :param frame: the last seen frame :return:

onWatcherAdded()[source]

overload if you need to react when this watcher gets added and active here you could set up other related watchers, etc. :return:

onWatcherRemoved()[source]

overload if you need to react when this watcher gets deactivated and removed here you could remove other related watchers, etc. :return:

setMaskFromRect(rect)[source]

Set the mask for movement detection based on a polygon. This is the easiest way of doing this. You can set more complex masks using SetMask :param rect: the rectangle :return:

update(qp)[source]

Overload this if you need to paint something based on the state of this UI element. Useful for projected stuff, not useful if you are just watching for things and not projecting stuff. Gets called from the ui thread. :param qp: QT paint context :return: nothing