當前位置首頁 > 汽車/機械/制造 > 工業(yè)自動化
搜柄,搜必應! 快速導航 | 使用教程  [會員中心]

matlab-圖像分割算法源碼

文檔格式:DOCX| 6 頁|大小 70.28KB|積分 0|2021-08-13 發(fā)布|文檔ID:26785233
第1頁
下載文檔到電腦,查找使用更方便 還剩頁未讀,繼續(xù)閱讀>>
1 / 6
此文檔下載收益歸作者所有 下載文檔
  • 版權提示
  • 文本預覽
  • 常見問題
  • matlab- 圖像分割算法源碼matlab 圖像分割算法源碼1.圖像反轉MATLAB 程序?qū)崿F(xiàn)如下:I=imread(xian.bmp);J=double(I);J=-J+(256-1); % 圖像反轉線性變換H=uint8(J);subplot(1,2,1),imshow(I);subplot(1,2,2),imshow(H);2.灰度線性變換MATLAB 程序?qū)崿F(xiàn)如下:I=imread(xian.bmp);subplot(2,2,1),imshow(I);title( 原始圖像 );axis([50,250,50,200]);axis on; % 顯示坐標系I1=rgb2gray(I);subplot(2,2,2),imshow(I1);title(灰度圖像);axis([50,250,50,200]);axis on;% 顯示坐標系J=imadjust(I1,[0.1 0.5],[]); %局部拉伸,把[0.1 0.5]內(nèi)的灰度拉伸為[0 1]subplot(2,2,3),imshow(J);title(線性變換圖像[0.1 0.5]);axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系K=imadjust(I1,[0.3 0.7],[]); %局部拉伸,把[0.3 0.7]內(nèi)的灰度拉伸為[0 1]subplot(2,2,4),imshow(K);title(線性變換圖像[0.3 0.7]);axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系3.非線性變換MATLAB 程序?qū)崿F(xiàn)如下:I=imread(xian.bmp);I1=rgb2gray(I);subplot(1,2,1),imshow(I1);title( 灰度圖像 );axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系J=double(I1);J=40*(log(J+1));H=uint8(J);subplot(1,2,2),imshow(H);title( 對數(shù)變換圖像 );axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系4.直方圖均衡化MATLAB 程序?qū)崿F(xiàn)如下:I=imread(xian.bmp);I=rgb2gray(I);figure;subplot(2,2,1);imshow(I);subplot(2,2,2);imhist(I);I1=histeq(I);figure;subplot(2,2,1);imshow(I1);subplot(2,2,2);imhist(I1);5.線性平滑濾波器用 MATLAB 實現(xiàn)領域平均法抑制噪聲程序:I=imread(xian.bmp);subplot(231)imshow(I)title( 原始圖像 )I=rgb2gray(I);I1=imnoise(I,salt & pepper,0.02);subplot(232)imshow(I1)title( 添加椒鹽噪聲的圖像 )k1=filter2(fspecial(average,3),I1)/255;%進行 3*3模板平滑濾波k2=filter2(fspecial(average,5),I1)/255;%進行 5*5模板平滑濾波k3=filter2(fspecial(average,7),I1)/255;%進行 7*7模板平滑濾波k4=filter2(fspecial(average,9),I1)/255;%進行 9*9模板平滑濾波subplot(233),imshow(k1);title(3*3模板平滑濾波);subplot(234),imshow(k2);title(5*5模板平滑濾波);subplot(235),imshow(k3);title(7*7模板平滑濾波);subplot(236),imshow(k4);title(9*9模板平滑濾波);6.中值濾波器用 MATLAB 實現(xiàn)中值濾波程序如下:I=imread(xian.bmp);I=rgb2gray(I);J=imnoise(I,salt&pepper,0.02);subplot(231),imshow(I);title( 原圖像 );subplot(232),imshow(J);title( 添加椒鹽噪聲圖像 );k1=medfilt2(J);%進行 3*3 模板中值濾波k2=medfilt2(J,[5,5]);%進行 5*5模板中值濾波k3=medfilt2(J,[7,7]);%進行 7*7模板中值濾波k4=medfilt2(J,[9,9]);%進行 9*9模板中值濾波subplot(233),imshow(k1);title(3*3模板中值濾波 );subplot(234),imshow(k2);title(5*5模板中值濾波 );subplot(235),imshow(k3);title(7*7模板中值濾波 );subplot(236),imshow(k4);title(9*9模板中值濾波 );7.用 Sobel 算子和拉普拉斯對圖像銳化:I=imread(xian.bmp);subplot(2,2,1),imshow(I);title(原始圖像);axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系I1=im2bw(I);subplot(2,2,2),imshow(I1);title(二值圖像);axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系H=fspecial(sobel);%選擇sobel算子J=filter2(H,I1);% 卷積運算subplot(2,2,3),imshow(J);title(sobel 算子銳化圖像 );axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系h=[0 1 0,1 -4 1,0 1 0];%拉普拉斯算子J1=conv2(I1,h,same); % 卷積運算subplot(2,2,4),imshow(J1);title( 拉普拉斯算子銳化圖像 );axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系8.梯度算子檢測邊緣用 MATLAB 實現(xiàn)如下:I=imread(xian.bmp);subplot(2,3,1);imshow(I);title(原始圖像);axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系I1=im2bw(I);subplot(2,3,2);imshow(I1);title( 二值圖像 );axis([50,250,50,200]);grid on;%顯示網(wǎng)格線axis on;I2=edge(I1,roberts);% 顯示坐標系figure;subplot(2,3,3);imshow(I2);title(roberts 算子分割結果 axis([50,250,50,200]););grid on;%顯示網(wǎng)格線axis on;I3=edge(I1,sobel);subplot(2,3,4);imshow(I3);% 顯示坐標系title(sobel 算子分割結果 axis([50,250,50,200]););grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系subplot(2,3,5);imshow(I4);title(Prewitt 算子分割結果 axis([50,250,50,200]););grid on;%顯示網(wǎng)格線axis on;% 顯示坐標系9.LOG 算子檢測邊緣用 MATLAB 程序?qū)崿F(xiàn)如下:I=imread(xian.bmp);subplot(2,2,1);imshow(I);title( 原始圖像 );I1=rgb2gray(I); 。

    點擊閱讀更多內(nèi)容
    賣家[上傳人]:奔跑吧你
    資質(zhì):實名認證