Problem with defuzz method
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!