Wednesday, July 20, 2011

Video work

I've added video reading support with Opencv and GStreamer backends.

camera =CvVideo("test.avi")
#or camera = GstVideo("test.avi")
image = camera.get()

Extending the backend system to support switching classes would be great, similar to the way we handle functions but in a Video("test.avi", backend="opencv") kind of way.
The Opencv video duration retrieval methods are currently broken in Linux, but I implemented it anyway for when they fix it in the future. Until then, the functionality is there in GStreamer. Both implementations also play IP camera streams, so between them you are pretty much set to handle most cameras/codecs.

Monday, July 4, 2011

Backend Testing

The following is a code snippet of our testing system for Python Nose tests:

class TestSobel(BackendTester):
def test_00_00_zeros(self):
"""Sobel on an array of all zeros"""
result = F.sobel(np.zeros((10, 10), dtype=np.float32))
assert (np.all(result == 0))


When we inherit from BackendTester, tests are generated for all the implemented backends. If you have a missing dependency, the test will be skipped.