FFT_MQ.py
Go to the documentation of this file.
1 import argparse
2 import numpy as np
3 
4 from skimage import io
5 from skimage.util import img_as_ubyte
6 
7 from rose_v1_repo.fft_structure_extraction import FFTStructureExtraction as structure_extraction
8 
9 import rose_v1_repo.fft_structure_extraction
10 
11 
12 def main(path_to_image, path_to_folder, filter_level, par):
13  # FFT
14 
15  grid_map = img_as_ubyte(io.imread(path_to_image))
16  rose = structure_extraction(grid_map, peak_height=0.2, par=50)
17  rose.process_map()
18 
19  rose.simple_filter_map(filter_level)
20  fft_structure_extraction.save_simple_map(path_to_folder + "_" + str(filter_level) + ".png", rose.analysed_map, rose.shape)
21  # rose.simple_filter_map(filter_level)
22 
23  # rose.histogram_filtering()
24 
25  # rose.generate_initial_hypothesis_with_kde()
26  rose.generate_initial_hypothesis_simple()
27  # rose.find_walls_with_line_segments()
28  rose.find_walls_flood_filing()
29 
30  rose.report()
31 
32  # TODO adjust this part of the src
33 
34 
35  visualisation = {"Binary map": False,
36  "FFT Spectrum": False,
37  "Unfolded FFT Spectrum": False,
38  "FFT Spectrum Signal": False,
39  "FFT Spectrum Noise": False,
40  "Map Reconstructed Signal": False,
41  "Map Reconstructed Noise": False,
42  "Map Scored Good": True,
43  "Map Scored Bad": False,
44  "Map Scored Diff": False,
45  "Map Split Good": False,
46  "FFT Map Split Good": False,
47  "Side by Side": False,
48  "Histogram of pixels quality": False,
49  "Histogram of scaled pixels quality": False,
50  "Simple Filtered Map": False,
51  "FFT spectrum with directions": False,
52  "Map with directions": False,
53  "Partial Scores": False,
54  "Partial Reconstructs": False,
55  "Threshold Setup with Clusters": False,
56  "Cluster Filtered Map": False,
57  "Map with walls": False,
58  "Map with slices": False,
59  "Wall lines from mbb": True,
60  "Labels and Raw map": False,
61  "Raw line segments": False,
62  "Clustered line segments": True,
63  "Short wall lines from mbb": True,
64  "Short wall lines over original map": True
65  }
66  rose.show(visualisation, path_to_folder, rose.shape)
67 
68 
69 # if __name__ == "__main__":
70 # # parse input
71 # parser = argparse.ArgumentParser()
72 # parser.add_argument('img_file', help='Path to the map')
73 # args = parser.parse_args()
74 # main(args, '')
fft_structure_extraction.save_simple_map
def save_simple_map(name, map_to_save, shape)
Definition: fft_structure_extraction.py:30
FFT_MQ.main
def main(path_to_image, path_to_folder, filter_level, par)
Definition: FFT_MQ.py:12


rose2
Author(s): Gabriele Somaschini, Matteo Luperto
autogenerated on Wed Jun 28 2023 02:21:53