光譜影像客觀評價指標
SAM光譜角制圖、PSNR峰值信噪比、MSE均方誤差、SSIM結構相似性以及ERGAS相對全域無量綱誤差是用于評價光譜影像壓縮,融合等技術的客觀評價指標,本文旨在通過最簡單的方式對兩張光譜影像或RGB影像進行快速評價,
imgvision庫用于進行影像處理與質量評價,該庫僅基于Numpy庫進行撰寫,通過矩陣的方式對影像進行快速處理,包括不限于光譜影像的不同光源下顏色空間轉換、RGB影像不同光源下的色空間轉換、光譜影像余弦距離的監督聚類、影像的質量評價等,
安裝imgvision
imgvision在1.6.1版本后支持影像的質量評價,通過pycharm的Terminal或配置的虛擬環境進行安裝:
pip install imgvision
影像客觀質量評價
import numpy as np
import imgvision as iv
#匯入高光譜影像以及重建影像
Hyperspectral_Image = np.load('HSI.npy')
Reconstruction = np.load('Re_HSI')
#創建評價器
Metric = iv.spectra_metric(Hyperspectral_Image,Reconstruction)
#評價SAM:
SAM = Metric.SAM()
#評價PSNR:
PSNR = Metric.PSNR()
#評價SSIM:
SSIM = Metric.SSIM() #影像像素范圍的最大值為1時
SSIM_int8 = Metric.SSIM(l=255) #影像像素范圍的最大值為255時(即8進制)
#評價ERGAS:
ERGAS = Metric.ERGAS()
#評價PSNR, SAM, ERGAS, SSIM
Metric.Evaluation()
mat模式
在SAM, MSE指標中,mat模式用于獲取影像每個像素的指標值,
在PSNR, SSIM指標中,mat模式用于獲取影像每個波段的指標值,
想獲取每個像素的SAM、MSE值?
想獲取每個波段的PSNR、SSIM值?
開啟mat模式幫助你更好的分析影像質量,
import numpy as np
import imgvision as iv
#匯入高光譜影像以及重建影像
Hyperspectral_Image = np.load('HSI.npy')
Reconstruction = np.load('Re_HSI')
#創建評價器
Metric = iv.spectra_metric(Hyperspectral_Image,Reconstruction)
#評價SAM:
SAM = Metric.SAM(mode='mat')
#SAM.shape = [Hyperspectral_Image.shape[0]*Hyperspectral_Image.shape[1],]
#評價MSE:
MSE = Metric.MSE(mode='mat')
#MSE.shape = [Hyperspectral_Image.shape[0]*Hyperspectral_Image.shape[1],]
#評價PSNR:
PSNR = Metric.PSNR(mode='mat')
#PSNR.shape = [Hyperspectral_Image.shape[-1],]
#評價SSIM:
SSIM = Metric.SSIM(mode='mat') #影像像素范圍的最大值為1時
SSIM_int8 = Metric.SSIM(l=255,mode='mat') #影像像素范圍的最大值為255時(即8進制)
#SSIM.shape = [Hyperspectral_Image.shape[-1],]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/382980.html
標籤:其他
