After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598985 - Perspective tool incorrect results, memory overflow
Perspective tool incorrect results, memory overflow
Status: RESOLVED DUPLICATE of bug 316479
Product: GIMP
Classification: Other
Component: Tools
2.6.7
Other Linux
: Normal normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2009-10-19 21:17 UTC by Clarence Risher
Modified: 2012-06-17 19:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Photo that produces undesired effects when corrected for perspective (65.09 KB, image/jpeg)
2009-10-19 21:17 UTC, Clarence Risher
Details

Description Clarence Risher 2009-10-19 21:17:36 UTC
Created attachment 145807 [details]
Photo that produces undesired effects when corrected for perspective

When performing a perspective correction on the attached image, the results are
unpredictable and never correct.

Steps to reproduce:
1) Open the attached image
2) Use the Perspective tool
3) Select Corrective (backwards) direction
4) Drag the corners of the image to the corners of the sidewalk tile containing
the drawing, two of which are off the edge of the image and should be estimated
5) Click Transform

Possible results, pseudo-random in occurrence:
1) The main GIMP window becomes nonresponsive, CPU usage goes to 100%, the
status bar does not show a progress bar for the Perspective Correction, nothing
else happens until GIMP is killed.
2) The main GIMP window becomes nonresponsive, CPU usage goes to 100%, the
progress bar appears and fills to completion, but does not go away, nothing
else happens until GIMP is killed.
3) as (1) or (2), but with unbounded memory usage growth
4) The perspective transformation completes, but only a small part of the
image, wildly skewed, is preserved
5) as (4), but with the resulting layer wildly resized and far outside the
image boundaries
Comment 1 xiphmont 2009-10-23 08:10:55 UTC
The trigger for this behavior is that 'Clipping' is set to 'Adjust' and the inverse transform has a horizon singularity such that the upper right corner of the original source rectangle is projected past positive infinity and wraps around, reappearing on the negative side.  You can see this in the math from the fact that the 'w' term passes through zero and goes negative in the projection calculation.  This is resulting in an absurdly large transform boundary.

Thus, the 'adjust' setting is requesting an impossible result.  There is already code in gimp_transform_resize_boundary expecting this 'error' (checking to see if the projected corners are FINITE(), but there's no portable way in C89 to set a double to +/-Inf or NAN for that matter, and code in transform_point avoids any exception so the FINITE() checks in gimp_transform_resize_boundary will never trigger.

Would the proper thing to do be to  check for an impossible transform out of band (a new libgimpmath call?) and drop back to 'GIMP_TRANSFORM_RESIZE_CLIP' in that case?
Comment 2 xiphmont 2009-10-23 08:13:24 UTC
Oh, I forgot to note: selecting the 'Clip' option in the dropdown menu avoids the singularity and the transform succeeds.
Comment 3 Michael Natterer 2012-06-17 19:02:40 UTC
I trust Alexis' elaborate analysis in bug #316479 and resolve this
one a a duplicate.

*** This bug has been marked as a duplicate of bug 316479 ***