Problem with defuzz method
1 次查看(过去 30 天)
显示 更早的评论
Hello, I have an image and fuzification with one triangular membership function. Now i just defuzzy with 'centroid' . but i have an error. Please help me
clc ; clear all, close all;
img = imread('cameraman.tif');
mean_input = mean2(uint8(img));
img = double(img);
[m,n]= size(img);
mu = zeros(m,n);
a = 60 ;
a = double(a);
b = 120 ;
b = double(b);
c = 180;
c = double(c);
for i =1:m
for j=1:n
if img(i,j) <= 0
mu(i,j) = 0;
elseif img(i,j) >= a && img(i,j) <=b
mu(i,j) =(img(i,j)-a)/(b-a);
elseif img(i,j) >= b && img(i,j)
mu(i,j) = (c-img(i,j))/(c - b);
elseif c<=img(i,j)
mu(i,j) = 0;
end
end
end
for i=1:m
for j=1:n
out(i,j) = defuzz(img(i,j),mu(i,j),'centroid');
end
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!