def test_disparity(self):
        stereo.get_stereo_depth(self.left_video, self.right_video, {"frame": -1, "filename": "test_data/pc.ply"})
        actual_disparity = cv2.imread("test_data/disparity.jpg")
        disparity_diff = cv2.absdiff(actual_disparity, self.expected_disparity)

        # The median difference between the expected and actual disparity
        # should be less than the specified threshold.
        differences = disparity_diff.flatten().tolist()
        median_diff = sorted(differences)[len(differences) / 2]
        self.assertLessEqual(median_diff, self.max_disparity_diff)
Exemplo n.º 2
0
"""Simple demo of the stereo camera code. Creates disparity map in test_data, 
point cloud in current directory."""

import stereo_rig_model as stereo
import cv2

if __name__ == '__main__':
    lvideo = cv2.VideoCapture('test_data/videos/calibrator/left/%03d.jpeg')
    rvideo = cv2.VideoCapture('test_data/videos/calibrator/right/%03d.jpeg')
    stereo.get_stereo_depth(lvideo, rvideo, {
        'frame': -1,
        'filename': 'point_cloud.ply'
    })
    print 'Wrote point cloud to point_cloud.ply'
    print 'Wrote disparity map to test_data/disparity.jpg'
 def test_point_cloud(self):
     stereo.get_stereo_depth(self.left_video, self.right_video, {"frame": -1, "filename": "test_data/pc.ply"})
     self.assertTrue(os.path.exists("test_data/pc.ply"))
     self.assertGreater(os.stat("test_data/pc.ply").st_size, 0)
Exemplo n.º 4
0
"""Simple demo of the stereo camera code. Creates disparity map in test_data, 
point cloud in current directory."""

import stereo_rig_model as stereo
import cv2

if __name__ == '__main__':
    lvideo = cv2.VideoCapture('test_data/videos/calibrator/left/%03d.jpeg')
    rvideo = cv2.VideoCapture('test_data/videos/calibrator/right/%03d.jpeg')
    stereo.get_stereo_depth(lvideo, rvideo,
                            {'frame': -1, 'filename': 'point_cloud.ply'})
    print 'Wrote point cloud to point_cloud.ply'
    print 'Wrote disparity map to test_data/disparity.jpg'