README.md 3.07 KB
Newer Older
Ortner, Joshua's avatar
Ortner, Joshua committed
1
2
# ai4hdr_backend

3
4
5
6
7
## "sliceImage.py" program:
Slices an image into even sized tiles. 
Note: if the slice size doesn't fit evenly into the size of 
      the original image, pixels will be lost.

8
9
10
11
12
13
14
15
## Command line arguments:
- arg1: name of image file used for slicing
- arg2: file name used as base for all slices
- arg3: width of new slices
- arg4: height of new slices
- arg5: directory to save slices 

## Example run:
16
```bash
josh's avatar
josh committed
17
python ./Scripts/sliceImage.py ./TestResults/Slice/GeoEye_Original.jpg GeoEye_Slice 512 512 ./TestResults/Slice/
josh's avatar
josh committed
18
19
```

20
## Example run result:
josh's avatar
readme    
josh committed
21
## Original Image: 1180x1180
josh's avatar
josh committed
22
![](TestResults/Slice/GeoEye_Original.jpg)
josh's avatar
josh committed
23

josh's avatar
readme    
josh committed
24
## Slice 1: 512x512
josh's avatar
josh committed
25
![](TestResults/Slice/GeoEye_Slice-0-0.jpg)
josh's avatar
josh committed
26

josh's avatar
readme    
josh committed
27
## Slice 2: 512x512
josh's avatar
josh committed
28
![](TestResults/Slice/GeoEye_Slice-0-512.jpg)
josh's avatar
josh committed
29

josh's avatar
readme    
josh committed
30
## Slice 3: 512x512
josh's avatar
josh committed
31
![](TestResults/Slice/GeoEye_Slice-512-0.jpg)
josh's avatar
josh committed
32

josh's avatar
readme    
josh committed
33
## Slice 4: 512x512
josh's avatar
josh committed
34
![](TestResults/Slice/GeoEye_Slice-512-512.jpg)
35

36
37

## "meanShiftSeg.py" program:
josh's avatar
readme    
josh committed
38
39
 - Uses the pymeanshift library to create a segmented images
 - Install pymeanshift: pip install git+git://github.com/fjean/pymeanshift.git
40
41
42
43
44
45
46
47
48
49
50

## Command line arguments:
 - arg1: image file used for segmentation
 - arg2: directory to save results
 - arg3: base name for results files
 - arg4: spatial radius for ms algo
 - arg5: range radius for ms algo
 - arg6: min density for ms algo

 ## Example run:
 ```bash
josh's avatar
josh committed
51
python ./Scripts/meanShiftSeg.py ./TestResults/MS/GeoEye_MS_Original.jpg ./TestResults/MS pyms 6 6 50
52
53
```

josh's avatar
josh committed
54
55
56
## "initDB.py" program:
 - Sets up the base file structure for an image database at a given location.

josh's avatar
josh committed
57
## Directory Visual with no data:
josh's avatar
josh committed
58
59
60
61
62
63
64
```
|-- ImageDatabase
│   |-- MeanShift
│   |-- Original
│   |-- Sliced
```

josh's avatar
josh committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
## Directory Visual with an image:
```
|-- ImageDatabase
│   |-- MeanShift
|   |   |--image_name-id    
|   |   |   |--128x128
|   |   |   |   |--image_name-128-smap-0-0.<ext>      <- segmented map
|   |   |   |   |--image_name-128-simage-0-0.<ext>    <- segmented image
|   |   |   |--256x256
|   |   |   |--512x512
│   |-- Original
|   |   |--image_name-id.<ext>     <- original image, id = auto increment integer
│   |-- Sliced
|   |   |--image_name-id
|   |   |   |--128x128
|   |   |   |   |--image_name-128-0-0.<ext>   <- sliced image
|   |   |   |--256x256
|   |   |   |--512x512
```

josh's avatar
josh committed
85
86
87
## Example run result:
## Original Image:
![](TestResults/MS/GeoEye_MS_Original.jpg)
88

josh's avatar
josh committed
89
90
## Segmentation Image:
![](TestResults/MS/pyms-color-seg.jpg)
91

josh's avatar
josh committed
92
93
## Labels Image:
![](TestResults/MS/pyms-labels-image.jpg)
94
95
96


## "meanShift3Channel.py" program:
97
98
99
100
101
102
103
104
Uses the mean shift algorithm to create a segmentation mask for an image.

## Command line arguments:
 - arg1: image file used for segmentation
 - arg2: file name to save segmentation

 ## Example run:
 ```bash
josh's avatar
josh committed
105
python ./Scripts/meanShift3Channel.py ./TestResults/MS/GeoEye_MS_Original.jpg ./TestResults/MS/three-channel-seg
106
107
108
109
```

 ## Example run result:
 ## Original Image:
josh's avatar
josh committed
110
 ![](TestResults/MS/GeoEye_MS_Original.jpg)
111
112

 ## Segmentation Image:
josh's avatar
josh committed
113
 ![](TestResults/MS/three-channel-seg.jpg)
114
115

 ## Program run time:
116
117
118
 This program takes roughly 20 seconds to run, tested on an AMD FX(tm)-4300 Quad-Core Processor