@dannadori/image-score-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

image-score-js

This package provide image scoring functions.

Currentry provided functions is belows.

  • PSNR
  • SSIM

This package include three edition. The file size is different, so please choose one depneding on your usecase.

  • WASM
  • WASM SIMD
  • WASM and WASM SIMD

Sample source code is here

Installation and basic usage

Instalattion

npm install @dannadori/imager-score-js

Importing to your application

  1. WASM edition
import { ImageScoreWasm } from '@dannadori/image-score-js/dist/image-score-wasm'
  1. WASM SIMD edition
import { ImageScoreWasmSimd } from '@dannadori/image-score-js/dist/image-score-wasm-simd'

  1. WASM and WASM SIMD edition
import { ImageScore } from '@dannadori/image-score-js'

Initialize

const is = new ImageScore() // If you use othere edition, you should change
is.init()

Functions

PSNR and SSIM

PSNR and SSIM are implemented according to this article

At first you put two image(HTMLCanvasElement) by setImage, then call psnr or mssim.

setImage: (image1: HTMLCanvasElement, image2: HTMLCanvasElement, params: ImageScoreParams) => void;
psnr: (params: ImageScoreParams) => number;
mssim: (params: ImageScoreParams) => {
        mssimR: number;
        mssimG: number;
        mssimB: number;
        mssimA: number;
};

ImageScoreParams have useSimd attribute. Only when you use WASM and WASM SIMD edition, this value is used. Otherewise, ignored

export interface ImageScoreParams {
    useSimd: boolean;
}

Package Sidebar

Install

npm i @dannadori/image-score-js

Weekly Downloads

1

Version

1.0.13

License

MIT

Unpacked Size

5.27 MB

Total Files

10

Last publish

Collaborators

  • dannadori