Merge pull request #5569 from Lawrence37/perspective
Generalize perspective correction
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"
|
||||
|
||||
@@ -280,6 +281,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);
|
||||
@@ -732,6 +734,7 @@ void ToolPanelCoordinator::initImage(rtengine::StagedImageProcessor* ipc_, bool
|
||||
|
||||
icm->setRawMeta(raw, (const rtengine::FramesData*)pMetaData);
|
||||
lensProf->setRawMeta(raw, pMetaData);
|
||||
perspective->setMetadata(pMetaData);
|
||||
}
|
||||
|
||||
|
||||
@@ -983,6 +986,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