Skip to content

Fix for code review#9

Closed
darthegg wants to merge 1 commit intomainfrom
code-review
Closed

Fix for code review#9
darthegg wants to merge 1 commit intomainfrom
code-review

Conversation

@darthegg
Copy link
Copy Markdown
Collaborator

No description provided.

@darthegg darthegg requested a review from hyunsehyun March 18, 2026 01:36
#!/usr/bin/env python3
"""
NavOCR with OCR Text Recognition (PaddleDetection + PaddleOCR)
Migrated from ultralytics YOLO to PaddleDetection (PPYOLOe)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description does not need specific update log.

self.declare_parameter('confidence_threshold', 0.5)
self.declare_parameter('output_dir', os.path.join(navocr_path, 'results/ros_result_ocr'))
self.declare_parameter('ocr_language', 'en')
self.declare_parameter('image_publish_rate', 2.0)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused parameter

self.declare_parameter('output_dir', os.path.join(navocr_path, 'results/ros_result_ocr'))
self.declare_parameter('ocr_language', 'en')
self.declare_parameter('image_publish_rate', 2.0)
self.declare_parameter('save_image', False)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flag for save image and benchmark.
Save images as default is too expensive.

self.get_logger().info(f'Session name: {self.session_name}')

# Rate limiting for image publishing
self.last_image_publish_time = self.get_clock().now()
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused variables


has_korean = any('\uac00' <= char <= '\ud7a3' for char in label)

if has_korean:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should add Korean support or not.
Korean support is always welcome, but our following stacks(e.g., TextMap) do not support Korean.

filename = os.path.join(self.output_dir, f"frame_{self.frame_id:06d}.png")
cv2.imwrite(filename, annotated_image)
# Save image periodically if save_image mode is on
if self.save_image:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flag for expensive operation.

def _draw_opencv_text(self, image, x1, y1, label_text):
"""Helper function to draw text with OpenCV"""
font = cv2.FONT_HERSHEY_SIMPLEX
font_scale = 0.6
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid hard-coding constant.
Use config file is the best, but if it is too much, then at least declare it as a class member_variable.

@darthegg darthegg closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant