Page 1 of 1

Warp problem workspace

Posted: February 18th, 2021, 6:15 pm
by jfoster
Attached is a self-contained workspace (no external image files needed) that illustrates a problem with the Warp transformation.

When using the Warp Transformation, there is an anomaly on the opposite edge of the warped file. See here the seam that appears when compositing the warped image onto another image:
warptest_problem-1.jpg
warptest_problem-1.jpg (202.05 KiB) Viewed 2869 times
Also, the problems reported on Nov 3, 2020 (where the Warp Transformation changes the size of the image by default) still seems to be a problem with larger images - the Nov 3 example only used an 800 pixel wide image but for larger images the resizing problem still occurs.

BTW, an image warp and composite (as illustrated here) shows no seam in PWP 7.

Jeff

Re: Warp problem workspace

Posted: February 19th, 2021, 8:15 am
by jsachs
It appears than when you did the warp, you accidentally moved the right edge very slightly beyond the edge of the image and thus picked up a thin vertical black line along the right edge. This was then composited onto the base image. If I go back to the Warp transformation and do a Reset and then move just the left edge of the grid, the line goes away.

Re: Warp problem workspace

Posted: February 19th, 2021, 9:08 am
by jfoster
I don't see that being the case. I can send you a screen-shot video if that would help. Also, notice that the Warp transformation changes the Y dimension from 2000 to 2001 on its own.


Jeff

Re: Warp problem workspace

Posted: February 19th, 2021, 9:54 am
by jsachs
There appear to be various roundoff issues that can create small variations in the location of the quadrilateral overlay. I was able to fix the error in the output image size when everything is reset -- at least for the case you posted.

Generally, Warp is not intended to be used the way you are using it -- it is really for doing perspective correction and intentionally distorting images. If all you want to do is add a black border to one side of an image, I would use Add Border.

Here is how Warp currently works:

Before you drag part of the quadrilateral, the current vertices are converted to screen coordinates -- after dragging the quadrilateral on the screen, the coordinates are converted back to image coordinates. If the zoom factor is less than 1:1 (i.e. if the image is zoomed out), this can cause small changes to the position of the quadrilateral, even parts you did not move -- the advantage of this technique is that if the zoom factor is greater than 1:1, you can set the vertices with sub-pixel accuracy. None of this really matters in most cases when you are straightening the verticals in an image, but it does not maintain absolute precision of vertices that you do not explicitly move.

Re: Warp problem workspace

Posted: February 19th, 2021, 11:20 am
by jfoster
IDK, it doesn’t seem good to change vertices in a non-user-directed fashion through round-off errors. PWP 7 warp is spot-on without these problems (as is every other image and video editor with which I’m familiar).

A design approach that might alleviate this problem would be to store the original image vertices and set a flag if a user operation changed a coordinate. If at the conclusion of the Warp operation, the “modify flag” (dirty bit) isn’t set on a coordinate then revert its coord to the original value with no round-off.

As a bonus, the original corner coords might be used for the Reset operation.

Cases that come to mind:

“Rigid” operations change all coords – the dirty bit is set for all corner’s X and Y coords.
“Rotate” – same as Rigid
“Free Corner” unconstrained (Shift-key not depressed) – X and Y dirty bit set only for that corner
“Free Corner” constrained by Shift-key – only the respective X or Y dirty bit for that corner is set.
“Free Edge” unconstrained – both adjacent corner’s X and Y dirty bits are set.
“Free Edge” constrained – both adjacent corner’s X OR Y dirty bits are set.

(Hopefully only set dirty bits after mouse movement event is detected and not merely by depressing mouse button on edge element.)

Obviously I’m not doing the coding so it’s easy for me to spew forth ideas.

Jeff

Re: Warp problem workspace

Posted: February 19th, 2021, 11:46 am
by jsachs
The code for PWP 8 was taken more or less directly from PWP 7 so I believe this issue has been there from the beginning. There have been minor roundoff errors I have chased down over the years, but fixing one case usually causes a problem somewhere else.

I will put fixing this on the requested feature list, but I am working on other parts of the program right now.

Re: Warp problem workspace

Posted: February 19th, 2021, 12:01 pm
by jfoster
Thanks.