资源简介
谱聚类算法对图像进行分割的程序,可以直接运行,主程序为Demo,Demo_features,运行后可以对程序包中带的图片1和图片2进行分割。
代码片段和文件信息
% This code implemented a 搉ormalized-cut?segmentation using color and texture information
% This code segment an image using color texture and spatial data
% RGB color is used as an color data
% Four texture features are used: 1. mean 2. variance 3. skewness 4. kurtosis
% Normalized Cut (inherently uses spatial data)
% ncut parameters are “SI“ Color similarity “ST“ Texture similarity “SX“ Spatial similarity “r“ Spatial threshold (less than r pixels apart) “sNcut“ The smallest Ncut value (threshold) to keep partitioning and “sArea“ The smallest size of area (threshold) to be accepted as a segment
% an implementation by “Naotoshi Seo“ with a small modification is used for 搉ormalized-cut?segmentation available online at: “http://note.sonots.com/SciSoftware/NcutImageSegmentation.html“ It is sensitive in choosing parameters.
% Alireza Asvadi
% Department of ECE SPR Lab
% Babol (Noshirvani) University of Technology
% http://www.a-asvadi.ir
% 2013
%% clear command windows
clc
clear all
close all
tic
%% initialize
Im = imread(‘1.jpg‘);
[nRownColdim] = size(Im); % Image row & col
N = nRow*nCol; % Number of pixels
Vx = reshape(ImNdim); % Vertices of Graph
% figure(); imshow(Im);
%% Texture
m = 1; % window width for texture extraction is 2*m+1
ST = 10; % texture similarity
dim2 = 4; % number of texture features
In = im2double(rgb2gray(Im));
T = zeros(nRownColdim2); % initialize variance image
for i = 1:nRow % central pixel (in image coordinate)
for j = 1:nCol
Vi = (i-floor(m)):(i+floor(m)); %% neighbourhood pixels (in image coordinate)
Vj = ((j-floor(m)):(j+floor(m)));
Vi = Vi(Vi>=1 & Vi<=nRow); % keep pixels that are inside image
Vj = Vj(Vj>=1 & Vj<=nCol);
blk = In(ViVj); %% image block
T(ij1) = mean(blk(:)); % mean
T(ij2) = var(blk(:)); % variance
T(ij3) = skewness(blk(:)); % skewness
T(ij4) = kurtosis(blk(:)); % kurtosis
end
end
T(::1) = (T(::1)-min(min(T(::1))))/(max(max(T(::1)))-min(min(T(::1))));
T(::2) = (T(::2)-min(min(T(::2))))/(max(max(T(::2)))-min(min(T(::2))));
T(::3) = (T(::3)-min(min(T(::3))))/(max(max(T(::3)))-min(min(T(::3))));
T(::4) = (T(::4)-min(min(T(::4))))/(max(max(T(::4)))-min(min(T(::4))));
T = uint8(255*T); % normalization
% figure(); imshow(T)
%% Compute weight matrix W
r = 1.5; % Spatial threshold (less than r pixels apart)
SI = 5; % Color similarity
SX = 6; % Spatial similarity
sNcut = 0.22; % The smallest Ncut value (threshold) to keep partitioning
sArea = 30;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3033 2013-09-15 06:42 NcutPartition.m
文件 1374 2013-09-15 06:43 NcutValue.m
文件 16869 2013-07-04 00:11 1.jpg
文件 13507 2013-09-15 05:47 2.jpg
文件 6803 2015-08-27 18:17 Demo.m
文件 2462 2013-09-15 14:51 Demo_features.m
文件 1307 2015-09-09 08:21 license.txt
- 上一篇:魔兽世界插件制作指南
- 下一篇:谱聚类算法对图像进行分割
相关资源
- 谱聚类算法对图像进行分割
- 边缘检测图像边缘检测
- 大数据集快速谱聚类算法
- 基于小波变换的彩色图像分割
- OpenCV基于分水岭图像分割算法
- meanshift图像分割代码
- Graphcut-源码及实现
- 利用基于直方图的自适应阈值方法实
- 基于改进PSO算法的最大熵阈值图像分
- 基于Mumford-Shah模型的水平集图像分割
- 基于交叉熵阈值法的快速迭代算法
- PSO算法的最大熵阈值图像分割
- 几种图像分割算法在CT 图像分割上的
- 三种方法实现图像的分割含程序源码
- 图像分割+GUI
- 实现图像分割的grabcut代码
- 图像分割的源代码资源
- 三维Otsu图像分割算法
- U-Net:用于生物医学图像分割的卷积网
- 改进的细菌觅食优化算法用于双阈值
- Normalized Cut图像分割
- 图像分割算法研究综述
- 3.25 基于脉冲耦合神经网络的图像分割
- 基于边缘和区域信息的水平集SAR图像
- 图像分割ncut代码
- FCN Caffe Net
- ncut图像分割算法
- 用FCM算法实现图像分割(图像源可以
- 基于模糊c聚类的图像分割
- 利用snake算法实现数字图像的边缘检测
评论
共有 条评论