Add draw img data
This commit is contained in:
parent
63105b5ae4
commit
c74ebb3cd5
|
@ -67,6 +67,32 @@ cv::Rect CVPainter::DrawSize(const cv::Mat &img, const gravity_t &gravity) {
|
||||||
return DrawText(img, ss.str(), gravity, 5);
|
return DrawText(img, ss.str(), gravity, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::Rect CVPainter::DrawImgData(
|
||||||
|
const cv::Mat &img, const mynteye::ImgData &data,
|
||||||
|
const gravity_t &gravity) {
|
||||||
|
int sign = 1;
|
||||||
|
if (gravity == BOTTOM_LEFT || gravity == BOTTOM_RIGHT)
|
||||||
|
sign = -1;
|
||||||
|
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << "frame_id: " << data.frame_id << ", stamp: " << data.timestamp
|
||||||
|
<< ", expo: " << data.exposure_time;
|
||||||
|
cv::Rect rect_i = DrawText(img, ss.str(), gravity, 5);
|
||||||
|
|
||||||
|
Clear(ss) << "size: " << img.cols << "x" << img.rows;
|
||||||
|
cv::Rect rect_s =
|
||||||
|
DrawText(img, ss.str(), gravity, 5, 0, sign * (5 + rect_i.height));
|
||||||
|
|
||||||
|
// rect_i.width is the max one
|
||||||
|
if (sign > 0) {
|
||||||
|
return cv::Rect(
|
||||||
|
rect_i.tl(),
|
||||||
|
cv::Point(rect_i.x + rect_i.width, rect_s.y + rect_s.height));
|
||||||
|
} else {
|
||||||
|
return cv::Rect(rect_s.tl(), rect_i.br());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cv::Rect CVPainter::DrawImuData(
|
cv::Rect CVPainter::DrawImuData(
|
||||||
const cv::Mat &img, const mynteye::ImuData &data,
|
const cv::Mat &img, const mynteye::ImuData &data,
|
||||||
const gravity_t &gravity) {
|
const gravity_t &gravity) {
|
||||||
|
|
|
@ -34,6 +34,9 @@ class CVPainter {
|
||||||
~CVPainter();
|
~CVPainter();
|
||||||
|
|
||||||
cv::Rect DrawSize(const cv::Mat &img, const gravity_t &gravity = TOP_LEFT);
|
cv::Rect DrawSize(const cv::Mat &img, const gravity_t &gravity = TOP_LEFT);
|
||||||
|
cv::Rect DrawImgData(
|
||||||
|
const cv::Mat &img, const mynteye::ImgData &data,
|
||||||
|
const gravity_t &gravity = TOP_LEFT);
|
||||||
cv::Rect DrawImuData(
|
cv::Rect DrawImuData(
|
||||||
const cv::Mat &img, const mynteye::ImuData &data,
|
const cv::Mat &img, const mynteye::ImuData &data,
|
||||||
const gravity_t &gravity = TOP_RIGHT);
|
const gravity_t &gravity = TOP_RIGHT);
|
||||||
|
|
|
@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
painter.DrawSize(img);
|
painter.DrawImgData(img, *left_data.img);
|
||||||
if (!motion_datas.empty()) {
|
if (!motion_datas.empty()) {
|
||||||
painter.DrawImuData(img, *motion_datas[0].imu);
|
painter.DrawImuData(img, *motion_datas[0].imu);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user