MatLab 数字图像处理实验 图像分割
生活随笔
收集整理的這篇文章主要介紹了
MatLab 数字图像处理实验 图像分割
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
實(shí)驗(yàn)(1)以chair.jpg圖像為例,分別采用sobel、prewitt、roberts和log對該圖像及其加上噪聲后的圖像進(jìn)行邊緣檢測。
close all clear all I=imread('D:/chair.jpg'); I_noise=imnoise(I,'gaussian',0.06); bw1=edge(I_noise,'sobel'); bw2=edge(I_noise,'prewitt'); bw3=edge(I_noise,'roberts'); bw4=edge(I_noise,'log',[],4); subplot(2,3,1);imshow(I);xlabel('原圖'); subplot(2,3,2);imshow(I_noise,[]);xlabel('加入高斯噪聲后的圖像'); subplot(2,3,3);imshow(bw1);xlabel('Sober算子'); subplot(2,3,4);imshow(bw2);xlabel('Prewitt算子'); subplot(2,3,5);imshow(bw3);xlabel('Robrtts算子'); subplot(2,3,5);imshow(bw4);xlabel('LoG算子');實(shí)驗(yàn)(2)以cell.jpg圖像為例,分別迭代式閾值選擇法和最大類間方差閾值選擇法對該圖像進(jìn)行分割。
clc close all clear all I=imread('D:/cell.jpg'); I=im2double(I); [width.heoght]=size(I) T1=graythresh(I); BW1=im2bw(I,T1); f=double(I); T=(min(f(:))+max(f(:)))/2; done=false; i=0; while~doner1=find(f<=T);r2=find(f>T);Tnew=(mean(f(r1))+mean(f(r2)))/2done=abs(Tnew-T)<1T=Tnew;i=i+1; end f(r1)=0; f(r2)=1; subplot(1,3,1);imshow(I);xlabel('原圖'); subplot(1,3,2);imshow(f);xlabel('迭代式閾值選擇法'); subplot(1,3,3);imshow(BW1);xlabel('Otsu算法');參考:https://blog.csdn.net/uchihalyn/article/details/104593878
總結(jié)
以上是生活随笔為你收集整理的MatLab 数字图像处理实验 图像分割的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab 实现马赫带效应,图像上机实
- 下一篇: 全息摄影测量