标签:
一阶颜色矩——均值,反映图像明暗程度
二阶颜色矩 ——标准差,反映图像颜色分布范围
三阶颜色矩 ——方差,反映图像颜色分布对称性
firstMoment = mean(mean(tmpImage)); % 一阶颜色矩
difference = tmpImage(:,:,m) - firstMoment(1,1,m); %差分颜色矩
secondMoment = sqrt(mean(mean(difference.*difference))); % 二阶颜色矩
thirdMoment = nthroot(mean(mean(difference.*difference.*difference)),3); % 三阶颜色矩
To interpret
tmpImage –>101(rows)*101(columns)*3(layers) Matrix
第一次求均值(mean(tmpImage)):1*101*3
%均值mean函数,优先对列求均值
firstMoment –> 第二次求均值:1*1*3
difference –> 101*101*1
%点乘(矩阵乘法):[3*3*1].*[3*3*1] –> [3*3*1]
difference.*difference –> 101*101*1
%两次求均值是因为要求一个二维矩阵的矩阵
secondMoment –> 原理同上
thirdMoment –> 原理同上
firstMoment = mean(mean(tmpImage)); % 一阶颜色矩
difference = tmpImage(:,:,m) - firstMoment(1,1,m); %差分颜色矩
secondMoment = sqrt(sum(difference(:).*difference(:))/101/101)); % 二阶颜色矩
thirdMoment = nthroot(sum(difference(:).*difference(:).*difference(:))/101*101,3); % 三阶颜色矩
To interpret
difference(:) –>10201*1(columns)*1(layer)
%将其矩阵转换为n*1的列矩阵
difference(:).*difference(:) –> 10201*1*1
sum((difference(:).*difference(:))/101/101)) –> 1(sum value)*1*1
sum value/101/101 –> mean value
标签:
原文地址:http://www.cnblogs.com/shadrach/p/5511160.html