📄 avg_distortion.m
字号:
%
% function D = distortion(region, cdbk, imagesize): compute the average
% distortion overall partitions based on newly generated cdbk
%
%
% Input:
% region -- cell stores "nwds" matrices of different sizes,
% each matrix has certain number of rows and 3 columns,
% which represents all the points in one region
% cdbk -- optimal code book
% parameter: n_features -- total number of vectors over the whole regions
%
% Output:
% D -- average distortion of all vectors in this region
%
%
function D = avg_distortion(region, cdbk)
nwds = size(cdbk, 1);
all_D = 0;
n_features = 0;
for i_nwds = 1: nwds
p = region{i_nwds};
n_reg = size(p, 1);
n_features = n_features + n_reg;
for i_reg = 1: n_reg
all_D = all_D + my_distance(p(i_reg, :), cdbk(i_nwds,:));
end
end
D = all_D/n_features;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -