Object Detection using Template

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Files Functions Variables
SymetryBaseComparator.java
Go to the documentation of this file.
1 package cz.vutbr.feec.novak68.hogcomparators;
2
3
10 public abstract class SymetryBaseComparator implements HOGComparator {
14 protected int computetYSymetry(float threshold, float[][][] cells){
15 int cellsInYSymetry = 0;
16 boolean [][][] cellsMask = new boolean[cells.length][cells[0].length][cells[0][0].length];
17 for(int y=0;y<cells[0].length;y++ )
18 for (int x=0;x<cells.length; x++)
19 for(int a = 0; a<cells[0][0].length;a++)
20 if(cells[x][y][a] > threshold){
21 for(int x2=x+1;x2<cells.length;x2++){
22 if(cells[x2][y][a] > threshold){
23 for (int y2 = y+1;y2<cells[0].length;y2++)
24 if(cells[x2][y][a] >threshold && cells[x2][y2][a]>threshold && cells[x][y2][a]>threshold){
25 //znamena, ze se ulozi vzdy 2 nasledujici
26 cellsMask[x][y][a]=true;
27 cellsMask[x2][y][a]=true;
28 cellsMask[x][y2][a]=true;
29 cellsMask[x2][y2][a]=true;
30 }
31 else{
32 break;
33 }
34 }
35 }
36
37 }
38 for (int x=0;x<cells.length;x++)
39 for(int y = 0; y<cells[0].length;y++)
40 for(int a = 0; a<cells[0][0].length;a++)
41 cellsInYSymetry += (cellsMask[x][y][a]==true ? 1 : 0);
42 // System.out.println("Cells in Y symetry = " + cellsInYSymetry);
43 return cellsInYSymetry;
44 }
45 protected int computeXSymetry(float threshold, float [][][] cells){
46 int cellsInXSymetry = 0;
47 boolean [][][] cellsMask = new boolean[cells.length][cells[0].length][cells[0][0].length];
48 for (int x=0;x<cells.length; x++)
49 for(int y=0;y<cells[0].length;y++ )
50 for(int a = 0; a<cells[0][0].length;a++)
51 if(cells[x][y][a] > threshold){
52 for (int y2 = y+1;y2<cells[0].length;y2++)
53 if(cells[x][y2][a] > threshold){
54 for(int x2=x+1;x2<cells.length;x2++){
55 if(cells[x2][y][a] >threshold && cells[x2][y2][a]>threshold && cells[x][y2][a]>threshold){
56 //znamena, ze se ulozi vzdy 2 nasledujici
57 cellsMask[x][y][a]=true;
58 cellsMask[x2][y][a]=true;
59 cellsMask[x][y2][a]=true;
60 cellsMask[x2][y2][a]=true;
61 }
62 else{
63 break;
64 }
65 }
66 }
67
68 }
69 for (int x=0;x<cells.length;x++)
70 for(int y = 0; y<cells[0].length;y++)
71 for(int a = 0; a<cells[0][0].length;a++)
72 cellsInXSymetry += (cellsMask[x][y][a]==true ? 1 : 0);
73 // System.out.println("Cells in X symetry = " + cellsInXSymetry);
74 return cellsInXSymetry;
75 }
76 }
cz.vutbr.feec.novak68.hogcomparators.SymetryBaseComparator.computetYSymetry
int computetYSymetry(float threshold, float[][][] cells)
Definition: SymetryBaseComparator.java:14
cz.vutbr.feec.novak68.hogcomparators.HOGComparator
Definition: HOGComparator.java:9
cz.vutbr.feec.novak68.hogcomparators.SymetryBaseComparator.computeXSymetry
int computeXSymetry(float threshold, float[][][] cells)
Definition: SymetryBaseComparator.java:45
cz.vutbr.feec.novak68.hogcomparators.SymetryBaseComparator
Definition: SymetryBaseComparator.java:10