%检测地板 clear all; close all; clc; f=imread('F:\图像处理\练习-分割地板\12.jpg'); g=rgb2gray(f); g1=imadjust(g,[0 1],[0 1]); t=graythresh(g1); g2=edge(g1,'canny',t); se=strel('disk',3); bw1=imdilate(g2,se); bw2=imdilate(bw1,se); bw2=imcomplement(bw2); figure,imshow(bw2); [B,L,NR,A]=bwboundaries(bw2); [L,num]=bw