Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grids to astar/combination images #15

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions autonav_ws/src/autonav_nav/src/astar.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def create_path(self):

cv2.circle(cvimg, (self.best_pos[0], self.best_pos[1]), 1, (255, 0, 0), 1)
cvimg = cv2.resize(cvimg, (320, 320), interpolation=cv2.INTER_NEAREST)
# Draw a grid on the image that is the scale of the original image, so it should be a 80x80 grid scaled up 4x
for i in range(80):
cv2.line(cvimg, (0, i * 4), (320, i * 4), (85, 85, 85), 1)
cv2.line(cvimg, (i * 4, 0), (i * 4, 320), (85, 85, 85), 1)
self.pathDebugImagePublisher.publish(CV_BRIDGE.cv2_to_compressed_imgmsg(cvimg))

def reconstruct_path(self, path, current):
Expand Down
6 changes: 6 additions & 0 deletions autonav_ws/src/autonav_vision/src/combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def try_combine_grids(self):
preview_image[i, j] = 0 if combined_grid.data[i * 80 + j] <= 10 else 255
preview_image = cv2.cvtColor(preview_image, cv2.COLOR_GRAY2RGB)
preview_image = cv2.resize(preview_image, (320, 320))

# Draw a grid on the image that is the scale of the original image, so it should be a 80x80 grid scaled up 4x
for i in range(80):
cv2.line(preview_image, (0, i * 4), (320, i * 4), (85, 85, 85), 1)
cv2.line(preview_image, (i * 4, 0), (i * 4, 320), (85, 85, 85), 1)

compressed_image = g_bridge.cv2_to_compressed_imgmsg(preview_image)
self.combined_grid_image_publisher.publish(compressed_image)

Expand Down
Loading