Demo entry 6359639

SLIC

   

Submitted by anonymous on Apr 29, 2017 at 04:13
Language: Matlab. Code size: 520 Bytes.

close all;clc;
%% 输入参数
img = imread('3.tif');
grey_img = double(img);
nC = 200; % 像素块的数目
lambda_prime = 0.5;sigma = 5.0; 
conn8 = 0; % 设置为四连通
[labels] = mex_ers(grey_img,nC,lambda_prime,sigma,conn8);
%% 求边界
[height, width] = size(grey_img);
[bmap] = seg2bmap(labels,width,height);
bmapOnImg = img;
idx = find(bmap>0);
timg = grey_img;
timg(idx) = 255;
bmapOnImg(:,:,2) = timg;
bmapOnImg(:,:,1) = grey_img;
bmapOnImg(:,:,3) = grey_img;
%% 输出图像
figure;
imshow(bmapOnImg,[]);
title('superpixels-slic');

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).