Object Detection using Template

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Files Functions Variables
ElementBaseComparator.java
Go to the documentation of this file.
1 package cz.vutbr.feec.novak68.hogcomparators;
2
8 public abstract class ElementBaseComparator implements HOGComparator{
9
10 protected int computeHorizontalElements(float [][][] cells, float threshold){
11 //horizontalni bude vzdy bin 0, tedy
12 int count = 0;
13 for (int x = 0; x< cells.length;x++)
14 for(int y = 0; y< cells[0].length; y++)
15 count += (cells[x][y][0]>threshold ? 1 : 0);
16 return count;
17 }
18 protected int computeVerticalElements(float [][][] cells, float threshold){
19 int count = 0;
20 //u vertikalniho muze dojit na 2 pripady kdy neni presne 90° -> \/
21 if (((float)cells[0][0].length % 2)==0){
22 for(int x = 0; x<cells.length; x++)
23 for (int y = 0; y<cells[0].length;y++)
24 count += (cells[x][y][cells[0][0].length/2] >threshold ? 1 : 0);
25 }
26 else
27 {
28 for(int x = 0; x<cells.length; x++)
29 for (int y = 0; y<cells[0].length;y++){
30 count += (cells[x][y][(int) Math.floor(cells[0][0].length/2)] !=0 ? 1 : 0);
31 count += (cells[x][y][Math.round(cells[0][0].length/2)] >threshold ? 1 : 0);
32 }
33 }
34 return count;
35 }
36 protected int computeOtherElements(float [][][] cells,float threshold){
37 return computeAllElements(cells,threshold) - computeHorizontalElements(cells,threshold)-computeVerticalElements(cells,threshold);
38 }
39 protected int computeAllElements(float [][][] cells,float threshold){
40 int count =0;
41 for(int x = 0; x<cells.length;x++)
42 for(int y = 0; y < cells[0].length;y++)
43 for(int a =0; a < cells[0][0].length;a++)
44 count += (cells[x][y][a] >threshold ? 1 : 0);
45 return count;
46 }
47 }
cz.vutbr.feec.novak68.hogcomparators.ElementBaseComparator.computeVerticalElements
int computeVerticalElements(float[][][] cells, float threshold)
Definition: ElementBaseComparator.java:18
cz.vutbr.feec.novak68.hogcomparators.HOGComparator
Definition: HOGComparator.java:9
cz.vutbr.feec.novak68.hogcomparators.ElementBaseComparator
Definition: ElementBaseComparator.java:8
cz.vutbr.feec.novak68.hogcomparators.ElementBaseComparator.computeAllElements
int computeAllElements(float[][][] cells, float threshold)
Definition: ElementBaseComparator.java:39
cz.vutbr.feec.novak68.hogcomparators.ElementBaseComparator.computeHorizontalElements
int computeHorizontalElements(float[][][] cells, float threshold)
Definition: ElementBaseComparator.java:10
cz.vutbr.feec.novak68.hogcomparators.ElementBaseComparator.computeOtherElements
int computeOtherElements(float[][][] cells, float threshold)
Definition: ElementBaseComparator.java:36