필터 지우기
필터 지우기

Problem with defuzz method

조회 수: 2 (최근 30일)
Dani D
Dani D 2016년 5월 5일
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개)

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by