An openFrameworks port of the Cinder-Warping block by @paulhoux. Enables you to easily create editable bi-linear and perspective warps, or a combination of the two.
From the Cinder-Warping README:
Image warping, as used in this addon, is the process of manipulating an image so that it can be projected onto flat or curved surfaces without distortion. There are three types of warps available:
- Perspective warp: performs image correction for projecting onto flat surfaces in case the projector is not horizontally and/or vertically aligned with the wall. Use it to exactly project your content on a rectangular area on a wall or building, regardless of how your projector is setup. For best results, disable any keystone correction on the projector. Then simply drag the four corners of your content where you want them to be on the wall.
- Bilinear warp: inferior to perspective warping on flat surfaces, but allows projecting onto curved surfaces. Simply add control points to the warp and drag them to where you want your content to be.
- Perspective-bilinear warp: a combination of both techniques, where you first drag the four corners of your content to the desired location on the wall, then adjust for curvatures using the additional control points. If you (accidentally) move your projector later, all you need to do is adjust the four corners and the projection should perfectly fit on the curved wall again.
- Drop the addon folder into your
openFrameworks/addonsdirectory, and add to project as you would any other addon. - Copy the shaders found in the example to your project's
bin/data/shaders/ofxWarpfolder.
- openFrameworks 0.9 and up
- OpenGL 3 and up (programmable pipeline)
- The included shaders only work with normalized textures (
GL_TEXTURE_2D) but can be easily modified to work with rectangle textures
You can use ofxWarp::Controller to adjust your warps:
wto toggle editing on all warps- Use mouse or cursor keys to move the currently selected control point
TABto select the next control point-or+to change brightnessrto reset the warp to its default settingsF11to flip content horizontallyF12to flip content vertically
For Perspective warps only:
F9to rotate content counter-clockwiseF10to rotate content clockwise
For Bilinear warps only:
mto toggle between linear and curved mappingF1to reduce the number of horizontal control pointsF2to increase the number of horizontal control pointsF3to reduce the number of vertical control pointsF4to increase the number of vertical control pointsF5to decrease the mesh resolutionF6to increase the mesh resolutionF7to toggle adaptive mesh resolution