Clearing errors in executing GLCM matlab code

2 ビュー (過去 30 日間)
senthil vadivu
senthil vadivu 2018 年 6 月 19 日
編集済み: Guillaume 2018 年 6 月 19 日
Hii
I have downloaded GLCM matlab code here from file exchange This is my main file
I = imread('D:\Fire-smoke\kurangani-photos\red.jpg');
GLCM2 = graycomatrix(I,'Offset',[2 0;0 2]);
stats = GLCM_Features1(GLCM2,0);
The GLCM_Features1.m contains the function
function [out] = GLCM_Features1(glcmin,pairs)
and continues
But when i execute i am getting the following error
>> checkglcm
Attempt to execute SCRIPT graycomatrix as a function:
C:\Mathworks Matlab R2015a (64-Bit)-[FirstUploads]\programs\graycomatrix.m
Error in checkglcm (line 2)
GLCM2 = graycomatrix(I,'Offset',[2 0;0 2]);
What could be the mistake Plz help me to solve it

回答 (1 件)

Guillaume
Guillaume 2018 年 6 月 19 日
graycomatrix is a function in the image processing toolbox. However, when your code attempts to call this function it finds a script instead, as the error message tells you. That can only happens if you've created your own script and named it graycomatrix.m, thus shadowing the original function.
To solve it, rename your script using a name that is not a matlab function.
  2 件のコメント
senthil vadivu
senthil vadivu 2018 年 6 月 19 日
I have not named my file as graycomatrix.m My original main function name is checklbp.m I have written code follows in that
imread('D:\Fire-smoke\kurangani-photos\red.jpg'); GLCM2 = graycomatrix(I,'Offset',[2 0;0 2]); stats = GLCM_Features1(GLCM2,0);
Then could be the error Plz help me
Guillaume
Guillaume 2018 年 6 月 19 日
what does
which graycomatrix -all
return?

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by