ndarray-warp

WebJar for ndarray-warp

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

ndarray-warp
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

ndarray-warp
WebJar for ndarray-warp
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/scijs/ndarray-warp

Download ndarray-warp

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ndarray-warp/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ndarray-warp</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ndarray-warp/
implementation 'org.webjars.npm:ndarray-warp:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/ndarray-warp/
implementation ("org.webjars.npm:ndarray-warp:1.0.1")
'org.webjars.npm:ndarray-warp:jar:1.0.1'
<dependency org="org.webjars.npm" name="ndarray-warp" rev="1.0.1">
  <artifact name="ndarray-warp" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ndarray-warp', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "ndarray-warp" % "1.0.1"
[org.webjars.npm/ndarray-warp "1.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : cwise jar [1.0.4,2)
org.webjars.npm : ndarray-linear-interpolate jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

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 warp

  • input is an ndarray iamge that is warped

  • map(result, coord) is a mapping from the coordinates of out image to input image.

    • result gets the resulting coordinate in input
    • coord is the coordinate in output

Credits

(c) 2013 Mikola Lysenko. MIT License

org.webjars.npm

Versions

Version
1.0.1