[PLUGIN] Paster

Post your completed addons to share with the community

Post » Sat Jan 31, 2015 6:39 am

You cannot capture a trapezoid so you'll need to capture the rectangle and then do some serious math to calculate the distortion, then the clean rectangle based on that. After you have it I would just draw the distorted image as a quad on a paster object of the correct size (but it would probably have a seam of sorts as seen in an older post here.

I once tried doing this for a work project in a different system and then my head exploded. It might be trivial for someone like R0J0, but if math isn't your strong side it could be tough.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Feb 02, 2015 2:15 am

@icepam
That's not really possible using this plugin.

You could of course calculate the transformation matrix from the points on the left to the points on the right, and apply the same transformation on the corners of the image on the left. It's a rough idea and a little tedious to do, especially if you've never done any matrix math. I could also instead possibly add another "draw textured quad" action that let's you specify uv coordinates to use.

The second and probably more pressing problem is the "draw texture quad" action doesn't do any perspective correction since it has no z knowledge. It looks like "affine" in this link:
http://en.wikipedia.org/wiki/Texture_ma ... orrectness

So you'd either have to write an effect to do the perspective drawing or do it with math in events a pixel at a time, which is relatively very slow. The math is basically in the above link but it doesn't cover everything.

I was able to use it a few posts back with horizontal lines but it's not enough for what you're after.
plugin-paster_p875157?#p875157
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Mon Feb 02, 2015 9:43 am

Thanks @R0J0hound, I found these maths (add the dots): www imagemagick org/Usage/distorts/#perspective, but as you said the block is the lack of trapezoid to start with.

Can the plugin have an added action like "copy underlying pixels to the quad" (with custom resolution ideally) - which would be similar to having a quad shaped Paster object I guess?

Then the 2D maths at imagemagick should, if I understood it correctly, allow us to fix the distortion - no need for z.
B
6
Posts: 16
Reputation: 282

Post » Mon Feb 02, 2015 7:03 pm

@icepam
I added an improved "draw quad" action that can set the texture uv's of an image. Attached is an example. It uses and updated paster plugin so you'll need to re-download it.

Notice it still doesn't look right since without z it's an affine transformation. For a correct look the z would need to be calculated for each point and the perspective drawing would have to be done manually.
You do not have the required permissions to view the files attached to this post.
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Tue Feb 03, 2015 11:23 am

thank you @R0j0hound, this looks nifty, and what you did should be sufficient for my demo, until I find a better technology to do this function. I don't understand uv mapping so I will do some research anyway to understand your capx.

I have done a version which seems to get slightly better results, but it is much more convoluted than the 5 lines in your capx. I will try to share later if anyone is interested.
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 03, 2015 11:34 am

thinking out loud here, would something like this be feasible with the current plugin? it would allow an extra degree of adjustment in the center of the image where the "diagonal" was hurting most. By extrapolation one can write a routine that will subdivide the whole image with such quads, with coordinated nodes... anyone?'''

QUADS.png
You do not have the required permissions to view the files attached to this post.
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 03, 2015 1:00 pm

@R0J0hound It looks like your updated Paster do not paste objects anymore :)
On every capx I've checked (using r196) "Paste Object into canvas" do not work at all.
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Tue Feb 03, 2015 1:06 pm

shinkan wrote:@R0J0hound It looks like your updated Paster do not paste objects anymore :)
On every capx I've checked (using r196) "Paste Object into canvas" do not work at all.


Indeed, can confirm.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Feb 03, 2015 1:36 pm

Somebody wrote:
shinkan wrote:@R0J0hound It looks like your updated Paster do not paste objects anymore :)
On every capx I've checked (using r196) "Paste Object into canvas" do not work at all.


Indeed, can confirm.


me too, thought it was me :)
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 03, 2015 1:38 pm

*sneaky mode on* This would be the perfect occasion to look into pasted object opacity being set to 100 every time as well *sneaky mode to moderate*
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: ahtur and 1 guest