Object Detection using Template

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Files Functions Variables
HOGExample.java
Go to the documentation of this file.
1 package cz.vutbr.feec.novak68;
2
3 import ij.ImagePlus;
4 import ij.io.FileSaver;
5 import cz.vutbr.feec.novak68.hogcomparators.HOGComparator;
6 import cz.vutbr.feec.novak68.hogcomparators.SimpleSthrenghtHOGComparator;
7
12 public class HOGExample {
13 public static void main(String[] args) {
14 // Load image via ImageJ library.
15 ImagePlus img1 = new ImagePlus("data/pedestrian/train/images2.jpg");
16 ImagePlus img2 = new ImagePlus("data/pedestrian/train/images.jpg");
17 System.out.println(Math.pow(5, 2));
18 // Vytvor HOG
19 HOG hog1 = getHOGTemplate(img1);
20 HOG hog2 = getHOGTemplate(img2);
21
22 // Porovnej HOG mezi sebou
23 // TODO vymyslet metodu porovnavani mezi sebou
24 HOGComparator comp = new SimpleSthrenghtHOGComparator();
25 double odlisnost = comp.getDistance(hog1, hog2);
26
27 System.out.println("Mira odlisnosti obrazku je: " + odlisnost);
28 }
29
34 private static HOG getHOGTemplate(ImagePlus img) {
35 // img.show();
36
37 // resize to pixels
38 int width = 120;
39 img = new ImagePlus("Resized", img.getProcessor().resize(width));
40
41 // apply HOG
42 int cellSizeX = 12;
43 int cellSizeY = 12;
44 int numOfBins = 6;
45 HOG hog = new HOG(img, cellSizeX, cellSizeY, numOfBins);
46 hog.compute();
47
48 // show partial results
49
50
51
52 FileSaver saver = new FileSaver(hog.showGradientX());
53 saver.saveAsPng("data/hogExample/gradientX.png");
54 saver = new FileSaver(hog.showGradientY());
55 saver.saveAsPng("data/hogExample/gradientY.png");
56 saver = new FileSaver(hog.showMagnification());
57 saver.saveAsPng("data/hogExample/magnif.png");
58 saver = new FileSaver(hog.showOrientation());
59 saver.saveAsPng("data/hogExample/orient.png");
60
61 // show final result - TODO
62 saver = new FileSaver(hog.displayAngles());
63 saver.saveAsPng("data/hogExample/angles.png");
64 hog.displayStrenghtOnly();
65 return hog;
66 }
67 }
cz.vutbr.feec.novak68.HOG.showGradientX
ImagePlus showGradientX()
Definition: HOG.java:304
cz.vutbr.feec.novak68.HOG.showGradientY
ImagePlus showGradientY()
Definition: HOG.java:315
cz.vutbr.feec.novak68.HOG.showOrientation
ImagePlus showOrientation()
Definition: HOG.java:335
cz.vutbr.feec.novak68.HOG.displayAngles
ImagePlus displayAngles()
Definition: HOG.java:168
cz.vutbr.feec.novak68.HOG.showMagnification
ImagePlus showMagnification()
Definition: HOG.java:325
cz.vutbr.feec.novak68.hogcomparators.HOGComparator
Definition: HOGComparator.java:9
cz.vutbr.feec.novak68.HOGExample.getHOGTemplate
static HOG getHOGTemplate(ImagePlus img)
Definition: HOGExample.java:34
cz.vutbr.feec.novak68.hogcomparators.SimpleSthrenghtHOGComparator
Definition: SimpleSthrenghtHOGComparator.java:11
cz.vutbr.feec.novak68.HOGExample.main
static void main(String[] args)
Definition: HOGExample.java:13
cz.vutbr.feec.novak68.HOG
Definition: HOG.java:19
cz.vutbr.feec.novak68.HOGExample
Definition: HOGExample.java:12