Esempio n. 1
0
class ShotDetectorTestCase(unittest.TestCase):
    def setUp(self):
        logging.basicConfig(level=logging.ERROR)
        video_uri = md().video_uri
        print video_uri
        self.video = Video(video_uri,begin=0,end=42)
        self.sd = ShotDetector()
        self.cuts,self.diss = self.sd.process(self.video.uri,profile='relax')

    def test_cuts(self):
        res = numpy.array([38,275,336,359,376,388,432,443,452,458,473,542,565,603])
        assert_equal(self.cuts[:14],res)
        
    def test_dissolves(self):
        res = [[ 459,  465],
               [ 713,  718],
               [1293, 1301],
               [1515, 1519],
               [1605, 1613],
               [1937, 1943],
               [2184, 2192],                             
               [2396, 2404],
               [2439, 2444],
               [2482, 2486],
               [2488, 2494]]
        assert_equal(self.diss,res)
Esempio n. 2
0
 def setUp(self):
     logging.basicConfig(level=logging.ERROR)
     video_uri = md().video_uri
     print video_uri
     self.video = Video(video_uri,begin=0,end=42)
     self.sd = ShotDetector()
     self.cuts,self.diss = self.sd.process(self.video.uri,profile='relax')
Esempio n. 3
0
    def getcuts(self):
        u"""
        video cut detection using GoodShotDetector class.

        :param smoothbyhisto: if true, we remove cut if histogram difference isn't sufficient 
        :type: boolean

        :rtype: list of frame number where cut was detected
        """        
        if 'goodshotdetection' not in self.hdf5['visual'].keys(): 
            sd = ShotDetector()
            cuts, diss = sd.process(self.uri)
            cuts.sort()
            diss.sort()

            gsd = self.hdf5['visual'].create_group('goodshotdetection')
            gsd.create_dataset('cuts', data=cuts)
            gsd.create_dataset('dissolves', data=diss)            
            
        gsd = self.hdf5['visual']['goodshotdetection']
        return map(numpy.array, (gsd['cuts'],gsd['dissolves']))