Trying to unskew a masked image, any suggestions?

Hi,

So, i’ve been having some trouble figuring out how to crop and straighten the masked output of a processed image. My patch conceptually works like this:

  1. a camera takes in an image of a scene and renders it out (i know i could just video texture, but the feed is essential for another part of the patch to be devved later)
  2. a rendered feed is created from a quad that can be skewed and deformed in 3d space
  3. the video image is then masked by the quad image to produce a cropped and skewed masked image

Here’s where i’m not sure how to proceed

  1. the remaining non-black pixels are processed and stretched to fill a texture
  2. the texture is fed into a quad and renderer outputting a dewarped view of the contents of the masked live video

i’m having a hard time doing this, can anyone give me any suggestions

Here’s my Patch:

helpme (17.7 kB)

I’m not quite sure I follow, probably just a bit tired. But do have a look at the texture transform pin on the quad. If I got a general idea of what you are after I think you should be able to implement it with just this.

homography!

See attached

crop image.v4p (20.0 kB)

Thanks for the homography suggestion, it’s definitely what will be needed once i can map the xy coordinates of the original quad so i can math out the corners, my issue is that i need to grab the contents of the masked out quad so i can stretch it out

sorry that was unclear, i need it to dynamically adjust the homography values so that the output is a stable, squared image, no matter what the orientation of the mask quad

dynamically, how?

sorry, still unclear :)

k, so the larger patch that this is a part of creates a quad based on the position of a fiducial (ARTracker), the quad generated acts as a mask for a live video input, the resulting image will be stretched to fill another quad, undistorted. So no matter what orientation the masking quad the final video produced will appear somewhat stable and undistorted.

is there a way to retrieve the corner positions of the masking quad from matrix transform data? if so then i can use those values to calculate the homography distortion of the final image.

You can, but I still think that is more complicated then it need to be. Does this do what you want?

cropStraigten_2.v4p (16.9 kB)

I think that arbitrary point node can go to- should still work

yah it works great! thanks, what does arbitrary point do when its connected into itself like that?

Normally you would use it to deform geometry points, and it grabs the points of the downstream dx9 object. There are some examples in girlpower folder. Try deformsphere.v4p

In your patch it’s not needed at all and was really just a mistake though :P