From 576283b7634b1f38eecded5148d2684aa27f094c Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Tue, 4 Jun 2019 04:30:22 +0800 Subject: [PATCH] add badge and example codes to README --- README.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 96b0190..8a100f7 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,43 @@ # ImageQualityIndexes +[![Build Status](https://travis-ci.org/JuliaImages/ImageQualityIndexes.jl.svg?branch=master)](https://travis-ci.org/JuliaImages/ImageQualityIndexes.jl) +[![Codecov](https://codecov.io/gh/JuliaImages/ImageQualityIndexes.jl/badge.svg?branch=master)](https://codecov.io/gh/JuliaImages/ImageQualityIndexes.jl) + ImageQualityIndexes provides the basic image quality assessment methods. ## Supported indexes -* `PSNR` -- Peak signal-to-noise ratio -* `SSIM` -- Structural similarity +### Full reference indexes + +* `PSNR`/`psnr` -- Peak signal-to-noise ratio +* `SSIM`/`ssim` -- Structural similarity ## Basic usage -In this package, each index corresponds to a `ImageQualityIndex` type, there are three ways to assess the image quality: +The root type is `ImageQualityIndex`, each concrete index is supposed to be one of `FullReferenceIQI`, `ReducedReferenceIQI` and `NoReferenceIQI`. + +There are three ways to assess the image quality: * use the general protocol, e.g., `assess(PSNR(), x, ref)`. This reads as "**assess** the image quality of **x** using method **PSNR** with information **ref**" * each index instance is itself a function, e.g., `PSNR()(x, ref)` -* for well-known indexes, there are also convenient name for it, e.g., `psnr(x, ref)` +* for well-known indexes, there are also convenient name for it for benchmark purpose. For detailed usage of particular index, please check the docstring (e.g., `?PSNR`) + +## Examples + +```julia +using Images, TestImages +using ImageQualityIndexes + +img = testimage("lena_gray_256") .|> float64 +noisy_img = img .+ 0.1 .* randn(size(img)) +ssim(noisy_img, img) # 0.3577 +psnr(noisy_img, img) # 19.9941 + +kernel = ones(3, 3)./9 # mean filter +denoised_img = imfilter(noisy_img, kernel) +ssim(denoised_img, img) # 0.6529 +psnr(denoised_img, img) # 26.0350 +```