필터 지우기
필터 지우기

calculation of graycoprops function and sorting of values of graycoprops

조회 수: 2 (최근 30일)
I=imread('liftingbody.png');
G=graycomatrix(I);
[m n]=size(G);
for x=1:m
for y=1:n
stats=graycoprops(G,'contrast');
end
end
Sort=sort(stats);
fprintf('\n sorted contrast values are:\n %d',stats);
this gives error....says that stats is of struct type... i want to sort the contrast values... tel me plz how it can be done..
help me to solve my query plz

채택된 답변

Image Analyst
Image Analyst 2013년 3월 6일
Type "stats" on the command line and see what it is. Then change the last few lines to this:
stats
sortedStats=sort([stats.Contrast])
fprintf('\n sorted contrast values are:\n %d\n', sortedStats);
Note the brackets around stats.Contrast to turn it into an array. But why are you looping over m and n and just overwriting the same stats scalar over and over again? It needs to be indexed so you keep the separate values.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by