def brisque_metric(img_tile): brisq = brisque.BRISQUE() score = brisq.get_score(img_tile) return score
def my_brisque(img): brisq = brisque.BRISQUE() brisq.get_feature(img) return brisq.get_score(img)
import os import argparse import sys import json from libsvm import svmutil import brisque import PIL.Image import pytesseract from shutil import rmtree connection = pymongo.MongoClient("mongodb://localhost:27017/") db = connection["sous"] recipe_collection = db["recipe"] target_folder = '/run/media/anfa/1C8A5B0249DD18B9/h32/' b = brisque.BRISQUE() for dirpath, dirs, files in os.walk(target_folder): for di in dirs: for dirpath, dirs, files in os.walk(target_folder + di): fs = files scores = [] raw_scores = [] position = 0 if files: for f in fs: if f != 'hold': path = dirpath + '/' + f img = PIL.Image.open(path) width, height = img.size
def score(img): brisq=br.BRISQUE() feats=brisq.get_feature(img) err=brisq.get_score(img) print("Brisque Score: "+str(err)) return err