#include <QRCodeDetectionNode.hpp>
Definition at line 17 of file QRCodeDetectionNode.hpp.
◆ QRCodeDetectionNode()
| QRCodeDetectionNode::QRCodeDetectionNode |
( |
| ) |
|
◆ checkBoundingBox()
| bool QRCodeDetectionNode::checkBoundingBox |
( |
cv::Mat & |
bbox, |
|
|
cv::Mat & |
image |
|
) |
| |
|
private |
Definition at line 143 of file QRCodeDetectionNode.cpp.
145 float percentage = 0.3;
146 cv::Point2i topLeft = cv::Point2i(bbox.at<
float>(0,0),bbox.at<
float>(0,1));
147 cv::Point2i topRight = cv::Point2i(bbox.at<
float>(1,0),bbox.at<
float>(1,1));
148 cv::Point2i botRight = cv::Point2i(bbox.at<
float>(2,0),bbox.at<
float>(2,1));
149 cv::Point2i botLeft = cv::Point2i(bbox.at<
float>(3,0),bbox.at<
float>(3,1));
155 return std::abs(topLeft.y - topRight.y) < percentage * image.rows&&
156 std::abs(topRight.x - botRight.x) < percentage * image.cols&&
157 std::abs(botRight.y - botLeft.y) < percentage * image.rows&&
158 std::abs(botLeft.x - topLeft.x) < percentage * image.cols;
Referenced by onImgCallback(), and test_detection_loop().
◆ drawBox()
| void QRCodeDetectionNode::drawBox |
( |
cv::Mat & |
im, |
|
|
cv::Mat & |
bbox |
|
) |
| |
|
private |
Definition at line 161 of file QRCodeDetectionNode.cpp.
163 for(
int i = 0 ; i < n ; i++){
166 cv::Point2i(bbox.at<
float>(i,0),bbox.at<
float>(i,1)),
167 cv::Point2i(bbox.at<
float>((i+1) % n,0), bbox.at<
float>((i+1) % n,1)), cv::Scalar(255,0,0),
Referenced by onImgCallback(), and test_detection_loop().
◆ onImgCallback()
| void QRCodeDetectionNode::onImgCallback |
( |
const sensor_msgs::msg::Image::SharedPtr |
p_ImgMsg | ) |
|
Definition at line 50 of file QRCodeDetectionNode.cpp.
52 cv::Mat image = cv_bridge::toCvShare(p_ImgMsg,
"bgr8")->image;
54 bool foundQR = this->
m_detector.detect(image, boundingBox);
59 this->
drawBox(image, boundingBox);
72 log(
"Sending message: QR Code found.");
75 this->
publishQR(p_ImgMsg->header.stamp,
true);
78 log(
"Sending message: QR Code NOT found.");
79 this->
publishQR(p_ImgMsg->header.stamp,
false);
83 std::this_thread::sleep_for(std::chrono::milliseconds(250));
References checkBoundingBox(), drawBox(), galaxis::utils::log(), m_detector, m_foundQRCount, m_foundQRCountForSendingMessage, m_qrCodeFoundSometime, and publishQR().
Referenced by QRCodeDetectionNode().
◆ publishImage()
| void QRCodeDetectionNode::publishImage |
( |
cv::Mat & |
image | ) |
|
|
private |
◆ publishQR()
| void QRCodeDetectionNode::publishQR |
( |
rclcpp::Time |
stamp, |
|
|
bool |
detected |
|
) |
| |
|
private |
◆ test_detection_loop()
| void QRCodeDetectionNode::test_detection_loop |
( |
std::string |
path | ) |
|
◆ m_detector
| cv::QRCodeDetector QRCodeDetectionNode::m_detector |
|
private |
◆ m_foundQRCount
| int QRCodeDetectionNode::m_foundQRCount = 0 |
|
private |
◆ m_foundQRCountForSendingMessage
| int QRCodeDetectionNode::m_foundQRCountForSendingMessage = 10 |
|
private |
◆ m_imgBridge
| cv_bridge::CvImage QRCodeDetectionNode::m_imgBridge |
|
private |
◆ m_imgSubscriber
| rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr QRCodeDetectionNode::m_imgSubscriber |
|
private |
◆ m_publisherSeqNumber
| int QRCodeDetectionNode::m_publisherSeqNumber = 0 |
|
private |
◆ m_qrCodeDetectionPubSPtr
| rclcpp::Publisher<QRCodeDetectType>::SharedPtr QRCodeDetectionNode::m_qrCodeDetectionPubSPtr |
|
private |
◆ m_qrCodeFoundSometime
| bool QRCodeDetectionNode::m_qrCodeFoundSometime = false |
|
private |
◆ m_qrCodeVisible
| bool QRCodeDetectionNode::m_qrCodeVisible = false |
|
private |
◆ m_settingsJsonFilename
| std::string QRCodeDetectionNode::m_settingsJsonFilename |
|
private |
The documentation for this class was generated from the following files: