16
16
from utils import *
17
17
18
18
P_prior = 0.5 # Prior occupancy probability
19
- P_occ = 0.9 # Probability that cell is occupied with total confidence
19
+ P_occ = 0.9 # Probability that cell is occupied with total confidence
20
20
P_free = 0.3 # Probability that cell is free with total confidence
21
21
22
22
RESOLUTION = 0.03 # Grid resolution in [m]
49
49
50
50
# Create grid map
51
51
gridMap = GridMap (X_lim = map_x_lim ,
52
- Y_lim = map_y_lim ,
53
- resolution = RESOLUTION ,
54
- p = P_prior )
52
+ Y_lim = map_y_lim ,
53
+ resolution = RESOLUTION ,
54
+ p = P_prior )
55
55
56
56
# Init time
57
57
t_start = perf_counter ()
114
114
set_pixel_color (bgr_image , x , y , 'GREEN' )
115
115
116
116
resized_image = cv2 .resize (src = bgr_image ,
117
- dsize = (500 , 500 ),
118
- interpolation = cv2 .INTER_AREA )
117
+ dsize = (500 , 500 ),
118
+ interpolation = cv2 .INTER_AREA )
119
119
120
120
rotated_image = cv2 .rotate (src = resized_image ,
121
- rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
121
+ rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
122
122
123
123
cv2 .imshow ("Grid map" , rotated_image )
124
124
cv2 .waitKey (1 )
143
143
144
144
# Saving Grid Map
145
145
resized_image = cv2 .resize (src = gridMap .to_BGR_image (),
146
- dsize = (500 , 500 ),
147
- interpolation = cv2 .INTER_AREA )
146
+ dsize = (500 , 500 ),
147
+ interpolation = cv2 .INTER_AREA )
148
148
149
149
rotated_image = cv2 .rotate (src = resized_image ,
150
- rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
150
+ rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
151
151
152
152
flag_1 = cv2 .imwrite (img = rotated_image * 255.0 ,
153
- filename = MAPS_PATH + '/' + MAP_NAME + '_grid_map_TEST.png' )
153
+ filename = MAPS_PATH + '/' + MAP_NAME + '_grid_map_TEST.png' )
154
154
155
155
# Calculating Maximum likelihood estimate of the map
156
156
gridMap .calc_MLE ()
157
157
158
158
# Saving MLE of the Grid Map
159
159
resized_image_MLE = cv2 .resize (src = gridMap .to_BGR_image (),
160
- dsize = (500 , 500 ),
161
- interpolation = cv2 .INTER_AREA )
160
+ dsize = (500 , 500 ),
161
+ interpolation = cv2 .INTER_AREA )
162
162
163
163
rotated_image_MLE = cv2 .rotate (src = resized_image_MLE ,
164
- rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
164
+ rotateCode = cv2 .ROTATE_90_COUNTERCLOCKWISE )
165
165
166
166
flag_2 = cv2 .imwrite (img = rotated_image_MLE * 255.0 ,
167
- filename = MAPS_PATH + '/' + MAP_NAME + '_grid_map_TEST_mle.png' )
167
+ filename = MAPS_PATH + '/' + MAP_NAME + '_grid_map_TEST_mle.png' )
168
168
169
169
if flag_1 and flag_2 :
170
170
print ('\n Grid map successfully saved!\n ' )
171
171
172
172
if cv2 .waitKey (0 ) == 27 :
173
173
cv2 .destroyAllWindows ()
174
174
175
- pass
175
+ pass
0 commit comments