Package Exports
- ndarray-warp
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ndarray-warp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ndarray-warp
Inverse image warping operations for ndarrays.
Example
//Load input image
var lena = require("luminance")(require("lena"))
//Allocate storage for result
var result = require("zeros")([512, 512])
//Apply warp
require("ndarray-warp")(result, lena, function(out, inp) {
var dx = inp[0] - 256
var dy = inp[1] - 256
var r = Math.sqrt(dx * dx + dy * dy)
var theta = Math.atan2(dy, dx)
out[0] = 0.9 * r * Math.cos(theta + 0.01 * r) + 256
out[1] = 0.7 * r * Math.sin(theta + 0.01 * r) + 256
})
//Save the result to stdout
require("save-pixels")(result, "png").pipe(process.stdout)
Which produces the following image:

Install
npm install ndarray-warp
require("ndarray-warp")(output, input, map(out_coord, in_coord))
Applies an inverse warp to an image
output
is an ndarray image that gets the result of applying the warpinput
is an ndarray iamge that is warpedmap(result, coord)
is a mapping from the coordinates of out image to input image.result
gets the resulting coordinate ininput
coord
is the coordinate inoutput
Credits
(c) 2013 Mikola Lysenko. MIT License