数字图像处理(DIP)作业8 matlab or OpenCV 对lena 图片进行边缘提取
生活随笔
收集整理的這篇文章主要介紹了
数字图像处理(DIP)作业8 matlab or OpenCV 对lena 图片进行边缘提取
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
數字圖像處理(DIP)作業8 matlab or OpenCV 對lena 圖片進行邊緣提取
數字圖像處理課程相關文章 傳送門
https://blog.csdn.net/qq_46164507/article/details/122503851
博文說明
本文所使用代碼或多或少參考了以往博文的同類or相似文章的代碼,并非純原創
本文僅用于記錄并提供一種代碼思路,供大家參考
文章目錄
- 數字圖像處理(DIP)作業8 matlab or OpenCV 對lena 圖片進行邊緣提取
- 數字圖像處理課程相關文章 傳送門
- 博文說明
- 正文
- 要求
- 代碼
- 結果
正文
要求
代碼
這里選用matlab,matlab代碼如下:
%使用sobel,roberts,prewitt,log,canny進行邊緣處理 clc,clear,close all; I = imread('lena.jpg'); for i=[1,2,3]bw1(:,:,i)=edge(I(:,:,i),'sobel'); %Sobel operatorsbw2(:,:,i) = edge(I(:,:,i),'roberts'); %roberts operatorsbw3(:,:,i) = edge(I(:,:,i),'prewitt'); %Prewitt operatorsbw4(:,:,i) = edge(I(:,:,i),'log'); %LOG operatorsbw5(:,:,i) = edge(I(:,:,i),'canny'); end for i=1:512for j=1:512bw1(i,j,1) = sum(bw1(i,j));bw2(i,j,1) = sum(bw2(i,j));bw3(i,j,1) = sum(bw3(i,j));bw4(i,j,1) = sum(bw4(i,j));bw5(i,j,1) = sum(bw5(i,j));end end subplot(2,3,1),imshow(I), title('Original Image') subplot(2,3,2),imshow(bw1(:,:,1)), title('Sobel') subplot(2,3,3),imshow(bw2(:,:,1)), title('roberts') subplot(2,3,4),imshow(bw3(:,:,1)), title('Prewitt') subplot(2,3,5),imshow(bw4(:,:,1)), title('LOG') subplot(2,3,6),imshow(bw5(:,:,1)), title('canny')結果
總結
以上是生活随笔為你收集整理的数字图像处理(DIP)作业8 matlab or OpenCV 对lena 图片进行边缘提取的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 当前常见游戏服务器引擎
- 下一篇: PCWorld:火狐浏览器已宣告死亡【转