40 Eigen::Matrix4f eigen;
41 for (
size_t r = 0; r < 4; ++r) {
42 for (
size_t c = 0; c < 4; ++c) {
43 eigen(r, c) = matrix(r, c);
51 for (
size_t r = 0; r < 4; ++r) {
52 for (
size_t c = 0; c < 4; ++c) {
53 qt(r, c) = matrix(r, c);
61 for (
int y = 0;
y <
image.height(); ++
y) {
62 QRgb* image_line = (QRgb*)
image.scanLine(
y);
63 for (
int x = 0;
x <
image.width(); ++
x) {
74 QPixmap
image = QPixmap(QSize(image1.width() + image2.width(),
75 std::max(image1.height(), image2.height())));
79 QPainter painter(&
image);
80 painter.drawImage(0, 0, image1.toImage());
81 painter.drawImage(image1.width(), 0, image2.toImage());
87 const QColor&
color) {
88 if (pixmap->isNull()) {
92 const int pen_width = std::max(pixmap->width(), pixmap->height()) / 2048 + 1;
93 const int radius = 3 * pen_width + (3 * pen_width) % 2;
94 const float radius2 = radius / 2.0f;
96 QPainter painter(pixmap);
97 painter.setRenderHint(QPainter::Antialiasing);
100 pen.setWidth(pen_width);
104 for (
const auto& point :
points) {
105 painter.drawEllipse(point.x - radius2, point.y - radius2, radius, radius);
113 const QColor& keypoints_color) {
116 QPainter painter(&
image);
117 painter.setRenderHint(QPainter::Antialiasing);
121 const int pen_width = std::max(
image.width(),
image.height()) / 2048 + 1;
122 const int radius = 3 * pen_width + (3 * pen_width) % 2;
123 const float radius2 = radius / 2.0f;
126 pen.setWidth(pen_width);
127 pen.setColor(keypoints_color);
130 for (
const auto& point : points1) {
131 painter.drawEllipse(point.x - radius2, point.y - radius2, radius, radius);
133 for (
const auto& point : points2) {
134 painter.drawEllipse(image1.width() + point.x - radius2, point.y - radius2,
140 pen.setWidth(std::max(pen_width / 2, 1));
142 for (
const auto& match : matches) {
143 const point2D_t idx1 = match.point2D_idx1;
144 const point2D_t idx2 = match.point2D_idx2;
145 pen.setColor(QColor(0, 255, 0));
147 painter.drawLine(QPoint(points1[idx1].
x, points1[idx1].
y),
148 QPoint(image1.width() + points2[idx2].x, points2[idx2].y));
std::shared_ptr< core::Tensor > image
bool GetPixel(const int x, const int y, BitmapColor< uint8_t > *color) const
QPixmap DrawMatches(const QPixmap &image1, const QPixmap &image2, const FeatureKeypoints &points1, const FeatureKeypoints &points2, const FeatureMatches &matches, const QColor &keypoints_color)
QImage BitmapToQImageRGB(const Bitmap &bitmap)
void DrawKeypoints(QPixmap *pixmap, const FeatureKeypoints &points, const QColor &color)
Eigen::Matrix4f QMatrixToEigen(const QMatrix4x4 &matrix)
QMatrix4x4 EigenToQMatrix(const Eigen::Matrix4f &matrix)
std::vector< FeatureKeypoint > FeatureKeypoints
std::vector< FeatureMatch > FeatureMatches
QPixmap ShowImagesSideBySide(const QPixmap &image1, const QPixmap &image2)
constexpr Rgb black(0, 0, 0)