【发布时间】:2015-03-30 11:47:49
【问题描述】:
在我的 GUI 中,我使用此 matlab 代码将值存储在 excel 表中。此代码正在计算 glcm 六个特征。
function [Contrast,cor,ener,homo,Var,Entropy] = glcm_feature_extraction(I1)
Contrast = graycoprops(graycomatrix(rgb2gray(I1)),'Contrast')
cor= graycoprops(graycomatrix(rgb2gray(I1)), 'Correlation')
ener = graycoprops(graycomatrix(rgb2gray(I1)), 'Energy')
homo = graycoprops(graycomatrix(rgb2gray(I1)), 'Homogeneity')
img = double(I1);
Var = var((img(:)))
Entropy=entropy(I1)
这里假设我在计算后得到这些值:
[0.603606103 : 0.785092239 : 0.271728411 : 0.855429408 :1889.578963 : 7.178149206]
但我只需要近似值,例如:
[0.6 : 0.7 : .2 ....]
如何修改这段代码得到这个结果?
【问题讨论】:
-
您可以使用
x_round = round(x, N)将值四舍五入到小数点右侧的N位数。有关详细信息,请参阅round的文档。 -
我收到错误 Error using ==> round Too many input arguments.
标签: excel matlab feature-extraction glcm