2011-10-27 7 views
1


私は画像を持っています。私はそれに共起行列(graycomatrix)異なる特性(コントラスト、相関)を抽出するなどの作成(graycopropsマトリックス上に異なる 'graycoprops'プロパティ値を保存[MATLAB]

x = [] 
for a lot of pictures, do the same: 
    imgB = imread('currentLoopImage.jpg') 

    contrast = graycoprops(graycomatrix(rgb2gray(imgB)), 'Contrast') 
    correlation = graycoprops(graycomatrix(rgb2gray(imgB)), 'Correlation') 
    energy = graycoprops(graycomatrix(rgb2gray(imgB)), 'Energy') 
    homogeneity = graycoprops(graycomatrix(rgb2gray(imgB)), 'Homogeneity') 

    x = [x;contrast;correlation;energy;homogeneity] 

事は、私がその行列X上のすべての値を保存する必要がありますが、私ということです私は、各タイプから取得した出力このよう

CAT arguments are not consistent in structure field names.

されています:次のエラーを取得する

homogeneity = 

    Homogeneity: 0.8587 

は、さまざまな種類がありますが私はSAVすることはできませんそれらをX行列上に置く。
出力行列X、数字のみを保存し、無視すべきである「均質性」という

誰かが私を伝えることができ、私はこれを誰行うことができますか? graycoprops()例から

答えて

2

>> GLCM = [0 1 2 3;1 1 2 3;1 0 2 0;0 0 0 3]; 
>> stats = graycoprops(GLCM) 

stats = 

     Contrast: 2.8947 
    Correlation: 0.0783 
     Energy: 0.1191 
    Homogeneity: 0.5658 

は、それからちょうど行います

>> x = struct2array(stats) 

ans = 

    2.8947 0.0783 0.1191 0.5658 

はまた、あなたがmxnxp行列にすべての画像が含まれており、一度にすべてを処理できることに注意して、代わりに使用してforループ。例:

>> GLCM(:,:,2) = GLCM; 
>> cell2mat(struct2cell(stats)) 

ans = 

    2.8947 2.8947 
    0.0783 0.0783 
    0.1191 0.1191 
    0.5658 0.5658 
関連する問題