Exemplo n.º 1
0
""" non-generated points """
#from simulator.points_dataset_... import points
#from outlierfilter import outlierfilterlib
#points = outlierfilterlib.filter_outliers(points)

""" pre-filtered points """
#from simulator.points_dataset_fish_robot_room import points

""" detect room """
#L = detect_room(points, do_preprocessing=False, numwalls=[4, 6, 8, 10], numcalculations=4, fancy_output=True)
#L = detect_room(points, do_preprocessing=False, numwalls=[4, 6], numcalculations=2, fancy_output=True)
L = detect_room(points, do_preprocessing=False, numwalls=[4], numcalculations=12, fancy_output=True)
#L = detect_room(points, do_preprocessing=False, numwalls=[4], numcalculations=1, fancy_output=True)

""" evaluate """
evaluator.evaluate_lines(L, 'line', points)

""" plot """
ioff()
plot_lines()
plot_points(points)
plot_walls(L)
show()

""" print """
#print encode_tuplearray_to_string([ l.E() for l in L ])




from simulator.evaluator import Evaluator
""" setup evaluator """
evaluator = Evaluator("wmm")
""" generate points """
points = generate_points(evaluator.sigma)
""" non-generated points """
#from simulator.points_dataset_... import points
#from outlierfilter import outlierfilterlib
#points = outlierfilterlib.filter_outliers(points)
""" pre-filtered points """
#from simulator.points_dataset_fish_robot_room import points
""" detect room """
#L = detect_room(points, do_preprocessing=False, numwalls=[4, 6, 8, 10], numcalculations=4, fancy_output=True)
#L = detect_room(points, do_preprocessing=False, numwalls=[4, 6], numcalculations=2, fancy_output=True)
L = detect_room(points,
                do_preprocessing=False,
                numwalls=[4],
                numcalculations=12,
                fancy_output=True)
#L = detect_room(points, do_preprocessing=False, numwalls=[4], numcalculations=1, fancy_output=True)
""" evaluate """
evaluator.evaluate_lines(L, 'line', points)
""" plot """
ioff()
plot_lines()
plot_points(points)
plot_walls(L)
show()
""" print """
#print encode_tuplearray_to_string([ l.E() for l in L ])
Exemplo n.º 3
0
for i, (rho_i, theta_i) in enumerate(peaks):
    peaks[i] = theta_i - 1, rho_i - 1

""" convert peaks to lines """
lines = []
peaks_theta_rho = []
for p in peaks:
    theta = thetas[p[0]]
    rho = rhos[p[1]]
    a = cos(theta)
    b = sin(theta)
    c = -rho
    peaks_theta_rho.append([theta, rho])
    lines.append([a, b, c])

""" evaluate """
evaluator.evaluate_lines(lines, "abc", points)

""" hough plot """
## plot 1: points space
plot_lines()
plot_points(points)
for l in lines:
    plot_abc_line(l, points)
show()

## plot 2: parameter space
# plot_hough(thetas, rhos, hgrid, peaks=peaks)
# plot_hough(thetas, rhos, hgrid)
# show()
Exemplo n.º 4
0
peaks = loadmat(MATLAB_PEAKS_FILE)['P']
evaluator.toc()
""" convert from matlab to python """
for i, (rho_i, theta_i) in enumerate(peaks):
    peaks[i] = theta_i - 1, rho_i - 1
""" convert peaks to lines """
lines = []
peaks_theta_rho = []
for p in peaks:
    theta = thetas[p[0]]
    rho = rhos[p[1]]
    a = cos(theta)
    b = sin(theta)
    c = -rho
    peaks_theta_rho.append([theta, rho])
    lines.append([a, b, c])
""" evaluate """
evaluator.evaluate_lines(lines, 'abc', points)
""" hough plot """
## plot 1: points space
plot_lines()
plot_points(points)
for l in lines:
    plot_abc_line(l, points)
show()

## plot 2: parameter space
#plot_hough(thetas, rhos, hgrid, peaks=peaks)
#plot_hough(thetas, rhos, hgrid)
#show()