zoukankan      html  css  js  c++  java
  • matab 从多个文件夹读数据,分别计算指标

    clear all; close all; clc 
    load modelparameters.mat
    blocksizerow    = 96;
    blocksizecol    = 96;
    blockrowoverlap = 0;
    blockcoloverlap = 0;
    dataset = {'DICM','LIME','MEF','NPE','VV'};%不同的文件夹名
    num_set = length(dataset);
    ext = {'*.jpg', '*.png', '*.bmp'};%不同的图片文件格式
    record_results_txt = ['Quality_Results','.txt'];
    results = fopen(fullfile(record_results_txt), 'wt');%写入.txt文档
    for idx_set = 1:2  %for 区间左右都是闭区间
        fprintf(results, '**********************
    ');
        fprintf(results, 'Set: %s
    ',  dataset{idx_set});%写入results文档
        filepaths = [];
        for idx_ext = 1:length(ext)
            filepaths = cat(1, filepaths, dir(fullfile('./source', dataset{idx_set}, ext{idx_ext})));
        end
        ret = 0;
        for idx_im = 1:length(filepaths)
            name_HR = filepaths(idx_im).name;
            %fprintf('%s 
    ',name_HR)%文件的输出顺序依然是1.jpg 10.jpg 2.jpg
            %fprintf('%s 
    ',fullfile('./source', dataset{idx_set}, name_HR))
            HR = imread(fullfile('./source', dataset{idx_set}, name_HR));%读取所有文件
            quality = computequality(HR,blocksizerow,blocksizecol,blockrowoverlap,blockcoloverlap, ...
            mu_prisparam,cov_prisparam);%一般=最后都要加; 不然每次都要输出
            ret = ret + quality;
        end
        fprintf(results,"avgrage quality: %.4f
    ",ret);
    end
    fclose(results);%记住要关闭
    fprintf('finshed!!!!');

  • 相关阅读:
    Foxit 出mac 版本啦
    mac 上的latex (有很多链接,侵权请通知,一定删除)
    集合转数组
    select2搜索框查询加遍历
    下拉框回显
    柱状堆积图Echarts
    echarts X轴数据显示不全问题
    Map静态键值对
    如何配置pl/sql (本地客户端)连接远程oracle服务器
    自定义验证jquery.validate
  • 原文地址:https://www.cnblogs.com/tingtin/p/14609323.html
Copyright © 2011-2022 走看看