1
2
3
4
5
6
7
8
9 package org.openimaj.video.tracking.klt;
10
11 import org.openimaj.image.FImage;
12 import org.openimaj.image.processing.convolution.FGaussianConvolve;
13
14
15
16
17
18
19
20 public class PyramidSet{
21
22
23
24
25 public PyramidSet(FImage image, TrackingContext tc) {
26 int nrows = image.height, ncols = image.width;
27 FImage floatimg2 = image.process(new FGaussianConvolve(tc.computeSmoothSigma()));
28 this.imgPyr = new Pyramid(ncols, nrows, (int) tc.subsampling, tc.nPyramidLevels);
29 this.imgPyr.computePyramid(floatimg2, tc.pyramid_sigma_fact);
30 this.gradx = new Pyramid(ncols, nrows, (int) tc.subsampling, tc.nPyramidLevels);
31 this.grady = new Pyramid(ncols, nrows, (int) tc.subsampling, tc.nPyramidLevels);
32 for (int i = 0 ; i < tc.nPyramidLevels ; i++)
33 tc.computeGradients(imgPyr.img[i], tc.grad_sigma, gradx.img[i], grady.img[i]);
34 }
35
36
37
38
39
40 public PyramidSet(Pyramid imgPyr, Pyramid gradx,Pyramid grady) {
41 this.imgPyr = imgPyr;
42 this.gradx = gradx;
43 this.grady = grady;
44 }
45 PyramidSet() {
46
47 }
48
49
50
51 public Pyramid imgPyr;
52
53
54
55 public Pyramid gradx;
56
57
58
59 public Pyramid grady;
60
61
62
63
64 public boolean isNull() {
65 return imgPyr == null || grady == null || gradx == null;
66 }
67 }