⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fuzzy_segment.m

📁 Information Fusion of Flash and Non-Flash Images (Project)
💻 M
字号:
function [obj_img] = fuzzy_segment(imageName, tol, mult);
rgb_img = imread(imageName);
gray_img = double(rgb2gray(rgb_img));
[M,N,P] = size(rgb_img);
figure(1);
%draw 2 polygons- in case of disjoint background
t_inds1 = find(roipoly(rgb_img));
t_inds2 = find(roipoly(rgb_img));
t_inds = [t_inds1; t_inds2];

disp('performing classification...');
res_img = [];
if (mult==0)
    res_img = classify_img(rgb_img,t_inds,tol);
else
    res_img = classify_img2(rgb_img,t_inds,tol);
end


disp('formatting results...');
%find pixels with background classification, 
%which are connected to first training pixel

ind1n = floor(t_inds(1)/M) + 1
ind1m = mod(t_inds(1),M) + 1
obj_img1 = 1 - double(bwselect(res_img,ind1n,ind1m,8));
obj_img = double(bwselect(obj_img1,8));

%display binary detections
% figure(6);
% imagesc(res_img);
% colormap(gray);
% title('detections');

%display segmentation mask
figure(7);
imagesc(obj_img);
colormap(gray);
title('final mask');

%display final segmentation
% figure(2);
% imagesc(obj_img.*gray_img);
% colormap(gray);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -