# ndarray-corr2

> Calculate 2-D correlation coefficient between two ndarrays.

Latest version **0.1.1** (published 2019-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ndarray-corr2
pnpm add ndarray-corr2
yarn add ndarray-corr2
bun add ndarray-corr2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-10-15 |
| First published | 2019-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Abdelaziz Mokhnache |
| Maintainers | abdelaziz18003 |
| Keywords | ndarray, correlation, corr2, matrix, image processing |

## Links

- npm: https://www.npmjs.com/package/ndarray-corr2
- Repository: https://github.com/Abdelaziz18003/ndarray-corr2
- Homepage: https://github.com/Abdelaziz18003/ndarray-corr2#readme
- Issues: https://github.com/Abdelaziz18003/ndarray-corr2/issues
- npm.io page: https://npm.io/package/ndarray-corr2

## Dependencies (2)

- [ndarray](https://npm.io/package/ndarray.md) ^1.0.18
- [ndarray-ops](https://npm.io/package/ndarray-ops.md) ^1.2.2

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2019-10-15
- 0.1.0 — 2019-06-16

## README

# ndarray-corr2
Calculate 2-D correlation coefficient between two ndarrays.

## Installation

```bash
npm install ndarray-corr2
```

## Usage

```js
const ndarray = require("ndarray");
const getPixels = require("get-pixels");
const corr2 = require("ndarray-corr2");

// example 1
let ndarray1 = ndarray([1, 2, 3, 4, 5, 6]);
let ndarray2 = ndarray([1, 2, 3, 4, 5, 6]);
console.log(corr2(ndarray1, ndarray2));
// print "1"

// example 2
let ndarray1 = ndarray([1, 2, 3, 4, 5, 6], [2, 3]);
let ndarray2 = ndarray([6, 5, 4, 3, 2, 1], [2, 3]);
console.log(corr2(ndarray1, ndarray2));
// print "-1"

// example 3
let ndarray1 = ndarray([23, 16, 85, 58], [2, 2]);
let ndarray2 = ndarray([25, 56, 32, 41], [2, 2]);
console.log(corr2(ndarray1, ndarray2));
// print "-0.33985761679300736"

// example 4
getPixels("lena.png", function(err, pixels) {
  if(!err && pixels) {
    console.log(corr2(pixels, pixels));
    // print "1" because the two images are similar
  }
});
```

---
_Source: https://npm.io/package/ndarray-corr2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
