Add camera_defish to PerspCorrection::read/write

This commit is contained in:
Alexander Brock 2023-02-11 23:51:32 +01:00
parent 841e2ff26f
commit f023a90170
2 changed files with 8 additions and 3 deletions

View File

@ -521,7 +521,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
x_d /= params->perspective.camera_scale;
y_d /= params->perspective.camera_scale;
if (true || params->perspective.camera_defish) {
if (params->perspective.camera_defish) {
double const focal_source = params->perspective.camera_focal_length * maxRadius*1351.0/5206.416/6.5;
double focal_dst = focal_source;
x_d /= focal_dst;
@ -1261,7 +1261,7 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I
x_d /= params->perspective.camera_scale;
y_d /= params->perspective.camera_scale;
if (true || params->perspective.camera_defish) {
if (params->perspective.camera_defish) {
double const focal_source = params->perspective.camera_focal_length * maxRadius*1351.0/5206.416/6.5;
double focal_dst = focal_source;
x_d /= focal_dst;
@ -1513,7 +1513,9 @@ bool ImProcFunctions::needsPerspective () const
params->perspective.projection_shift_horiz ||
params->perspective.projection_shift_vert ||
params->perspective.projection_yaw ||
params->perspective.camera_defish) );
params->perspective.camera_defish ||
params->perspective.camera_scale > 1.0 + 1e-6 ||
params->perspective.camera_scale < 1.0 - 1e-6 ));
}
bool ImProcFunctions::needsGradient () const

View File

@ -346,6 +346,7 @@ void PerspCorrection::read (const ProcParams* pp, const ParamsEdited* pedited)
vert->setValue (pp->perspective.vertical);
setFocalLengthValue (pp, metadata);
camera_pitch->setValue (pp->perspective.camera_pitch);
camera_defish->set_active(pp->perspective.camera_defish);
camera_scale->setValue (pp->perspective.camera_scale);
camera_roll->setValue (pp->perspective.camera_roll);
camera_shift_horiz->setValue (pp->perspective.camera_shift_horiz);
@ -399,6 +400,7 @@ void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited)
pp->perspective.camera_focal_length = camera_focal_length->getValue ();
}
pp->perspective.camera_pitch = camera_pitch->getValue ();
pp->perspective.camera_defish = camera_defish->get_active ();
pp->perspective.camera_scale = camera_scale->getValue ();
pp->perspective.camera_roll = camera_roll->getValue ();
pp->perspective.camera_shift_horiz = camera_shift_horiz->getValue ();
@ -422,6 +424,7 @@ void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited)
}
if (pedited) {
pedited->perspective.camera_defish = true;
pedited->perspective.method = method->get_active_row_number() != 2;
pedited->perspective.horizontal = horiz->getEditedState ();
pedited->perspective.vertical = vert->getEditedState ();