function [x_pts, y_pts] = generateObstacles(env, threshold, dx, init_conf, final_conf, safe_radius)

xdim = env(2) - env(1);
ydim = env(4) - env(3);

im = zeros(floor(xdim/dx), floor(ydim/dx)); 
im = perlin_noise(im);
obs_points = im;

obs_points = obs_points + abs(min(min(obs_points))); % make it positive
obs_points = obs_points/max(max(obs_points)); % make it normal
obs_points = smoothdata(obs_points,1,'movmean',10);
obs_points = smoothdata(obs_points,2,'movmean',10);

[x_pts, y_pts] = find(obs_points <= threshold);
x_pts = x_pts.*dx;
y_pts = y_pts.*dx;

% iterate through to get rid of points interferring with starting and
% ending points
% but do it for all points in initial and final configurations

for i=1:size(init_conf,1)
    init_d = sqrt((init_conf(i,1) - x_pts).^2 + (init_conf(i,2) - y_pts).^2);
    x_pts = x_pts(init_d >= safe_radius);
    y_pts = y_pts(init_d >= safe_radius);
end
for i=1:size(final_conf,1)
    final_d = sqrt((final_conf(i,1) - x_pts).^2 + (final_conf(i,2) - y_pts).^2);
    x_pts = x_pts(final_d >= safe_radius);
    y_pts = y_pts(final_d >= safe_radius);
end

end