Fix automatic perspective correction for de-fished images.

This commit is contained in:
Alexander Brock 2023-03-04 00:04:42 +01:00
parent e38a36ed9d
commit cb762662be

View File

@ -304,14 +304,18 @@ PerspectiveCorrection::Params PerspectiveCorrection::autocompute(ImageSource *sr
// TODO: Ensure image borders of rotated image do not get detected as lines.
neutral.rotate = pparams->rotate;
neutral.distortion = pparams->distortion;
neutral.perspective.camera_defish = pparams->perspective.camera_defish;
neutral.perspective.camera_focal_length = pparams->perspective.camera_focal_length;
neutral.perspective.camera_crop_factor = pparams->perspective.camera_crop_factor;
neutral.perspective.camera_scale = pparams->perspective.camera_scale;
neutral.lensProf = pparams->lensProf;
ImProcFunctions ipf(&neutral, true);
if (ipf.needsTransform(w, h, src->getRotateDegree(), src->getMetaData())) {
//if (ipf.needsTransform(w, h, src->getRotateDegree(), src->getMetaData())) {
Imagefloat *tmp = new Imagefloat(w, h);
ipf.transform(img.get(), tmp, 0, 0, 0, 0, w, h, w, h,
src->getMetaData(), src->getRotateDegree(), false);
img.reset(tmp);
}
//}
// allocate the gui buffer
g.buf = static_cast<float *>(malloc(sizeof(float) * w * h * 4));