Commit 2373c1db authored by Sushil BHATTACHARJEE's avatar Sushil BHATTACHARJEE

code update; returns numpy array instead of tuple

parent 8559a22f
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
This package is part of the signal-processing and machine learning toolbox This package is part of the signal-processing and machine learning toolbox
Bob_. It provides functions for extracting image-quality features proposed Bob_. It provides functions for extracting image-quality features proposed
for PAD experiments by different research group. for PAD experiments by different research groups. Image quality measures
proposed by Galbally et al (TIFS 2014) and by Wen et al. (TIFS 2015)
are implemented in this package.
Installation Installation
------------ ------------
......
...@@ -188,7 +188,7 @@ def image_quality_measures(refImage, testImage): ...@@ -188,7 +188,7 @@ def image_quality_measures(refImage, testImage):
#26 HLFI: high-low frequency index (implemented as done by Galbally in Matlab). #26 HLFI: high-low frequency index (implemented as done by Galbally in Matlab).
hlfi25=high_low_freq_index(fftRef, refImage.shape[1]) hlfi25=high_low_freq_index(fftRef, refImage.shape[1])
return (mse00, psnr01, ad02, sc03, nk04, md05, lmse06, nae07, snrv08, ramdv09, mas10, mams11, sme12, gme16, gpe17, ssim18, vif19, hlfi25) return np.asarray((mse00, psnr01, ad02, sc03, nk04, md05, lmse06, nae07, snrv08, ramdv09, mas10, mams11, sme12, gme16, gpe17, ssim18, vif19, hlfi25), dtype=np.float32)
""" """
......
...@@ -34,24 +34,24 @@ def computeVideoIQM(video4d): ...@@ -34,24 +34,24 @@ def computeVideoIQM(video4d):
print(rgbFrame.shape) print(rgbFrame.shape)
iqmSet = iqm.compute_quality_features(rgbFrame) #iqmSet = iqm.compute_quality_features(grayFrame) iqmSet = iqm.compute_quality_features(rgbFrame) #iqmSet = iqm.compute_quality_features(grayFrame)
numIQM = len(iqmSet) numIQM = len(iqmSet)
print(numIQM)
iqaSet = iqa.compute_msu_iqa_features(rgbFrame) iqaSet = iqa.compute_msu_iqa_features(rgbFrame)
numIQA = len(iqaSet) numIQA = len(iqaSet)
print(numIQA)
print(iqaSet.shape)
print(iqmSet.shape)
#now initialize fset to store iqm features for all frames of input video. #now initialize fset to store iqm features for all frames of input video.
bobfset = np.zeros([numframes, numIQM]) bobfset = np.zeros([numframes, numIQM])
bobQFeats = np.asarray(iqmSet) # compute_quality_features() returns a tuple bobfset[f] = iqmSet
bobfset[f] = bobQFeats
msufset = np.zeros([numframes, numIQA]) msufset = np.zeros([numframes, numIQA])
msuQFeats = np.asarray(iqaSet) msufset[f] = iqaSet
msufset[f] = msuQFeats
for f in range(1,numframes): for f in range(1,numframes):
print('frame #: %d' %f) print('frame #: %d' %f)
rgbFrame = video4d[f] rgbFrame = video4d[f]
print(rgbFrame.shape) print(rgbFrame.shape)
# grayFrame = matlab_rgb2gray(rgbFrame) #compute gray-level image for input color-frame bobQFeats = iqm.compute_quality_features(rgbFrame)
# bobQFeats = np.asarray(iqm.compute_quality_features(grayFrame)) # computeQualityFeatures() returns a tuple
bobQFeats = np.asarray(iqm.compute_quality_features(rgbFrame)) # computeQualityFeatures() returns a tuple
msuQFeats = iqa.compute_msu_iqa_features(rgbFrame) msuQFeats = iqa.compute_msu_iqa_features(rgbFrame)
bobfset[f] = bobQFeats bobfset[f] = bobQFeats
msufset[f] = msuQFeats msufset[f] = msuQFeats
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment