diff --git a/README.md b/README.md
index d71b372..d2a2d7a 100644
--- a/README.md
+++ b/README.md
@@ -14,30 +14,29 @@
## Install
-Via npm for Node.js (Node module):
-
-```js
-$ npm install homography
-...
-import { Homography, loadImage } from "homography";
-```
-
To use as a module in the browser (Recommended):
```html
```
If you don't need to perform Piecewise Affine Transforms, you can also use a very lightweight UMD build that will expose the homography
global variable and will charge faster:
```js
-
+
...
// And then in your script
const myHomography = new homography.Homography();
// Remember to don't override the homography variable by naming your object "homography"
```
+Via npm for Node.js (Node module):
+
+```js
+$ npm install homography
+...
+import { Homography, loadImage } from "homography";
+```
## Usage
### In the Browser
@@ -191,7 +190,7 @@ Sets the source reference points ([[x1, y1], [x2, y2], ..., [xn, yn
- points : Source points of the transform, given as a
ArrayBuffer
or Array
in the form [x1, y1, x2, y2, ..., xn, yn]
or [[x1, y1], [x2, y2], ..., [xn, yn]]
. For large set of source points, performance improvements come when using Float32Array
. These source points can be declared in image coordinates, (x : [0, width], y : [0, height]) or in normalized coordinates (x : [0.0, 1.0], y : [0.0, 1.0]). In order to allow transforms with upscalings (from x0 to x8), normalized scale is automatically detected when the points Array
does not contain any value larger than 8.0. Coordinates with larger numbers are considered to be in image scale (x : [0, width], y : [0, height]). This automatic behaviour can be avoided by using the pointsAreNormalized parameter. Please note that, if width and height parameters are setted and points are given in image coordinates, these image coordinates should be declared in terms of the given width and height, instead of the original image width/height).
- - [image] : Optional source image, that will be warped later. Given as an
HTMLImageElement
. Setting this element here will help to advance some calculations, improving the later warping performance. Specially when it is planned to apply multiple transformations (same source points but different destiny points) to the same image. If width and/or height are given, the image will be internally rescaled before any transformation.
+ - [image] : Optional source image, that will be warped later. Given as an
HTMLImageElement
or ImageData
in the browser version or as the output of await loadImage('path-to-image')
in the Node.js version. Setting this element here will help to advance some calculations, improving the later warping performance. Specially when it is planned to apply multiple transformations (same source points but different destiny points) to the same image. If width and/or height are given, the image will be internally rescaled before any transformation if it is given as HTMLImageElement
(if image is given as ImageData
these parameters will be ignored).
- [width]: Optional width to which rescale the input image. It is equivalent to the width parameter of the constructor.
@@ -220,7 +219,7 @@ This function just makes a call to Homography.setSourcePoints(srcPoints[,
Sets the image that will be transformed when warping.
Setting the image before the destiny points (call to setDestinyPoints()
) and the warping (call to warp()
) will help to advance some calculations as well as to avoid future redundant operations when successive calls to setDestinyPoints()->warp()
will occur in the future.
- - image : Source image, that will be warped later. Given as an
HTMLImageElement
.
+ - image : Source image, that will be warped later. Given as an
HTMLImageElement
or ImageData
in the browser version. If given as ImageData, width and height will not be used. In the Node.js it should be the output of await loadImage('path-to-image')
.
- [width]: Optional width to which rescale the given image. It is equivalent to the width parameters of the constructor or
setSourcePoints()
.