Mercurial > hg > segmentation
comparison novelty.py @ 8:a34f9c5d0cd9
remove pyc files tracked by mistake
author | mitian |
---|---|
date | Mon, 11 May 2015 17:29:19 +0100 |
parents | 294f66d285af |
children | c01fcb752221 |
comparison
equal
deleted
inserted
replaced
7:294f66d285af | 8:a34f9c5d0cd9 |
---|---|
44 | 44 |
45 if normalise: | 45 if normalise: |
46 novelty = (novelty - np.min(novelty)) / (np.max(novelty) - np.min(novelty)) | 46 novelty = (novelty - np.min(novelty)) / (np.max(novelty) - np.min(novelty)) |
47 return novelty | 47 return novelty |
48 | 48 |
49 def getNoveltyDiff(novelty, N=1, relative=False): | |
50 '''Return the second order differece in the novelty curve.''' | |
51 | |
52 diff = np.zeros_like(novelty) | |
53 diff[:-N] = np.diff(novelty, n=N) | |
54 | |
55 if relative: | |
56 diff /= novelty | |
57 | |
58 return diff | |
59 | |
49 def getDiagonalSlice(ssm, width): | 60 def getDiagonalSlice(ssm, width): |
50 ''' Return a diagonal stripe of the ssm given its width, with 45 degrees rotation. | 61 ''' Return a diagonal stripe of the ssm given its width, with 45 degrees rotation. |
51 Note: requres 45 degrees rotated kernel also.''' | 62 Note: requres 45 degrees rotated kernel also.''' |
52 w = int(np.floor(width/2.0)) | 63 w = int(np.floor(width/2.0)) |
53 length = len(np.diagonal(ssm)) | 64 length = len(np.diagonal(ssm)) |