Skip to content
Snippets Groups Projects
Commit e6619fd1 authored by l.dressen's avatar l.dressen
Browse files

Merge branch '438-drawing-of-calibration-points-crashes-on-more-2d-than-3d-points' into 'master'

fix crash on more 2D points than 3D points

Closes #438

See merge request !413
parents 13393810 ed12f1ff
No related branches found
No related tags found
1 merge request!413fix crash on more 2D points than 3D points
Pipeline #191244 passed
......@@ -690,9 +690,7 @@ bool ExtrCalibration::calcReprojectionError(const ExtrinsicParameters &extrParam
max_px,
mControlWidget->getDefaultHeight()};
return reprojectionError.pointHeightAvg() > MAX_AV_ERROR ?
false :
true; // Falls pixel fehler im schnitt > 20 ist das Ergebnis nicht akzeptabel
return reprojectionError.pointHeightAvg() <= MAX_AV_ERROR; // if average error > 20, result is not acceptable
}
/**
......
......@@ -199,31 +199,33 @@ void CoordItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*opti
cv::Point2f p2 = extCalib->get2DList().at(i);
painter->drawEllipse(p2.x - 8, p2.y - 8, 16, 16);
// general configuration
painter->setPen(Qt::blue);
painter->setBrush(Qt::blue);
// Projected 3D-Points
cv::Point3f p3d = extCalib->get3DList().at(i);
auto trans = mCoordSys->getCoordTrans3D();
p3d -= trans.toCvPoint();
// Show point number
painter->setPen(Qt::black);
painter->setBrush(Qt::black);
painter->drawText(QPointF(p2.x + 10, p2.y + font.pixelSize()), QObject::tr("%1").arg((i + 1)));
auto swap = mCoordSys->getSwap3D();
p3d.x *= (swap.x ? -1 : 1);
p3d.y *= (swap.y ? -1 : 1);
p3d.z *= (swap.z ? -1 : 1);
if(i < extCalib->get3DList().size())
{
// general configuration
painter->setPen(Qt::blue);
painter->setBrush(Qt::blue);
// Projected 3D-Points
cv::Point3f p3d = extCalib->get3DList().at(i);
auto trans = mCoordSys->getCoordTrans3D();
p3d -= trans.toCvPoint();
cv::Point2f p3 = extCalib->getImagePoint(p3d);
auto swap = mCoordSys->getSwap3D();
p3d.x *= (swap.x ? -1 : 1);
p3d.y *= (swap.y ? -1 : 1);
p3d.z *= (swap.z ? -1 : 1);
painter->drawEllipse(p3.x - 4, p3.y - 4, 8, 8);
cv::Point2f p3 = extCalib->getImagePoint(p3d);
// Connecting-line Pixel-3D-Points
painter->drawLine(QPointF(p2.x, p2.y), QPointF(p3.x, p3.y));
painter->drawEllipse(p3.x - 4, p3.y - 4, 8, 8);
// Show point number
painter->setPen(Qt::black);
painter->setBrush(Qt::black);
painter->drawText(QPointF(p2.x + 10, p2.y + font.pixelSize()), QObject::tr("%1").arg((i + 1)));
// Connecting-line Pixel-3D-Points
painter->drawLine(QPointF(p2.x, p2.y), QPointF(p3.x, p3.y));
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment