Object Detection using Template

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Files Functions Variables
SimpleHOGcellExtractor.java
Go to the documentation of this file.
1 package cz.vutbr.feec.novak68.extractors;
2
3 import cz.vutbr.feec.novak68.HOG;
4
8 public class SimpleHOGcellExtractor {
9 // protected int width;
10 // protected int cellSizeX;
11 // protected int cellSizeY;
12 // protected int numOfBins;
13 private int threshold;
14
18 public SimpleHOGcellExtractor() {
19 this(1000);
20 }
21
25 public SimpleHOGcellExtractor(int threshold) {
26 // this.width = width;
27 // this.cellSizeX = cellSizeX;
28 // this.cellSizeY = cellSizeY;
29 // this.numOfBins = numOfBins;
30 this.threshold = threshold;
31 // this.output = writer;
32 }
33
38 public String extractProperies(HOG hogTest) {
39 int [] bins = computeBinCount(hogTest, threshold);
40
41 StringBuilder finStr = new StringBuilder();
42 for (int i = 0 ; i < (bins.length); i++)
43 {
44 finStr.append(", ");
45 finStr.append(bins[i]);
46 }
47 return finStr.toString();
48 }
54 private int [] computeBinCount (HOG hog, int threshold){
55 int [] binCount = new int [hog.getCells().length * hog.getCells()[0].length * hog.getCells()[0][0].length];
56 for (int y = 0; y < hog.getCells()[0].length; y++)
57 for (int x = 0; x < hog.getCells().length;x++)
58 for (int a = 0; a <hog.getCells()[0][0].length; a++)
59 {
60 binCount[a + x * hog.getCells()[0][0].length + (y * hog.getCells().length * hog.getCells()[0][0].length)] += ((hog.getCells()[x][y][a] > threshold) ? 1 : 0);
61 }
62 return binCount;
63 }
68 public String extractProperiesMore(HOG hogTest) {
69 float [] bins = computeBinCountMore(hogTest, threshold);
70
71 StringBuilder finStr = new StringBuilder();
72 for (int i = 0 ; i < (bins.length); i++)
73 {
74 finStr.append(", ");
75 finStr.append(bins[i]);
76 }
77 return finStr.toString();
78 }
79
85 private float[] computeBinCountMore(HOG hog, int threshold) {
86 float [] binCount = new float [hog.getCells().length * hog.getCells()[0].length * hog.getCells()[0][0].length];
87 for (int y = 0; y < hog.getCells()[0].length; y++)
88 for (int x = 0; x < hog.getCells().length;x++)
89 for (int a = 0; a <hog.getCells()[0][0].length; a++)
90 {
91 binCount[a + x * hog.getCells()[0][0].length + (y * hog.getCells().length * hog.getCells()[0][0].length)] += ((hog.getCells()[x][y][a] > threshold) ? hog.getCells()[x][y][a] : 0);
92 }
93 return binCount;
94 }
95
96 }
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.threshold
int threshold
Definition: SimpleHOGcellExtractor.java:13
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.extractProperiesMore
String extractProperiesMore(HOG hogTest)
Definition: SimpleHOGcellExtractor.java:68
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.computeBinCountMore
float[] computeBinCountMore(HOG hog, int threshold)
Definition: SimpleHOGcellExtractor.java:85
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor
Definition: SimpleHOGcellExtractor.java:8
cz.vutbr.feec.novak68.HOG.getCells
float[][][] getCells()
Definition: HOG.java:345
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.SimpleHOGcellExtractor
SimpleHOGcellExtractor(int threshold)
Definition: SimpleHOGcellExtractor.java:25
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.computeBinCount
int[] computeBinCount(HOG hog, int threshold)
Definition: SimpleHOGcellExtractor.java:54
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.extractProperies
String extractProperies(HOG hogTest)
Definition: SimpleHOGcellExtractor.java:38
cz.vutbr.feec.novak68.HOG
Definition: HOG.java:19
cz.vutbr.feec.novak68.extractors.SimpleHOGcellExtractor.SimpleHOGcellExtractor
SimpleHOGcellExtractor()
Definition: SimpleHOGcellExtractor.java:18