Corner pin UI

I might be getting things wrong… but in my opinion, depending on what you are doing, it would be nice if the interface also allowed me to specify the “inverse transform”. That is… I do not want to say where the the image must fit. I want to clip the image and make it all fit to the screen. It is like zooming, but I would like to zoom and kind of plumb.

It would be like the cage transform on Gimp. But only with four vertexes that would be mapped to the “screen” corners.

You pin the original image.

Then it gets transformed like this.

The UI could show me the clip without the corner pin effect. Then, I pin where I want the image to be fit to the screen. The transform would simply be the inverse of the usually computed transform.

This would be useful if you need to size, position, rotate and “plumb”.

Sorry for the horrible images. :sweat_smile:



This could be implemented in different ways.

  1. You double-click somewhere in the image and this point goes straight to the corner. We just need a nice way to figure which corner.
    1.1 Could be the corner closest to the point. (this would be nice for small adjustments)
    1.2 The user could hold the key indicating which corner while s/he does it.

  2. There could be a checkbox (associated with a key) that would produce the inverse when selected. The only important thing here, is that the preview of the transform shall not be executed while dragging. It can be executed just after the mouse button is released.
    2.1 Instead of a checkbox, there could be a “toggable” dot right in the middle. When you click it, “corner dots in white” would be substituted by “corner dots in red”.

  3. Both. :grin:

I like this idea!

I was just checking frei0r’s c0rners implementation. The first thing I noticed… @shotcut Dan’s picture appears everywhere!!! :slight_smile:

The second thing I noticed is that there is a geom4c_b that generates a map[x][y] (that needs to be allocated). This array can be used to implement an c0rners_inverse_map(int *x, int *y). The idea is:

int x = a;
int y = b;
c0rners_inverse_map(&x, &y);
std:: cout << “The point (”, << x << ", " << y << “) is transformed to (” << a << ", " << b << “).”;

All c0rners_inverse_map has to do is look for the point (map[...], map[...]) that is closest to (a, b). Here is how map can be read.

If I understand your suggestion correctly, I guess it would be more like the Transform > Distort tool in Photoshop.

Gimp’s Cage Transform tool produces a somewhat distorted result.

I don’t know Photoshop, but I think you are right. Gimp and Photoshop should swap their tool name! Gimp’s feature distorts much more. :wink:

I want to do exactly what frei0r.c0rners do. But with a different UI. For the user, it can look like a different filter, but it is just a different method to specify the same filter.

Imagine you want to mix two clips. In both of them you have some “four corner object”. In my case, a whiteboard, but it could be a door, a painting on the wall, a window, etc. You want the object to overlap. You don’t want your transition to be abrupt. You don’t want the object to disappear and reappear in a slightly different place. You want the four corners on one clip to be mapped to the corresponding four corners on the other clip.

So, it would be nice to have a UI where you could give this information. The UI would then figure out the correct parameter (four points) to pass to frei0r.c0rners.