Add auto perspective correction to GUI
Add three buttons for correcting pitch, yaw, or both. Horizontal and/or vertical tilt adjusters are updated with the automatically computed values.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "../rtengine/dfmanager.h"
|
||||
#include "../rtengine/ffmanager.h"
|
||||
#include "../rtengine/improcfun.h"
|
||||
#include "../rtengine/perspectivecorrection.h"
|
||||
#include "../rtengine/procevents.h"
|
||||
#include "../rtengine/refreshmap.h"
|
||||
|
||||
@@ -258,6 +259,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
|
||||
flatfield->setFFProvider (this);
|
||||
lensgeom->setLensGeomListener (this);
|
||||
rotate->setLensGeomListener (this);
|
||||
perspective->setLensGeomListener (this);
|
||||
distortion->setLensGeomListener (this);
|
||||
crop->setCropPanelListener (this);
|
||||
icm->setICMPanelListener (this);
|
||||
@@ -844,6 +846,26 @@ void ToolPanelCoordinator::straightenRequested ()
|
||||
toolBar->setTool (TMStraighten);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::autoPerspRequested (bool corr_pitch, bool corr_yaw, double& rot, double& pitch, double& yaw)
|
||||
{
|
||||
if (!(ipc && (corr_pitch || corr_yaw))) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtengine::ImageSource *src = dynamic_cast<rtengine::ImageSource *>(ipc->getInitialImage());
|
||||
if (!src) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtengine::procparams::ProcParams params;
|
||||
ipc->getParams(¶ms);
|
||||
|
||||
auto res = rtengine::PerspectiveCorrection::autocompute(src, corr_pitch, corr_yaw, ¶ms, src->getMetaData());
|
||||
rot = res.angle;
|
||||
pitch = res.pitch;
|
||||
yaw = res.yaw;
|
||||
}
|
||||
|
||||
double ToolPanelCoordinator::autoDistorRequested ()
|
||||
{
|
||||
if (!ipc) {
|
||||
|
Reference in New Issue
Block a user