@dannadori/image-score-js
v1.0.13
Published
This package provide image scoring functions.
Downloads
23
Readme
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
- WASM edition
import { ImageScoreWasm } from '@dannadori/image-score-js/dist/image-score-wasm'
- WASM SIMD edition
import { ImageScoreWasmSimd } from '@dannadori/image-score-js/dist/image-score-wasm-simd'
- 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;
}