"// {lamp states type : "decimal value"} std::unorderedmap<LampState, uint32t,…
- User
"// {lamp states type : "decimal value"} std::unordered_map<LampState, uint32_t, LampStateHash, LampStateEqual> states2id_ { {{auto_perception_msgs::msg::LampState::RED, 0, 0, 16657}, 1091698688},
{{auto_perception_msgs::msg::LampState::YELLOW, 0, 0, 16657}, 1091829760}, {{auto_perception_msgs::msg::LampState::GREEN, 0, 0, 16657}, 1091960832}, {{auto_perception_msgs::msg::LampState::UNKNOWN, 0, 0, 16657}, 1073741824}, {{auto_perception_msgs::msg::LampState::RED, 0, 0, 16689}, 1092747264}, {{auto_perception_msgs::msg::LampState::RED, nami_perception_msgs::msg::LampState::RIGHT, 0, 16673}, 1092747266}, {{auto_perception_msgs::msg::LampState::RED, 0, 0, 16673}, 1092747265}, {{auto_perception_msgs::msg::LampState::GREEN, nami_perception_msgs::msg::LampState::RIGHT, 0, 16673}, 1093009410}, {{auto_perception_msgs::msg::LampState::GREEN, 0, 0, 16673}, 1093009409}, {{auto_perception_msgs::msg::LampState::GREEN, 0, 0, 16689}, 1093009408}, {{auto_perception_msgs::msg::LampState::GREEN, 0, 0, 16673}, 1094057984}, {{auto_perception_msgs::msg::LampState::RED, nami_perception_msgs::msg::LampState::LEFT, 0, 16689}, 1093804032}, {{auto_perception_msgs::msg::LampState::RED, 0, 0, 16689}, 1093799936}, {{auto_perception_msgs::msg::LampState::RED, 0, 0, 16673}, 1093795840}, {{auto_perception_msgs::msg::LampState::GREEN, nami_perception_msgs::msg::LampState::LEFT, 0, 16689}, 1094066176}, {{auto_perception_msgs::msg::LampState::GREEN, 0, 0, 16689}, 1094062080} };" make an analogue in case of incorrect subtype input - Assistant
- User
"void TrafficLightImageVisualization::drawIconsOnImage(cv::Mat &image, const LampState &lampStates, const uint8_t numTl) { // coordinates pixel of the image int x = 0; int y = 0; int m = 0;
// determine center point where icons should be drawn int centerImg = image.cols / 2 + iconHeight_;
// check whether there's enough space to draw all specified icons if (centerImg - numTl * iconHeight_ < 0) { RCLCPP_ERROR(this->get_logger(), "Not enough horizontal space in image."); }
// determine the starting point for drawing the traffic light icon auto startX = centerImg - iconHeight_ / 2 - numTl * iconHeight_; auto endX = centerImg + iconHeight_ / 2 - numTl * iconHeight_;
// loop over pixels within range defined by number and size of icons for (x = startX; x < endX; x++) { for (y = 0; y < iconWidth_; y++) { // get a pixel cv::Vec3b imColor = image.atcv::Vec3b(cv::Point(x, y)); cv::Vec3b tlColor = dbTls_[states2id_[lampStates]].atcv::Vec3b(m);
code - Assistant